equal
deleted
inserted
replaced
|
1 (* Title: Pure/Isar/experiment.ML |
|
2 Author: Makarius |
|
3 |
|
4 Target for specification experiments that are mostly private. |
|
5 *) |
|
6 |
|
7 signature EXPERIMENT = |
|
8 sig |
|
9 val experiment: Element.context_i list -> theory -> Binding.scope * local_theory |
|
10 val experiment_cmd: Element.context list -> theory -> Binding.scope * local_theory |
|
11 end; |
|
12 |
|
13 structure Experiment: EXPERIMENT = |
|
14 struct |
|
15 |
|
16 fun gen_experiment add_locale elems thy = |
|
17 let |
|
18 val (_, lthy) = thy |
|
19 |> add_locale (Binding.name ("experiment" ^ serial_string ())) Binding.empty ([], []) elems; |
|
20 val (scope, naming) = |
|
21 Name_Space.new_scope (Proof_Context.naming_of (Local_Theory.target_of lthy)); |
|
22 val naming' = naming |> Name_Space.private scope; |
|
23 val lthy' = lthy |> Local_Theory.map_contexts (K (Proof_Context.map_naming (K naming'))); |
|
24 in (scope, lthy') end; |
|
25 |
|
26 val experiment = gen_experiment Expression.add_locale; |
|
27 val experiment_cmd = gen_experiment Expression.add_locale_cmd; |
|
28 |
|
29 end; |