author | wenzelm |
Wed, 08 Apr 2015 11:52:35 +0200 | |
changeset 59952 | 550b74e9b08c |
parent 58421 | 37cbbd8eb460 |
child 61143 | 5f898411ce87 |
permissions | -rw-r--r-- |
3987 | 1 |
(* Title: Pure/pure_thy.ML |
2 |
Author: Markus Wenzel, TU Muenchen |
|
3 |
||
39557
fe5722fce758
renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents:
39507
diff
changeset
|
4 |
Pure theory syntax and further logical content. |
3987 | 5 |
*) |
6 |
||
7 |
signature PURE_THY = |
|
8 |
sig |
|
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
9 |
val old_appl_syntax: theory -> bool |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
10 |
val old_appl_syntax_setup: theory -> theory |
52160 | 11 |
val token_markers: string list |
3987 | 12 |
end; |
13 |
||
39557
fe5722fce758
renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents:
39507
diff
changeset
|
14 |
structure Pure_Thy: PURE_THY = |
3987 | 15 |
struct |
16 |
||
33384 | 17 |
val typ = Simple_Syntax.read_typ; |
18 |
val prop = Simple_Syntax.read_prop; |
|
35429
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
19 |
|
42290
b1f544c84040
discontinued special treatment of structure Lexicon;
wenzelm
parents:
42288
diff
changeset
|
20 |
val tycon = Lexicon.mark_type; |
b1f544c84040
discontinued special treatment of structure Lexicon;
wenzelm
parents:
42288
diff
changeset
|
21 |
val const = Lexicon.mark_const; |
24243 | 22 |
|
56234 | 23 |
val qualify = Binding.qualify true Context.PureN; |
24 |
||
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
25 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
26 |
(* application syntax variants *) |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
27 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
28 |
val appl_syntax = |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
29 |
[("_appl", typ "('b => 'a) => args => logic", Mixfix ("(1_/(1'(_')))", [1000, 0], 1000)), |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
30 |
("_appl", typ "('b => 'a) => args => aprop", Mixfix ("(1_/(1'(_')))", [1000, 0], 1000))]; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
31 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
32 |
val applC_syntax = |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
33 |
[("", typ "'a => cargs", Delimfix "_"), |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
34 |
("_cargs", typ "'a => cargs => cargs", Mixfix ("_/ _", [1000, 1000], 1000)), |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
35 |
("_applC", typ "('b => 'a) => cargs => logic", Mixfix ("(1_/ _)", [1000, 1000], 999)), |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
36 |
("_applC", typ "('b => 'a) => cargs => aprop", Mixfix ("(1_/ _)", [1000, 1000], 999))]; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
37 |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
38 |
structure Old_Appl_Syntax = Theory_Data |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
39 |
( |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
40 |
type T = bool; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
41 |
val empty = false; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
42 |
val extend = I; |
33522 | 43 |
fun merge (b1, b2) : T = |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
44 |
if b1 = b2 then b1 |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
45 |
else error "Cannot merge theories with different application syntax"; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
46 |
); |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
47 |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
48 |
val old_appl_syntax = Old_Appl_Syntax.get; |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
49 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
50 |
val old_appl_syntax_setup = |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
51 |
Old_Appl_Syntax.put true #> |
56240 | 52 |
Sign.del_syntax Syntax.mode_default applC_syntax #> |
53 |
Sign.add_syntax Syntax.mode_default appl_syntax; |
|
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
54 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
55 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
56 |
(* main content *) |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
57 |
|
52160 | 58 |
val token_markers = |
59 |
["_tfree", "_tvar", "_free", "_bound", "_loose", "_var", "_numeral", "_inner_string"]; |
|
60 |
||
53171 | 61 |
val _ = Theory.setup |
33365 | 62 |
(Sign.map_naming (Name_Space.set_theory_name Context.PureN) #> |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
63 |
Old_Appl_Syntax.put false #> |
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42297
diff
changeset
|
64 |
Sign.add_types_global |
56436 | 65 |
[(Binding.make ("fun", @{here}), 2, NoSyn), |
66 |
(Binding.make ("prop", @{here}), 0, NoSyn), |
|
67 |
(Binding.make ("itself", @{here}), 1, NoSyn), |
|
68 |
(Binding.make ("dummy", @{here}), 0, NoSyn)] |
|
52160 | 69 |
#> Sign.add_nonterminals_global |
56436 | 70 |
(map (fn name => Binding.make (name, @{here})) |
52160 | 71 |
(Lexicon.terminals @ ["logic", "type", "types", "sort", "classes", |
72 |
"args", "cargs", "pttrn", "pttrns", "idt", "idts", "aprop", "asms", |
|
58421 | 73 |
"any", "prop'", "num_const", "float_const", "num_position", |
74 |
"float_position", "index", "struct", "tid_position", |
|
55108
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
75 |
"tvar_position", "id_position", "longid_position", "var_position", |
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
76 |
"str_position", "string_position", "cartouche_position", "type_name", |
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
77 |
"class_name"])) |
56240 | 78 |
#> Sign.add_syntax Syntax.mode_default (map (fn x => (x, typ "'a", NoSyn)) token_markers) |
79 |
#> Sign.add_syntax Syntax.mode_default |
|
42294 | 80 |
[("", typ "prop' => prop", Delimfix "_"), |
81 |
("", typ "logic => any", Delimfix "_"), |
|
82 |
("", typ "prop' => any", Delimfix "_"), |
|
83 |
("", typ "logic => logic", Delimfix "'(_')"), |
|
84 |
("", typ "prop' => prop'", Delimfix "'(_')"), |
|
85 |
("_constrain", typ "logic => type => logic", Mixfix ("_::_", [4, 0], 3)), |
|
86 |
("_constrain", typ "prop' => type => prop'", Mixfix ("_::_", [4, 0], 3)), |
|
52211
66bc827e37f8
explicit support for type annotations within printed syntax trees;
wenzelm
parents:
52161
diff
changeset
|
87 |
("_ignore_type", typ "'a", NoSyn), |
49674
dbadb4d03cbc
report sort assignment of visible type variables;
wenzelm
parents:
46483
diff
changeset
|
88 |
("", typ "tid_position => type", Delimfix "_"), |
dbadb4d03cbc
report sort assignment of visible type variables;
wenzelm
parents:
46483
diff
changeset
|
89 |
("", typ "tvar_position => type", Delimfix "_"), |
42263
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
90 |
("", typ "type_name => type", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
91 |
("_type_name", typ "id => type_name", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
92 |
("_type_name", typ "longid => type_name", Delimfix "_"), |
49685
4341e4d86872
allow position constraints to coexist with 0 or 1 sort constraints;
wenzelm
parents:
49674
diff
changeset
|
93 |
("_ofsort", typ "tid_position => sort => type", Mixfix ("_::_", [1000, 0], 1000)), |
4341e4d86872
allow position constraints to coexist with 0 or 1 sort constraints;
wenzelm
parents:
49674
diff
changeset
|
94 |
("_ofsort", typ "tvar_position => sort => type", Mixfix ("_::_", [1000, 0], 1000)), |
42297
140f283266b7
discontinued Syntax.max_pri, which is not really a symbolic parameter;
wenzelm
parents:
42296
diff
changeset
|
95 |
("_dummy_ofsort", typ "sort => type", Mixfix ("'_()::_", [0], 1000)), |
42263
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
96 |
("", typ "class_name => sort", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
97 |
("_class_name", typ "id => class_name", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
98 |
("_class_name", typ "longid => class_name", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
99 |
("_topsort", typ "sort", Delimfix "{}"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
100 |
("_sort", typ "classes => sort", Delimfix "{_}"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
101 |
("", typ "class_name => classes", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
102 |
("_classes", typ "class_name => classes => classes", Delimfix "_,_"), |
42297
140f283266b7
discontinued Syntax.max_pri, which is not really a symbolic parameter;
wenzelm
parents:
42296
diff
changeset
|
103 |
("_tapp", typ "type => type_name => type", Mixfix ("_ _", [1000, 0], 1000)), |
42263
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
104 |
("_tappl", typ "type => types => type_name => type", Delimfix "((1'(_,/ _')) _)"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
105 |
("", typ "type => types", Delimfix "_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
106 |
("_types", typ "type => types => types", Delimfix "_,/ _"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
107 |
("\\<^type>fun", typ "type => type => type", Mixfix ("(_/ => _)", [1, 0], 0)), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
108 |
("_bracket", typ "types => type => type", Mixfix ("([_]/ => _)", [0, 0], 0)), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
109 |
("", typ "type => type", Delimfix "'(_')"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
110 |
("\\<^type>dummy", typ "type", Delimfix "'_"), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
111 |
("_type_prop", typ "'a", NoSyn), |
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
112 |
("_lambda", typ "pttrns => 'a => logic", Mixfix ("(3%_./ _)", [0, 3], 3)), |
26436 | 113 |
("_abs", typ "'a", NoSyn), |
114 |
("", typ "'a => args", Delimfix "_"), |
|
115 |
("_args", typ "'a => args => args", Delimfix "_,/ _"), |
|
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
116 |
("", typ "id_position => idt", Delimfix "_"), |
26436 | 117 |
("_idtdummy", typ "idt", Delimfix "'_"), |
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
118 |
("_idtyp", typ "id_position => type => idt", Mixfix ("_::_", [], 0)), |
26436 | 119 |
("_idtypdummy", typ "type => idt", Mixfix ("'_()::_", [], 0)), |
120 |
("", typ "idt => idt", Delimfix "'(_')"), |
|
121 |
("", typ "idt => idts", Delimfix "_"), |
|
122 |
("_idts", typ "idt => idts => idts", Mixfix ("_/ _", [1, 0], 0)), |
|
123 |
("", typ "idt => pttrn", Delimfix "_"), |
|
124 |
("", typ "pttrn => pttrns", Delimfix "_"), |
|
125 |
("_pttrns", typ "pttrn => pttrns => pttrns", Mixfix ("_/ _", [1, 0], 0)), |
|
28856
5e009a80fe6d
Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents:
28841
diff
changeset
|
126 |
("", typ "aprop => aprop", Delimfix "'(_')"), |
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
127 |
("", typ "id_position => aprop", Delimfix "_"), |
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
128 |
("", typ "longid_position => aprop", Delimfix "_"), |
51612
6a1e40f9dd55
added var_position in analogy to longid_position, for typing reports on input;
wenzelm
parents:
50636
diff
changeset
|
129 |
("", typ "var_position => aprop", Delimfix "_"), |
26436 | 130 |
("_DDDOT", typ "aprop", Delimfix "..."), |
131 |
("_aprop", typ "aprop => prop", Delimfix "PROP _"), |
|
132 |
("_asm", typ "prop => asms", Delimfix "_"), |
|
133 |
("_asms", typ "prop => asms => asms", Delimfix "_;/ _"), |
|
134 |
("_bigimpl", typ "asms => prop => prop", Mixfix ("((3[| _ |])/ ==> _)", [0, 1], 1)), |
|
135 |
("_ofclass", typ "type => logic => prop", Delimfix "(1OFCLASS/(1'(_,/ _')))"), |
|
136 |
("_mk_ofclass", typ "dummy", NoSyn), |
|
137 |
("_TYPE", typ "type => logic", Delimfix "(1TYPE/(1'(_')))"), |
|
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
138 |
("", typ "id_position => logic", Delimfix "_"), |
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
139 |
("", typ "longid_position => logic", Delimfix "_"), |
51612
6a1e40f9dd55
added var_position in analogy to longid_position, for typing reports on input;
wenzelm
parents:
50636
diff
changeset
|
140 |
("", typ "var_position => logic", Delimfix "_"), |
26436 | 141 |
("_DDDOT", typ "logic", Delimfix "..."), |
42057
3eba96ff3d3e
more selective strip_positions in case patterns -- reactivate translations based on "case _ of _" in HOL and special patterns in HOLCF;
wenzelm
parents:
42048
diff
changeset
|
142 |
("_strip_positions", typ "'a", NoSyn), |
46236
ae79f2978a67
position constraints for numerals enable PIDE markup;
wenzelm
parents:
45703
diff
changeset
|
143 |
("_position", typ "num_token => num_position", Delimfix "_"), |
ae79f2978a67
position constraints for numerals enable PIDE markup;
wenzelm
parents:
45703
diff
changeset
|
144 |
("_position", typ "float_token => float_position", Delimfix "_"), |
ae79f2978a67
position constraints for numerals enable PIDE markup;
wenzelm
parents:
45703
diff
changeset
|
145 |
("_constify", typ "num_position => num_const", Delimfix "_"), |
ae79f2978a67
position constraints for numerals enable PIDE markup;
wenzelm
parents:
45703
diff
changeset
|
146 |
("_constify", typ "float_position => float_const", Delimfix "_"), |
26436 | 147 |
("_index", typ "logic => index", Delimfix "(00\\<^bsub>_\\<^esub>)"), |
148 |
("_indexdefault", typ "index", Delimfix ""), |
|
149 |
("_indexvar", typ "index", Delimfix "'\\<index>"), |
|
150 |
("_struct", typ "index => logic", Mixfix ("\\<struct>_", [1000], 1000)), |
|
35145
f132a4fd8679
moved generic update_name to Pure syntax -- not specific to HOL/record;
wenzelm
parents:
35130
diff
changeset
|
151 |
("_update_name", typ "idt", NoSyn), |
42295
8fdbb3b10beb
moved CONST syntax/translations to their proper place;
wenzelm
parents:
42294
diff
changeset
|
152 |
("_constrainAbs", typ "'a", NoSyn), |
49674
dbadb4d03cbc
report sort assignment of visible type variables;
wenzelm
parents:
46483
diff
changeset
|
153 |
("_position_sort", typ "tid => tid_position", Delimfix "_"), |
dbadb4d03cbc
report sort assignment of visible type variables;
wenzelm
parents:
46483
diff
changeset
|
154 |
("_position_sort", typ "tvar => tvar_position", Delimfix "_"), |
42410
16bc5564535f
less bulky "_position", for improved readability of parse trees;
wenzelm
parents:
42375
diff
changeset
|
155 |
("_position", typ "id => id_position", Delimfix "_"), |
16bc5564535f
less bulky "_position", for improved readability of parse trees;
wenzelm
parents:
42375
diff
changeset
|
156 |
("_position", typ "longid => longid_position", Delimfix "_"), |
51612
6a1e40f9dd55
added var_position in analogy to longid_position, for typing reports on input;
wenzelm
parents:
50636
diff
changeset
|
157 |
("_position", typ "var => var_position", Delimfix "_"), |
46483 | 158 |
("_position", typ "str_token => str_position", Delimfix "_"), |
55108
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
159 |
("_position", typ "string_token => string_position", Delimfix "_"), |
55033 | 160 |
("_position", typ "cartouche => cartouche_position", Delimfix "_"), |
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
161 |
("_type_constraint_", typ "'a", NoSyn), |
42296 | 162 |
("_context_const", typ "id_position => logic", Delimfix "CONST _"), |
163 |
("_context_const", typ "id_position => aprop", Delimfix "CONST _"), |
|
164 |
("_context_const", typ "longid_position => logic", Delimfix "CONST _"), |
|
165 |
("_context_const", typ "longid_position => aprop", Delimfix "CONST _"), |
|
166 |
("_context_xconst", typ "id_position => logic", Delimfix "XCONST _"), |
|
167 |
("_context_xconst", typ "id_position => aprop", Delimfix "XCONST _"), |
|
168 |
("_context_xconst", typ "longid_position => logic", Delimfix "XCONST _"), |
|
169 |
("_context_xconst", typ "longid_position => aprop", Delimfix "XCONST _"), |
|
56245 | 170 |
(const "Pure.imp", typ "prop => prop => prop", Delimfix "op ==>"), |
56241 | 171 |
(const "Pure.dummy_pattern", typ "aprop", Delimfix "'_"), |
28856
5e009a80fe6d
Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents:
28841
diff
changeset
|
172 |
("_sort_constraint", typ "type => prop", Delimfix "(1SORT'_CONSTRAINT/(1'(_')))"), |
35255 | 173 |
(const "Pure.term", typ "logic => prop", Delimfix "TERM _"), |
174 |
(const "Pure.conjunction", typ "prop => prop => prop", Infixr ("&&&", 2))] |
|
56240 | 175 |
#> Sign.add_syntax Syntax.mode_default applC_syntax |
176 |
#> Sign.add_syntax (Symbol.xsymbolsN, true) |
|
35429
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
177 |
[(tycon "fun", typ "type => type => type", Mixfix ("(_/ \\<Rightarrow> _)", [1, 0], 0)), |
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
178 |
("_bracket", typ "types => type => type", Mixfix ("([_]/ \\<Rightarrow> _)", [0, 0], 0)), |
49685
4341e4d86872
allow position constraints to coexist with 0 or 1 sort constraints;
wenzelm
parents:
49674
diff
changeset
|
179 |
("_ofsort", typ "tid_position => sort => type", Mixfix ("_\\<Colon>_", [1000, 0], 1000)), |
35429
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
180 |
("_constrain", typ "logic => type => logic", Mixfix ("_\\<Colon>_", [4, 0], 3)), |
42293
6cca0343ea48
renamed sprop "prop#" to "prop'" -- proper identifier;
wenzelm
parents:
42290
diff
changeset
|
181 |
("_constrain", typ "prop' => type => prop'", Mixfix ("_\\<Colon>_", [4, 0], 3)), |
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
182 |
("_idtyp", typ "id_position => type => idt", Mixfix ("_\\<Colon>_", [], 0)), |
35429
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
183 |
("_idtypdummy", typ "type => idt", Mixfix ("'_()\\<Colon>_", [], 0)), |
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
184 |
("_lambda", typ "pttrns => 'a => logic", Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3)), |
56245 | 185 |
(const "Pure.eq", typ "'a => 'a => prop", Infix ("\\<equiv>", 2)), |
186 |
(const "Pure.all_binder", typ "idts => prop => prop", Mixfix ("(3\\<And>_./ _)", [0, 0], 0)), |
|
187 |
(const "Pure.imp", typ "prop => prop => prop", Infixr ("\\<Longrightarrow>", 1)), |
|
35429
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
188 |
("_DDDOT", typ "aprop", Delimfix "\\<dots>"), |
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
189 |
("_bigimpl", typ "asms => prop => prop", Mixfix ("((1\\<lbrakk>_\\<rbrakk>)/ \\<Longrightarrow> _)", [0, 1], 1)), |
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
190 |
("_DDDOT", typ "logic", Delimfix "\\<dots>")] |
56240 | 191 |
#> Sign.add_syntax ("", false) |
56244 | 192 |
[(const "Pure.prop", typ "prop => prop", Mixfix ("_", [0], 0))] |
56240 | 193 |
#> Sign.add_syntax ("HTML", false) |
24243 | 194 |
[("_lambda", typ "pttrns => 'a => logic", Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3))] |
56239 | 195 |
#> Sign.add_consts |
56436 | 196 |
[(qualify (Binding.make ("eq", @{here})), typ "'a => 'a => prop", Infix ("==", 2)), |
197 |
(qualify (Binding.make ("imp", @{here})), typ "prop => prop => prop", Mixfix ("(_/ ==> _)", [2, 1], 1)), |
|
198 |
(qualify (Binding.make ("all", @{here})), typ "('a => prop) => prop", Binder ("!!", 0, 0)), |
|
199 |
(qualify (Binding.make ("prop", @{here})), typ "prop => prop", NoSyn), |
|
200 |
(qualify (Binding.make ("type", @{here})), typ "'a itself", NoSyn), |
|
201 |
(qualify (Binding.make ("dummy_pattern", @{here})), typ "'a", Delimfix "'_")] |
|
56245 | 202 |
#> Theory.add_deps_global "Pure.eq" ("Pure.eq", typ "'a => 'a => prop") [] |
203 |
#> Theory.add_deps_global "Pure.imp" ("Pure.imp", typ "prop => prop => prop") [] |
|
204 |
#> Theory.add_deps_global "Pure.all" ("Pure.all", typ "('a => prop) => prop") [] |
|
56243 | 205 |
#> Theory.add_deps_global "Pure.type" ("Pure.type", typ "'a itself") [] |
56241 | 206 |
#> Theory.add_deps_global "Pure.dummy_pattern" ("Pure.dummy_pattern", typ "'a") [] |
52143 | 207 |
#> Sign.parse_ast_translation Syntax_Trans.pure_parse_ast_translation |
208 |
#> Sign.parse_translation Syntax_Trans.pure_parse_translation |
|
209 |
#> Sign.print_ast_translation Syntax_Trans.pure_print_ast_translation |
|
56239 | 210 |
#> Sign.add_consts |
56436 | 211 |
[(qualify (Binding.make ("term", @{here})), typ "'a => prop", NoSyn), |
212 |
(qualify (Binding.make ("sort_constraint", @{here})), typ "'a itself => prop", NoSyn), |
|
213 |
(qualify (Binding.make ("conjunction", @{here})), typ "prop => prop => prop", NoSyn)] |
|
26430 | 214 |
#> Sign.local_path |
39557
fe5722fce758
renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents:
39507
diff
changeset
|
215 |
#> (Global_Theory.add_defs false o map Thm.no_attributes) |
56436 | 216 |
[(Binding.make ("prop_def", @{here}), |
217 |
prop "(CONST Pure.prop :: prop => prop) (A::prop) == A::prop"), |
|
218 |
(Binding.make ("term_def", @{here}), |
|
219 |
prop "(CONST Pure.term :: 'a => prop) (x::'a) == (!!A::prop. A ==> A)"), |
|
220 |
(Binding.make ("sort_constraint_def", @{here}), |
|
56243 | 221 |
prop "(CONST Pure.sort_constraint :: 'a itself => prop) (CONST Pure.type :: 'a itself) ==\ |
222 |
\ (CONST Pure.term :: 'a itself => prop) (CONST Pure.type :: 'a itself)"), |
|
56436 | 223 |
(Binding.make ("conjunction_def", @{here}), |
224 |
prop "(A &&& B) == (!!C::prop. (A ==> B ==> C) ==> C)")] #> snd |
|
225 |
#> Global_Theory.add_thmss [((Binding.make ("nothing", @{here}), []), [])] #> snd |
|
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42297
diff
changeset
|
226 |
#> fold (fn (a, prop) => |
56436 | 227 |
snd o Thm.add_axiom_global (Binding.make (a, @{here}), prop)) Proofterm.equality_axms); |
3987 | 228 |
|
229 |
end; |