src/Pure/Isar/obtain.ML
changeset 41228 e1fce873b814
parent 39134 917b4b6ba3d2
child 42284 326f57825e1a
equal deleted inserted replaced
41227:11e7ee2ca77f 41228:e1fce873b814
   191 
   191 
   192     val ((thesis_var, thesis), thesis_ctxt) = bind_judgment ctxt Auto_Bind.thesisN;
   192     val ((thesis_var, thesis), thesis_ctxt) = bind_judgment ctxt Auto_Bind.thesisN;
   193     val rule =
   193     val rule =
   194       (case SINGLE (Method.insert_tac facts 1 THEN tac thesis_ctxt) (Goal.init (cert thesis)) of
   194       (case SINGLE (Method.insert_tac facts 1 THEN tac thesis_ctxt) (Goal.init (cert thesis)) of
   195         NONE => raise THM ("Obtain.result: tactic failed", 0, facts)
   195         NONE => raise THM ("Obtain.result: tactic failed", 0, facts)
   196       | SOME th => check_result ctxt thesis (MetaSimplifier.norm_hhf (Goal.conclude th)));
   196       | SOME th => check_result ctxt thesis (Raw_Simplifier.norm_hhf (Goal.conclude th)));
   197 
   197 
   198     val closed_rule = Thm.forall_intr (cert (Free thesis_var)) rule;
   198     val closed_rule = Thm.forall_intr (cert (Free thesis_var)) rule;
   199     val ((_, [rule']), ctxt') = Variable.import false [closed_rule] ctxt;
   199     val ((_, [rule']), ctxt') = Variable.import false [closed_rule] ctxt;
   200     val obtain_rule = Thm.forall_elim (cert (Logic.varify_global (Free thesis_var))) rule';
   200     val obtain_rule = Thm.forall_elim (cert (Logic.varify_global (Free thesis_var))) rule';
   201     val ((params, stmt), fix_ctxt) = Variable.focus (Thm.cprem_of obtain_rule 1) ctxt';
   201     val ((params, stmt), fix_ctxt) = Variable.focus (Thm.cprem_of obtain_rule 1) ctxt';
   297       end;
   297       end;
   298 
   298 
   299     val goal = Var (("guess", 0), propT);
   299     val goal = Var (("guess", 0), propT);
   300     fun print_result ctxt' (k, [(s, [_, th])]) =
   300     fun print_result ctxt' (k, [(s, [_, th])]) =
   301       Proof_Display.print_results int ctxt' (k, [(s, [th])]);
   301       Proof_Display.print_results int ctxt' (k, [(s, [th])]);
   302     val before_qed = SOME (Method.primitive_text (Goal.conclude #> MetaSimplifier.norm_hhf #>
   302     val before_qed = SOME (Method.primitive_text (Goal.conclude #> Raw_Simplifier.norm_hhf #>
   303         (fn th => Goal.protect (Conjunction.intr (Drule.mk_term (Thm.cprop_of th)) th))));
   303         (fn th => Goal.protect (Conjunction.intr (Drule.mk_term (Thm.cprop_of th)) th))));
   304     fun after_qed [[_, res]] =
   304     fun after_qed [[_, res]] =
   305       Proof.end_block #> guess_context (check_result ctxt thesis res);
   305       Proof.end_block #> guess_context (check_result ctxt thesis res);
   306   in
   306   in
   307     state
   307     state