equal
deleted
inserted
replaced
229 |
229 |
230 (* Rule for case splitting along the sum types *) |
230 (* Rule for case splitting along the sum types *) |
231 val xss = map (fn (SchemeBranch { xs, ... }) => map Free xs) branches |
231 val xss = map (fn (SchemeBranch { xs, ... }) => map Free xs) branches |
232 val pats = map_index (uncurry inject) xss |
232 val pats = map_index (uncurry inject) xss |
233 val sum_split_rule = |
233 val sum_split_rule = |
234 Pat_Completeness.prove_completeness thy [x] (P_comp $ x) xss (map single pats) |
234 Pat_Completeness.prove_completeness ctxt [x] (P_comp $ x) xss (map single pats) |
235 |
235 |
236 fun prove_branch (bidx, (SchemeBranch { P, xs, ws, Cs, ... }, (complete_thm, pat))) = |
236 fun prove_branch (bidx, (SchemeBranch { P, xs, ws, Cs, ... }, (complete_thm, pat))) = |
237 let |
237 let |
238 val fxs = map Free xs |
238 val fxs = map Free xs |
239 val branch_hyp = Thm.assume (cert (HOLogic.mk_Trueprop (HOLogic.mk_eq (x, pat)))) |
239 val branch_hyp = Thm.assume (cert (HOLogic.mk_Trueprop (HOLogic.mk_eq (x, pat)))) |
251 map (Thm.assume o cert o HOLogic.mk_Trueprop o HOLogic.mk_eq) (fxs ~~ lhs) |
251 map (Thm.assume o cert o HOLogic.mk_Trueprop o HOLogic.mk_eq) (fxs ~~ lhs) |
252 |
252 |
253 val cqs = map (cert o Free) qs |
253 val cqs = map (cert o Free) qs |
254 val ags = map (Thm.assume o cert) gs |
254 val ags = map (Thm.assume o cert) gs |
255 |
255 |
256 val replace_x_ss = HOL_basic_ss addsimps (branch_hyp :: case_hyps) |
256 val replace_x_simpset = |
257 val sih = full_simplify replace_x_ss aihyp |
257 put_simpset HOL_basic_ss ctxt addsimps (branch_hyp :: case_hyps) |
|
258 val sih = full_simplify replace_x_simpset aihyp |
258 |
259 |
259 fun mk_Prec (idx, Gvs, Gas, rcargs) (ineq, pres) = |
260 fun mk_Prec (idx, Gvs, Gas, rcargs) (ineq, pres) = |
260 let |
261 let |
261 val cGas = map (Thm.assume o cert) Gas |
262 val cGas = map (Thm.assume o cert) Gas |
262 val cGvs = map (cert o Free) Gvs |
263 val cGvs = map (cert o Free) Gvs |
371 |> SumTree.mk_inj ST (length branches) (i + 1) |
372 |> SumTree.mk_inj ST (length branches) (i + 1) |
372 |> cert |
373 |> cert |
373 in |
374 in |
374 indthm |
375 indthm |
375 |> Drule.instantiate' [] [SOME inst] |
376 |> Drule.instantiate' [] [SOME inst] |
376 |> simplify SumTree.sumcase_split_ss |
377 |> simplify (put_simpset SumTree.sumcase_split_ss ctxt'') |
377 |> Conv.fconv_rule ind_rulify |
378 |> Conv.fconv_rule ind_rulify |
378 end |
379 end |
379 |
380 |
380 val res = Conjunction.intr_balanced (map_index project branches) |
381 val res = Conjunction.intr_balanced (map_index project branches) |
381 |> fold_rev Thm.implies_intr (map cprop_of newgoals @ steps) |
382 |> fold_rev Thm.implies_intr (map cprop_of newgoals @ steps) |