309 REPEAT (etac conjE 1)]) |
309 REPEAT (etac conjE 1)]) |
310 [ex] ctxt |
310 [ex] ctxt |
311 in (freshs1 @ [term_of cx], freshs2 @ ths, ctxt') end; |
311 in (freshs1 @ [term_of cx], freshs2 @ ths, ctxt') end; |
312 |
312 |
313 fun mk_ind_proof thy thss = |
313 fun mk_ind_proof thy thss = |
314 let val ctxt = ProofContext.init thy |
314 Goal.prove_global thy [] prems' concl' (fn {prems = ihyps, context = ctxt} => |
315 in Goal.prove_global thy [] prems' concl' (fn ihyps => |
|
316 let val th = Goal.prove ctxt [] [] concl (fn {context, ...} => |
315 let val th = Goal.prove ctxt [] [] concl (fn {context, ...} => |
317 rtac raw_induct 1 THEN |
316 rtac raw_induct 1 THEN |
318 EVERY (maps (fn ((((_, bvars, oprems, _), vc_compat_ths), ihyp), (vs, ihypt)) => |
317 EVERY (maps (fn ((((_, bvars, oprems, _), vc_compat_ths), ihyp), (vs, ihypt)) => |
319 [REPEAT (rtac allI 1), simp_tac eqvt_ss 1, |
318 [REPEAT (rtac allI 1), simp_tac eqvt_ss 1, |
320 SUBPROOF (fn {prems = gprems, params, concl, context = ctxt', ...} => |
319 SUBPROOF (fn {prems = gprems, params, concl, context = ctxt', ...} => |
402 in |
401 in |
403 cut_facts_tac [th] 1 THEN REPEAT (etac conjE 1) THEN |
402 cut_facts_tac [th] 1 THEN REPEAT (etac conjE 1) THEN |
404 REPEAT (REPEAT (resolve_tac [conjI, impI] 1) THEN |
403 REPEAT (REPEAT (resolve_tac [conjI, impI] 1) THEN |
405 etac impE 1 THEN atac 1 THEN REPEAT (etac allE_Nil 1) THEN |
404 etac impE 1 THEN atac 1 THEN REPEAT (etac allE_Nil 1) THEN |
406 asm_full_simp_tac (simpset_of thy) 1) |
405 asm_full_simp_tac (simpset_of thy) 1) |
407 end) |
406 end); |
408 end; |
|
409 |
407 |
410 (** strong case analysis rule **) |
408 (** strong case analysis rule **) |
411 |
409 |
412 val cases_prems = map (fn ((name, avoids), rule) => |
410 val cases_prems = map (fn ((name, avoids), rule) => |
413 let |
411 let |
458 |
456 |
459 val cases_eqvt_ss = HOL_ss addsimps eqvt_thms @ calc_atm delsplits [split_if]; |
457 val cases_eqvt_ss = HOL_ss addsimps eqvt_thms @ calc_atm delsplits [split_if]; |
460 |
458 |
461 fun mk_cases_proof thy ((((name, thss), elim), (prem, args, concl, prems)), |
459 fun mk_cases_proof thy ((((name, thss), elim), (prem, args, concl, prems)), |
462 prems') = |
460 prems') = |
463 let val ctxt1 = ProofContext.init thy |
461 (name, Goal.prove_global thy [] (prem :: prems') concl |
464 in (name, Goal.prove_global thy [] (prem :: prems') concl (fn hyp :: hyps => |
462 (fn {prems = hyp :: hyps, context = ctxt1} => |
465 EVERY (rtac (hyp RS elim) 1 :: |
463 EVERY (rtac (hyp RS elim) 1 :: |
466 map (fn (((_, vc_compat_ths), case_hyp), (_, qs, is, _)) => |
464 map (fn (((_, vc_compat_ths), case_hyp), (_, qs, is, _)) => |
467 SUBPROOF (fn {prems = case_hyps, params, context = ctxt2, concl, ...} => |
465 SUBPROOF (fn {prems = case_hyps, params, context = ctxt2, concl, ...} => |
468 if null qs then |
466 if null qs then |
469 rtac (first_order_mrs case_hyps case_hyp) 1 |
467 rtac (first_order_mrs case_hyps case_hyp) 1 |
532 resolve_tac case_hyps' 1) |
530 resolve_tac case_hyps' 1) |
533 end) ctxt4 1) |
531 end) ctxt4 1) |
534 val final = ProofContext.export ctxt3 ctxt2 [th] |
532 val final = ProofContext.export ctxt3 ctxt2 [th] |
535 in resolve_tac final 1 end) ctxt1 1) |
533 in resolve_tac final 1 end) ctxt1 1) |
536 (thss ~~ hyps ~~ prems)))) |
534 (thss ~~ hyps ~~ prems)))) |
537 end |
|
538 |
535 |
539 in |
536 in |
540 thy |> |
537 thy |> |
541 ProofContext.init |> |
538 ProofContext.init |> |
542 Proof.theorem_i NONE (fn thss => ProofContext.theory (fn thy => |
539 Proof.theorem_i NONE (fn thss => ProofContext.theory (fn thy => |