32 local_theory -> (term * (bstring * thm)) list * local_theory |
32 local_theory -> (term * (bstring * thm)) list * local_theory |
33 val abbreviation: Syntax.mode -> ((string * string option * mixfix) option * string) list -> |
33 val abbreviation: Syntax.mode -> ((string * string option * mixfix) option * string) list -> |
34 local_theory -> local_theory |
34 local_theory -> local_theory |
35 val abbreviation_i: Syntax.mode -> ((string * typ option * mixfix) option * term) list -> |
35 val abbreviation_i: Syntax.mode -> ((string * typ option * mixfix) option * term) list -> |
36 local_theory -> local_theory |
36 local_theory -> local_theory |
37 val const_syntax: Syntax.mode -> (xstring * mixfix) list -> local_theory -> local_theory |
37 val notation: Syntax.mode -> (string * mixfix) list -> local_theory -> local_theory |
38 val const_syntax_i: Syntax.mode -> (string * mixfix) list -> local_theory -> local_theory |
38 val notation_i: Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory |
39 val theorems: string -> ((bstring * Attrib.src list) * (thmref * Attrib.src list) list) list |
39 val theorems: string -> ((bstring * Attrib.src list) * (thmref * Attrib.src list) list) list |
40 -> local_theory -> (bstring * thm list) list * local_theory |
40 -> local_theory -> (bstring * thm list) list * local_theory |
41 val theorems_i: string -> ((bstring * Attrib.src list) * (thm list * Attrib.src list) list) list |
41 val theorems_i: string -> ((bstring * Attrib.src list) * (thm list * Attrib.src list) list) list |
42 -> local_theory -> (bstring * thm list) list * local_theory |
42 -> local_theory -> (bstring * thm list) list * local_theory |
43 val theorem: string -> Method.text option -> (thm list list -> local_theory -> local_theory) -> |
43 val theorem: string -> Method.text option -> (thm list list -> local_theory -> local_theory) -> |
172 val abbreviation_i = gen_abbrevs cert_specification; |
172 val abbreviation_i = gen_abbrevs cert_specification; |
173 |
173 |
174 |
174 |
175 (* const syntax *) |
175 (* const syntax *) |
176 |
176 |
177 fun gen_syntax intern_const mode raw_args lthy = |
177 fun gen_notation prep_const mode args lthy = |
178 let val args = raw_args |> map (apfst (intern_const (ProofContext.consts_of lthy))) |
178 lthy |> LocalTheory.notation mode (map (apfst (prep_const lthy)) args); |
179 in lthy |> LocalTheory.const_syntax mode args end; |
179 |
180 |
180 val notation = gen_notation ProofContext.read_const; |
181 val const_syntax = gen_syntax Consts.intern; |
181 val notation_i = gen_notation (K I); |
182 val const_syntax_i = gen_syntax (K I); |
|
183 |
182 |
184 |
183 |
185 (* fact statements *) |
184 (* fact statements *) |
186 |
185 |
187 fun gen_theorems prep_thms prep_att kind raw_facts lthy = |
186 fun gen_theorems prep_thms prep_att kind raw_facts lthy = |
218 fun gen_theorem prep_att prep_stmt |
217 fun gen_theorem prep_att prep_stmt |
219 kind before_qed after_qed (name, raw_atts) raw_elems raw_concl lthy0 = |
218 kind before_qed after_qed (name, raw_atts) raw_elems raw_concl lthy0 = |
220 let |
219 let |
221 val _ = LocalTheory.assert lthy0; |
220 val _ = LocalTheory.assert lthy0; |
222 val thy = ProofContext.theory_of lthy0; |
221 val thy = ProofContext.theory_of lthy0; |
223 |
222 |
224 val (loc, ctxt, lthy) = |
223 val (loc, ctxt, lthy) = |
225 (case (TheoryTarget.peek lthy0, exists (fn Locale.Expr _ => true | _ => false) raw_elems) of |
224 (case (TheoryTarget.peek lthy0, exists (fn Locale.Expr _ => true | _ => false) raw_elems) of |
226 (SOME loc, true) => (* workaround non-modularity of in/includes *) (* FIXME *) |
225 (SOME loc, true) => (* workaround non-modularity of in/includes *) (* FIXME *) |
227 (warning "Re-initializing theory target for locale inclusion"; |
226 (warning "Re-initializing theory target for locale inclusion"; |
228 (SOME loc, ProofContext.init thy, LocalTheory.reinit lthy0)) |
227 (SOME loc, ProofContext.init thy, LocalTheory.reinit lthy0)) |