src/Pure/sign.ML
changeset 19407 7c7a2e337504
parent 19391 4812d28c90a6
child 19427 f086002893ad
equal deleted inserted replaced
19406:410b9d9bf9a1 19407:7c7a2e337504
    98   val syn_of: theory -> Syntax.syntax
    98   val syn_of: theory -> Syntax.syntax
    99   val tsig_of: theory -> Type.tsig
    99   val tsig_of: theory -> Type.tsig
   100   val classes_of: theory -> Sorts.classes
   100   val classes_of: theory -> Sorts.classes
   101   val arities_of: theory -> Sorts.arities
   101   val arities_of: theory -> Sorts.arities
   102   val classes: theory -> class list
   102   val classes: theory -> class list
       
   103   val super_classes: theory -> class -> class list
   103   val defaultS: theory -> sort
   104   val defaultS: theory -> sort
   104   val subsort: theory -> sort * sort -> bool
   105   val subsort: theory -> sort * sort -> bool
   105   val of_sort: theory -> typ * sort -> bool
   106   val of_sort: theory -> typ * sort -> bool
   106   val witness_sorts: theory -> sort list -> sort list -> (typ * sort) list
   107   val witness_sorts: theory -> sort list -> sort list -> (typ * sort) list
   107   val universal_witness: theory -> (typ * sort) option
   108   val universal_witness: theory -> (typ * sort) option
   163   val no_vars: Pretty.pp -> term -> term
   164   val no_vars: Pretty.pp -> term -> term
   164   val cert_def: Pretty.pp -> term -> (string * typ) * term
   165   val cert_def: Pretty.pp -> term -> (string * typ) * term
   165   val read_class: theory -> xstring -> class
   166   val read_class: theory -> xstring -> class
   166   val read_sort': Syntax.syntax -> Context.generic -> string -> sort
   167   val read_sort': Syntax.syntax -> Context.generic -> string -> sort
   167   val read_sort: theory -> string -> sort
   168   val read_sort: theory -> string -> sort
   168   val read_classrel: theory -> xstring * xstring -> class * class
       
   169   val cert_classrel: theory -> class * class -> class * class
       
   170   val read_arity: theory -> xstring * string list * string -> arity
   169   val read_arity: theory -> xstring * string list * string -> arity
   171   val cert_arity: theory -> arity -> arity
   170   val cert_arity: theory -> arity -> arity
   172   val read_typ': Syntax.syntax -> Context.generic ->
   171   val read_typ': Syntax.syntax -> Context.generic ->
   173     (indexname -> sort option) -> string -> typ
   172     (indexname -> sort option) -> string -> typ
   174   val read_typ_syntax': Syntax.syntax -> Context.generic ->
   173   val read_typ_syntax': Syntax.syntax -> Context.generic ->
   269 
   268 
   270 val tsig_of = #tsig o rep_sg;
   269 val tsig_of = #tsig o rep_sg;
   271 val classes_of = snd o #classes o Type.rep_tsig o tsig_of;
   270 val classes_of = snd o #classes o Type.rep_tsig o tsig_of;
   272 val arities_of = #arities o Type.rep_tsig o tsig_of;
   271 val arities_of = #arities o Type.rep_tsig o tsig_of;
   273 val classes = Type.classes o tsig_of;
   272 val classes = Type.classes o tsig_of;
       
   273 val super_classes = Graph.imm_succs o classes_of;
   274 val defaultS = Type.defaultS o tsig_of;
   274 val defaultS = Type.defaultS o tsig_of;
   275 val subsort = Type.subsort o tsig_of;
   275 val subsort = Type.subsort o tsig_of;
   276 val of_sort = Type.of_sort o tsig_of;
   276 val of_sort = Type.of_sort o tsig_of;
   277 val witness_sorts = Type.witness_sorts o tsig_of;
   277 val witness_sorts = Type.witness_sorts o tsig_of;
   278 val universal_witness = Type.universal_witness o tsig_of;
   278 val universal_witness = Type.universal_witness o tsig_of;
   511     val _ = Context.check_thy thy;
   511     val _ = Context.check_thy thy;
   512     val S = intern_sort thy (Syntax.read_sort context syn str);
   512     val S = intern_sort thy (Syntax.read_sort context syn str);
   513   in certify_sort thy S handle TYPE (msg, _, _) => error msg end;
   513   in certify_sort thy S handle TYPE (msg, _, _) => error msg end;
   514 
   514 
   515 fun read_sort thy str = read_sort' (syn_of thy) (Context.Theory thy) str;
   515 fun read_sort thy str = read_sort' (syn_of thy) (Context.Theory thy) str;
   516 
       
   517 
       
   518 (* class relations *)
       
   519 
       
   520 fun prep_classrel prep thy raw_rel =
       
   521   let val rel = Library.pairself (prep thy) raw_rel
       
   522   in Type.add_classrel (pp thy) [rel] (tsig_of thy); rel end;
       
   523 
       
   524 val read_classrel = prep_classrel read_class;
       
   525 val cert_classrel = prep_classrel certify_class;
       
   526 
   516 
   527 
   517 
   528 (* type arities *)
   518 (* type arities *)
   529 
   519 
   530 fun prep_arity prep_tycon prep_sort thy (t, Ss, S) =
   520 fun prep_arity prep_tycon prep_sort thy (t, Ss, S) =