50 |
50 |
51 (* generic setup *) |
51 (* generic setup *) |
52 |
52 |
53 fun setup source = |
53 fun setup source = |
54 ML_Lex.read_source source |
54 ML_Lex.read_source source |
55 |> ML_Context.expression (Input.range_of source) "setup" "theory -> theory" |
55 |> ML_Context.expression ("setup", Position.thread_data ()) "theory -> theory" |
56 "Context.map_theory setup" |
56 "Context.map_theory setup" |
57 |> Context.theory_map; |
57 |> Context.theory_map; |
58 |
58 |
59 fun local_setup source = |
59 fun local_setup source = |
60 ML_Lex.read_source source |
60 ML_Lex.read_source source |
61 |> ML_Context.expression (Input.range_of source) "local_setup" "local_theory -> local_theory" |
61 |> ML_Context.expression ("local_setup", Position.thread_data ()) "local_theory -> local_theory" |
62 "Context.map_proof local_setup" |
62 "Context.map_proof local_setup" |
63 |> Context.proof_map; |
63 |> Context.proof_map; |
64 |
64 |
65 |
65 |
66 (* translation functions *) |
66 (* translation functions *) |
67 |
67 |
68 fun parse_ast_translation source = |
68 fun parse_ast_translation source = |
69 ML_Lex.read_source source |
69 ML_Lex.read_source source |
70 |> ML_Context.expression (Input.range_of source) "parse_ast_translation" |
70 |> ML_Context.expression ("parse_ast_translation", Position.thread_data ()) |
71 "(string * (Proof.context -> Ast.ast list -> Ast.ast)) list" |
71 "(string * (Proof.context -> Ast.ast list -> Ast.ast)) list" |
72 "Context.map_theory (Sign.parse_ast_translation parse_ast_translation)" |
72 "Context.map_theory (Sign.parse_ast_translation parse_ast_translation)" |
73 |> Context.theory_map; |
73 |> Context.theory_map; |
74 |
74 |
75 fun parse_translation source = |
75 fun parse_translation source = |
76 ML_Lex.read_source source |
76 ML_Lex.read_source source |
77 |> ML_Context.expression (Input.range_of source) "parse_translation" |
77 |> ML_Context.expression ("parse_translation", Position.thread_data ()) |
78 "(string * (Proof.context -> term list -> term)) list" |
78 "(string * (Proof.context -> term list -> term)) list" |
79 "Context.map_theory (Sign.parse_translation parse_translation)" |
79 "Context.map_theory (Sign.parse_translation parse_translation)" |
80 |> Context.theory_map; |
80 |> Context.theory_map; |
81 |
81 |
82 fun print_translation source = |
82 fun print_translation source = |
83 ML_Lex.read_source source |
83 ML_Lex.read_source source |
84 |> ML_Context.expression (Input.range_of source) "print_translation" |
84 |> ML_Context.expression ("print_translation", Position.thread_data ()) |
85 "(string * (Proof.context -> term list -> term)) list" |
85 "(string * (Proof.context -> term list -> term)) list" |
86 "Context.map_theory (Sign.print_translation print_translation)" |
86 "Context.map_theory (Sign.print_translation print_translation)" |
87 |> Context.theory_map; |
87 |> Context.theory_map; |
88 |
88 |
89 fun typed_print_translation source = |
89 fun typed_print_translation source = |
90 ML_Lex.read_source source |
90 ML_Lex.read_source source |
91 |> ML_Context.expression (Input.range_of source) "typed_print_translation" |
91 |> ML_Context.expression ("typed_print_translation", Position.thread_data ()) |
92 "(string * (Proof.context -> typ -> term list -> term)) list" |
92 "(string * (Proof.context -> typ -> term list -> term)) list" |
93 "Context.map_theory (Sign.typed_print_translation typed_print_translation)" |
93 "Context.map_theory (Sign.typed_print_translation typed_print_translation)" |
94 |> Context.theory_map; |
94 |> Context.theory_map; |
95 |
95 |
96 fun print_ast_translation source = |
96 fun print_ast_translation source = |
97 ML_Lex.read_source source |
97 ML_Lex.read_source source |
98 |> ML_Context.expression (Input.range_of source) "print_ast_translation" |
98 |> ML_Context.expression ("print_ast_translation", Position.thread_data ()) |
99 "(string * (Proof.context -> Ast.ast list -> Ast.ast)) list" |
99 "(string * (Proof.context -> Ast.ast list -> Ast.ast)) list" |
100 "Context.map_theory (Sign.print_ast_translation print_ast_translation)" |
100 "Context.map_theory (Sign.print_ast_translation print_ast_translation)" |
101 |> Context.theory_map; |
101 |> Context.theory_map; |
102 |
102 |
103 |
103 |
141 |
141 |
142 (* declarations *) |
142 (* declarations *) |
143 |
143 |
144 fun declaration {syntax, pervasive} source = |
144 fun declaration {syntax, pervasive} source = |
145 ML_Lex.read_source source |
145 ML_Lex.read_source source |
146 |> ML_Context.expression (Input.range_of source) "declaration" "Morphism.declaration" |
146 |> ML_Context.expression ("declaration", Position.thread_data ()) "Morphism.declaration" |
147 ("Context.map_proof (Local_Theory.declaration {syntax = " ^ Bool.toString syntax ^ ", \ |
147 ("Context.map_proof (Local_Theory.declaration {syntax = " ^ Bool.toString syntax ^ ", \ |
148 \pervasive = " ^ Bool.toString pervasive ^ "} declaration)") |
148 \pervasive = " ^ Bool.toString pervasive ^ "} declaration)") |
149 |> Context.proof_map; |
149 |> Context.proof_map; |
150 |
150 |
151 |
151 |
152 (* simprocs *) |
152 (* simprocs *) |
153 |
153 |
154 fun simproc_setup name lhss source = |
154 fun simproc_setup name lhss source = |
155 ML_Lex.read_source source |
155 ML_Lex.read_source source |
156 |> ML_Context.expression (Input.range_of source) "proc" |
156 |> ML_Context.expression ("proc", Position.thread_data ()) |
157 "Morphism.morphism -> Proof.context -> cterm -> thm option" |
157 "Morphism.morphism -> Proof.context -> cterm -> thm option" |
158 ("Context.map_proof (Simplifier.define_simproc_cmd " ^ |
158 ("Context.map_proof (Simplifier.define_simproc_cmd " ^ |
159 ML_Syntax.atomic (ML_Syntax.make_binding name) ^ |
159 ML_Syntax.atomic (ML_Syntax.make_binding name) ^ |
160 "{lhss = " ^ ML_Syntax.print_strings lhss ^ ", proc = proc})") |
160 "{lhss = " ^ ML_Syntax.print_strings lhss ^ ", proc = proc})") |
161 |> Context.proof_map; |
161 |> Context.proof_map; |