src/HOL/Tools/SMT2/z3_new_replay_util.ML
changeset 57229 489083abce44
parent 56090 34bd10a9a2ad
child 57230 ec5ff6bb2a92
equal deleted inserted replaced
57228:d52012eabf0d 57229:489083abce44
    21   val compose: compose_data -> thm -> thm
    21   val compose: compose_data -> thm -> thm
    22 
    22 
    23   (*simpset*)
    23   (*simpset*)
    24   val add_simproc: Simplifier.simproc -> Context.generic -> Context.generic
    24   val add_simproc: Simplifier.simproc -> Context.generic -> Context.generic
    25   val make_simpset: Proof.context -> thm list -> simpset
    25   val make_simpset: Proof.context -> thm list -> simpset
    26 end
    26 end;
    27 
    27 
    28 structure Z3_New_Replay_Util: Z3_NEW_REPLAY_UTIL =
    28 structure Z3_New_Replay_Util: Z3_NEW_REPLAY_UTIL =
    29 struct
    29 struct
    30 
       
    31 
       
    32 
    30 
    33 (* theorem nets *)
    31 (* theorem nets *)
    34 
    32 
    35 fun thm_net_of f xthms =
    33 fun thm_net_of f xthms =
    36   let fun insert xthm = Net.insert_term (K false) (Thm.prop_of (f xthm), xthm)
    34   let fun insert xthm = Net.insert_term (K false) (Thm.prop_of (f xthm), xthm)
    57     net
    55     net
    58 
    56 
    59 end
    57 end
    60 
    58 
    61 
    59 
    62 
       
    63 (* proof combinators *)
    60 (* proof combinators *)
    64 
    61 
    65 fun under_assumption f ct =
    62 fun under_assumption f ct =
    66   let val ct' = SMT2_Util.mk_cprop ct in Thm.implies_intr ct' (f (Thm.assume ct')) end
    63   let val ct' = SMT2_Util.mk_cprop ct in Thm.implies_intr ct' (f (Thm.assume ct')) end
    67 
    64 
    68 fun discharge p pq = Thm.implies_elim pq p
    65 fun discharge p pq = Thm.implies_elim pq p
    69 
       
    70 
    66 
    71 
    67 
    72 (* a faster COMP *)
    68 (* a faster COMP *)
    73 
    69 
    74 type compose_data = cterm list * (cterm -> cterm list) * thm
    70 type compose_data = cterm list * (cterm -> cterm list) * thm
    78 fun precompose f rule = (f (Thm.cprem_of rule 1), f, rule)
    74 fun precompose f rule = (f (Thm.cprem_of rule 1), f, rule)
    79 fun precompose2 f rule = precompose (list2 o f) rule
    75 fun precompose2 f rule = precompose (list2 o f) rule
    80 
    76 
    81 fun compose (cvs, f, rule) thm =
    77 fun compose (cvs, f, rule) thm =
    82   discharge thm (Thm.instantiate ([], cvs ~~ f (Thm.cprop_of thm)) rule)
    78   discharge thm (Thm.instantiate ([], cvs ~~ f (Thm.cprop_of thm)) rule)
    83 
       
    84 
    79 
    85 
    80 
    86 (* simpset *)
    81 (* simpset *)
    87 
    82 
    88 local
    83 local
   150 fun make_simpset ctxt rules =
   145 fun make_simpset ctxt rules =
   151   simpset_of (put_simpset (Simpset.get (Context.Proof ctxt)) ctxt addsimps rules)
   146   simpset_of (put_simpset (Simpset.get (Context.Proof ctxt)) ctxt addsimps rules)
   152 
   147 
   153 end
   148 end
   154 
   149 
   155 end
   150 end;