src/Pure/axclass.ML
changeset 56941 952833323c99
parent 56144 27167f903c6d
child 59058 a78612c67ec0
equal deleted inserted replaced
56940:35ce6dab3f5e 56941:952833323c99
    28   val add_arity: thm -> theory -> theory
    28   val add_arity: thm -> theory -> theory
    29   val prove_classrel: class * class -> (Proof.context -> tactic) -> theory -> theory
    29   val prove_classrel: class * class -> (Proof.context -> tactic) -> theory -> theory
    30   val prove_arity: string * sort list * sort -> (Proof.context -> tactic) -> theory -> theory
    30   val prove_arity: string * sort list * sort -> (Proof.context -> tactic) -> theory -> theory
    31   val define_class: binding * class list -> string list ->
    31   val define_class: binding * class list -> string list ->
    32     (Thm.binding * term list) list -> theory -> class * theory
    32     (Thm.binding * term list) list -> theory -> class * theory
    33   val axiomatize_classrel: (class * class) list -> theory -> theory
    33   val classrel_axiomatization: (class * class) list -> theory -> theory
    34   val axiomatize_arity: arity -> theory -> theory
    34   val arity_axiomatization: arity -> theory -> theory
    35   val axiomatize_class: binding * class list -> theory -> theory
    35   val class_axiomatization: binding * class list -> theory -> theory
    36 end;
    36 end;
    37 
    37 
    38 structure Axclass: AXCLASS =
    38 structure Axclass: AXCLASS =
    39 struct
    39 struct
    40 
    40 
   580 (** axiomatizations **)
   580 (** axiomatizations **)
   581 
   581 
   582 local
   582 local
   583 
   583 
   584 (*old-style axioms*)
   584 (*old-style axioms*)
   585 fun axiomatize prep mk name add raw_args thy =
   585 fun add_axioms prep mk name add raw_args thy =
   586   let
   586   let
   587     val args = prep thy raw_args;
   587     val args = prep thy raw_args;
   588     val specs = mk args;
   588     val specs = mk args;
   589     val names = name args;
   589     val names = name args;
   590   in
   590   in
   596 fun class_const c =
   596 fun class_const c =
   597   (Logic.const_of_class c, Term.itselfT (Term.aT []) --> propT);
   597   (Logic.const_of_class c, Term.itselfT (Term.aT []) --> propT);
   598 
   598 
   599 in
   599 in
   600 
   600 
   601 val axiomatize_classrel =
   601 val classrel_axiomatization =
   602   axiomatize (map o cert_classrel) (map Logic.mk_classrel)
   602   add_axioms (map o cert_classrel) (map Logic.mk_classrel)
   603     (map (prefix classrel_prefix o Logic.name_classrel)) add_classrel;
   603     (map (prefix classrel_prefix o Logic.name_classrel)) add_classrel;
   604 
   604 
   605 val axiomatize_arity =
   605 val arity_axiomatization =
   606   axiomatize (Proof_Context.cert_arity o Proof_Context.init_global) Logic.mk_arities
   606   add_axioms (Proof_Context.cert_arity o Proof_Context.init_global) Logic.mk_arities
   607     (map (prefix arity_prefix) o Logic.name_arities) add_arity;
   607     (map (prefix arity_prefix) o Logic.name_arities) add_arity;
   608 
   608 
   609 fun axiomatize_class (bclass, raw_super) thy =
   609 fun class_axiomatization (bclass, raw_super) thy =
   610   let
   610   let
   611     val class = Sign.full_name thy bclass;
   611     val class = Sign.full_name thy bclass;
   612     val super = map (Sign.certify_class thy) raw_super |> Sign.minimize_sort thy;
   612     val super = map (Sign.certify_class thy) raw_super |> Sign.minimize_sort thy;
   613   in
   613   in
   614     thy
   614     thy
   615     |> Sign.primitive_class (bclass, super)
   615     |> Sign.primitive_class (bclass, super)
   616     |> axiomatize_classrel (map (fn c => (class, c)) super)
   616     |> classrel_axiomatization (map (fn c => (class, c)) super)
   617     |> Theory.add_deps_global "" (class_const class) (map class_const super)
   617     |> Theory.add_deps_global "" (class_const class) (map class_const super)
   618   end;
   618   end;
   619 
   619 
   620 end;
   620 end;
   621 
   621