src/Pure/Isar/locale.ML
changeset 28710 e2064974c114
parent 28691 0dafa8aa5983
child 28726 47ff45771f2c
equal deleted inserted replaced
28709:6a5d214aaa82 28710:e2064974c114
    39   datatype expr =
    39   datatype expr =
    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
       
    45   val map_elem: ('a -> 'b) -> 'a element -> 'b element
       
    46 
    44 
    47   val intern: theory -> xstring -> string
    45   val intern: theory -> xstring -> string
    48   val intern_expr: theory -> expr -> expr
    46   val intern_expr: theory -> expr -> expr
    49   val extern: theory -> string -> xstring
    47   val extern: theory -> string -> xstring
    50   val init: string -> theory -> Proof.context
    48   val init: string -> theory -> Proof.context
    63 
    61 
    64   (* Not part of the official interface.  DO NOT USE *)
    62   (* Not part of the official interface.  DO NOT USE *)
    65   val declarations_of: theory -> string -> declaration list * declaration list;
    63   val declarations_of: theory -> string -> declaration list * declaration list;
    66 
    64 
    67   (* Processing of locale statements *)
    65   (* Processing of locale statements *)
    68   val read_context_statement: xstring option -> Element.context element list ->
    66   val read_context_statement: xstring option -> Element.context list ->
    69     (string * string list) list list -> Proof.context ->
    67     (string * string list) list list -> Proof.context ->
    70     string option * Proof.context * Proof.context * (term * term list) list list
    68     string option * Proof.context * Proof.context * (term * term list) list list
    71   val read_context_statement_i: string option -> Element.context element list ->
    69   val read_context_statement_i: string option -> Element.context list ->
    72     (string * string list) list list -> Proof.context ->
    70     (string * string list) list list -> Proof.context ->
    73     string option * Proof.context * Proof.context * (term * term list) list list
    71     string option * Proof.context * Proof.context * (term * term list) list list
    74   val cert_context_statement: string option -> Element.context_i element list ->
    72   val cert_context_statement: string option -> Element.context_i list ->
    75     (term * term list) list list -> Proof.context ->
    73     (term * term list) list list -> Proof.context ->
    76     string option * Proof.context * Proof.context * (term * term list) list list
    74     string option * Proof.context * Proof.context * (term * term list) list list
    77   val read_expr: expr -> Element.context list -> Proof.context ->
    75   val read_expr: expr -> Element.context list -> Proof.context ->
    78     Element.context_i list * Proof.context
    76     Element.context_i list * Proof.context
    79   val cert_expr: expr -> Element.context_i list -> Proof.context ->
    77   val cert_expr: expr -> Element.context_i list -> Proof.context ->
  1539         NONE => ([], empty)
  1537         NONE => ([], empty)
  1540       | SOME name =>
  1538       | SOME name =>
  1541           let val {params = ps, ...} = the_locale thy name
  1539           let val {params = ps, ...} = the_locale thy name
  1542           in (map fst ps, Locale name) end);
  1540           in (map fst ps, Locale name) end);
  1543     val ((((locale_ctxt, _), (elems_ctxt, _, _)), _), concl') =
  1541     val ((((locale_ctxt, _), (elems_ctxt, _, _)), _), concl') =
  1544       prep_ctxt false fixed_params imports elems concl ctxt;
  1542       prep_ctxt false fixed_params imports (map Elem elems) concl ctxt;
  1545   in (locale, locale_ctxt, elems_ctxt, concl') end;
  1543   in (locale, locale_ctxt, elems_ctxt, concl') end;
  1546 
  1544 
  1547 fun prep_expr prep imports body ctxt =
  1545 fun prep_expr prep imports body ctxt =
  1548   let
  1546   let
  1549     val (((_, import_elemss), (ctxt', elemss, _)), _) = prep imports body ctxt;
  1547     val (((_, import_elemss), (ctxt', elemss, _)), _) = prep imports body ctxt;