more robust: avoid crash of Thm.solve_constraints due to changed background theory, e.g. relevant for AFP/Transition_Systems_and_Automata;
authorwenzelm
Tue, 26 Dec 2023 12:46:10 +0100
changeset 79359 5b01b93de062
parent 79358 b191339a014c
child 79360 da22c8ab0112
more robust: avoid crash of Thm.solve_constraints due to changed background theory, e.g. relevant for AFP/Transition_Systems_and_Automata;
src/Pure/Isar/generic_target.ML
--- a/src/Pure/Isar/generic_target.ML	Tue Dec 26 12:37:33 2023 +0100
+++ b/src/Pure/Isar/generic_target.ML	Tue Dec 26 12:46:10 2023 +0100
@@ -306,12 +306,11 @@
     Local_Theory.background_theory_result (Thm.store_zproof (name, pos) thm) lthy
   else (thm, lthy);
 
-fun thm_definition (name_pos, thm0) lthy =
+fun thm_definition (name_pos, thm) lthy =
   let
     val thy_ctxt = Proof_Context.init_global (Proof_Context.theory_of lthy);
 
     (*export assumes/defines*)
-    val thm = Goal.norm_result lthy thm0;
     val ((defs, asms), thm') = Local_Defs.export lthy thy_ctxt thm;
     val asms' = map (rewrite_rule lthy (Drule.norm_hhf_eqs @ defs)) asms;
 
@@ -361,8 +360,9 @@
 
 in
 
-fun notes target_notes kind facts lthy =
+fun notes target_notes kind facts0 lthy =
   let
+    val facts = Attrib.map_thms (Goal.norm_result lthy) facts0;
     val (facts', lthy') =
       (facts, lthy) |-> fold_map (fn (a, thms) => fn lthy1 =>
         let