src/Pure/Isar/class.ML
changeset 60344 a40369ea3ba5
parent 60341 fcbd7f0c52c3
child 60345 592806806494
equal deleted inserted replaced
60343:063698416239 60344:a40369ea3ba5
    16     -> (string * (class * (typ * term))) list
    16     -> (string * (class * (typ * term))) list
    17   val print_classes: Proof.context -> unit
    17   val print_classes: Proof.context -> unit
    18   val init: class -> theory -> Proof.context
    18   val init: class -> theory -> Proof.context
    19   val begin: class list -> sort -> Proof.context -> Proof.context
    19   val begin: class list -> sort -> Proof.context -> Proof.context
    20   val const: class -> (binding * mixfix) * term -> term list * term list -> local_theory -> local_theory
    20   val const: class -> (binding * mixfix) * term -> term list * term list -> local_theory -> local_theory
    21   val abbrev: class -> Syntax.mode -> (binding * mixfix) * term -> term -> term list * term list -> local_theory -> local_theory
    21   val abbrev: class -> Syntax.mode -> (binding * mixfix) * term -> local_theory -> (term * term) * local_theory
    22   val redeclare_operations: theory -> sort -> Proof.context -> Proof.context
    22   val redeclare_operations: theory -> sort -> Proof.context -> Proof.context
    23   val class_prefix: string -> string
    23   val class_prefix: string -> string
    24   val register: class -> class list -> ((string * typ) * (string * typ)) list
    24   val register: class -> class list -> ((string * typ) * (string * typ)) list
    25     -> sort -> morphism -> morphism -> thm option -> thm option -> thm
    25     -> sort -> morphism -> morphism -> thm option -> thm option -> thm
    26     -> theory -> theory
    26     -> theory -> theory
   411     |> Generic_Target.standard_const (fn (this, other) => other <> 0 andalso this <> other)
   411     |> Generic_Target.standard_const (fn (this, other) => other <> 0 andalso this <> other)
   412          Syntax.mode_default ((b, if null dangling_params then NoSyn else mx), lhs)
   412          Syntax.mode_default ((b, if null dangling_params then NoSyn else mx), lhs)
   413     |> synchronize_class_syntax_target class
   413     |> synchronize_class_syntax_target class
   414   end;
   414   end;
   415 
   415 
   416 fun abbrev class prmode ((b, mx), lhs) rhs' params lthy =
   416 fun target_abbrev class prmode ((b, mx), lhs) rhs' params lthy =
   417   let
   417   let
   418     val phi = morphism (Proof_Context.theory_of lthy) class;
   418     val phi = morphism (Proof_Context.theory_of lthy) class;
   419     val dangling_term_params = map (Morphism.term phi) (snd (dangling_params_for lthy class params));
   419     val dangling_term_params = map (Morphism.term phi) (snd (dangling_params_for lthy class params));
   420   in
   420   in
   421     lthy
   421     lthy
   424          ((Morphism.binding phi b, if null dangling_term_params then mx else NoSyn), rhs'))
   424          ((Morphism.binding phi b, if null dangling_term_params then mx else NoSyn), rhs'))
   425     |> Generic_Target.standard_const (fn (this, other) => other <> 0 andalso this <> other)
   425     |> Generic_Target.standard_const (fn (this, other) => other <> 0 andalso this <> other)
   426          prmode ((b, if null dangling_term_params then NoSyn else mx), lhs)
   426          prmode ((b, if null dangling_term_params then NoSyn else mx), lhs)
   427     |> synchronize_class_syntax_target class
   427     |> synchronize_class_syntax_target class
   428   end;
   428   end;
       
   429 
       
   430 fun abbrev class = Generic_Target.abbrev (fn prmode => fn (b, mx) => fn global_rhs => fn params =>
       
   431   Generic_Target.background_abbrev (b, global_rhs) (snd params)
       
   432   #-> (fn (lhs, rhs) => target_abbrev class prmode ((b, mx), lhs) rhs params));
   429 
   433 
   430 end;
   434 end;
   431 
   435 
   432 
   436 
   433 (* subclasses *)
   437 (* subclasses *)