author | wenzelm |
Fri, 20 Sep 2024 23:36:33 +0200 | |
changeset 80916 | 01b8c8d17f13 |
parent 80897 | 5328d67ec647 |
child 80921 | a37ed1aeb163 |
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 |
||
70388
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
17 |
(* auxiliary *) |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
18 |
|
33384 | 19 |
val typ = Simple_Syntax.read_typ; |
20 |
val prop = Simple_Syntax.read_prop; |
|
35429
afa8cf9e63d8
authentic syntax for classes and type constructors;
wenzelm
parents:
35262
diff
changeset
|
21 |
|
42290
b1f544c84040
discontinued special treatment of structure Lexicon;
wenzelm
parents:
42288
diff
changeset
|
22 |
val tycon = Lexicon.mark_type; |
b1f544c84040
discontinued special treatment of structure Lexicon;
wenzelm
parents:
42288
diff
changeset
|
23 |
val const = Lexicon.mark_const; |
24243 | 24 |
|
56234 | 25 |
val qualify = Binding.qualify true Context.PureN; |
26 |
||
62752 | 27 |
fun mixfix (sy, ps, p) = Mixfix (Input.string sy, ps, p, Position.no_range); |
28 |
fun infix_ (sy, p) = Infix (Input.string sy, p, Position.no_range); |
|
29 |
fun infixr_ (sy, p) = Infixr (Input.string sy, p, Position.no_range); |
|
30 |
fun binder (sy, p, q) = Binder (Input.string sy, p, q, Position.no_range); |
|
31 |
||
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
32 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
33 |
(* application syntax variants *) |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
34 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
35 |
val appl_syntax = |
80916 | 36 |
[("_appl", typ "('b \<Rightarrow> 'a) \<Rightarrow> args \<Rightarrow> logic", |
37 |
mixfix ("(\<open>indent=1 expression=term_application\<close>_/(1'(_')))", [1000, 0], 1000)), |
|
38 |
("_appl", typ "('b \<Rightarrow> 'a) \<Rightarrow> args \<Rightarrow> aprop", |
|
39 |
mixfix ("(\<open>indent=1 expression=term_application\<close>_/(1'(_')))", [1000, 0], 1000))]; |
|
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
40 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
41 |
val applC_syntax = |
67721 | 42 |
[("", typ "'a \<Rightarrow> cargs", Mixfix.mixfix "_"), |
43 |
("_cargs", typ "'a \<Rightarrow> cargs \<Rightarrow> cargs", mixfix ("_/ _", [1000, 1000], 1000)), |
|
80916 | 44 |
("_applC", typ "('b \<Rightarrow> 'a) \<Rightarrow> cargs \<Rightarrow> logic", |
45 |
mixfix ("(\<open>indent=1 expression=term_application\<close>_/ _)", [1000, 1000], 999)), |
|
46 |
("_applC", typ "('b \<Rightarrow> 'a) \<Rightarrow> cargs \<Rightarrow> aprop", |
|
47 |
mixfix ("(\<open>indent=1 expression=term_application\<close>_/ _)", [1000, 1000], 999))]; |
|
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
48 |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
49 |
structure Old_Appl_Syntax = Theory_Data |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
50 |
( |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
51 |
type T = bool; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
52 |
val empty = false; |
33522 | 53 |
fun merge (b1, b2) : T = |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
54 |
if b1 = b2 then b1 |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
55 |
else error "Cannot merge theories with different application syntax"; |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
56 |
); |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
57 |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
58 |
val old_appl_syntax = Old_Appl_Syntax.get; |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
59 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
60 |
val old_appl_syntax_setup = |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
61 |
Old_Appl_Syntax.put true #> |
80897
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
62 |
Sign.syntax_global false Syntax.mode_default applC_syntax #> |
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
63 |
Sign.syntax_global true Syntax.mode_default appl_syntax; |
26959
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
64 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
65 |
|
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
66 |
(* main content *) |
f8f2df3e4d83
theory Pure provides regular application syntax by default;
wenzelm
parents:
26693
diff
changeset
|
67 |
|
52160 | 68 |
val token_markers = |
69 |
["_tfree", "_tvar", "_free", "_bound", "_loose", "_var", "_numeral", "_inner_string"]; |
|
70 |
||
53171 | 71 |
val _ = Theory.setup |
72053
4ed33ea8d957
prefer conservative extend/merge of theory naming;
wenzelm
parents:
71777
diff
changeset
|
72 |
(Sign.init_naming #> |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36744
diff
changeset
|
73 |
Old_Appl_Syntax.put false #> |
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42297
diff
changeset
|
74 |
Sign.add_types_global |
64556 | 75 |
[(Binding.make ("fun", \<^here>), 2, NoSyn), |
76 |
(Binding.make ("prop", \<^here>), 0, NoSyn), |
|
77 |
(Binding.make ("itself", \<^here>), 1, NoSyn), |
|
70388
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
78 |
(Binding.make ("dummy", \<^here>), 0, NoSyn), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
79 |
(qualify (Binding.make ("proof", \<^here>)), 0, NoSyn)] |
74339 | 80 |
#> Theory.add_deps_type "fun" |
81 |
#> Theory.add_deps_type "prop" |
|
82 |
#> Theory.add_deps_type "itself" |
|
83 |
#> Theory.add_deps_type "dummy" |
|
84 |
#> Theory.add_deps_type "Pure.proof" |
|
52160 | 85 |
#> Sign.add_nonterminals_global |
64556 | 86 |
(map (fn name => Binding.make (name, \<^here>)) |
52160 | 87 |
(Lexicon.terminals @ ["logic", "type", "types", "sort", "classes", |
88 |
"args", "cargs", "pttrn", "pttrns", "idt", "idts", "aprop", "asms", |
|
58421 | 89 |
"any", "prop'", "num_const", "float_const", "num_position", |
90 |
"float_position", "index", "struct", "tid_position", |
|
55108
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
91 |
"tvar_position", "id_position", "longid_position", "var_position", |
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
92 |
"str_position", "string_position", "cartouche_position", "type_name", |
0b7a0c1fdf7e
inner syntax token language allows regular quoted strings;
wenzelm
parents:
55033
diff
changeset
|
93 |
"class_name"])) |
80897
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
94 |
#> Sign.syntax_global true Syntax.mode_default (map (fn x => (x, typ "'a", NoSyn)) token_markers) |
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
95 |
#> Sign.syntax_global true Syntax.mode_default |
67721 | 96 |
[("", typ "prop' \<Rightarrow> prop", Mixfix.mixfix "_"), |
97 |
("", typ "logic \<Rightarrow> any", Mixfix.mixfix "_"), |
|
98 |
("", typ "prop' \<Rightarrow> any", Mixfix.mixfix "_"), |
|
99 |
("", typ "logic \<Rightarrow> logic", Mixfix.mixfix "'(_')"), |
|
100 |
("", typ "prop' \<Rightarrow> prop'", Mixfix.mixfix "'(_')"), |
|
101 |
("_constrain", typ "logic \<Rightarrow> type \<Rightarrow> logic", mixfix ("_::_", [4, 0], 3)), |
|
102 |
("_constrain", typ "prop' \<Rightarrow> type \<Rightarrow> prop'", mixfix ("_::_", [4, 0], 3)), |
|
52211
66bc827e37f8
explicit support for type annotations within printed syntax trees;
wenzelm
parents:
52161
diff
changeset
|
103 |
("_ignore_type", typ "'a", NoSyn), |
67721 | 104 |
("", typ "tid_position \<Rightarrow> type", Mixfix.mixfix "_"), |
105 |
("", typ "tvar_position \<Rightarrow> type", Mixfix.mixfix "_"), |
|
106 |
("", typ "type_name \<Rightarrow> type", Mixfix.mixfix "_"), |
|
107 |
("_type_name", typ "id \<Rightarrow> type_name", Mixfix.mixfix "_"), |
|
108 |
("_type_name", typ "longid \<Rightarrow> type_name", Mixfix.mixfix "_"), |
|
109 |
("_ofsort", typ "tid_position \<Rightarrow> sort \<Rightarrow> type", mixfix ("_::_", [1000, 0], 1000)), |
|
110 |
("_ofsort", typ "tvar_position \<Rightarrow> sort \<Rightarrow> type", mixfix ("_::_", [1000, 0], 1000)), |
|
71546 | 111 |
("_dummy_ofsort", typ "sort \<Rightarrow> type", mixfix ("'_' ::_", [0], 1000)), |
67721 | 112 |
("", typ "class_name \<Rightarrow> sort", Mixfix.mixfix "_"), |
113 |
("_class_name", typ "id \<Rightarrow> class_name", Mixfix.mixfix "_"), |
|
114 |
("_class_name", typ "longid \<Rightarrow> class_name", Mixfix.mixfix "_"), |
|
67718 | 115 |
("_dummy_sort", typ "sort", Mixfix.mixfix "'_"), |
62761 | 116 |
("_topsort", typ "sort", Mixfix.mixfix "{}"), |
67721 | 117 |
("_sort", typ "classes \<Rightarrow> sort", Mixfix.mixfix "{_}"), |
118 |
("", typ "class_name \<Rightarrow> classes", Mixfix.mixfix "_"), |
|
119 |
("_classes", typ "class_name \<Rightarrow> classes \<Rightarrow> classes", Mixfix.mixfix "_,_"), |
|
120 |
("_tapp", typ "type \<Rightarrow> type_name \<Rightarrow> type", mixfix ("_ _", [1000, 0], 1000)), |
|
80916 | 121 |
("_tappl", typ "type \<Rightarrow> types \<Rightarrow> type_name \<Rightarrow> type", |
122 |
Mixfix.mixfix "(\<open>expression=type_application\<close>(1'(_,/ _')) _)"), |
|
67721 | 123 |
("", typ "type \<Rightarrow> types", Mixfix.mixfix "_"), |
124 |
("_types", typ "type \<Rightarrow> types \<Rightarrow> types", Mixfix.mixfix "_,/ _"), |
|
80916 | 125 |
("\<^type>fun", typ "type \<Rightarrow> type \<Rightarrow> type", |
126 |
mixfix ("(\<open>notation=\<open>infix \<Rightarrow>\<close>\<close>_/ \<Rightarrow> _)", [1, 0], 0)), |
|
127 |
("_bracket", typ "types \<Rightarrow> type \<Rightarrow> type", |
|
128 |
mixfix ("(\<open>notation=\<open>infix \<Rightarrow>\<close>\<close>[_]/ \<Rightarrow> _)", [0, 0], 0)), |
|
67721 | 129 |
("", typ "type \<Rightarrow> type", Mixfix.mixfix "'(_')"), |
62761 | 130 |
("\<^type>dummy", typ "type", Mixfix.mixfix "'_"), |
42263
49b1b8d0782f
type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents:
42245
diff
changeset
|
131 |
("_type_prop", typ "'a", NoSyn), |
80916 | 132 |
("_lambda", typ "pttrns \<Rightarrow> 'a \<Rightarrow> logic", |
133 |
mixfix ("(\<open>indent=3 expression=term_abstraction\<close>\<lambda>_./ _)", [0, 3], 3)), |
|
26436 | 134 |
("_abs", typ "'a", NoSyn), |
67721 | 135 |
("", typ "'a \<Rightarrow> args", Mixfix.mixfix "_"), |
136 |
("_args", typ "'a \<Rightarrow> args \<Rightarrow> args", Mixfix.mixfix "_,/ _"), |
|
137 |
("", typ "id_position \<Rightarrow> idt", Mixfix.mixfix "_"), |
|
62761 | 138 |
("_idtdummy", typ "idt", Mixfix.mixfix "'_"), |
67721 | 139 |
("_idtyp", typ "id_position \<Rightarrow> type \<Rightarrow> idt", mixfix ("_::_", [], 0)), |
71546 | 140 |
("_idtypdummy", typ "type \<Rightarrow> idt", mixfix ("'_' ::_", [], 0)), |
67721 | 141 |
("", typ "idt \<Rightarrow> idt", Mixfix.mixfix "'(_')"), |
142 |
("", typ "idt \<Rightarrow> idts", Mixfix.mixfix "_"), |
|
143 |
("_idts", typ "idt \<Rightarrow> idts \<Rightarrow> idts", mixfix ("_/ _", [1, 0], 0)), |
|
144 |
("", typ "idt \<Rightarrow> pttrn", Mixfix.mixfix "_"), |
|
145 |
("", typ "pttrn \<Rightarrow> pttrns", Mixfix.mixfix "_"), |
|
146 |
("_pttrns", typ "pttrn \<Rightarrow> pttrns \<Rightarrow> pttrns", mixfix ("_/ _", [1, 0], 0)), |
|
147 |
("", typ "aprop \<Rightarrow> aprop", Mixfix.mixfix "'(_')"), |
|
148 |
("", typ "id_position \<Rightarrow> aprop", Mixfix.mixfix "_"), |
|
149 |
("", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "_"), |
|
150 |
("", typ "var_position \<Rightarrow> aprop", Mixfix.mixfix "_"), |
|
62761 | 151 |
("_DDDOT", typ "aprop", Mixfix.mixfix "\<dots>"), |
67721 | 152 |
("_aprop", typ "aprop \<Rightarrow> prop", Mixfix.mixfix "PROP _"), |
153 |
("_asm", typ "prop \<Rightarrow> asms", Mixfix.mixfix "_"), |
|
154 |
("_asms", typ "prop \<Rightarrow> asms \<Rightarrow> asms", Mixfix.mixfix "_;/ _"), |
|
80916 | 155 |
("_bigimpl", typ "asms \<Rightarrow> prop \<Rightarrow> prop", |
156 |
mixfix ("(\<open>notation=\<open>infix \<Longrightarrow>\<close>\<close>(1\<lbrakk>_\<rbrakk>)/ \<Longrightarrow> _)", [0, 1], 1)), |
|
67721 | 157 |
("_ofclass", typ "type \<Rightarrow> logic \<Rightarrow> prop", Mixfix.mixfix "(1OFCLASS/(1'(_,/ _')))"), |
26436 | 158 |
("_mk_ofclass", typ "dummy", NoSyn), |
67721 | 159 |
("_TYPE", typ "type \<Rightarrow> logic", Mixfix.mixfix "(1TYPE/(1'(_')))"), |
160 |
("", typ "id_position \<Rightarrow> logic", Mixfix.mixfix "_"), |
|
161 |
("", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "_"), |
|
162 |
("", typ "var_position \<Rightarrow> logic", Mixfix.mixfix "_"), |
|
62761 | 163 |
("_DDDOT", typ "logic", Mixfix.mixfix "\<dots>"), |
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
|
164 |
("_strip_positions", typ "'a", NoSyn), |
67721 | 165 |
("_position", typ "num_token \<Rightarrow> num_position", Mixfix.mixfix "_"), |
166 |
("_position", typ "float_token \<Rightarrow> float_position", Mixfix.mixfix "_"), |
|
167 |
("_constify", typ "num_position \<Rightarrow> num_const", Mixfix.mixfix "_"), |
|
168 |
("_constify", typ "float_position \<Rightarrow> float_const", Mixfix.mixfix "_"), |
|
169 |
("_index", typ "logic \<Rightarrow> index", Mixfix.mixfix "(\<open>unbreakable\<close>\<^bsub>_\<^esub>)"), |
|
62761 | 170 |
("_indexdefault", typ "index", Mixfix.mixfix ""), |
171 |
("_indexvar", typ "index", Mixfix.mixfix "'\<index>"), |
|
67721 | 172 |
("_struct", typ "index \<Rightarrow> logic", NoSyn), |
35145
f132a4fd8679
moved generic update_name to Pure syntax -- not specific to HOL/record;
wenzelm
parents:
35130
diff
changeset
|
173 |
("_update_name", typ "idt", NoSyn), |
42295
8fdbb3b10beb
moved CONST syntax/translations to their proper place;
wenzelm
parents:
42294
diff
changeset
|
174 |
("_constrainAbs", typ "'a", NoSyn), |
67721 | 175 |
("_position_sort", typ "tid \<Rightarrow> tid_position", Mixfix.mixfix "_"), |
176 |
("_position_sort", typ "tvar \<Rightarrow> tvar_position", Mixfix.mixfix "_"), |
|
177 |
("_position", typ "id \<Rightarrow> id_position", Mixfix.mixfix "_"), |
|
178 |
("_position", typ "longid \<Rightarrow> longid_position", Mixfix.mixfix "_"), |
|
179 |
("_position", typ "var \<Rightarrow> var_position", Mixfix.mixfix "_"), |
|
180 |
("_position", typ "str_token \<Rightarrow> str_position", Mixfix.mixfix "_"), |
|
181 |
("_position", typ "string_token \<Rightarrow> string_position", Mixfix.mixfix "_"), |
|
182 |
("_position", typ "cartouche \<Rightarrow> cartouche_position", Mixfix.mixfix "_"), |
|
42048
afd11ca8e018
support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents:
39557
diff
changeset
|
183 |
("_type_constraint_", typ "'a", NoSyn), |
67721 | 184 |
("_context_const", typ "id_position \<Rightarrow> logic", Mixfix.mixfix "CONST _"), |
185 |
("_context_const", typ "id_position \<Rightarrow> aprop", Mixfix.mixfix "CONST _"), |
|
186 |
("_context_const", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "CONST _"), |
|
187 |
("_context_const", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "CONST _"), |
|
188 |
("_context_xconst", typ "id_position \<Rightarrow> logic", Mixfix.mixfix "XCONST _"), |
|
189 |
("_context_xconst", typ "id_position \<Rightarrow> aprop", Mixfix.mixfix "XCONST _"), |
|
190 |
("_context_xconst", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "XCONST _"), |
|
191 |
("_context_xconst", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "XCONST _"), |
|
62761 | 192 |
(const "Pure.dummy_pattern", typ "aprop", Mixfix.mixfix "'_"), |
67721 | 193 |
("_sort_constraint", typ "type \<Rightarrow> prop", Mixfix.mixfix "(1SORT'_CONSTRAINT/(1'(_')))"), |
194 |
(const "Pure.term", typ "logic \<Rightarrow> prop", Mixfix.mixfix "TERM _"), |
|
195 |
(const "Pure.conjunction", typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("&&&", 2))] |
|
80897
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
196 |
#> Sign.syntax_global true Syntax.mode_default applC_syntax |
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
197 |
#> Sign.syntax_global true (Print_Mode.ASCII, true) |
80916 | 198 |
[(tycon "fun", typ "type \<Rightarrow> type \<Rightarrow> type", |
199 |
mixfix ("(\<open>notation=\<open>infix =>\<close>\<close>_/ => _)", [1, 0], 0)), |
|
200 |
("_bracket", typ "types \<Rightarrow> type \<Rightarrow> type", |
|
201 |
mixfix ("(\<open>notation=\<open>infix =>\<close>\<close>[_]/ => _)", [0, 0], 0)), |
|
202 |
("_lambda", typ "pttrns \<Rightarrow> 'a \<Rightarrow> logic", |
|
203 |
mixfix ("(\<open>indent=3 expression=term_abstraction\<close>%_./ _)", [0, 3], 3)), |
|
67721 | 204 |
(const "Pure.eq", typ "'a \<Rightarrow> 'a \<Rightarrow> prop", infix_ ("==", 2)), |
80916 | 205 |
(const "Pure.all_binder", typ "idts \<Rightarrow> prop \<Rightarrow> prop", |
206 |
mixfix ("(\<open>indent=3 notation=\<open>binder !!\<close>\<close>!!_./ _)", [0, 0], 0)), |
|
67721 | 207 |
(const "Pure.imp", typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("==>", 1)), |
62761 | 208 |
("_DDDOT", typ "aprop", Mixfix.mixfix "..."), |
80916 | 209 |
("_bigimpl", typ "asms \<Rightarrow> prop \<Rightarrow> prop", |
210 |
mixfix ("(\<open>notation=\<open>infix \<Longrightarrow>\<close>\<close>(3[| _ |])/ ==> _)", [0, 1], 1)), |
|
62761 | 211 |
("_DDDOT", typ "logic", Mixfix.mixfix "...")] |
80897
5328d67ec647
more explicit context for syn_ext/mixfix operations, but it often degenerates to background theory;
wenzelm
parents:
80753
diff
changeset
|
212 |
#> Sign.syntax_global true ("", false) |
67721 | 213 |
[(const "Pure.prop", typ "prop \<Rightarrow> prop", mixfix ("_", [0], 0))] |
56239 | 214 |
#> Sign.add_consts |
67721 | 215 |
[(qualify (Binding.make ("eq", \<^here>)), typ "'a \<Rightarrow> 'a \<Rightarrow> prop", infix_ ("\<equiv>", 2)), |
216 |
(qualify (Binding.make ("imp", \<^here>)), typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("\<Longrightarrow>", 1)), |
|
217 |
(qualify (Binding.make ("all", \<^here>)), typ "('a \<Rightarrow> prop) \<Rightarrow> prop", binder ("\<And>", 0, 0)), |
|
218 |
(qualify (Binding.make ("prop", \<^here>)), typ "prop \<Rightarrow> prop", NoSyn), |
|
64556 | 219 |
(qualify (Binding.make ("type", \<^here>)), typ "'a itself", NoSyn), |
70388
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
220 |
(qualify (Binding.make ("dummy_pattern", \<^here>)), typ "'a", Mixfix.mixfix "'_"), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
221 |
(qualify (Binding.make ("Appt", \<^here>)), typ "Pure.proof \<Rightarrow> 'a \<Rightarrow> Pure.proof", NoSyn), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
222 |
(qualify (Binding.make ("AppP", \<^here>)), typ "Pure.proof \<Rightarrow> Pure.proof \<Rightarrow> Pure.proof", NoSyn), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
223 |
(qualify (Binding.make ("Abst", \<^here>)), typ "('a \<Rightarrow> Pure.proof) \<Rightarrow> Pure.proof", NoSyn), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
224 |
(qualify (Binding.make ("AbsP", \<^here>)), typ "prop \<Rightarrow> (Pure.proof \<Rightarrow> Pure.proof) \<Rightarrow> Pure.proof", NoSyn), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
225 |
(qualify (Binding.make ("Hyp", \<^here>)), typ "prop \<Rightarrow> Pure.proof", NoSyn), |
e31271559de8
global declaration of abstract syntax for proof terms, with qualified names;
wenzelm
parents:
67721
diff
changeset
|
226 |
(qualify (Binding.make ("Oracle", \<^here>)), typ "prop \<Rightarrow> Pure.proof", NoSyn), |
71777
3875815f5967
clarified signature: avoid clash with Isabelle/Scala Term.OFCLASS on case-insensible file-system;
wenzelm
parents:
71546
diff
changeset
|
227 |
(qualify (Binding.make ("PClass", \<^here>)), typ "('a itself \<Rightarrow> prop) \<Rightarrow> Pure.proof", NoSyn), |
70403
468cfd56ee03
avoid global syntax for MinProof (amending e31271559de8);
wenzelm
parents:
70388
diff
changeset
|
228 |
(qualify (Binding.make ("MinProof", \<^here>)), typ "Pure.proof", NoSyn)] |
74339 | 229 |
#> Theory.add_deps_const "Pure.eq" |
230 |
#> Theory.add_deps_const "Pure.imp" |
|
231 |
#> Theory.add_deps_const "Pure.all" |
|
232 |
#> Theory.add_deps_const "Pure.type" |
|
233 |
#> Theory.add_deps_const "Pure.dummy_pattern" |
|
52143 | 234 |
#> Sign.parse_ast_translation Syntax_Trans.pure_parse_ast_translation |
235 |
#> Sign.parse_translation Syntax_Trans.pure_parse_translation |
|
236 |
#> Sign.print_ast_translation Syntax_Trans.pure_print_ast_translation |
|
80753 | 237 |
#> Sign.syntax_deps |
238 |
[("_bracket", ["\<^type>fun"]), ("_bigimpl", ["\<^const>Pure.imp"])] |
|
56239 | 239 |
#> Sign.add_consts |
67721 | 240 |
[(qualify (Binding.make ("term", \<^here>)), typ "'a \<Rightarrow> prop", NoSyn), |
241 |
(qualify (Binding.make ("sort_constraint", \<^here>)), typ "'a itself \<Rightarrow> prop", NoSyn), |
|
242 |
(qualify (Binding.make ("conjunction", \<^here>)), typ "prop \<Rightarrow> prop \<Rightarrow> prop", NoSyn)] |
|
26430 | 243 |
#> Sign.local_path |
79336
032a31db4c6f
clarified signature: downgrade old-style Global_Theory.add_defs to Global_Theory.add_def without attributes;
wenzelm
parents:
79120
diff
changeset
|
244 |
#> fold (snd oo Global_Theory.add_def) |
64556 | 245 |
[(Binding.make ("prop_def", \<^here>), |
67721 | 246 |
prop "(CONST Pure.prop :: prop \<Rightarrow> prop) (A::prop) \<equiv> A::prop"), |
64556 | 247 |
(Binding.make ("term_def", \<^here>), |
67721 | 248 |
prop "(CONST Pure.term :: 'a \<Rightarrow> prop) (x::'a) \<equiv> (\<And>A::prop. A \<Longrightarrow> A)"), |
64556 | 249 |
(Binding.make ("sort_constraint_def", \<^here>), |
67721 | 250 |
prop "(CONST Pure.sort_constraint :: 'a itself \<Rightarrow> prop) (CONST Pure.type :: 'a itself) \<equiv>\ |
251 |
\ (CONST Pure.term :: 'a itself \<Rightarrow> prop) (CONST Pure.type :: 'a itself)"), |
|
64556 | 252 |
(Binding.make ("conjunction_def", \<^here>), |
79336
032a31db4c6f
clarified signature: downgrade old-style Global_Theory.add_defs to Global_Theory.add_def without attributes;
wenzelm
parents:
79120
diff
changeset
|
253 |
prop "(A &&& B) \<equiv> (\<And>C::prop. (A \<Longrightarrow> B \<Longrightarrow> C) \<Longrightarrow> C)")] |
79120 | 254 |
#> fold (#2 oo Thm.add_axiom_global) Theory.equality_axioms); |
3987 | 255 |
|
256 |
end; |