src/Pure/Isar/locale.ML
changeset 21035 326c15917a33
parent 21005 8f3896f0e5af
child 21225 bf0b1e62cf60
equal deleted inserted replaced
21034:99697a1597b2 21035:326c15917a33
    40     Locale of string |
    40     Locale of string |
    41     Rename of expr * (string * mixfix option) option list |
    41     Rename of expr * (string * mixfix option) option list |
    42     Merge of expr list
    42     Merge of expr list
    43   val empty: expr
    43   val empty: expr
    44   datatype 'a element = Elem of 'a | Expr of expr
    44   datatype 'a element = Elem of 'a | Expr of expr
       
    45   val map_elem: ('a -> 'b) -> 'a element -> 'b element
    45 
    46 
    46   val intern: theory -> xstring -> string
    47   val intern: theory -> xstring -> string
    47   val extern: theory -> string -> xstring
    48   val extern: theory -> string -> xstring
    48   val init: string -> theory -> Proof.context
    49   val init: string -> theory -> Proof.context
    49 
    50 
    58   val global_asms_of: theory -> string ->
    59   val global_asms_of: theory -> string ->
    59     ((string * Attrib.src list) * term list) list
    60     ((string * Attrib.src list) * term list) list
    60 
    61 
    61   (* Processing of locale statements *)
    62   (* Processing of locale statements *)
    62   val read_context_statement: xstring option -> Element.context element list ->
    63   val read_context_statement: xstring option -> Element.context element list ->
       
    64     (string * string list) list list -> Proof.context ->
       
    65     string option * Proof.context * Proof.context * (term * term list) list list
       
    66   val read_context_statement_i: string option -> Element.context element list ->
    63     (string * string list) list list -> Proof.context ->
    67     (string * string list) list list -> Proof.context ->
    64     string option * Proof.context * Proof.context * (term * term list) list list
    68     string option * Proof.context * Proof.context * (term * term list) list list
    65   val cert_context_statement: string option -> Element.context_i element list ->
    69   val cert_context_statement: string option -> Element.context_i element list ->
    66     (term * term list) list list -> Proof.context ->
    70     (term * term list) list list -> Proof.context ->
    67     string option * Proof.context * Proof.context * (term * term list) list list
    71     string option * Proof.context * Proof.context * (term * term list) list list
   447 
   451 
   448     val prt_term = Pretty.quote o ProofContext.pretty_term ctxt;
   452     val prt_term = Pretty.quote o ProofContext.pretty_term ctxt;
   449     fun prt_inst ts =
   453     fun prt_inst ts =
   450         Pretty.enclose "(" ")" (Pretty.breaks (map prt_term ts));
   454         Pretty.enclose "(" ")" (Pretty.breaks (map prt_term ts));
   451     fun prt_attn (prfx, atts) =
   455     fun prt_attn (prfx, atts) =
   452         Pretty.breaks (Pretty.str prfx :: Args.pretty_attribs ctxt atts);
   456         Pretty.breaks (Pretty.str prfx :: Attrib.pretty_attribs ctxt atts);
   453     fun prt_witns witns = Pretty.enclose "[" "]"
   457     fun prt_witns witns = Pretty.enclose "[" "]"
   454       (Pretty.breaks (map (prt_term o Element.witness_prop) witns));
   458       (Pretty.breaks (map (prt_term o Element.witness_prop) witns));
   455     fun prt_reg (ts, (("", []), witns)) =
   459     fun prt_reg (ts, (("", []), witns)) =
   456         if show_wits
   460         if show_wits
   457           then Pretty.block [prt_inst ts, Pretty.fbrk, prt_witns witns]
   461           then Pretty.block [prt_inst ts, Pretty.fbrk, prt_witns witns]
  1438 fun cert_context import body ctxt = #1 (cert_ctxt true [] import (map Elem body) [] ctxt);
  1442 fun cert_context import body ctxt = #1 (cert_ctxt true [] import (map Elem body) [] ctxt);
  1439 
  1443 
  1440 val read_expr = prep_expr read_context;
  1444 val read_expr = prep_expr read_context;
  1441 val cert_expr = prep_expr cert_context;
  1445 val cert_expr = prep_expr cert_context;
  1442 
  1446 
  1443 fun read_context_statement raw_locale = prep_statement intern read_ctxt raw_locale ;
  1447 fun read_context_statement loc = prep_statement intern read_ctxt loc;
  1444 fun cert_context_statement raw_locale = prep_statement (K I) cert_ctxt raw_locale ;
  1448 fun read_context_statement_i loc = prep_statement (K I) read_ctxt loc;
       
  1449 fun cert_context_statement loc = prep_statement (K I) cert_ctxt loc;
  1445 
  1450 
  1446 end;
  1451 end;
  1447 
  1452 
  1448 
  1453 
  1449 (* print locale *)
  1454 (* print locale *)