125 fun expression_no_pos (expr, fixes) : Expression.expression = |
125 fun expression_no_pos (expr, fixes) : Expression.expression = |
126 (map (fn (name, inst) => ((name, Position.none), inst)) expr, fixes); |
126 (map (fn (name, inst) => ((name, Position.none), inst)) expr, fixes); |
127 |
127 |
128 fun prove_interpretation_in ctxt_tac (name, expr) thy = |
128 fun prove_interpretation_in ctxt_tac (name, expr) thy = |
129 thy |
129 thy |
130 |> Expression.sublocale_global_cmd I (name, Position.none) (expression_no_pos expr) [] |
130 |> Expression.sublocale_global_cmd (name, Position.none) (expression_no_pos expr) [] |
131 |> Proof.global_terminal_proof |
131 |> Proof.global_terminal_proof |
132 ((Method.Basic (fn ctxt => SIMPLE_METHOD (ctxt_tac ctxt)), Position.no_range), NONE) |
132 ((Method.Basic (fn ctxt => SIMPLE_METHOD (ctxt_tac ctxt)), Position.no_range), NONE) |
133 |> Proof_Context.theory_of |
133 |> Proof_Context.theory_of |
134 |
134 |
135 fun add_locale name expr elems thy = |
135 fun add_locale name expr elems thy = |
136 thy |
136 thy |
137 |> Expression.add_locale I (Binding.name name) (Binding.name name) expr elems |
137 |> Expression.add_locale (Binding.name name) (Binding.name name) expr elems |
138 |> snd |
138 |> snd |
139 |> Local_Theory.exit; |
139 |> Local_Theory.exit; |
140 |
140 |
141 fun add_locale_cmd name expr elems thy = |
141 fun add_locale_cmd name expr elems thy = |
142 thy |
142 thy |
143 |> Expression.add_locale_cmd I (Binding.name name) Binding.empty (expression_no_pos expr) elems |
143 |> Expression.add_locale_cmd (Binding.name name) Binding.empty (expression_no_pos expr) elems |
144 |> snd |
144 |> snd |
145 |> Local_Theory.exit; |
145 |> Local_Theory.exit; |
146 |
146 |
147 type statespace_info = |
147 type statespace_info = |
148 {args: (string * sort) list, (* type arguments *) |
148 {args: (string * sort) list, (* type arguments *) |
292 fun inject_name T = injectN ^"_"^encode_type T; |
292 fun inject_name T = injectN ^"_"^encode_type T; |
293 |
293 |
294 |
294 |
295 fun add_declaration name decl thy = |
295 fun add_declaration name decl thy = |
296 thy |
296 thy |
297 |> Named_Target.init I name |
297 |> Named_Target.init name |
298 |> (fn lthy => Local_Theory.declaration {syntax = false, pervasive = false} (decl lthy) lthy) |
298 |> (fn lthy => Local_Theory.declaration {syntax = false, pervasive = false} (decl lthy) lthy) |
299 |> Local_Theory.exit_global; |
299 |> Local_Theory.exit_global; |
300 |
300 |
301 fun parent_components thy (Ts, pname, renaming) = |
301 fun parent_components thy (Ts, pname, renaming) = |
302 let |
302 let |