136 (rewrite (map (R.ASSUME o tych) cntxt) (R.SPEC_ALL th))) |
136 (rewrite (map (R.ASSUME o tych) cntxt) (R.SPEC_ALL th))) |
137 end |
137 end |
138 val gen_all = S.gen_all |
138 val gen_all = S.gen_all |
139 in |
139 in |
140 fun proof_stage ss theory {f, R, rules, full_pats_TCs, TCs} = |
140 fun proof_stage ss theory {f, R, rules, full_pats_TCs, TCs} = |
141 let val dummy = prs "Proving induction theorem.. " |
141 let val dummy = writeln "Proving induction theorem.. " |
142 val ind = Prim.mk_induction theory f R full_pats_TCs |
142 val ind = Prim.mk_induction theory f R full_pats_TCs |
143 val dummy = prs "Proved induction theorem.\nPostprocessing.. " |
143 val dummy = writeln "Proved induction theorem.\nPostprocessing.. " |
144 val {rules, induction, nested_tcs} = |
144 val {rules, induction, nested_tcs} = |
145 std_postprocessor ss theory {rules=rules, induction=ind, TCs=TCs} |
145 std_postprocessor ss theory {rules=rules, induction=ind, TCs=TCs} |
146 in |
146 in |
147 case nested_tcs |
147 case nested_tcs |
148 of [] => (writeln "Postprocessing done."; |
148 of [] => (writeln "Postprocessing done."; |
149 {induction=induction, rules=rules,tcs=[]}) |
149 {induction=induction, rules=rules,tcs=[]}) |
150 | L => let val dummy = prs "Simplifying nested TCs.. " |
150 | L => let val dummy = writeln "Simplifying nested TCs.. " |
151 val (solved,simplified,stubborn) = |
151 val (solved,simplified,stubborn) = |
152 U.itlist (fn th => fn (So,Si,St) => |
152 U.itlist (fn th => fn (So,Si,St) => |
153 if (id_thm th) then (So, Si, th::St) else |
153 if (id_thm th) then (So, Si, th::St) else |
154 if (solved th) then (th::So, Si, St) |
154 if (solved th) then (th::So, Si, St) |
155 else (So, th::Si, St)) nested_tcs ([],[],[]) |
155 else (So, th::Si, St)) nested_tcs ([],[],[]) |
229 * |
229 * |
230 |
230 |
231 local structure R = Rules |
231 local structure R = Rules |
232 in |
232 in |
233 fun function theory eqs = |
233 fun function theory eqs = |
234 let val dummy = prs "Making definition.. " |
234 let val dummy = writeln "Making definition.. " |
235 val {rules,R,theory,full_pats_TCs,...} = Prim.lazyR_def theory eqs |
235 val {rules,R,theory,full_pats_TCs,...} = Prim.lazyR_def theory eqs |
236 val f = func_of_cond_eqn (concl(R.CONJUNCT1 rules handle _ => rules)) |
236 val f = func_of_cond_eqn (concl(R.CONJUNCT1 rules handle _ => rules)) |
237 val dummy = prs "Definition made.\n" |
237 val dummy = writeln "Definition made." |
238 val dummy = prs "Proving induction theorem.. " |
238 val dummy = writeln "Proving induction theorem.. " |
239 val induction = Prim.mk_induction theory f R full_pats_TCs |
239 val induction = Prim.mk_induction theory f R full_pats_TCs |
240 val dummy = prs "Induction theorem proved.\n" |
240 val dummy = writeln "Induction theorem proved." |
241 in {theory = theory, |
241 in {theory = theory, |
242 eq_ind = standard (induction RS (rules RS conjI))} |
242 eq_ind = standard (induction RS (rules RS conjI))} |
243 end |
243 end |
244 end; |
244 end; |
245 |
245 |