src/Pure/Isar/generic_target.ML
changeset 45352 0b4038361a3a
parent 45310 adaf2184b79d
child 45353 68f3e073ee21
equal deleted inserted replaced
45351:8b1604119bc0 45352:0b4038361a3a
   104     val cert = Thm.cterm_of thy;
   104     val cert = Thm.cterm_of thy;
   105 
   105 
   106     (*export assumes/defines*)
   106     (*export assumes/defines*)
   107     val th = Goal.norm_result raw_th;
   107     val th = Goal.norm_result raw_th;
   108     val (defs, th') = Local_Defs.export ctxt thy_ctxt th;
   108     val (defs, th') = Local_Defs.export ctxt thy_ctxt th;
   109     val assms = map (Raw_Simplifier.rewrite_rule defs o Thm.assume)
   109     val assms =
   110       (Assumption.all_assms_of ctxt);
   110       map (Raw_Simplifier.rewrite_rule defs o Thm.assume)
       
   111         (Assumption.all_assms_of ctxt);
   111     val nprems = Thm.nprems_of th' - Thm.nprems_of th;
   112     val nprems = Thm.nprems_of th' - Thm.nprems_of th;
   112 
   113 
   113     (*export fixes*)
   114     (*export fixes*)
   114     val tfrees = map TFree (Thm.fold_terms Term.add_tfrees th' []);
   115     val tfrees = map TFree (Thm.fold_terms Term.add_tfrees th' []);
   115     val frees = map Free (Thm.fold_terms Term.add_frees th' []);
   116     val frees = map Free (Thm.fold_terms Term.add_frees th' []);
   116     val (th'' :: vs) = (th' :: map (Drule.mk_term o cert) (map Logic.mk_type tfrees @ frees))
   117     val (th'' :: vs) =
       
   118       (th' :: map (Drule.mk_term o cert) (map Logic.mk_type tfrees @ frees))
   117       |> Variable.export ctxt thy_ctxt
   119       |> Variable.export ctxt thy_ctxt
   118       |> Drule.zero_var_indexes_list;
   120       |> Drule.zero_var_indexes_list;
   119 
   121 
   120     (*thm definition*)
   122     (*thm definition*)
   121     val result = Global_Theory.name_thm true true name (Thm.compress th'');
   123     val result = Global_Theory.name_thm true true name (Thm.compress th'');
   181     |> Proof_Context.add_abbrev Print_Mode.internal (b, t) |> snd
   183     |> Proof_Context.add_abbrev Print_Mode.internal (b, t) |> snd
   182     |> Local_Defs.fixed_abbrev ((b, NoSyn), t)
   184     |> Local_Defs.fixed_abbrev ((b, NoSyn), t)
   183   end;
   185   end;
   184 
   186 
   185 
   187 
       
   188 
   186 (** primitive theory operations **)
   189 (** primitive theory operations **)
   187 
   190 
   188 fun theory_declaration decl lthy =
   191 fun theory_declaration decl lthy =
   189   let
   192   let
   190     val global_decl = Morphism.form
   193     val global_decl = Morphism.form