src/Pure/pure_thy.ML
changeset 35856 f81557a124d5
parent 35852 4e3fe0b8687b
child 35985 0bbf0d2348f9
equal deleted inserted replaced
35855:e7d004b89ca8 35856:f81557a124d5
    30   val add_thm: (binding * thm) * attribute list -> theory -> thm * theory
    30   val add_thm: (binding * thm) * attribute list -> theory -> thm * theory
    31   val add_thmss: ((binding * thm list) * attribute list) list -> theory -> thm list list * theory
    31   val add_thmss: ((binding * thm list) * attribute list) list -> theory -> thm list list * theory
    32   val add_thms_dynamic: binding * (Context.generic -> thm list) -> theory -> theory
    32   val add_thms_dynamic: binding * (Context.generic -> thm list) -> theory -> theory
    33   val note_thmss: string -> (Thm.binding * (thm list * attribute list) list) list
    33   val note_thmss: string -> (Thm.binding * (thm list * attribute list) list) list
    34     -> theory -> (string * thm list) list * theory
    34     -> theory -> (string * thm list) list * theory
    35   val add_axioms: ((binding * term) * attribute list) list -> theory -> thm list * theory
       
    36   val add_defs: bool -> ((binding * term) * attribute list) list ->
    35   val add_defs: bool -> ((binding * term) * attribute list) list ->
    37     theory -> thm list * theory
    36     theory -> thm list * theory
    38   val add_defs_unchecked: bool -> ((binding * term) * attribute list) list ->
    37   val add_defs_unchecked: bool -> ((binding * term) * attribute list) list ->
    39     theory -> thm list * theory
    38     theory -> thm list * theory
    40   val add_defs_cmd: bool -> ((binding * string) * attribute list) list ->
    39   val add_defs_cmd: bool -> ((binding * string) * attribute list) list ->
   199 
   198 
   200 
   199 
   201 (* store axioms as theorems *)
   200 (* store axioms as theorems *)
   202 
   201 
   203 local
   202 local
   204   fun get_ax thy (b, _) = Thm.axiom thy (Sign.full_name thy b);
   203   fun add_axm add = fold_map (fn ((b, prop), atts) => fn thy =>
   205   fun get_axs thy named_axs = map (Thm.forall_elim_vars 0 o get_ax thy) named_axs;
       
   206   fun add_axm add = fold_map (fn ((b, ax), atts) => fn thy =>
       
   207     let
   204     let
   208       val named_ax = [(b, ax)];
   205       val thy' = add [(b, prop)] thy;
   209       val thy' = add named_ax thy;
   206       val thm = Thm.forall_elim_vars 0 (Thm.axiom thy' (Sign.full_name thy' b));
   210       val thm = hd (get_axs thy' named_ax);
       
   211     in apfst hd (gen_add_thms (K I) [((b, thm), atts)] thy') end);
   207     in apfst hd (gen_add_thms (K I) [((b, thm), atts)] thy') end);
   212 in
   208 in
   213   val add_defs               = add_axm o Theory.add_defs_i false;
   209   val add_defs               = add_axm o Theory.add_defs_i false;
   214   val add_defs_unchecked     = add_axm o Theory.add_defs_i true;
   210   val add_defs_unchecked     = add_axm o Theory.add_defs_i true;
   215   val add_axioms             = add_axm Theory.add_axioms_i;
       
   216   val add_defs_cmd           = add_axm o Theory.add_defs false;
   211   val add_defs_cmd           = add_axm o Theory.add_defs false;
   217   val add_defs_unchecked_cmd = add_axm o Theory.add_defs true;
   212   val add_defs_unchecked_cmd = add_axm o Theory.add_defs true;
   218 end;
   213 end;
   219 
   214 
   220 
   215 
   365     (Binding.name "conjunction_def", prop "(A &&& B) == (!!C::prop. (A ==> B ==> C) ==> C)")] #> snd
   360     (Binding.name "conjunction_def", prop "(A &&& B) == (!!C::prop. (A ==> B ==> C) ==> C)")] #> snd
   366   #> Sign.hide_const false "Pure.term"
   361   #> Sign.hide_const false "Pure.term"
   367   #> Sign.hide_const false "Pure.sort_constraint"
   362   #> Sign.hide_const false "Pure.sort_constraint"
   368   #> Sign.hide_const false "Pure.conjunction"
   363   #> Sign.hide_const false "Pure.conjunction"
   369   #> add_thmss [((Binding.name "nothing", []), [])] #> snd
   364   #> add_thmss [((Binding.name "nothing", []), [])] #> snd
   370   #> Theory.add_axioms_i (map (apfst Binding.name) Proofterm.equality_axms)));
   365   #> fold (fn (a, prop) => snd o Thm.add_axiom (Binding.name a, prop)) Proofterm.equality_axms));
   371 
   366 
   372 end;
   367 end;