src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML
changeset 36610 bafd82950e24
parent 36254 95ef0a3cf31c
child 37391 476270a6c2dc
equal deleted inserted replaced
36609:6ed6112f0a95 36610:bafd82950e24
   776       | _ => rewrite_args args (pats, intro_t, ctxt))
   776       | _ => rewrite_args args (pats, intro_t, ctxt))
   777     fun rewrite_prem atom =
   777     fun rewrite_prem atom =
   778       let
   778       let
   779         val (_, args) = strip_comb atom
   779         val (_, args) = strip_comb atom
   780       in rewrite_args args end
   780       in rewrite_args args end
   781     val ctxt = ProofContext.init thy
   781     val ctxt = ProofContext.init_global thy
   782     val (((T_insts, t_insts), [intro']), ctxt1) = Variable.import false [intro] ctxt
   782     val (((T_insts, t_insts), [intro']), ctxt1) = Variable.import false [intro] ctxt
   783     val intro_t = prop_of intro'
   783     val intro_t = prop_of intro'
   784     val concl = Logic.strip_imp_concl intro_t
   784     val concl = Logic.strip_imp_concl intro_t
   785     val (p, args) = strip_comb (HOLogic.dest_Trueprop concl)
   785     val (p, args) = strip_comb (HOLogic.dest_Trueprop concl)
   786     val (pats', intro_t', ctxt2) = rewrite_args args ([], intro_t, ctxt1)
   786     val (pats', intro_t', ctxt2) = rewrite_args args ([], intro_t, ctxt1)
   858 
   858 
   859 (* some peephole optimisations *)
   859 (* some peephole optimisations *)
   860 
   860 
   861 fun peephole_optimisation thy intro =
   861 fun peephole_optimisation thy intro =
   862   let
   862   let
   863     val process = MetaSimplifier.rewrite_rule (Predicate_Compile_Simps.get (ProofContext.init thy))
   863     val process =
       
   864       MetaSimplifier.rewrite_rule (Predicate_Compile_Simps.get (ProofContext.init_global thy))
   864     fun process_False intro_t =
   865     fun process_False intro_t =
   865       if member (op =) (Logic.strip_imp_prems intro_t) @{prop "False"} then NONE else SOME intro_t
   866       if member (op =) (Logic.strip_imp_prems intro_t) @{prop "False"} then NONE else SOME intro_t
   866     fun process_True intro_t =
   867     fun process_True intro_t =
   867       map_filter_premises (fn p => if p = @{prop True} then NONE else SOME p) intro_t
   868       map_filter_premises (fn p => if p = @{prop True} then NONE else SOME p) intro_t
   868   in
   869   in