equal
deleted
inserted
replaced
105 PureThy.add_defs_i false (map Thm.no_attributes fixdefs) thy; |
105 PureThy.add_defs_i false (map Thm.no_attributes fixdefs) thy; |
106 val ctuple_fixdef_thm = foldr1 (fn (x,y) => cpair_equalI OF [x,y]) fixdef_thms; |
106 val ctuple_fixdef_thm = foldr1 (fn (x,y) => cpair_equalI OF [x,y]) fixdef_thms; |
107 |
107 |
108 fun mk_cterm t = cterm_of thy' (infer thy' t); |
108 fun mk_cterm t = cterm_of thy' (infer thy' t); |
109 val ctuple_unfold_ct = mk_cterm (mk_trp (mk_ctuple lhss === mk_ctuple rhss)); |
109 val ctuple_unfold_ct = mk_cterm (mk_trp (mk_ctuple lhss === mk_ctuple rhss)); |
110 val ctuple_unfold_thm = prove_goalw_cterm [] ctuple_unfold_ct |
110 val ctuple_unfold_thm = OldGoals.prove_goalw_cterm [] ctuple_unfold_ct |
111 (fn _ => [rtac (ctuple_fixdef_thm RS fix_eq2 RS trans) 1, |
111 (fn _ => [rtac (ctuple_fixdef_thm RS fix_eq2 RS trans) 1, |
112 simp_tac (simpset_of thy') 1]); |
112 simp_tac (simpset_of thy') 1]); |
113 val ctuple_induct_thm = |
113 val ctuple_induct_thm = |
114 (space_implode "_" names ^ "_induct", ctuple_fixdef_thm RS def_fix_ind); |
114 (space_implode "_" names ^ "_induct", ctuple_fixdef_thm RS def_fix_ind); |
115 |
115 |
216 (* proves a block of pattern matching equations as theorems, using unfold *) |
216 (* proves a block of pattern matching equations as theorems, using unfold *) |
217 fun make_simps thy (unfold_thm, eqns) = |
217 fun make_simps thy (unfold_thm, eqns) = |
218 let |
218 let |
219 fun tacsf prems = |
219 fun tacsf prems = |
220 [rtac (unfold_thm RS ssubst_lhs) 1, simp_tac (simpset_of thy addsimps prems) 1]; |
220 [rtac (unfold_thm RS ssubst_lhs) 1, simp_tac (simpset_of thy addsimps prems) 1]; |
221 fun prove_term t = prove_goalw_cterm [] (cterm_of thy t) tacsf; |
221 fun prove_term t = OldGoals.prove_goalw_cterm [] (cterm_of thy t) tacsf; |
222 fun prove_eqn ((name, eqn_t), atts) = ((name, prove_term eqn_t), atts); |
222 fun prove_eqn ((name, eqn_t), atts) = ((name, prove_term eqn_t), atts); |
223 in |
223 in |
224 map prove_eqn eqns |
224 map prove_eqn eqns |
225 end; |
225 end; |
226 |
226 |
273 val T = fastype_of t; |
273 val T = fastype_of t; |
274 val eq = mk_trp (HOLogic.eq_const T $ t $ Var (("x",0),T)); |
274 val eq = mk_trp (HOLogic.eq_const T $ t $ Var (("x",0),T)); |
275 val cname = case chead_of t of Const(c,_) => c | _ => |
275 val cname = case chead_of t of Const(c,_) => c | _ => |
276 fixrec_err "function is not declared as constant in theory"; |
276 fixrec_err "function is not declared as constant in theory"; |
277 val unfold_thm = PureThy.get_thm thy (Name (cname^"_unfold")); |
277 val unfold_thm = PureThy.get_thm thy (Name (cname^"_unfold")); |
278 val simp = prove_goalw_cterm [] (cterm_of thy eq) |
278 val simp = OldGoals.prove_goalw_cterm [] (cterm_of thy eq) |
279 (fn _ => [stac unfold_thm 1, simp_tac (simpset_of thy) 1]); |
279 (fn _ => [stac unfold_thm 1, simp_tac (simpset_of thy) 1]); |
280 in simp end; |
280 in simp end; |
281 |
281 |
282 fun gen_add_fixpat prep_term prep_attrib ((name, srcs), strings) thy = |
282 fun gen_add_fixpat prep_term prep_attrib ((name, srcs), strings) thy = |
283 let |
283 let |