src/Pure/Isar/expression.ML
changeset 57181 2d13bf9ea77b
parent 56809 b60009672a65
child 57860 bcc243ea48e7
equal deleted inserted replaced
57180:74c81a5b5a34 57181:2d13bf9ea77b
    29       * Element.context_i list * Proof.context) * ((string * typ) list * Proof.context)
    29       * Element.context_i list * Proof.context) * ((string * typ) list * Proof.context)
    30       (*FIXME*)
    30       (*FIXME*)
    31   val read_declaration: expression -> (Proof.context -> Proof.context) -> Element.context list ->
    31   val read_declaration: expression -> (Proof.context -> Proof.context) -> Element.context list ->
    32     Proof.context -> (((string * typ) * mixfix) list * (string * morphism) list
    32     Proof.context -> (((string * typ) * mixfix) list * (string * morphism) list
    33       * Element.context_i list * Proof.context) * ((string * typ) list * Proof.context)
    33       * Element.context_i list * Proof.context) * ((string * typ) list * Proof.context)
    34   val add_locale: (local_theory -> local_theory) -> binding -> binding ->
    34   val add_locale: binding -> binding ->
    35     expression_i -> Element.context_i list -> theory -> string * local_theory
    35     expression_i -> Element.context_i list -> theory -> string * local_theory
    36   val add_locale_cmd: (local_theory -> local_theory) -> binding -> binding ->
    36   val add_locale_cmd: binding -> binding ->
    37     expression -> Element.context list -> theory -> string * local_theory
    37     expression -> Element.context list -> theory -> string * local_theory
    38 
    38 
    39   (* Interpretation *)
    39   (* Interpretation *)
    40   val cert_goal_expression: expression_i -> Proof.context ->
    40   val cert_goal_expression: expression_i -> Proof.context ->
    41     (term list list * (string * morphism) list * morphism) * Proof.context
    41     (term list list * (string * morphism) list * morphism) * Proof.context
    51   val interpretation: expression_i -> (Attrib.binding * term) list -> local_theory -> Proof.state
    51   val interpretation: expression_i -> (Attrib.binding * term) list -> local_theory -> Proof.state
    52   val interpretation_cmd: expression -> (Attrib.binding * string) list ->
    52   val interpretation_cmd: expression -> (Attrib.binding * string) list ->
    53     local_theory -> Proof.state
    53     local_theory -> Proof.state
    54   val sublocale: expression_i -> (Attrib.binding * term) list -> local_theory -> Proof.state
    54   val sublocale: expression_i -> (Attrib.binding * term) list -> local_theory -> Proof.state
    55   val sublocale_cmd: expression -> (Attrib.binding * string) list -> local_theory -> Proof.state
    55   val sublocale_cmd: expression -> (Attrib.binding * string) list -> local_theory -> Proof.state
    56   val sublocale_global: (local_theory -> local_theory) -> string -> expression_i ->
    56   val sublocale_global: string -> expression_i ->
    57     (Attrib.binding * term) list -> theory -> Proof.state
    57     (Attrib.binding * term) list -> theory -> Proof.state
    58   val sublocale_global_cmd: (local_theory -> local_theory) -> xstring * Position.T -> expression ->
    58   val sublocale_global_cmd: xstring * Position.T -> expression ->
    59     (Attrib.binding * string) list -> theory -> Proof.state
    59     (Attrib.binding * string) list -> theory -> Proof.state
    60 
    60 
    61   (* Diagnostic *)
    61   (* Diagnostic *)
    62   val print_dependencies: Proof.context -> bool -> expression -> unit
    62   val print_dependencies: Proof.context -> bool -> expression -> unit
    63 end;
    63 end;
   760         (a, [([Assumption.assume ctxt (cterm_of (Proof_Context.theory_of ctxt) def)],
   760         (a, [([Assumption.assume ctxt (cterm_of (Proof_Context.theory_of ctxt) def)],
   761           [(Attrib.internal o K) Locale.witness_add])])) defs)
   761           [(Attrib.internal o K) Locale.witness_add])])) defs)
   762   | defines_to_notes _ e = e;
   762   | defines_to_notes _ e = e;
   763 
   763 
   764 fun gen_add_locale prep_decl
   764 fun gen_add_locale prep_decl
   765     before_exit binding raw_predicate_binding raw_import raw_body thy =
   765     binding raw_predicate_binding raw_import raw_body thy =
   766   let
   766   let
   767     val name = Sign.full_name thy binding;
   767     val name = Sign.full_name thy binding;
   768     val _ = Locale.defined thy name andalso
   768     val _ = Locale.defined thy name andalso
   769       error ("Duplicate definition of locale " ^ quote name);
   769       error ("Duplicate definition of locale " ^ quote name);
   770 
   770 
   818     val axioms = map (Element.conclude_witness pred_ctxt) b_axioms;
   818     val axioms = map (Element.conclude_witness pred_ctxt) b_axioms;
   819 
   819 
   820     val loc_ctxt = thy'
   820     val loc_ctxt = thy'
   821       |> Locale.register_locale binding (extraTs, params)
   821       |> Locale.register_locale binding (extraTs, params)
   822           (asm, rev defs) (a_intro, b_intro) axioms [] (rev notes) (rev deps')
   822           (asm, rev defs) (a_intro, b_intro) axioms [] (rev notes) (rev deps')
   823       |> Named_Target.init before_exit name
   823       |> Named_Target.init name
   824       |> fold (fn (kind, facts) => Local_Theory.notes_kind kind facts #> snd) notes';
   824       |> fold (fn (kind, facts) => Local_Theory.notes_kind kind facts #> snd) notes';
   825 
   825 
   826   in (name, loc_ctxt) end;
   826   in (name, loc_ctxt) end;
   827 
   827 
   828 in
   828 in
   936 
   936 
   937 
   937 
   938 (* special case: global sublocale command *)
   938 (* special case: global sublocale command *)
   939 
   939 
   940 fun gen_sublocale_global prep_loc prep_interpretation
   940 fun gen_sublocale_global prep_loc prep_interpretation
   941     before_exit raw_locale expression raw_eqns thy =
   941     raw_locale expression raw_eqns thy =
   942   let
   942   let
   943     val lthy = Named_Target.init before_exit (prep_loc thy raw_locale) thy;
   943     val lthy = Named_Target.init (prep_loc thy raw_locale) thy;
   944     fun setup_proof after_qed =
   944     fun setup_proof after_qed =
   945       Element.witness_proof_eqs
   945       Element.witness_proof_eqs
   946         (fn wits => fn eqs => after_qed wits eqs #> Local_Theory.exit);
   946         (fn wits => fn eqs => after_qed wits eqs #> Local_Theory.exit);
   947   in
   947   in
   948     lthy |>
   948     lthy |>