src/Pure/Isar/proof.ML
changeset 58950 d07464875dd4
parent 58892 20aa19ecf2cc
child 59150 71b416020f42
equal deleted inserted replaced
58949:e9559088ba29 58950:d07464875dd4
   469     fun lost_structure () = error ("Lost goal structure:\n" ^ Display.string_of_thm ctxt goal);
   469     fun lost_structure () = error ("Lost goal structure:\n" ^ Display.string_of_thm ctxt goal);
   470 
   470 
   471     val th =
   471     val th =
   472       (Goal.conclude (if length (flat propss) > 1 then Thm.norm_proof goal else goal)
   472       (Goal.conclude (if length (flat propss) > 1 then Thm.norm_proof goal else goal)
   473         handle THM _ => lost_structure ())
   473         handle THM _ => lost_structure ())
   474       |> Drule.flexflex_unique
   474       |> Drule.flexflex_unique (SOME ctxt)
   475       |> Thm.check_shyps (Variable.sorts_of ctxt)
   475       |> Thm.check_shyps (Variable.sorts_of ctxt)
   476       |> Thm.check_hyps (Context.Proof ctxt);
   476       |> Thm.check_hyps (Context.Proof ctxt);
   477 
   477 
   478     val goal_propss = filter_out null propss;
   478     val goal_propss = filter_out null propss;
   479     val results =
   479     val results =
   480       Conjunction.elim_balanced (length goal_propss) th
   480       Conjunction.elim_balanced (length goal_propss) th
   481       |> map2 Conjunction.elim_balanced (map length goal_propss)
   481       |> map2 Conjunction.elim_balanced (map length goal_propss)
   482       handle THM _ => lost_structure ();
   482       handle THM _ => lost_structure ();
   483     val _ = Unify.matches_list thy (flat goal_propss) (map Thm.prop_of (flat results)) orelse
   483     val _ =
   484       error ("Proved a different theorem:\n" ^ Display.string_of_thm ctxt th);
   484       Unify.matches_list (Context.Proof ctxt) (flat goal_propss) (map Thm.prop_of (flat results))
       
   485         orelse error ("Proved a different theorem:\n" ^ Display.string_of_thm ctxt th);
   485 
   486 
   486     fun recover_result ([] :: pss) thss = [] :: recover_result pss thss
   487     fun recover_result ([] :: pss) thss = [] :: recover_result pss thss
   487       | recover_result (_ :: pss) (ths :: thss) = ths :: recover_result pss thss
   488       | recover_result (_ :: pss) (ths :: thss) = ths :: recover_result pss thss
   488       | recover_result [] [] = []
   489       | recover_result [] [] = []
   489       | recover_result _ _ = lost_structure ();
   490       | recover_result _ _ = lost_structure ();