author | wenzelm |
Sun, 21 Jul 2019 12:11:35 +0200 | |
changeset 70386 | 6af87375b95f |
parent 70384 | 8ce08b154aa1 |
child 70529 | 2ecbbe6b35db |
permissions | -rw-r--r-- |
68154 | 1 |
(* Title: Pure/Thy/export_theory.ML |
2 |
Author: Makarius |
|
3 |
||
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
4 |
Export foundational theory content and locale/class structure. |
68154 | 5 |
*) |
6 |
||
7 |
signature EXPORT_THEORY = |
|
8 |
sig |
|
68201 | 9 |
val setup_presentation: (Thy_Info.presentation_context -> theory -> unit) -> unit |
10 |
val export_body: theory -> string -> XML.body -> unit |
|
68154 | 11 |
end; |
12 |
||
13 |
structure Export_Theory: EXPORT_THEORY = |
|
14 |
struct |
|
15 |
||
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
16 |
(* approximative syntax *) |
69076 | 17 |
|
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
18 |
val get_syntax = Syntax.get_approx o Proof_Context.syn_of; |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
19 |
fun get_syntax_type ctxt = get_syntax ctxt o Lexicon.mark_type; |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
20 |
fun get_syntax_const ctxt = get_syntax ctxt o Lexicon.mark_const; |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
21 |
fun get_syntax_fixed ctxt = get_syntax ctxt o Lexicon.mark_fixed; |
69076 | 22 |
|
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
23 |
fun get_syntax_param ctxt loc x = |
69076 | 24 |
let val thy = Proof_Context.theory_of ctxt in |
25 |
if Class.is_class thy loc then |
|
26 |
(case AList.lookup (op =) (Class.these_params thy [loc]) x of |
|
27 |
NONE => NONE |
|
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
28 |
| SOME (_, (c, _)) => get_syntax_const ctxt c) |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
29 |
else get_syntax_fixed ctxt x |
69076 | 30 |
end; |
31 |
||
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
32 |
val encode_syntax = |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
33 |
XML.Encode.variant |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
34 |
[fn NONE => ([], []), |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
35 |
fn SOME (Syntax.Prefix delim) => ([delim], []), |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
36 |
fn SOME (Syntax.Infix {assoc, delim, pri}) => |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
37 |
let |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
38 |
val ass = |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
39 |
(case assoc of |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
40 |
Printer.No_Assoc => 0 |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
41 |
| Printer.Left_Assoc => 1 |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
42 |
| Printer.Right_Assoc => 2); |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
43 |
open XML.Encode Term_XML.Encode; |
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
44 |
in ([], triple int string int (ass, delim, pri)) end]; |
69076 | 45 |
|
46 |
||
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
47 |
(* standardization of variables: only frees and named bounds *) |
68725 | 48 |
|
49 |
local |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
50 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
51 |
fun declare_names (Abs (_, _, b)) = declare_names b |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
52 |
| declare_names (t $ u) = declare_names t #> declare_names u |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
53 |
| declare_names (Const (c, _)) = Name.declare (Long_Name.base_name c) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
54 |
| declare_names (Free (x, _)) = Name.declare x |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
55 |
| declare_names _ = I; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
56 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
57 |
fun variant_abs bs (Abs (x, T, t)) = |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
58 |
let |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
59 |
val names = fold Name.declare bs (declare_names t Name.context); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
60 |
val x' = #1 (Name.variant x names); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
61 |
val t' = variant_abs (x' :: bs) t; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
62 |
in Abs (x', T, t') end |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
63 |
| variant_abs bs (t $ u) = variant_abs bs t $ variant_abs bs u |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
64 |
| variant_abs _ t = t; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
65 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
66 |
in |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
67 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
68 |
fun standard_vars used = |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
69 |
let |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
70 |
fun zero_var_indexes tm = |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
71 |
Term_Subst.instantiate (Term_Subst.zero_var_indexes_inst used [tm]) tm; |
68725 | 72 |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
73 |
fun unvarifyT ty = ty |> Term.map_atyps |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
74 |
(fn TVar ((a, _), S) => TFree (a, S) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
75 |
| T as TFree (a, _) => |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
76 |
if Name.is_declared used a then T |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
77 |
else raise TYPE (Logic.bad_fixed a, [ty], [])); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
78 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
79 |
fun unvarify tm = tm |> Term.map_aterms |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
80 |
(fn Var ((x, _), T) => Free (x, T) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
81 |
| t as Free (x, _) => |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
82 |
if Name.is_declared used x then t |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
83 |
else raise TERM (Logic.bad_fixed x, [tm]) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
84 |
| t => t); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
85 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
86 |
in zero_var_indexes #> map_types unvarifyT #> unvarify #> variant_abs [] end; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
87 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
88 |
val standard_vars_global = standard_vars Name.context; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
89 |
|
68725 | 90 |
end; |
91 |
||
92 |
||
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
93 |
(* free variables: not declared in the context *) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
94 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
95 |
val is_free = not oo Name.is_declared; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
96 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
97 |
fun add_frees used = |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
98 |
fold_aterms (fn Free (x, T) => is_free used x ? insert (op =) (x, T) | _ => I); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
99 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
100 |
fun add_tfrees used = |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
101 |
(fold_types o fold_atyps) (fn TFree (a, S) => is_free used a ? insert (op =) (a, S) | _ => I); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
102 |
|
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
103 |
|
69992
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
104 |
(* spec rules *) |
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
105 |
|
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
106 |
fun primrec_types ctxt const = |
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
107 |
Spec_Rules.retrieve ctxt (Const const) |
69996
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
108 |
|> get_first |
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
109 |
(fn (Spec_Rules.Equational (Spec_Rules.Primrec types), _) => SOME (types, false) |
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
110 |
| (Spec_Rules.Equational (Spec_Rules.Primcorec types), _) => SOME (types, true) |
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
111 |
| _ => NONE) |
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
112 |
|> the_default ([], false); |
69992
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
113 |
|
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
114 |
|
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
115 |
(* locales content *) |
69019 | 116 |
|
69034 | 117 |
fun locale_content thy loc = |
69019 | 118 |
let |
69083
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
119 |
val ctxt = Locale.init loc thy; |
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
120 |
val args = |
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
121 |
Locale.params_of thy loc |
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
122 |
|> map (fn ((x, T), _) => ((x, T), get_syntax_param ctxt loc x)); |
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
123 |
val axioms = |
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
124 |
let |
69083
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
125 |
val (asm, defs) = Locale.specification_of thy loc; |
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
126 |
val cprops = map (Thm.cterm_of ctxt) (the_list asm @ defs); |
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
127 |
val (intro1, intro2) = Locale.intros_of thy loc; |
69083
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
128 |
val intros_tac = Method.try_intros_tac ctxt (the_list intro1 @ the_list intro2) []; |
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
129 |
val res = |
69083
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
130 |
Goal.init (Conjunction.mk_conjunction_balanced cprops) |
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
131 |
|> (ALLGOALS Goal.conjunction_tac THEN intros_tac) |
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
132 |
|> try Seq.hd; |
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
133 |
in |
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
134 |
(case res of |
69083
6f8ae6ddc26b
more direct locale goal: avoid renaming of type_parameters;
wenzelm
parents:
69077
diff
changeset
|
135 |
SOME goal => Thm.prems_of goal |
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
136 |
| NONE => raise Fail ("Cannot unfold locale " ^ quote loc)) |
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
137 |
end; |
69076 | 138 |
val typargs = rev (fold Term.add_tfrees (map (Free o #1) args @ axioms) []); |
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
139 |
in {typargs = typargs, args = args, axioms = axioms} end; |
69019 | 140 |
|
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
141 |
fun get_locales thy = |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
142 |
Locale.get_locales thy |> map_filter (fn loc => |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
143 |
if Experiment.is_experiment thy loc then NONE else SOME (loc, ())); |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
144 |
|
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
145 |
fun get_dependencies prev_thys thy = |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
146 |
Locale.dest_dependencies prev_thys thy |> map_filter (fn dep => |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
147 |
if Experiment.is_experiment thy (#source dep) orelse |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
148 |
Experiment.is_experiment thy (#target dep) then NONE |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
149 |
else |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
150 |
let |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
151 |
val (type_params, params) = Locale.parameters_of thy (#source dep); |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
152 |
val typargs = fold (Term.add_tfreesT o #2 o #1) params type_params; |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
153 |
val substT = |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
154 |
typargs |> map_filter (fn v => |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
155 |
let |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
156 |
val T = TFree v; |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
157 |
val T' = Morphism.typ (#morphism dep) T; |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
158 |
in if T = T' then NONE else SOME (v, T') end); |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
159 |
val subst = |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
160 |
params |> map_filter (fn (v, _) => |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
161 |
let |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
162 |
val t = Free v; |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
163 |
val t' = Morphism.term (#morphism dep) t; |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
164 |
in if t aconv t' then NONE else SOME (v, t') end); |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
165 |
in SOME (dep, (substT, subst)) end); |
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
166 |
|
69019 | 167 |
|
68201 | 168 |
(* general setup *) |
68154 | 169 |
|
68201 | 170 |
fun setup_presentation f = |
171 |
Theory.setup (Thy_Info.add_presentation (fn context => fn thy => |
|
172 |
if Options.bool (#options context) "export_theory" then f context thy else ())); |
|
68154 | 173 |
|
68201 | 174 |
fun export_body thy name body = |
70015
c8e08d8ffb93
clarified signature: more explicit type Path.binding;
wenzelm
parents:
69996
diff
changeset
|
175 |
Export.export thy (Path.binding0 (Path.make ["theory", name])) |
69784
24bbc4e30e5b
clarified signature: Path.T as in Generated_Files;
wenzelm
parents:
69087
diff
changeset
|
176 |
(Buffer.chunks (YXML.buffer_body body Buffer.empty)); |
68165 | 177 |
|
68154 | 178 |
|
68201 | 179 |
(* presentation *) |
180 |
||
181 |
val _ = setup_presentation (fn {adjust_pos, ...} => fn thy => |
|
182 |
let |
|
68900
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
183 |
val parents = Theory.parents_of thy; |
68264 | 184 |
val rep_tsig = Type.rep_tsig (Sign.tsig_of thy); |
185 |
||
69003 | 186 |
val thy_ctxt = Proof_Context.init_global thy; |
68997 | 187 |
|
68264 | 188 |
|
68201 | 189 |
(* entities *) |
68154 | 190 |
|
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
191 |
fun make_entity_markup name xname pos serial = |
68201 | 192 |
let |
193 |
val props = |
|
68830
44ec6fdaacf8
retain original id, which is command_id/exec_id for PIDE;
wenzelm
parents:
68727
diff
changeset
|
194 |
Position.offset_properties_of (adjust_pos pos) @ |
44ec6fdaacf8
retain original id, which is command_id/exec_id for PIDE;
wenzelm
parents:
68727
diff
changeset
|
195 |
Position.id_properties_of pos @ |
44ec6fdaacf8
retain original id, which is command_id/exec_id for PIDE;
wenzelm
parents:
68727
diff
changeset
|
196 |
Markup.serial_properties serial; |
68997 | 197 |
in (Markup.entityN, (Markup.nameN, name) :: (Markup.xnameN, xname) :: props) end; |
68154 | 198 |
|
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
199 |
fun entity_markup space name = |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
200 |
let |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
201 |
val xname = Name_Space.extern_shortest thy_ctxt space name; |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
202 |
val {serial, pos, ...} = Name_Space.the_entry space name; |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
203 |
in make_entity_markup name xname pos serial end; |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
204 |
|
68201 | 205 |
fun export_entities export_name export get_space decls = |
206 |
let val elems = |
|
207 |
let |
|
68206 | 208 |
val parent_spaces = map get_space parents; |
68201 | 209 |
val space = get_space thy; |
210 |
in |
|
211 |
(decls, []) |-> fold (fn (name, decl) => |
|
212 |
if exists (fn space => Name_Space.declared space name) parent_spaces then I |
|
213 |
else |
|
214 |
(case export name decl of |
|
215 |
NONE => I |
|
68724 | 216 |
| SOME body => |
217 |
cons (#serial (Name_Space.the_entry space name), |
|
218 |
XML.Elem (entity_markup space name, body)))) |
|
219 |
|> sort (int_ord o apply2 #1) |> map #2 |
|
68201 | 220 |
end; |
221 |
in if null elems then () else export_body thy export_name elems end; |
|
68165 | 222 |
|
223 |
||
68201 | 224 |
(* types *) |
68165 | 225 |
|
68201 | 226 |
val encode_type = |
227 |
let open XML.Encode Term_XML.Encode |
|
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
228 |
in triple encode_syntax (list string) (option typ) end; |
68165 | 229 |
|
69003 | 230 |
fun export_type c (Type.LogicalType n) = |
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
231 |
SOME (encode_type (get_syntax_type thy_ctxt c, Name.invent Name.context Name.aT n, NONE)) |
69003 | 232 |
| export_type c (Type.Abbreviation (args, U, false)) = |
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
233 |
SOME (encode_type (get_syntax_type thy_ctxt c, args, SOME U)) |
69003 | 234 |
| export_type _ _ = NONE; |
68165 | 235 |
|
68201 | 236 |
val _ = |
69003 | 237 |
export_entities "types" export_type Sign.type_space |
68264 | 238 |
(Name_Space.dest_table (#types rep_tsig)); |
68201 | 239 |
|
68173 | 240 |
|
68201 | 241 |
(* consts *) |
242 |
||
243 |
val encode_const = |
|
69992
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
244 |
let open XML.Encode Term_XML.Encode in |
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
245 |
pair encode_syntax |
69996
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
246 |
(pair (list string) |
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
247 |
(pair typ (pair (option term) (pair bool (pair (list string) bool))))) |
69992
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
248 |
end; |
68165 | 249 |
|
68201 | 250 |
fun export_const c (T, abbrev) = |
251 |
let |
|
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
252 |
val syntax = get_syntax_const thy_ctxt c; |
69992
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
253 |
val U = Logic.unvarifyT_global T; |
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
254 |
val U0 = Type.strip_sorts U; |
69996
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
255 |
val recursion = primrec_types thy_ctxt (c, U); |
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
256 |
val abbrev' = abbrev |> Option.map (standard_vars_global #> map_types Type.strip_sorts); |
69992
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
257 |
val args = map (#1 o dest_TFree) (Consts.typargs (Sign.consts_of thy) (c, U0)); |
bd3c10813cc4
more informative Spec_Rules.Equational, notably primrec argument types;
wenzelm
parents:
69988
diff
changeset
|
258 |
val propositional = Object_Logic.is_propositional thy_ctxt (Term.body_type U0); |
69996
8f2d3a27aff0
more informative Spec_Rules.Equational: support corecursion;
wenzelm
parents:
69992
diff
changeset
|
259 |
in encode_const (syntax, (args, (U0, (abbrev', (propositional, recursion))))) end; |
68165 | 260 |
|
68201 | 261 |
val _ = |
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
262 |
export_entities "consts" (SOME oo export_const) Sign.const_space |
68201 | 263 |
(#constants (Consts.dest (Sign.consts_of thy))); |
264 |
||
68208 | 265 |
|
68232 | 266 |
(* axioms and facts *) |
68208 | 267 |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
268 |
fun prop_of raw_thm = |
68727 | 269 |
let |
270 |
val thm = raw_thm |
|
271 |
|> Thm.transfer thy |
|
272 |
|> Thm.check_hyps (Context.Theory thy) |
|
273 |
|> Thm.strip_shyps; |
|
274 |
val prop = thm |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
275 |
|> Thm.full_prop_of; |
68727 | 276 |
in (Thm.extra_shyps thm, prop) end; |
68539 | 277 |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
278 |
fun encode_prop used (Ss, raw_prop) = |
68208 | 279 |
let |
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
280 |
val prop = standard_vars used raw_prop; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
281 |
val args = rev (add_frees used prop []); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
282 |
val typargs = rev (add_tfrees used prop []); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
283 |
val used' = fold (Name.declare o #1) typargs used; |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
284 |
val sorts = Name.invent used' Name.aT (length Ss) ~~ Ss; |
68726 | 285 |
in |
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
286 |
(sorts @ typargs, args, prop) |> |
68727 | 287 |
let open XML.Encode Term_XML.Encode |
288 |
in triple (list (pair string sort)) (list (pair string typ)) term end |
|
68726 | 289 |
end; |
68208 | 290 |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
291 |
fun encode_axiom used t = encode_prop used ([], t); |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
292 |
|
70386 | 293 |
val encode_fact = encode_prop Name.context; |
294 |
val encode_fact_single = encode_fact o prop_of; |
|
295 |
val encode_fact_multi = XML.Encode.list encode_fact o map prop_of; |
|
68208 | 296 |
|
68232 | 297 |
val _ = |
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
298 |
export_entities "axioms" (fn _ => fn t => SOME (encode_axiom Name.context t)) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
299 |
Theory.axiom_space (Theory.axioms_of thy); |
68235
a3bd410db5b2
standardize implicit variables: non-zero indexes do occur occasionally, e.g. via RS;
wenzelm
parents:
68232
diff
changeset
|
300 |
val _ = |
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
301 |
export_entities "facts" (K (SOME o encode_fact_multi)) |
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
302 |
(Facts.space_of o Global_Theory.facts_of) |
68232 | 303 |
(Facts.dest_static true [] (Global_Theory.facts_of thy)); |
304 |
||
68264 | 305 |
|
306 |
(* type classes *) |
|
307 |
||
308 |
val encode_class = |
|
309 |
let open XML.Encode Term_XML.Encode |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
310 |
in pair (list (pair string typ)) (list encode_fact_single) end; |
68264 | 311 |
|
312 |
fun export_class name = |
|
313 |
(case try (Axclass.get_info thy) name of |
|
314 |
NONE => ([], []) |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
315 |
| SOME {params, axioms, ...} => (params, axioms)) |
68264 | 316 |
|> encode_class |> SOME; |
317 |
||
318 |
val _ = |
|
319 |
export_entities "classes" (fn name => fn () => export_class name) |
|
320 |
Sign.class_space (map (rpair ()) (Graph.keys (Sorts.classes_of (#2 (#classes rep_tsig))))); |
|
321 |
||
68295 | 322 |
|
323 |
(* sort algebra *) |
|
324 |
||
70386 | 325 |
local |
326 |
val prop = encode_axiom Name.context o Logic.varify_global; |
|
68295 | 327 |
|
70386 | 328 |
val encode_classrel = |
329 |
let open XML.Encode |
|
330 |
in list (pair prop (pair string string)) end; |
|
70384
8ce08b154aa1
clarified export of sort algebra: avoid logical operations in Isabelle/Scala;
wenzelm
parents:
70015
diff
changeset
|
331 |
|
70386 | 332 |
val encode_arities = |
333 |
let open XML.Encode Term_XML.Encode |
|
334 |
in list (pair prop (triple string (list sort) string)) end; |
|
335 |
in |
|
336 |
val export_classrel = |
|
337 |
maps (fn (c, cs) => map (pair c) cs) #> map (`Logic.mk_classrel) #> encode_classrel; |
|
68295 | 338 |
|
70386 | 339 |
val export_arities = map (`Logic.mk_arity) #> encode_arities; |
70384
8ce08b154aa1
clarified export of sort algebra: avoid logical operations in Isabelle/Scala;
wenzelm
parents:
70015
diff
changeset
|
340 |
|
70386 | 341 |
val {classrel, arities} = |
342 |
Sorts.dest_algebra (map (#2 o #classes o Type.rep_tsig o Sign.tsig_of) parents) |
|
343 |
(#2 (#classes rep_tsig)); |
|
68295 | 344 |
|
70386 | 345 |
end; |
70384
8ce08b154aa1
clarified export of sort algebra: avoid logical operations in Isabelle/Scala;
wenzelm
parents:
70015
diff
changeset
|
346 |
|
8ce08b154aa1
clarified export of sort algebra: avoid logical operations in Isabelle/Scala;
wenzelm
parents:
70015
diff
changeset
|
347 |
val _ = if null classrel then () else export_body thy "classrel" (export_classrel classrel); |
8ce08b154aa1
clarified export of sort algebra: avoid logical operations in Isabelle/Scala;
wenzelm
parents:
70015
diff
changeset
|
348 |
val _ = if null arities then () else export_body thy "arities" (export_arities arities); |
68295 | 349 |
|
68862 | 350 |
|
351 |
(* locales *) |
|
352 |
||
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
353 |
fun encode_locale used = |
69076 | 354 |
let open XML.Encode Term_XML.Encode in |
69077
11529ae45786
more approximative prefix syntax, including binder;
wenzelm
parents:
69076
diff
changeset
|
355 |
triple (list (pair string sort)) (list (pair (pair string typ) encode_syntax)) |
69076 | 356 |
(list (encode_axiom used)) |
357 |
end; |
|
69023
cef000855cf4
clarified standardization of variables, with proper treatment of local variables;
wenzelm
parents:
69019
diff
changeset
|
358 |
|
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
359 |
fun export_locale loc = |
68864 | 360 |
let |
69034 | 361 |
val {typargs, args, axioms} = locale_content thy loc; |
69076 | 362 |
val used = fold Name.declare (map #1 typargs @ map (#1 o #1) args) Name.context; |
69027 | 363 |
in encode_locale used (typargs, args, axioms) end |
364 |
handle ERROR msg => |
|
365 |
cat_error msg ("The error(s) above occurred in locale " ^ |
|
366 |
quote (Locale.markup_name thy_ctxt loc)); |
|
68862 | 367 |
|
368 |
val _ = |
|
69029
aec64b88e708
clarified locale content: proper args with types for interpretation/axioms and typargs derived from the result;
wenzelm
parents:
69028
diff
changeset
|
369 |
export_entities "locales" (fn loc => fn () => SOME (export_locale loc)) |
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
370 |
Locale.locale_space (get_locales thy); |
68862 | 371 |
|
68900
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
372 |
|
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
373 |
(* locale dependencies *) |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
374 |
|
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
375 |
fun encode_locale_dependency (dep: Locale.locale_dependency, subst) = |
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
376 |
(#source dep, (#target dep, (#prefix dep, subst))) |> |
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
377 |
let |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
378 |
open XML.Encode Term_XML.Encode; |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
379 |
val encode_subst = |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
380 |
pair (list (pair (pair string sort) typ)) (list (pair (pair string typ) term)); |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
381 |
in pair string (pair string (pair (list (pair string bool)) encode_subst)) end; |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
382 |
|
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
383 |
val _ = |
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
384 |
(case get_dependencies parents thy of |
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
385 |
[] => () |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
386 |
| deps => |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
387 |
deps |> map_index (fn (i, dep) => |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
388 |
let |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
389 |
val xname = string_of_int (i + 1); |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
390 |
val name = Long_Name.implode [Context.theory_name thy, xname]; |
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
391 |
val markup = make_entity_markup name xname (#pos (#1 dep)) (#serial (#1 dep)); |
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
392 |
val body = encode_locale_dependency dep; |
69087
06017b2c4552
suppress aux. locales from command 'experiment' -- avoid crash of theory Dict_Construction.Test_Dict_Construction (AFP);
wenzelm
parents:
69086
diff
changeset
|
393 |
in XML.Elem (markup, body) end) |
69069
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
394 |
|> export_body thy "locale_dependencies"); |
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
395 |
|
b9aca3b9619f
export locale dependencies, with approx. morphism as type/term substitution;
wenzelm
parents:
69034
diff
changeset
|
396 |
|
68900
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
397 |
(* parents *) |
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
398 |
|
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
399 |
val _ = |
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
400 |
export_body thy "parents" |
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
401 |
(XML.Encode.string (cat_lines (map Context.theory_long_name parents))); |
1145b25c53de
more robust: parents are strict in Export_Theory.read_theory and thus approximate "commit" of exports;
wenzelm
parents:
68864
diff
changeset
|
402 |
|
68295 | 403 |
in () end); |
68165 | 404 |
|
405 |
end; |