equal
deleted
inserted
replaced
228 fun export_facts inner outer = |
228 fun export_facts inner outer = |
229 (case get_facts inner of |
229 (case get_facts inner of |
230 NONE => Seq.single (put_facts NONE outer) |
230 NONE => Seq.single (put_facts NONE outer) |
231 | SOME thms => |
231 | SOME thms => |
232 thms |
232 thms |
233 |> Seq.map_list (ProofContext.exports (context_of inner) (context_of outer)) |
233 |> ProofContext.exports (context_of inner) (context_of outer) |
234 |> Seq.map (fn ths => put_facts (SOME ths) outer)); |
234 |> Seq.map (fn ths => put_facts (SOME ths) outer)); |
235 |
235 |
236 |
236 |
237 (* mode *) |
237 (* mode *) |
238 |
238 |
442 (Tactic.norm_hhf_tac THEN' (SUBGOAL (fn (goal, i) => |
442 (Tactic.norm_hhf_tac THEN' (SUBGOAL (fn (goal, i) => |
443 if can Logic.unprotect (Logic.strip_assums_concl goal) then |
443 if can Logic.unprotect (Logic.strip_assums_concl goal) then |
444 Tactic.etac Drule.protectI i |
444 Tactic.etac Drule.protectI i |
445 else all_tac))); |
445 else all_tac))); |
446 |
446 |
447 fun refine_goal print_rule inner raw_rule state = |
447 in |
448 let val (outer, (_, goal)) = get_goal state in |
448 |
449 raw_rule |
449 fun refine_goals print_rule inner raw_rules state = |
|
450 let |
|
451 val (outer, (_, goal)) = get_goal state; |
|
452 fun refine rule st = (print_rule outer rule; FINDGOAL (refine_tac rule) st); |
|
453 in |
|
454 raw_rules |
450 |> ProofContext.goal_exports inner outer |
455 |> ProofContext.goal_exports inner outer |
451 |> Seq.maps (fn rule => |
456 |> Seq.maps (fn rules => Seq.lift set_goal (EVERY (map refine rules) goal) state) |
452 (print_rule outer rule; |
457 end; |
453 Seq.lift set_goal (FINDGOAL (refine_tac rule) goal) state)) |
|
454 end; |
|
455 |
|
456 in |
|
457 |
|
458 fun refine_goals print_rule inner raw_rules = |
|
459 Seq.EVERY (map (refine_goal print_rule inner) raw_rules); |
|
460 |
458 |
461 end; |
459 end; |
462 |
460 |
463 |
461 |
464 (* conclude_goal *) |
462 (* conclude_goal *) |
825 val outer_state = state |> close_block; |
823 val outer_state = state |> close_block; |
826 val outer_ctxt = context_of outer_state; |
824 val outer_ctxt = context_of outer_state; |
827 |
825 |
828 val props = |
826 val props = |
829 flat (tl stmt) |
827 flat (tl stmt) |
830 |> Variable.generalize goal_ctxt outer_ctxt; |
828 |> Variable.exportT_terms goal_ctxt outer_ctxt; |
831 val results = |
829 val results = |
832 tl (conclude_goal state goal stmt) |
830 tl (conclude_goal state goal stmt) |
833 |> (Seq.map_list o Seq.map_list) (ProofContext.exports goal_ctxt outer_ctxt); |
831 |> Seq.map_list (ProofContext.exports goal_ctxt outer_ctxt); |
834 in |
832 in |
835 outer_state |
833 outer_state |
836 |> map_context (ProofContext.auto_bind_facts props) |
834 |> map_context (ProofContext.auto_bind_facts props) |
837 |> pair (after_qed, results) |
835 |> pair (after_qed, results) |
838 end; |
836 end; |
882 #> Sign.restore_naming thy; |
880 #> Sign.restore_naming thy; |
883 |
881 |
884 fun after_qed' results = |
882 fun after_qed' results = |
885 (case target of NONE => I |
883 (case target of NONE => I |
886 | SOME prfx => store_results (NameSpace.base prfx) |
884 | SOME prfx => store_results (NameSpace.base prfx) |
887 (map (map (ProofContext.export_standard ctxt thy_ctxt |
885 (map (ProofContext.export_standard ctxt thy_ctxt |
888 #> Drule.strip_shyps_warning)) results)) |
886 #> map Drule.strip_shyps_warning) results)) |
889 #> after_qed results; |
887 #> after_qed results; |
890 in |
888 in |
891 init ctxt |
889 init ctxt |
892 |> generic_goal (prepp #> ProofContext.auto_fixes) (kind ^ goal_names target name names) |
890 |> generic_goal (prepp #> ProofContext.auto_fixes) (kind ^ goal_names target name names) |
893 before_qed (K Seq.single, after_qed') propp |
891 before_qed (K Seq.single, after_qed') propp |