11 val parse_ast_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
11 val parse_ast_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
12 val parse_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
12 val parse_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
13 val print_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
13 val print_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
14 val typed_print_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
14 val typed_print_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
15 val print_ast_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
15 val print_ast_translation: bool * (Symbol_Pos.text * Position.T) -> theory -> theory |
|
16 val translations: (xstring * string) Syntax.trrule list -> theory -> theory |
|
17 val no_translations: (xstring * string) Syntax.trrule list -> theory -> theory |
16 val oracle: bstring * Position.T -> Symbol_Pos.text * Position.T -> theory -> theory |
18 val oracle: bstring * Position.T -> Symbol_Pos.text * Position.T -> theory -> theory |
17 val add_axioms: (Attrib.binding * string) list -> theory -> theory |
19 val add_axioms: (Attrib.binding * string) list -> theory -> theory |
18 val add_defs: (bool * bool) * ((binding * string) * Attrib.src list) list -> theory -> theory |
20 val add_defs: (bool * bool) * ((binding * string) * Attrib.src list) list -> theory -> theory |
19 val declaration: {syntax: bool, pervasive: bool} -> |
21 val declaration: {syntax: bool, pervasive: bool} -> |
20 Symbol_Pos.text * Position.T -> local_theory -> local_theory |
22 Symbol_Pos.text * Position.T -> local_theory -> local_theory |
152 |> Context.theory_map; |
154 |> Context.theory_map; |
153 |
155 |
154 end; |
156 end; |
155 |
157 |
156 |
158 |
|
159 (* translation rules *) |
|
160 |
|
161 fun read_trrules thy raw_rules = |
|
162 let |
|
163 val ctxt = ProofContext.init_global thy; |
|
164 val type_ctxt = ProofContext.type_context ctxt; |
|
165 val syn = ProofContext.syn_of ctxt; |
|
166 in |
|
167 raw_rules |> map (Syntax.map_trrule (fn (r, s) => |
|
168 Syntax.read_rule_pattern ctxt type_ctxt syn (Sign.intern_type thy r, s))) |
|
169 end; |
|
170 |
|
171 fun translations args thy = Sign.add_trrules (read_trrules thy args) thy; |
|
172 fun no_translations args thy = Sign.del_trrules (read_trrules thy args) thy; |
|
173 |
|
174 |
157 (* oracles *) |
175 (* oracles *) |
158 |
176 |
159 fun oracle (name, pos) (body_txt, body_pos) = |
177 fun oracle (name, pos) (body_txt, body_pos) = |
160 let |
178 let |
161 val body = ML_Lex.read body_pos body_txt; |
179 val body = ML_Lex.read body_pos body_txt; |