equal
deleted
inserted
replaced
32 val (cpfalse, cfalse) = |
32 val (cpfalse, cfalse) = |
33 `Old_SMT_Utils.mk_cprop (Thm.cterm_of @{context} @{const False}) |
33 `Old_SMT_Utils.mk_cprop (Thm.cterm_of @{context} @{const False}) |
34 |
34 |
35 fun inst f ct thm = |
35 fun inst f ct thm = |
36 let val cv = f (Drule.strip_imp_concl (Thm.cprop_of thm)) |
36 let val cv = f (Drule.strip_imp_concl (Thm.cprop_of thm)) |
37 in Thm.instantiate ([], [(cv, ct)]) thm end |
37 in Thm.instantiate ([], [(dest_Var (Thm.term_of cv), ct)]) thm end |
38 in |
38 in |
39 |
39 |
40 fun instantiate_elim thm = |
40 fun instantiate_elim thm = |
41 (case Thm.concl_of thm of |
41 (case Thm.concl_of thm of |
42 @{const Trueprop} $ Var (_, @{typ bool}) => inst Thm.dest_arg cfalse thm |
42 @{const Trueprop} $ Var (_, @{typ bool}) => inst Thm.dest_arg cfalse thm |
213 mk_meta_eq @{lemma "p = trigger t p" by (simp add: trigger_def)} |
213 mk_meta_eq @{lemma "p = trigger t p" by (simp add: trigger_def)} |
214 |
214 |
215 fun insert_trigger_conv [] ct = Conv.all_conv ct |
215 fun insert_trigger_conv [] ct = Conv.all_conv ct |
216 | insert_trigger_conv ctss ct = |
216 | insert_trigger_conv ctss ct = |
217 let val (ctr, cp) = Thm.dest_binop (Thm.rhs_of trigger_eq) ||> rpair ct |
217 let val (ctr, cp) = Thm.dest_binop (Thm.rhs_of trigger_eq) ||> rpair ct |
218 in Thm.instantiate ([], [cp, (ctr, mk_trigger ctss)]) trigger_eq end |
218 in Thm.instantiate ([], map (apfst (dest_Var o Thm.term_of)) [cp, (ctr, mk_trigger ctss)]) trigger_eq end |
219 |
219 |
220 fun infer_trigger_eq_conv outer_ctxt (ctxt, cvs) ct = |
220 fun infer_trigger_eq_conv outer_ctxt (ctxt, cvs) ct = |
221 let |
221 let |
222 val (lhs, rhs) = dest_cond_eq ct |
222 val (lhs, rhs) = dest_cond_eq ct |
223 |
223 |
296 val weight_eq = |
296 val weight_eq = |
297 mk_meta_eq @{lemma "p = weight i p" by (simp add: weight_def)} |
297 mk_meta_eq @{lemma "p = weight i p" by (simp add: weight_def)} |
298 fun mk_weight_eq w = |
298 fun mk_weight_eq w = |
299 let val cv = Thm.dest_arg1 (Thm.rhs_of weight_eq) |
299 let val cv = Thm.dest_arg1 (Thm.rhs_of weight_eq) |
300 in |
300 in |
301 Thm.instantiate ([], [(cv, Numeral.mk_cnumber @{ctyp int} w)]) weight_eq |
301 Thm.instantiate ([], [(dest_Var (Thm.term_of cv), Numeral.mk_cnumber @{ctyp int} w)]) |
|
302 weight_eq |
302 end |
303 end |
303 |
304 |
304 fun add_weight_conv NONE _ = Conv.all_conv |
305 fun add_weight_conv NONE _ = Conv.all_conv |
305 | add_weight_conv (SOME weight) ctxt = |
306 | add_weight_conv (SOME weight) ctxt = |
306 let val cv = Conv.rewr_conv (mk_weight_eq weight) |
307 let val cv = Conv.rewr_conv (mk_weight_eq weight) |