25 val target_result: (Proof.context -> 'a * Proof.context) -> local_theory -> 'a * local_theory |
25 val target_result: (Proof.context -> 'a * Proof.context) -> local_theory -> 'a * local_theory |
26 val target: (Proof.context -> Proof.context) -> local_theory -> local_theory |
26 val target: (Proof.context -> Proof.context) -> local_theory -> local_theory |
27 val map_contexts: (Context.generic -> Context.generic) -> local_theory -> local_theory |
27 val map_contexts: (Context.generic -> Context.generic) -> local_theory -> local_theory |
28 val standard_morphism: local_theory -> Proof.context -> morphism |
28 val standard_morphism: local_theory -> Proof.context -> morphism |
29 val target_morphism: local_theory -> morphism |
29 val target_morphism: local_theory -> morphism |
|
30 val global_morphism: local_theory -> morphism |
30 val pretty: local_theory -> Pretty.T list |
31 val pretty: local_theory -> Pretty.T list |
31 val abbrev: Syntax.mode -> (binding * mixfix) * term -> local_theory -> |
32 val abbrev: Syntax.mode -> (binding * mixfix) * term -> local_theory -> |
32 (term * term) * local_theory |
33 (term * term) * local_theory |
33 val define: string -> (binding * mixfix) * (Attrib.binding * term) -> local_theory -> |
34 val define: string -> (binding * mixfix) * (Attrib.binding * term) -> local_theory -> |
34 (term * (string * thm)) * local_theory |
35 (term * (string * thm)) * local_theory |
35 val note: string -> Attrib.binding * thm list -> local_theory -> (string * thm list) * local_theory |
36 val note: string -> Attrib.binding * thm list -> local_theory -> (string * thm list) * local_theory |
36 val notes: string -> (Attrib.binding * (thm list * Attrib.src list) list) list -> |
37 val notes: string -> (Attrib.binding * (thm list * Attrib.src list) list) list -> |
37 local_theory -> (string * thm list) list * local_theory |
38 local_theory -> (string * thm list) list * local_theory |
38 val type_syntax: declaration -> local_theory -> local_theory |
39 val type_syntax: bool -> declaration -> local_theory -> local_theory |
39 val term_syntax: declaration -> local_theory -> local_theory |
40 val term_syntax: bool -> declaration -> local_theory -> local_theory |
40 val declaration: declaration -> local_theory -> local_theory |
41 val declaration: bool -> declaration -> local_theory -> local_theory |
41 val notation: bool -> Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory |
42 val notation: bool -> Syntax.mode -> (term * mixfix) list -> local_theory -> local_theory |
42 val init: string -> operations -> Proof.context -> local_theory |
43 val init: string -> operations -> Proof.context -> local_theory |
43 val restore: local_theory -> local_theory |
44 val restore: local_theory -> local_theory |
44 val reinit: local_theory -> local_theory |
45 val reinit: local_theory -> local_theory |
45 val exit: local_theory -> Proof.context |
46 val exit: local_theory -> Proof.context |
63 (binding * mixfix) * (Attrib.binding * term) -> local_theory -> |
64 (binding * mixfix) * (Attrib.binding * term) -> local_theory -> |
64 (term * (string * thm)) * local_theory, |
65 (term * (string * thm)) * local_theory, |
65 notes: string -> |
66 notes: string -> |
66 (Attrib.binding * (thm list * Attrib.src list) list) list -> |
67 (Attrib.binding * (thm list * Attrib.src list) list) list -> |
67 local_theory -> (string * thm list) list * local_theory, |
68 local_theory -> (string * thm list) list * local_theory, |
68 type_syntax: declaration -> local_theory -> local_theory, |
69 type_syntax: bool -> declaration -> local_theory -> local_theory, |
69 term_syntax: declaration -> local_theory -> local_theory, |
70 term_syntax: bool -> declaration -> local_theory -> local_theory, |
70 declaration: declaration -> local_theory -> local_theory, |
71 declaration: bool -> declaration -> local_theory -> local_theory, |
71 reinit: local_theory -> local_theory, |
72 reinit: local_theory -> local_theory, |
72 exit: local_theory -> Proof.context}; |
73 exit: local_theory -> Proof.context}; |
73 |
74 |
74 datatype lthy = LThy of |
75 datatype lthy = LThy of |
75 {naming: Name_Space.naming, |
76 {naming: Name_Space.naming, |
172 fun standard_morphism lthy ctxt = |
173 fun standard_morphism lthy ctxt = |
173 ProofContext.norm_export_morphism lthy ctxt $> |
174 ProofContext.norm_export_morphism lthy ctxt $> |
174 Morphism.binding_morphism (Name_Space.transform_binding (naming_of lthy)); |
175 Morphism.binding_morphism (Name_Space.transform_binding (naming_of lthy)); |
175 |
176 |
176 fun target_morphism lthy = standard_morphism lthy (target_of lthy); |
177 fun target_morphism lthy = standard_morphism lthy (target_of lthy); |
|
178 fun global_morphism lthy = standard_morphism lthy (ProofContext.init (ProofContext.theory_of lthy)); |
177 |
179 |
178 |
180 |
179 (* basic operations *) |
181 (* basic operations *) |
180 |
182 |
181 fun operation f lthy = f (#operations (get_lthy lthy)) lthy; |
183 fun operation f lthy = f (#operations (get_lthy lthy)) lthy; |
182 fun operation1 f x = operation (fn ops => f ops x); |
|
183 fun operation2 f x y lthy = operation (fn ops => f ops x y) lthy; |
184 fun operation2 f x y lthy = operation (fn ops => f ops x y) lthy; |
184 |
185 |
185 val pretty = operation #pretty; |
186 val pretty = operation #pretty; |
186 val abbrev = apsnd checkpoint ooo operation2 #abbrev; |
187 val abbrev = apsnd checkpoint ooo operation2 #abbrev; |
187 val define = apsnd checkpoint ooo operation2 #define; |
188 val define = apsnd checkpoint ooo operation2 #define; |
188 val notes = apsnd checkpoint ooo operation2 #notes; |
189 val notes = apsnd checkpoint ooo operation2 #notes; |
189 val type_syntax = checkpoint oo operation1 #type_syntax; |
190 val type_syntax = checkpoint ooo operation2 #type_syntax; |
190 val term_syntax = checkpoint oo operation1 #term_syntax; |
191 val term_syntax = checkpoint ooo operation2 #term_syntax; |
191 val declaration = checkpoint oo operation1 #declaration; |
192 val declaration = checkpoint ooo operation2 #declaration; |
192 |
193 |
193 fun note kind (a, ths) = notes kind [(a, [(ths, [])])] #>> the_single; |
194 fun note kind (a, ths) = notes kind [(a, [(ths, [])])] #>> the_single; |
194 |
195 |
195 fun notation add mode raw_args lthy = |
196 fun notation add mode raw_args lthy = |
196 let val args = map (apfst (Morphism.term (target_morphism lthy))) raw_args |
197 let val args = map (apfst (Morphism.term (target_morphism lthy))) raw_args |
197 in term_syntax (ProofContext.target_notation add mode args) lthy end; |
198 in term_syntax false (ProofContext.target_notation add mode args) lthy end; |
198 |
199 |
199 |
200 |
200 (* init *) |
201 (* init *) |
201 |
202 |
202 fun init theory_prefix operations target = |
203 fun init theory_prefix operations target = |