23 -> {induction:thm, rules:thm, nested_tcs:thm list} |
23 -> {induction:thm, rules:thm, nested_tcs:thm list} |
24 |
24 |
25 val define_i : theory -> xstring -> term |
25 val define_i : theory -> xstring -> term |
26 -> simpset * thm list (*allows special simplication*) |
26 -> simpset * thm list (*allows special simplication*) |
27 -> term list |
27 -> term list |
28 -> theory * {rules:thm list, induct:thm, tcs:term list} |
28 -> theory * {rules:(thm*int)list, induct:thm, tcs:term list} |
29 |
29 |
30 val define : theory -> xstring -> string |
30 val define : theory -> xstring -> string |
31 -> simpset * thm list |
31 -> simpset * thm list |
32 -> string list |
32 -> string list |
33 -> theory * {rules:thm list, induct:thm, tcs:term list} |
33 -> theory * {rules:(thm*int)list, induct:thm, tcs:term list} |
34 |
34 |
35 val defer_i : theory -> xstring |
35 val defer_i : theory -> xstring |
36 -> thm list (* congruence rules *) |
36 -> thm list (* congruence rules *) |
37 -> term list -> theory * thm |
37 -> term list -> theory * thm |
38 |
38 |
39 val defer : theory -> xstring |
39 val defer : theory -> xstring |
40 -> thm list |
40 -> thm list |
41 -> string list -> theory * thm |
41 -> string list -> theory * thm |
42 |
42 (* |
43 val simplify_defn : simpset * thm list |
43 val simplify_defn : simpset * thm list |
44 -> theory * (string * Prim.pattern list) |
44 -> theory * (string * Prim.pattern list) |
45 -> {rules:thm list, induct:thm, tcs:term list} |
45 -> {rules:thm list, induct:thm, tcs:term list} |
46 |
46 *) |
47 end; |
47 end; |
48 |
48 |
49 |
49 |
50 structure Tfl: TFL = |
50 structure Tfl: TFL = |
51 struct |
51 struct |
192 fun simplify_defn (ss, tflCongs) (thy,(id,pats)) = |
192 fun simplify_defn (ss, tflCongs) (thy,(id,pats)) = |
193 let val dummy = deny (id mem (Sign.stamp_names_of (Theory.sign_of thy))) |
193 let val dummy = deny (id mem (Sign.stamp_names_of (Theory.sign_of thy))) |
194 ("Recursive definition " ^ id ^ |
194 ("Recursive definition " ^ id ^ |
195 " would clash with the theory of the same name!") |
195 " would clash with the theory of the same name!") |
196 val def = freezeT(get_def thy id) RS meta_eq_to_obj_eq |
196 val def = freezeT(get_def thy id) RS meta_eq_to_obj_eq |
197 val {theory,rules,TCs,full_pats_TCs,patterns} = |
197 val {theory,rules,rows,TCs,full_pats_TCs} = |
198 Prim.post_definition (Prim.congs tflCongs) |
198 Prim.post_definition (Prim.congs tflCongs) |
199 (thy, (def,pats)) |
199 (thy, (def,pats)) |
200 val {lhs=f,rhs} = S.dest_eq(concl def) |
200 val {lhs=f,rhs} = S.dest_eq(concl def) |
201 val (_,[R,_]) = S.strip_comb rhs |
201 val (_,[R,_]) = S.strip_comb rhs |
202 val ss' = ss addsimps Prim.default_simps |
202 val ss' = ss addsimps Prim.default_simps |
206 full_pats_TCs = full_pats_TCs, |
206 full_pats_TCs = full_pats_TCs, |
207 TCs = TCs} |
207 TCs = TCs} |
208 val rules' = map (standard o normalize_thm [RSmp]) (R.CONJUNCTS rules) |
208 val rules' = map (standard o normalize_thm [RSmp]) (R.CONJUNCTS rules) |
209 in {induct = meta_outer |
209 in {induct = meta_outer |
210 (normalize_thm [RSspec,RSmp] (induction RS spec')), |
210 (normalize_thm [RSspec,RSmp] (induction RS spec')), |
211 rules = rules', |
211 rules = ListPair.zip(rules', rows), |
212 tcs = (termination_goals rules') @ tcs} |
212 tcs = (termination_goals rules') @ tcs} |
213 end |
213 end |
214 handle Utils.ERR {mesg,func,module} => |
214 handle Utils.ERR {mesg,func,module} => |
215 error (mesg ^ |
215 error (mesg ^ |
216 "\n (In TFL function " ^ module ^ "." ^ func ^ ")"); |
216 "\n (In TFL function " ^ module ^ "." ^ func ^ ")"); |