src/HOL/Tools/SMT2/z3_new_replay.ML
changeset 57230 ec5ff6bb2a92
parent 57229 489083abce44
child 57541 147e3f1e0459
equal deleted inserted replaced
57229:489083abce44 57230:ec5ff6bb2a92
    69 fun replay_step ctxt assumed (step as Z3_New_Proof.Z3_Step {id, prems, fixes, ...}) proofs =
    69 fun replay_step ctxt assumed (step as Z3_New_Proof.Z3_Step {id, prems, fixes, ...}) proofs =
    70   let val nthms = map (the o Inttab.lookup proofs) prems
    70   let val nthms = map (the o Inttab.lookup proofs) prems
    71   in Inttab.update (id, (fixes, replay_thm ctxt assumed nthms step)) proofs end
    71   in Inttab.update (id, (fixes, replay_thm ctxt assumed nthms step)) proofs end
    72 
    72 
    73 local
    73 local
    74   val remove_trigger = mk_meta_eq @{thm SMT2.trigger_def}
    74   val remove_trigger = mk_meta_eq @{thm trigger_def}
    75   val remove_fun_app = mk_meta_eq @{thm SMT2.fun_app_def}
    75   val remove_fun_app = mk_meta_eq @{thm fun_app_def}
    76 
    76 
    77   fun rewrite_conv _ [] = Conv.all_conv
    77   fun rewrite_conv _ [] = Conv.all_conv
    78     | rewrite_conv ctxt eqs = Simplifier.full_rewrite (empty_simpset ctxt addsimps eqs)
    78     | rewrite_conv ctxt eqs = Simplifier.full_rewrite (empty_simpset ctxt addsimps eqs)
    79 
    79 
    80   val prep_rules = [@{thm Let_def}, remove_trigger, remove_fun_app,
    80   val prep_rules = [@{thm Let_def}, remove_trigger, remove_fun_app,
    95 
    95 
    96     val assms_net =
    96     val assms_net =
    97       assms
    97       assms
    98       |> map (apsnd (rewrite ctxt eqs'))
    98       |> map (apsnd (rewrite ctxt eqs'))
    99       |> map (apsnd (Conv.fconv_rule Thm.eta_conversion))
    99       |> map (apsnd (Conv.fconv_rule Thm.eta_conversion))
   100       |> Z3_New_Replay_Util.thm_net_of snd 
   100       |> Z3_New_Replay_Util.thm_net_of snd
   101 
   101 
   102     fun revert_conv ctxt = rewrite_conv ctxt eqs' then_conv Thm.eta_conversion
   102     fun revert_conv ctxt = rewrite_conv ctxt eqs' then_conv Thm.eta_conversion
   103 
   103 
   104     fun assume thm ctxt =
   104     fun assume thm ctxt =
   105       let
   105       let
   157   "(P | ~ P) & (~ P | P)"
   157   "(P | ~ P) & (~ P | P)"
   158   by fast+}
   158   by fast+}
   159 
   159 
   160 fun discharge_assms_tac rules =
   160 fun discharge_assms_tac rules =
   161   REPEAT (HEADGOAL (resolve_tac (intro_def_rules @ rules) ORELSE' SOLVED' discharge_sk_tac))
   161   REPEAT (HEADGOAL (resolve_tac (intro_def_rules @ rules) ORELSE' SOLVED' discharge_sk_tac))
   162   
   162 
   163 fun discharge_assms ctxt rules thm =
   163 fun discharge_assms ctxt rules thm =
   164   (if Thm.nprems_of thm = 0 then
   164   (if Thm.nprems_of thm = 0 then
   165      thm
   165      thm
   166    else
   166    else
   167      (case Seq.pull (discharge_assms_tac rules thm) of
   167      (case Seq.pull (discharge_assms_tac rules thm) of