src/Pure/Isar/proof.ML
changeset 61268 abe08fb15a12
parent 61109 1c98bfc5d743
child 61508 2c7e2ae6173d
equal deleted inserted replaced
61267:0b6217fda81b 61268:abe08fb15a12
   493     val _ =
   493     val _ =
   494       Context.subthy_id (Thm.theory_id_of_thm goal, Context.theory_id thy) orelse
   494       Context.subthy_id (Thm.theory_id_of_thm goal, Context.theory_id thy) orelse
   495         error "Bad background theory of goal state";
   495         error "Bad background theory of goal state";
   496     val _ = Thm.no_prems goal orelse error (Proof_Display.string_of_goal ctxt goal);
   496     val _ = Thm.no_prems goal orelse error (Proof_Display.string_of_goal ctxt goal);
   497 
   497 
   498     fun err_lost () = error ("Lost goal structure:\n" ^ Display.string_of_thm ctxt goal);
   498     fun err_lost () = error ("Lost goal structure:\n" ^ Thm.string_of_thm ctxt goal);
   499 
   499 
   500     val th =
   500     val th =
   501       (Goal.conclude (if length (flat propss) > 1 then Thm.close_derivation goal else goal)
   501       (Goal.conclude (if length (flat propss) > 1 then Thm.close_derivation goal else goal)
   502         handle THM _ => err_lost ())
   502         handle THM _ => err_lost ())
   503       |> Drule.flexflex_unique (SOME ctxt)
   503       |> Drule.flexflex_unique (SOME ctxt)
   509       Conjunction.elim_balanced (length goal_propss) th
   509       Conjunction.elim_balanced (length goal_propss) th
   510       |> map2 Conjunction.elim_balanced (map length goal_propss)
   510       |> map2 Conjunction.elim_balanced (map length goal_propss)
   511       handle THM _ => err_lost ();
   511       handle THM _ => err_lost ();
   512     val _ =
   512     val _ =
   513       Unify.matches_list (Context.Proof ctxt) (flat goal_propss) (map Thm.prop_of (flat results))
   513       Unify.matches_list (Context.Proof ctxt) (flat goal_propss) (map Thm.prop_of (flat results))
   514         orelse error ("Proved a different theorem:\n" ^ Display.string_of_thm ctxt th);
   514         orelse error ("Proved a different theorem:\n" ^ Thm.string_of_thm ctxt th);
   515 
   515 
   516     fun recover_result ([] :: pss) thss = [] :: recover_result pss thss
   516     fun recover_result ([] :: pss) thss = [] :: recover_result pss thss
   517       | recover_result (_ :: pss) (ths :: thss) = ths :: recover_result pss thss
   517       | recover_result (_ :: pss) (ths :: thss) = ths :: recover_result pss thss
   518       | recover_result [] [] = []
   518       | recover_result [] [] = []
   519       | recover_result _ _ = err_lost ();
   519       | recover_result _ _ = err_lost ();