src/Pure/more_thm.ML
changeset 61261 ddb2da7cb2e4
parent 61059 0306e209fa9e
child 61262 7bd1eb4b056e
equal deleted inserted replaced
61260:e6f03fae14d5 61261:ddb2da7cb2e4
    70   val close_derivation: thm -> thm
    70   val close_derivation: thm -> thm
    71   val rename_params_rule: string list * int -> thm -> thm
    71   val rename_params_rule: string list * int -> thm -> thm
    72   val rename_boundvars: term -> term -> thm -> thm
    72   val rename_boundvars: term -> term -> thm -> thm
    73   val add_axiom: Proof.context -> binding * term -> theory -> (string * thm) * theory
    73   val add_axiom: Proof.context -> binding * term -> theory -> (string * thm) * theory
    74   val add_axiom_global: binding * term -> theory -> (string * thm) * theory
    74   val add_axiom_global: binding * term -> theory -> (string * thm) * theory
    75   val add_def: Proof.context -> bool -> bool -> binding * term -> theory -> (string * thm) * theory
    75   val add_def: Defs.context -> bool -> bool -> binding * term -> theory -> (string * thm) * theory
    76   val add_def_global: bool -> bool -> binding * term -> theory -> (string * thm) * theory
    76   val add_def_global: bool -> bool -> binding * term -> theory -> (string * thm) * theory
    77   type attribute = Context.generic * thm -> Context.generic option * thm option
    77   type attribute = Context.generic * thm -> Context.generic option * thm option
    78   type binding = binding * attribute list
    78   type binding = binding * attribute list
    79   val empty_binding: binding
    79   val empty_binding: binding
    80   val rule_attribute: (Context.generic -> thm -> thm) -> attribute
    80   val rule_attribute: (Context.generic -> thm -> thm) -> attribute
   473       |> fold elim_implies of_sorts;
   473       |> fold elim_implies of_sorts;
   474   in ((axm_name, thm), thy') end;
   474   in ((axm_name, thm), thy') end;
   475 
   475 
   476 fun add_axiom_global arg thy = add_axiom (Syntax.init_pretty_global thy) arg thy;
   476 fun add_axiom_global arg thy = add_axiom (Syntax.init_pretty_global thy) arg thy;
   477 
   477 
   478 fun add_def ctxt unchecked overloaded (b, prop) thy =
   478 fun add_def (context as (ctxt, _)) unchecked overloaded (b, prop) thy =
   479   let
   479   let
   480     val _ = Sign.no_vars ctxt prop;
   480     val _ = Sign.no_vars ctxt prop;
   481     val prems = map (Thm.cterm_of ctxt) (Logic.strip_imp_prems prop);
   481     val prems = map (Thm.cterm_of ctxt) (Logic.strip_imp_prems prop);
   482     val (_, recover, concl') = stripped_sorts thy (Logic.strip_imp_concl prop);
   482     val (_, recover, concl') = stripped_sorts thy (Logic.strip_imp_concl prop);
   483 
   483 
   484     val thy' = Theory.add_def ctxt unchecked overloaded (b, concl') thy;
   484     val thy' = Theory.add_def context unchecked overloaded (b, concl') thy;
   485     val axm_name = Sign.full_name thy' b;
   485     val axm_name = Sign.full_name thy' b;
   486     val axm' = Thm.axiom thy' axm_name;
   486     val axm' = Thm.axiom thy' axm_name;
   487     val thm =
   487     val thm =
   488       Thm.instantiate (recover, []) axm'
   488       Thm.instantiate (recover, []) axm'
   489       |> unvarify_global thy'
   489       |> unvarify_global thy'
   490       |> fold_rev Thm.implies_intr prems;
   490       |> fold_rev Thm.implies_intr prems;
   491   in ((axm_name, thm), thy') end;
   491   in ((axm_name, thm), thy') end;
   492 
   492 
   493 fun add_def_global unchecked overloaded arg thy =
   493 fun add_def_global unchecked overloaded arg thy =
   494   add_def (Syntax.init_pretty_global thy) unchecked overloaded arg thy;
   494   add_def (Syntax.init_pretty_global thy, NONE) unchecked overloaded arg thy;
   495 
   495 
   496 
   496 
   497 
   497 
   498 (** attributes **)
   498 (** attributes **)
   499 
   499