author | wenzelm |
Tue, 06 Nov 2001 01:16:50 +0100 | |
changeset 12061 | 1b77d46d0fd1 |
parent 12044 | d6294ebfff24 |
child 12083 | 15bafeb549e0 |
permissions | -rw-r--r-- |
5832 | 1 |
(* Title: Pure/Isar/isar_syn.ML |
2 |
ID: $Id$ |
|
3 |
Author: Markus Wenzel, TU Muenchen |
|
8807 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
5832 | 5 |
|
6353 | 6 |
Isar/Pure outer syntax. |
5832 | 7 |
*) |
8 |
||
9 |
signature ISAR_SYN = |
|
10 |
sig |
|
11 |
val keywords: string list |
|
12 |
val parsers: OuterSyntax.parser list |
|
13 |
end; |
|
14 |
||
15 |
structure IsarSyn: ISAR_SYN = |
|
16 |
struct |
|
17 |
||
6723 | 18 |
structure P = OuterParse and K = OuterSyntax.Keyword; |
5832 | 19 |
|
20 |
||
21 |
(** init and exit **) |
|
22 |
||
23 |
val theoryP = |
|
6723 | 24 |
OuterSyntax.command "theory" "begin theory" K.thy_begin |
9129 | 25 |
(ThyHeader.args >> (Toplevel.print oo IsarThy.theory)); |
5832 | 26 |
|
6687 | 27 |
val end_excursionP = |
6723 | 28 |
OuterSyntax.command "end" "end current excursion" K.thy_end |
6687 | 29 |
(Scan.succeed (Toplevel.print o Toplevel.exit)); |
30 |
||
6245 | 31 |
val contextP = |
7102 | 32 |
OuterSyntax.improper_command "context" "switch theory context" K.thy_switch |
6723 | 33 |
(P.name >> (Toplevel.print oo IsarThy.context)); |
6245 | 34 |
|
5832 | 35 |
|
36 |
||
7749 | 37 |
(** markup commands **) |
5832 | 38 |
|
9129 | 39 |
val headerP = OuterSyntax.markup_command IsarOutput.Markup "header" "theory header" K.diag |
7733 | 40 |
(P.comment >> IsarThy.add_header); |
6353 | 41 |
|
9129 | 42 |
val chapterP = OuterSyntax.markup_command IsarOutput.Markup "chapter" "chapter heading" |
43 |
K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_chapter)); |
|
5958 | 44 |
|
9129 | 45 |
val sectionP = OuterSyntax.markup_command IsarOutput.Markup "section" "section heading" |
46 |
K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_section)); |
|
5958 | 47 |
|
9129 | 48 |
val subsectionP = OuterSyntax.markup_command IsarOutput.Markup "subsection" "subsection heading" |
49 |
K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_subsection)); |
|
5958 | 50 |
|
7749 | 51 |
val subsubsectionP = |
9129 | 52 |
OuterSyntax.markup_command IsarOutput.Markup "subsubsection" "subsubsection heading" |
53 |
K.thy_heading (P.comment >> (Toplevel.theory o IsarThy.add_subsubsection)); |
|
5832 | 54 |
|
9129 | 55 |
val textP = OuterSyntax.markup_command IsarOutput.MarkupEnv "text" "formal comment (theory)" |
56 |
K.thy_decl (P.comment >> (Toplevel.theory o IsarThy.add_text)); |
|
7172 | 57 |
|
9129 | 58 |
val text_rawP = OuterSyntax.markup_command IsarOutput.Verbatim "text_raw" |
59 |
"raw document preparation text" K.thy_decl |
|
60 |
(P.comment >> (Toplevel.theory o IsarThy.add_text_raw)); |
|
7775 | 61 |
|
7172 | 62 |
|
9552 | 63 |
val sectP = OuterSyntax.markup_command IsarOutput.Markup "sect" "formal comment (proof)" |
64 |
K.prf_heading (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_sect))); |
|
7172 | 65 |
|
9129 | 66 |
val subsectP = OuterSyntax.markup_command IsarOutput.Markup "subsect" "formal comment (proof)" |
9552 | 67 |
K.prf_heading (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_subsect))); |
7172 | 68 |
|
9129 | 69 |
val subsubsectP = OuterSyntax.markup_command IsarOutput.Markup "subsubsect" |
9552 | 70 |
"formal comment (proof)" K.prf_heading |
7172 | 71 |
(P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_subsubsect))); |
72 |
||
9129 | 73 |
val txtP = OuterSyntax.markup_command IsarOutput.MarkupEnv "txt" "formal comment (proof)" |
74 |
K.prf_decl (P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_txt))); |
|
7172 | 75 |
|
9129 | 76 |
val txt_rawP = OuterSyntax.markup_command IsarOutput.Verbatim "txt_raw" |
77 |
"raw document preparation text (proof)" K.prf_decl |
|
78 |
(P.comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.add_txt_raw))); |
|
7775 | 79 |
|
5832 | 80 |
|
6886 | 81 |
|
82 |
(** theory sections **) |
|
83 |
||
5832 | 84 |
(* classes and sorts *) |
85 |
||
86 |
val classesP = |
|
6723 | 87 |
OuterSyntax.command "classes" "declare type classes" K.thy_decl |
11101
014e7b5c77ba
support \<subseteq> syntax in classes/classrel/axclass/instance;
wenzelm
parents:
11017
diff
changeset
|
88 |
(Scan.repeat1 (P.name -- Scan.optional ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- |
014e7b5c77ba
support \<subseteq> syntax in classes/classrel/axclass/instance;
wenzelm
parents:
11017
diff
changeset
|
89 |
P.!!! (P.list1 P.xname)) []) |
6727 | 90 |
-- P.marg_comment >> (Toplevel.theory o IsarThy.add_classes)); |
5832 | 91 |
|
92 |
val classrelP = |
|
6723 | 93 |
OuterSyntax.command "classrel" "state inclusion of type classes (axiomatic!)" K.thy_decl |
11101
014e7b5c77ba
support \<subseteq> syntax in classes/classrel/axclass/instance;
wenzelm
parents:
11017
diff
changeset
|
94 |
(P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname) -- P.marg_comment |
6727 | 95 |
>> (Toplevel.theory o IsarThy.add_classrel)); |
5832 | 96 |
|
97 |
val defaultsortP = |
|
6723 | 98 |
OuterSyntax.command "defaultsort" "declare default sort" K.thy_decl |
6727 | 99 |
(P.sort -- P.marg_comment >> (Toplevel.theory o IsarThy.add_defsort)); |
5832 | 100 |
|
101 |
||
102 |
(* types *) |
|
103 |
||
104 |
val typedeclP = |
|
6723 | 105 |
OuterSyntax.command "typedecl" "Pure type declaration" K.thy_decl |
6727 | 106 |
(P.type_args -- P.name -- P.opt_infix -- P.marg_comment >> (fn (((args, a), mx), cmt) => |
107 |
Toplevel.theory (IsarThy.add_typedecl ((a, args, mx), cmt)))); |
|
5832 | 108 |
|
109 |
val typeabbrP = |
|
6723 | 110 |
OuterSyntax.command "types" "declare type abbreviations" K.thy_decl |
6727 | 111 |
(Scan.repeat1 |
9037 | 112 |
(P.type_args -- P.name -- (P.$$$ "=" |-- P.!!! (P.typ -- P.opt_infix')) -- P.marg_comment) |
6727 | 113 |
>> (Toplevel.theory o IsarThy.add_tyabbrs o |
114 |
map (fn (((args, a), (T, mx)), cmt) => ((a, args, T, mx), cmt)))); |
|
5832 | 115 |
|
116 |
val nontermP = |
|
6370 | 117 |
OuterSyntax.command "nonterminals" "declare types treated as grammar nonterminal symbols" |
6727 | 118 |
K.thy_decl (Scan.repeat1 (P.name -- P.marg_comment) |
119 |
>> (Toplevel.theory o IsarThy.add_nonterminals)); |
|
5832 | 120 |
|
121 |
val aritiesP = |
|
6723 | 122 |
OuterSyntax.command "arities" "state type arities (axiomatic!)" K.thy_decl |
6727 | 123 |
(Scan.repeat1 ((P.xname -- (P.$$$ "::" |-- P.!!! P.arity) >> P.triple2) -- P.marg_comment) |
124 |
>> (Toplevel.theory o IsarThy.add_arities)); |
|
5832 | 125 |
|
126 |
||
127 |
(* consts and syntax *) |
|
128 |
||
8227 | 129 |
val judgmentP = |
130 |
OuterSyntax.command "judgment" "declare object-logic judgment" K.thy_decl |
|
131 |
(P.const -- P.marg_comment >> (Toplevel.theory o IsarThy.add_judgment)); |
|
132 |
||
5832 | 133 |
val constsP = |
6723 | 134 |
OuterSyntax.command "consts" "declare constants" K.thy_decl |
6727 | 135 |
(Scan.repeat1 (P.const -- P.marg_comment) >> (Toplevel.theory o IsarThy.add_consts)); |
5832 | 136 |
|
9731 | 137 |
|
138 |
val mode_spec = |
|
139 |
(P.$$$ "output" >> K ("", false)) || P.name -- Scan.optional (P.$$$ "output" >> K false) true; |
|
140 |
||
141 |
val opt_mode = Scan.optional (P.$$$ "(" |-- P.!!! (mode_spec --| P.$$$ ")")) ("", true); |
|
5832 | 142 |
|
143 |
val syntaxP = |
|
6723 | 144 |
OuterSyntax.command "syntax" "declare syntactic constants" K.thy_decl |
6727 | 145 |
(opt_mode -- Scan.repeat1 (P.const -- P.marg_comment) |
146 |
>> (Toplevel.theory o uncurry IsarThy.add_modesyntax)); |
|
5832 | 147 |
|
148 |
||
149 |
(* translations *) |
|
150 |
||
151 |
val trans_pat = |
|
6723 | 152 |
Scan.optional (P.$$$ "(" |-- P.!!! (P.xname --| P.$$$ ")")) "logic" -- P.string; |
5832 | 153 |
|
154 |
fun trans_arrow toks = |
|
10688 | 155 |
((P.$$$ "\\<rightharpoonup>" || P.$$$ "=>") >> K Syntax.ParseRule || |
156 |
(P.$$$ "\\<leftharpoondown>" || P.$$$ "<=") >> K Syntax.PrintRule || |
|
157 |
(P.$$$ "\\<rightleftharpoons>" || P.$$$ "==") >> K Syntax.ParsePrintRule) toks; |
|
5832 | 158 |
|
159 |
val trans_line = |
|
6723 | 160 |
trans_pat -- P.!!! (trans_arrow -- trans_pat) |
5832 | 161 |
>> (fn (left, (arr, right)) => arr (left, right)); |
162 |
||
163 |
val translationsP = |
|
6723 | 164 |
OuterSyntax.command "translations" "declare syntax translation rules" K.thy_decl |
6727 | 165 |
(Scan.repeat1 (trans_line -- P.marg_comment) >> (Toplevel.theory o IsarThy.add_trrules)); |
5832 | 166 |
|
167 |
||
168 |
(* axioms and definitions *) |
|
169 |
||
170 |
val axiomsP = |
|
6723 | 171 |
OuterSyntax.command "axioms" "state arbitrary propositions (axiomatic!)" K.thy_decl |
6727 | 172 |
(Scan.repeat1 (P.spec_name -- P.marg_comment) >> (Toplevel.theory o IsarThy.add_axioms)); |
5832 | 173 |
|
9323 | 174 |
val opt_overloaded = |
175 |
Scan.optional (P.$$$ "(" |-- P.!!! ((P.$$$ "overloaded" >> K true) --| P.$$$ ")")) false; |
|
176 |
||
5832 | 177 |
val defsP = |
6723 | 178 |
OuterSyntax.command "defs" "define constants" K.thy_decl |
9323 | 179 |
(opt_overloaded -- Scan.repeat1 (P.spec_name -- P.marg_comment) |
180 |
>> (Toplevel.theory o IsarThy.add_defs)); |
|
6370 | 181 |
|
182 |
val constdefsP = |
|
6723 | 183 |
OuterSyntax.command "constdefs" "declare and define constants" K.thy_decl |
6727 | 184 |
(Scan.repeat1 ((P.const -- P.marg_comment) -- (P.term -- P.marg_comment)) |
185 |
>> (Toplevel.theory o IsarThy.add_constdefs)); |
|
5832 | 186 |
|
187 |
||
5914 | 188 |
(* theorems *) |
189 |
||
9197 | 190 |
val name_facts = P.and_list1 (P.opt_thm_name "=" -- P.xthms1 -- P.marg_comment); |
5914 | 191 |
|
192 |
val theoremsP = |
|
6723 | 193 |
OuterSyntax.command "theorems" "define theorems" K.thy_decl |
11742 | 194 |
(name_facts >> (Toplevel.theory o IsarThy.have_theorems Drule.theoremK)); |
5914 | 195 |
|
196 |
val lemmasP = |
|
6723 | 197 |
OuterSyntax.command "lemmas" "define lemmas" K.thy_decl |
11742 | 198 |
(name_facts >> (Toplevel.theory o IsarThy.have_theorems Drule.lemmaK)); |
5914 | 199 |
|
9589 | 200 |
val declareP = |
9776 | 201 |
OuterSyntax.command "declare" "declare theorems (improper)" K.thy_script |
9589 | 202 |
(P.xthms1 -- P.marg_comment >> (Toplevel.theory o IsarThy.declare_theorems)); |
203 |
||
5914 | 204 |
|
5832 | 205 |
(* name space entry path *) |
206 |
||
207 |
val globalP = |
|
6723 | 208 |
OuterSyntax.command "global" "disable prefixing of theory name" K.thy_decl |
8723 | 209 |
(P.marg_comment >> (Toplevel.theory o IsarThy.global_path)); |
5832 | 210 |
|
211 |
val localP = |
|
6723 | 212 |
OuterSyntax.command "local" "enable prefixing of theory name" K.thy_decl |
8723 | 213 |
(P.marg_comment >> (Toplevel.theory o IsarThy.local_path)); |
214 |
||
215 |
val hideP = |
|
216 |
OuterSyntax.command "hide" "hide names from given name space" K.thy_decl |
|
217 |
(P.name -- Scan.repeat1 P.xname -- P.marg_comment >> (Toplevel.theory o IsarThy.hide_space)); |
|
5832 | 218 |
|
219 |
||
220 |
(* use ML text *) |
|
221 |
||
222 |
val useP = |
|
6723 | 223 |
OuterSyntax.command "use" "eval ML text from file" K.diag |
9273 | 224 |
(P.name -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.use)); |
5832 | 225 |
|
226 |
val mlP = |
|
7616 | 227 |
OuterSyntax.command "ML" "eval ML text (diagnostic)" K.diag |
9273 | 228 |
(P.text -- P.marg_comment >> IsarCmd.use_mltext true); |
7891 | 229 |
|
230 |
val ml_commandP = |
|
231 |
OuterSyntax.command "ML_command" "eval ML text" K.diag |
|
9978 | 232 |
(P.text -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.use_mltext false)); |
7616 | 233 |
|
234 |
val ml_setupP = |
|
235 |
OuterSyntax.command "ML_setup" "eval ML text (may change theory)" K.thy_decl |
|
9273 | 236 |
(P.text -- P.marg_comment >> IsarCmd.use_mltext_theory); |
5832 | 237 |
|
238 |
val setupP = |
|
7616 | 239 |
OuterSyntax.command "setup" "apply ML theory setup" K.thy_decl |
9273 | 240 |
(P.text -- P.marg_comment >> (Toplevel.theory o IsarCmd.use_setup)); |
5832 | 241 |
|
9197 | 242 |
val method_setupP = |
243 |
OuterSyntax.command "method_setup" "define proof method in ML" K.thy_decl |
|
244 |
(((P.name -- P.!!! (P.$$$ "=" |-- P.text -- P.text) >> P.triple2) |
|
245 |
-- P.marg_comment) >> (Toplevel.theory o IsarThy.method_setup)); |
|
246 |
||
5832 | 247 |
|
248 |
(* translation functions *) |
|
249 |
||
250 |
val parse_ast_translationP = |
|
6723 | 251 |
OuterSyntax.command "parse_ast_translation" "install parse ast translation functions" K.thy_decl |
9273 | 252 |
(P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.parse_ast_translation)); |
5832 | 253 |
|
254 |
val parse_translationP = |
|
6723 | 255 |
OuterSyntax.command "parse_translation" "install parse translation functions" K.thy_decl |
9273 | 256 |
(P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.parse_translation)); |
5832 | 257 |
|
258 |
val print_translationP = |
|
6723 | 259 |
OuterSyntax.command "print_translation" "install print translation functions" K.thy_decl |
9273 | 260 |
(P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.print_translation)); |
5832 | 261 |
|
262 |
val typed_print_translationP = |
|
6370 | 263 |
OuterSyntax.command "typed_print_translation" "install typed print translation functions" |
9273 | 264 |
K.thy_decl (P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.typed_print_translation)); |
5832 | 265 |
|
266 |
val print_ast_translationP = |
|
6723 | 267 |
OuterSyntax.command "print_ast_translation" "install print ast translation functions" K.thy_decl |
9273 | 268 |
(P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.print_ast_translation)); |
5832 | 269 |
|
270 |
val token_translationP = |
|
6723 | 271 |
OuterSyntax.command "token_translation" "install token translation functions" K.thy_decl |
9273 | 272 |
(P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.token_translation)); |
5832 | 273 |
|
274 |
||
275 |
(* oracles *) |
|
276 |
||
277 |
val oracleP = |
|
6723 | 278 |
OuterSyntax.command "oracle" "install oracle" K.thy_decl |
7140 | 279 |
((P.name --| P.$$$ "=") -- P.text -- P.marg_comment >> (Toplevel.theory o IsarThy.add_oracle)); |
5832 | 280 |
|
281 |
||
12061 | 282 |
(* locales *) |
283 |
||
284 |
val locale_decl = |
|
285 |
(P.name --| P.$$$ "=") -- |
|
286 |
(Scan.repeat1 (P.xname --| P.$$$ "+") -- Scan.repeat (P.locale_element -- P.marg_comment) || |
|
287 |
Scan.repeat1 (P.locale_element -- P.marg_comment) >> pair []) >> P.triple2; |
|
288 |
||
289 |
val localeP = |
|
290 |
OuterSyntax.command "locale" "define named proof context" K.thy_decl |
|
291 |
(locale_decl >> (Toplevel.theory o IsarThy.add_locale)); |
|
292 |
||
293 |
||
5832 | 294 |
|
295 |
(** proof commands **) |
|
296 |
||
297 |
(* statements *) |
|
298 |
||
12061 | 299 |
val in_locale = Scan.optional (P.$$$ "(" |-- P.!!! |
300 |
((P.$$$ "in" |-- P.xname -- P.opt_attribs >> Some) -- Scan.repeat P.locale_element || |
|
12044 | 301 |
Scan.repeat1 P.locale_element >> pair None) --| P.$$$ ")") (None, []); |
302 |
||
12006 | 303 |
val statement = P.opt_thm_name ":" -- P.propp -- P.marg_comment; |
5832 | 304 |
|
305 |
val theoremP = |
|
6723 | 306 |
OuterSyntax.command "theorem" "state theorem" K.thy_goal |
12061 | 307 |
(in_locale -- statement >> ((Toplevel.print oo Toplevel.theory_to_proof) o |
12006 | 308 |
uncurry (IsarThy.theorem Drule.theoremK))); |
5832 | 309 |
|
310 |
val lemmaP = |
|
6723 | 311 |
OuterSyntax.command "lemma" "state lemma" K.thy_goal |
12061 | 312 |
(in_locale -- statement >> ((Toplevel.print oo Toplevel.theory_to_proof) o |
12006 | 313 |
uncurry (IsarThy.theorem Drule.lemmaK))); |
11742 | 314 |
|
315 |
val corollaryP = |
|
316 |
OuterSyntax.command "corollary" "state corollary" K.thy_goal |
|
12061 | 317 |
(in_locale -- statement >> ((Toplevel.print oo Toplevel.theory_to_proof) o |
12006 | 318 |
uncurry (IsarThy.theorem Drule.corollaryK))); |
5832 | 319 |
|
320 |
val showP = |
|
6723 | 321 |
OuterSyntax.command "show" "state local goal, solving current obligation" K.prf_goal |
12006 | 322 |
(statement >> ((Toplevel.print oo Toplevel.proof') o IsarThy.show)); |
5832 | 323 |
|
324 |
val haveP = |
|
6723 | 325 |
OuterSyntax.command "have" "state local goal" K.prf_goal |
12006 | 326 |
(statement >> ((Toplevel.print oo Toplevel.proof) o IsarThy.have)); |
5832 | 327 |
|
6501 | 328 |
val thusP = |
6723 | 329 |
OuterSyntax.command "thus" "abbreviates \"then show\"" K.prf_goal |
12006 | 330 |
(statement >> ((Toplevel.print oo Toplevel.proof') o IsarThy.thus)); |
6501 | 331 |
|
332 |
val henceP = |
|
6723 | 333 |
OuterSyntax.command "hence" "abbreviates \"then have\"" K.prf_goal |
12006 | 334 |
(statement >> ((Toplevel.print oo Toplevel.proof) o IsarThy.hence)); |
6501 | 335 |
|
5832 | 336 |
|
5914 | 337 |
(* facts *) |
5832 | 338 |
|
9197 | 339 |
val facts = P.and_list1 (P.xthms1 -- P.marg_comment); |
340 |
||
5832 | 341 |
val thenP = |
6723 | 342 |
OuterSyntax.command "then" "forward chaining" K.prf_chain |
6727 | 343 |
(P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.chain))); |
5832 | 344 |
|
345 |
val fromP = |
|
6723 | 346 |
OuterSyntax.command "from" "forward chaining from given facts" K.prf_chain |
9197 | 347 |
(facts >> (Toplevel.print oo (Toplevel.proof o IsarThy.from_facts))); |
5914 | 348 |
|
6878 | 349 |
val withP = |
350 |
OuterSyntax.command "with" "forward chaining from given and current facts" K.prf_chain |
|
9197 | 351 |
(facts >> (Toplevel.print oo (Toplevel.proof o IsarThy.with_facts))); |
6878 | 352 |
|
6773 | 353 |
val noteP = |
6723 | 354 |
OuterSyntax.command "note" "define facts" K.prf_decl |
9197 | 355 |
(name_facts >> (Toplevel.print oo (Toplevel.proof o IsarThy.have_facts))); |
5832 | 356 |
|
357 |
||
358 |
(* proof context *) |
|
359 |
||
11890 | 360 |
val fixP = |
361 |
OuterSyntax.command "fix" "fix variables (Skolem constants)" K.prf_asm |
|
362 |
(P.and_list1 (Scan.repeat1 P.name -- Scan.option (P.$$$ "::" |-- P.typ) -- P.marg_comment) |
|
363 |
>> (Toplevel.print oo (Toplevel.proof o IsarThy.fix))); |
|
364 |
||
5832 | 365 |
val assumeP = |
6869 | 366 |
OuterSyntax.command "assume" "assume propositions" K.prf_asm |
10464 | 367 |
(P.and_list1 (P.opt_thm_name ":" -- Scan.repeat1 P.propp -- P.marg_comment) |
6727 | 368 |
>> (Toplevel.print oo (Toplevel.proof o IsarThy.assume))); |
5832 | 369 |
|
6850 | 370 |
val presumeP = |
6869 | 371 |
OuterSyntax.command "presume" "assume propositions, to be established later" K.prf_asm |
10464 | 372 |
(P.and_list1 (P.opt_thm_name ":" -- Scan.repeat1 P.propp -- P.marg_comment) |
6850 | 373 |
>> (Toplevel.print oo (Toplevel.proof o IsarThy.presume))); |
374 |
||
6953 | 375 |
val defP = |
376 |
OuterSyntax.command "def" "local definition" K.prf_asm |
|
10688 | 377 |
(P.opt_thm_name ":" -- (P.name -- ((P.$$$ "\\<equiv>" || P.$$$ "==") |-- P.!!! P.termp)) |
9465 | 378 |
-- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.local_def))); |
6953 | 379 |
|
11890 | 380 |
val obtainP = |
381 |
OuterSyntax.command "obtain" "generalized existence" |
|
382 |
K.prf_asm_goal |
|
383 |
(Scan.optional |
|
384 |
(P.and_list1 (Scan.repeat1 P.name -- Scan.option (P.$$$ "::" |-- P.typ) -- P.marg_comment) |
|
385 |
--| P.$$$ "where") [] -- |
|
386 |
P.and_list1 (P.opt_thm_name ":" -- Scan.repeat1 P.propp -- P.marg_comment) |
|
387 |
>> (Toplevel.print oo (Toplevel.proof o IsarThy.obtain))); |
|
5832 | 388 |
|
389 |
val letP = |
|
6723 | 390 |
OuterSyntax.command "let" "bind text variables" K.prf_decl |
8669 | 391 |
(P.and_list1 (P.enum1 "and" P.term -- (P.$$$ "=" |-- P.term) -- P.marg_comment) |
8615 | 392 |
>> (Toplevel.print oo (Toplevel.proof o IsarThy.let_bind))); |
5832 | 393 |
|
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
394 |
val case_spec = |
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
395 |
(P.$$$ "(" |-- P.!!! (P.xname -- Scan.repeat1 (P.underscore >> K None || P.name >> Some) |
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
396 |
--| P.$$$ ")") || P.xname >> rpair []) -- P.opt_attribs >> P.triple1; |
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
397 |
|
8370 | 398 |
val caseP = |
399 |
OuterSyntax.command "case" "invoke local context" K.prf_asm |
|
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
400 |
(case_spec -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.invoke_case))); |
8370 | 401 |
|
5832 | 402 |
|
403 |
(* proof structure *) |
|
404 |
||
405 |
val beginP = |
|
9056 | 406 |
OuterSyntax.command "{" "begin explicit proof block" K.prf_open |
9032 | 407 |
(P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.begin_block))); |
5832 | 408 |
|
6687 | 409 |
val endP = |
9056 | 410 |
OuterSyntax.command "}" "end explicit proof block" K.prf_close |
9032 | 411 |
(P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.end_block))); |
6687 | 412 |
|
5832 | 413 |
val nextP = |
6723 | 414 |
OuterSyntax.command "next" "enter next proof block" K.prf_block |
9032 | 415 |
(P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.next_block))); |
5832 | 416 |
|
417 |
||
418 |
(* end proof *) |
|
419 |
||
6404 | 420 |
val qedP = |
6735 | 421 |
OuterSyntax.command "qed" "conclude (sub-)proof" K.qed_block |
7002 | 422 |
(Scan.option (P.method -- P.interest) -- P.marg_comment >> IsarThy.qed); |
5832 | 423 |
|
6404 | 424 |
val terminal_proofP = |
6723 | 425 |
OuterSyntax.command "by" "terminal backward proof" K.qed |
7002 | 426 |
(P.method -- P.interest -- Scan.option (P.method -- P.interest) |
427 |
-- P.marg_comment >> IsarThy.terminal_proof); |
|
6404 | 428 |
|
8966 | 429 |
val default_proofP = |
430 |
OuterSyntax.command ".." "default proof" K.qed |
|
431 |
(P.marg_comment >> IsarThy.default_proof); |
|
432 |
||
6404 | 433 |
val immediate_proofP = |
6723 | 434 |
OuterSyntax.command "." "immediate proof" K.qed |
7002 | 435 |
(P.marg_comment >> IsarThy.immediate_proof); |
6404 | 436 |
|
8966 | 437 |
val done_proofP = |
438 |
OuterSyntax.command "done" "done proof" K.qed |
|
439 |
(P.marg_comment >> IsarThy.done_proof); |
|
5832 | 440 |
|
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
6886
diff
changeset
|
441 |
val skip_proofP = |
7172 | 442 |
OuterSyntax.improper_command "sorry" "skip proof (quick-and-dirty mode only!)" K.qed |
7002 | 443 |
(P.marg_comment >> IsarThy.skip_proof); |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
6886
diff
changeset
|
444 |
|
8210 | 445 |
val forget_proofP = |
8521 | 446 |
OuterSyntax.command "oops" "forget proof" K.qed_global |
8210 | 447 |
(P.marg_comment >> IsarThy.forget_proof); |
448 |
||
449 |
||
5832 | 450 |
|
451 |
(* proof steps *) |
|
452 |
||
8165 | 453 |
val deferP = |
8681 | 454 |
OuterSyntax.command "defer" "shuffle internal proof state" K.prf_script |
455 |
(Scan.option P.nat -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.defer))); |
|
8165 | 456 |
|
457 |
val preferP = |
|
8681 | 458 |
OuterSyntax.command "prefer" "shuffle internal proof state" K.prf_script |
459 |
(P.nat -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.prefer))); |
|
8165 | 460 |
|
6850 | 461 |
val applyP = |
8681 | 462 |
OuterSyntax.command "apply" "initial refinement step (unstructured)" K.prf_script |
463 |
(P.method -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.apply))); |
|
5832 | 464 |
|
8235 | 465 |
val apply_endP = |
8681 | 466 |
OuterSyntax.command "apply_end" "terminal refinement (unstructured)" K.prf_script |
467 |
(P.method -- P.marg_comment >> (Toplevel.print oo (Toplevel.proof o IsarThy.apply_end))); |
|
5832 | 468 |
|
6404 | 469 |
val proofP = |
6723 | 470 |
OuterSyntax.command "proof" "backward proof" K.prf_block |
7002 | 471 |
(P.interest -- Scan.option (P.method -- P.interest) -- P.marg_comment |
6727 | 472 |
>> (Toplevel.print oo (Toplevel.proof o IsarThy.proof))); |
5832 | 473 |
|
474 |
||
6773 | 475 |
(* calculational proof commands *) |
476 |
||
6878 | 477 |
val calc_args = |
478 |
Scan.option (P.$$$ "(" |-- P.!!! ((P.xthms1 --| P.$$$ ")") -- P.interest)); |
|
479 |
||
6773 | 480 |
val alsoP = |
8562 | 481 |
OuterSyntax.command "also" "combine calculation and current facts" K.prf_decl |
6878 | 482 |
(calc_args -- P.marg_comment >> IsarThy.also); |
6773 | 483 |
|
484 |
val finallyP = |
|
8562 | 485 |
OuterSyntax.command "finally" "combine calculation and current facts, exhibit result" K.prf_chain |
6878 | 486 |
(calc_args -- P.marg_comment >> IsarThy.finally); |
6773 | 487 |
|
8562 | 488 |
val moreoverP = |
489 |
OuterSyntax.command "moreover" "augment calculation by current facts" K.prf_decl |
|
490 |
(P.marg_comment >> IsarThy.moreover); |
|
491 |
||
8588 | 492 |
val ultimatelyP = |
493 |
OuterSyntax.command "ultimately" "augment calculation by current facts, exhibit result" |
|
494 |
K.prf_chain (P.marg_comment >> IsarThy.ultimately); |
|
495 |
||
6773 | 496 |
|
6742 | 497 |
(* proof navigation *) |
5944 | 498 |
|
5832 | 499 |
val backP = |
8235 | 500 |
OuterSyntax.command "back" "backtracking of proof command" K.prf_script |
9273 | 501 |
(Scan.optional (P.$$$ "!" >> K true) false -- P.marg_comment >> |
502 |
(Toplevel.print oo IsarCmd.back)); |
|
5832 | 503 |
|
504 |
||
6742 | 505 |
(* history *) |
506 |
||
507 |
val cannot_undoP = |
|
508 |
OuterSyntax.improper_command "cannot_undo" "report 'cannot undo' error message" K.control |
|
9010 | 509 |
(P.name >> (Toplevel.no_timing oo IsarCmd.cannot_undo)); |
6742 | 510 |
|
7733 | 511 |
val clear_undosP = |
512 |
OuterSyntax.improper_command "clear_undos" "clear theory-level undo information" K.control |
|
9010 | 513 |
(P.nat >> (Toplevel.no_timing oo IsarCmd.clear_undos_theory)); |
6742 | 514 |
|
515 |
val redoP = |
|
516 |
OuterSyntax.improper_command "redo" "redo last command" K.control |
|
9010 | 517 |
(Scan.succeed (Toplevel.no_timing o Toplevel.print o IsarCmd.redo)); |
6742 | 518 |
|
519 |
val undos_proofP = |
|
520 |
OuterSyntax.improper_command "undos_proof" "undo last proof commands" K.control |
|
9010 | 521 |
(P.nat >> ((Toplevel.no_timing o Toplevel.print) oo IsarCmd.undos_proof)); |
6742 | 522 |
|
523 |
val undoP = |
|
524 |
OuterSyntax.improper_command "undo" "undo last command" K.control |
|
9010 | 525 |
(Scan.succeed ((Toplevel.no_timing o Toplevel.print) o IsarCmd.undo)); |
6742 | 526 |
|
8500 | 527 |
val killP = |
528 |
OuterSyntax.improper_command "kill" "kill current history node" K.control |
|
9010 | 529 |
(Scan.succeed ((Toplevel.no_timing o Toplevel.print) o IsarCmd.kill)); |
8500 | 530 |
|
6742 | 531 |
|
5832 | 532 |
|
533 |
(** diagnostic commands (for interactive mode only) **) |
|
534 |
||
8464 | 535 |
val opt_modes = Scan.optional (P.$$$ "(" |-- P.!!! (Scan.repeat1 P.xname --| P.$$$ ")")) []; |
536 |
||
537 |
||
7124 | 538 |
val pretty_setmarginP = |
539 |
OuterSyntax.improper_command "pretty_setmargin" "change default margin for pretty printing" |
|
9010 | 540 |
K.diag (P.nat >> (Toplevel.no_timing oo IsarCmd.pretty_setmargin)); |
7124 | 541 |
|
5832 | 542 |
val print_commandsP = |
9221 | 543 |
OuterSyntax.improper_command "print_commands" "print outer syntax (global)" K.diag |
544 |
(Scan.succeed (Toplevel.no_timing o OuterSyntax.print_commands)); |
|
5832 | 545 |
|
7308 | 546 |
val print_contextP = |
547 |
OuterSyntax.improper_command "print_context" "print theory context name" K.diag |
|
9010 | 548 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_context)); |
7308 | 549 |
|
5832 | 550 |
val print_theoryP = |
6723 | 551 |
OuterSyntax.improper_command "print_theory" "print logical theory contents (verbose!)" K.diag |
9010 | 552 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_theory)); |
5832 | 553 |
|
554 |
val print_syntaxP = |
|
6723 | 555 |
OuterSyntax.improper_command "print_syntax" "print inner syntax of theory (verbose!)" K.diag |
9010 | 556 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_syntax)); |
5832 | 557 |
|
5881 | 558 |
val print_theoremsP = |
12061 | 559 |
OuterSyntax.improper_command "print_theorems" "print theorems of this theory" K.diag |
9010 | 560 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_theorems)); |
5881 | 561 |
|
12061 | 562 |
val print_localesP = |
563 |
OuterSyntax.improper_command "print_locales" "print locales of this theory" K.diag |
|
564 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_locales)); |
|
565 |
||
566 |
val print_localeP = |
|
567 |
OuterSyntax.improper_command "print_locale" "print named locale of this theory" K.diag |
|
568 |
(P.xname >> (Toplevel.no_timing oo IsarCmd.print_locale)); |
|
569 |
||
5832 | 570 |
val print_attributesP = |
12061 | 571 |
OuterSyntax.improper_command "print_attributes" "print attributes of this theory" K.diag |
9010 | 572 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_attributes)); |
5832 | 573 |
|
11666 | 574 |
val print_induct_rulesP = |
575 |
OuterSyntax.improper_command "print_induct_rules" "print induction and cases rules" K.diag |
|
576 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_induct_rules)); |
|
577 |
||
9221 | 578 |
val print_trans_rulesP = |
11666 | 579 |
OuterSyntax.improper_command "print_trans_rules" "print transitivity rules" K.diag |
9221 | 580 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_trans_rules)); |
581 |
||
5832 | 582 |
val print_methodsP = |
12061 | 583 |
OuterSyntax.improper_command "print_methods" "print methods of this theory" K.diag |
9010 | 584 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_methods)); |
5832 | 585 |
|
9221 | 586 |
val print_antiquotationsP = |
587 |
OuterSyntax.improper_command "print_antiquotations" "print antiquotations (global)" K.diag |
|
588 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_antiquotations)); |
|
589 |
||
7616 | 590 |
val thms_containingP = |
11017 | 591 |
OuterSyntax.improper_command "thms_containing" "print theorems containing certain constants" |
592 |
K.diag (Scan.repeat P.term >> (Toplevel.no_timing oo IsarCmd.print_thms_containing)); |
|
7616 | 593 |
|
9454 | 594 |
val thm_depsP = |
595 |
OuterSyntax.improper_command "thm_deps" "visualize theorem dependencies" |
|
596 |
K.diag (P.xthms1 >> (Toplevel.no_timing oo IsarCmd.thm_deps)); |
|
597 |
||
5832 | 598 |
val print_bindsP = |
6723 | 599 |
OuterSyntax.improper_command "print_binds" "print term bindings of proof context" K.diag |
9010 | 600 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_binds)); |
5832 | 601 |
|
602 |
val print_lthmsP = |
|
8370 | 603 |
OuterSyntax.improper_command "print_facts" "print facts of proof context" K.diag |
9010 | 604 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_lthms)); |
5832 | 605 |
|
8370 | 606 |
val print_casesP = |
607 |
OuterSyntax.improper_command "print_cases" "print cases of proof context" K.diag |
|
9010 | 608 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.print_cases)); |
8370 | 609 |
|
5896 | 610 |
val print_thmsP = |
8464 | 611 |
OuterSyntax.improper_command "thm" "print theorems" K.diag |
10581 | 612 |
(opt_modes -- P.xthms1 -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.print_thms)); |
5832 | 613 |
|
11524
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
614 |
val print_prfsP = |
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
615 |
OuterSyntax.improper_command "prf" "print proof terms of theorems" K.diag |
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
616 |
(opt_modes -- P.xthms1 -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.print_prfs false)); |
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
617 |
|
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
618 |
val print_full_prfsP = |
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
619 |
OuterSyntax.improper_command "full_prf" "print full proof terms of theorems" K.diag |
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
620 |
(opt_modes -- P.xthms1 -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.print_prfs true)); |
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
621 |
|
5832 | 622 |
val print_propP = |
6723 | 623 |
OuterSyntax.improper_command "prop" "read and print proposition" K.diag |
10581 | 624 |
(opt_modes -- P.term -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.print_prop)); |
5832 | 625 |
|
626 |
val print_termP = |
|
6723 | 627 |
OuterSyntax.improper_command "term" "read and print term" K.diag |
10581 | 628 |
(opt_modes -- P.term -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.print_term)); |
5832 | 629 |
|
630 |
val print_typeP = |
|
6723 | 631 |
OuterSyntax.improper_command "typ" "read and print type" K.diag |
10581 | 632 |
(opt_modes -- P.typ -- P.marg_comment >> (Toplevel.no_timing oo IsarCmd.print_type)); |
5832 | 633 |
|
634 |
||
635 |
||
636 |
(** system commands (for interactive mode only) **) |
|
637 |
||
638 |
val cdP = |
|
8650 | 639 |
OuterSyntax.improper_command "cd" "change current working directory" K.diag |
9010 | 640 |
(P.name >> (Toplevel.no_timing oo IsarCmd.cd)); |
5832 | 641 |
|
642 |
val pwdP = |
|
6723 | 643 |
OuterSyntax.improper_command "pwd" "print current working directory" K.diag |
9010 | 644 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.pwd)); |
5832 | 645 |
|
646 |
val use_thyP = |
|
6723 | 647 |
OuterSyntax.improper_command "use_thy" "use theory file" K.diag |
9010 | 648 |
(P.name >> (Toplevel.no_timing oo IsarCmd.use_thy)); |
5832 | 649 |
|
6694 | 650 |
val use_thy_onlyP = |
7102 | 651 |
OuterSyntax.improper_command "use_thy_only" "use theory file only, ignoring associated ML" |
9010 | 652 |
K.diag (P.name >> (Toplevel.no_timing oo IsarCmd.use_thy_only)); |
6694 | 653 |
|
6196 | 654 |
val update_thyP = |
6723 | 655 |
OuterSyntax.improper_command "update_thy" "update theory file" K.diag |
9010 | 656 |
(P.name >> (Toplevel.no_timing oo IsarCmd.update_thy)); |
5832 | 657 |
|
7102 | 658 |
val update_thy_onlyP = |
659 |
OuterSyntax.improper_command "update_thy_only" "update theory file, ignoring associated ML" |
|
9010 | 660 |
K.diag (P.name >> (Toplevel.no_timing oo IsarCmd.update_thy_only)); |
7102 | 661 |
|
662 |
val touch_thyP = |
|
663 |
OuterSyntax.improper_command "touch_thy" "outdate theory, including descendants" K.diag |
|
9010 | 664 |
(P.name >> (Toplevel.no_timing oo IsarCmd.touch_thy)); |
7102 | 665 |
|
666 |
val touch_all_thysP = |
|
667 |
OuterSyntax.improper_command "touch_all_thys" "outdate all non-finished theories" K.diag |
|
9010 | 668 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.touch_all_thys)); |
7102 | 669 |
|
7908 | 670 |
val touch_child_thysP = |
671 |
OuterSyntax.improper_command "touch_child_thys" "outdate child theories" K.diag |
|
9010 | 672 |
(P.name >> (Toplevel.no_timing oo IsarCmd.touch_child_thys)); |
7908 | 673 |
|
7102 | 674 |
val remove_thyP = |
675 |
OuterSyntax.improper_command "remove_thy" "remove theory from loader database" K.diag |
|
9010 | 676 |
(P.name >> (Toplevel.no_timing oo IsarCmd.remove_thy)); |
7102 | 677 |
|
7931 | 678 |
val kill_thyP = |
679 |
OuterSyntax.improper_command "kill_thy" "kill theory -- try to remove from loader database" |
|
9010 | 680 |
K.diag (P.name >> (Toplevel.no_timing oo IsarCmd.kill_thy)); |
7931 | 681 |
|
9731 | 682 |
val opt_limits = |
683 |
Scan.option P.nat -- Scan.option (P.$$$ "," |-- P.!!! P.nat); |
|
684 |
||
5832 | 685 |
val prP = |
8886 | 686 |
OuterSyntax.improper_command "pr" "print current proof state (if present)" K.diag |
9731 | 687 |
(opt_modes -- opt_limits >> (Toplevel.no_timing oo IsarCmd.pr)); |
7199 | 688 |
|
7222 | 689 |
val disable_prP = |
690 |
OuterSyntax.improper_command "disable_pr" "disable printing of toplevel state" K.diag |
|
9010 | 691 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.disable_pr)); |
5832 | 692 |
|
7222 | 693 |
val enable_prP = |
694 |
OuterSyntax.improper_command "enable_pr" "enable printing of toplevel state" K.diag |
|
9010 | 695 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.enable_pr)); |
7222 | 696 |
|
5832 | 697 |
val commitP = |
6723 | 698 |
OuterSyntax.improper_command "commit" "commit current session to ML database" K.diag |
9010 | 699 |
(P.opt_unit >> (Toplevel.no_timing oo K IsarCmd.use_commit)); |
5832 | 700 |
|
701 |
val quitP = |
|
6723 | 702 |
OuterSyntax.improper_command "quit" "quit Isabelle" K.control |
9010 | 703 |
(P.opt_unit >> (Toplevel.no_timing oo K IsarCmd.quit)); |
5832 | 704 |
|
705 |
val exitP = |
|
6723 | 706 |
OuterSyntax.improper_command "exit" "exit Isar loop" K.control |
9010 | 707 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.exit)); |
5832 | 708 |
|
7102 | 709 |
val init_toplevelP = |
710 |
OuterSyntax.improper_command "init_toplevel" "restart Isar toplevel loop" K.control |
|
9010 | 711 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.init_toplevel)); |
5991 | 712 |
|
7462 | 713 |
val welcomeP = |
8678 | 714 |
OuterSyntax.improper_command "welcome" "print welcome message" K.diag |
9010 | 715 |
(Scan.succeed (Toplevel.no_timing o IsarCmd.welcome)); |
7462 | 716 |
|
5832 | 717 |
|
718 |
||
719 |
(** the Pure outer syntax **) |
|
720 |
||
721 |
(*keep keywords consistent with the parsers, including those in |
|
722 |
outer_parse.ML, otherwise be prepared for unexpected errors*) |
|
723 |
||
724 |
val keywords = |
|
7415 | 725 |
["!", "!!", "%", "%%", "(", ")", "+", ",", "--", ":", "::", ";", "<", |
12044 | 726 |
"<=", "=", "==", "=>", "?", "[", "]", "and", "assumes", "binder", |
727 |
"concl", "defines", "files", "fixes", "in", "infix", "infixl", |
|
728 |
"infixr", "is", "notes", "output", "overloaded", "structure", |
|
729 |
"uses", "where", "|", "\\<equiv>", "\\<leftharpoondown>", |
|
730 |
"\\<rightharpoonup>", "\\<rightleftharpoons>", "\\<subseteq>"]; |
|
5832 | 731 |
|
732 |
val parsers = [ |
|
733 |
(*theory structure*) |
|
8500 | 734 |
theoryP, end_excursionP, contextP, |
7775 | 735 |
(*markup commands*) |
7733 | 736 |
headerP, chapterP, sectionP, subsectionP, subsubsectionP, textP, |
7862 | 737 |
text_rawP, sectP, subsectP, subsubsectP, txtP, txt_rawP, |
5832 | 738 |
(*theory sections*) |
7172 | 739 |
classesP, classrelP, defaultsortP, typedeclP, typeabbrP, nontermP, |
8227 | 740 |
aritiesP, judgmentP, constsP, syntaxP, translationsP, axiomsP, |
9589 | 741 |
defsP, constdefsP, theoremsP, lemmasP, declareP, globalP, localP, |
742 |
hideP, useP, mlP, ml_commandP, ml_setupP, setupP, method_setupP, |
|
9197 | 743 |
parse_ast_translationP, parse_translationP, print_translationP, |
744 |
typed_print_translationP, print_ast_translationP, |
|
12061 | 745 |
token_translationP, oracleP, localeP, |
5832 | 746 |
(*proof commands*) |
11890 | 747 |
theoremP, lemmaP, corollaryP, showP, haveP, thusP, henceP, fixP, |
748 |
assumeP, presumeP, defP, obtainP, letP, caseP, thenP, fromP, withP, |
|
749 |
noteP, beginP, endP, nextP, qedP, terminal_proofP, default_proofP, |
|
11742 | 750 |
immediate_proofP, done_proofP, skip_proofP, forget_proofP, deferP, |
751 |
preferP, applyP, apply_endP, proofP, alsoP, finallyP, moreoverP, |
|
752 |
ultimatelyP, backP, cannot_undoP, clear_undosP, redoP, undos_proofP, |
|
753 |
undoP, killP, |
|
5832 | 754 |
(*diagnostic commands*) |
7308 | 755 |
pretty_setmarginP, print_commandsP, print_contextP, print_theoryP, |
12061 | 756 |
print_syntaxP, print_theoremsP, print_localesP, print_localeP, |
757 |
print_attributesP, print_induct_rulesP, print_trans_rulesP, |
|
758 |
print_methodsP, print_antiquotationsP, thms_containingP, thm_depsP, |
|
759 |
print_bindsP, print_lthmsP, print_casesP, print_thmsP, print_prfsP, |
|
11666 | 760 |
print_full_prfsP, print_propP, print_termP, print_typeP, |
5832 | 761 |
(*system commands*) |
7102 | 762 |
cdP, pwdP, use_thyP, use_thy_onlyP, update_thyP, update_thy_onlyP, |
7931 | 763 |
touch_thyP, touch_all_thysP, touch_child_thysP, remove_thyP, |
764 |
kill_thyP, prP, disable_prP, enable_prP, commitP, quitP, exitP, |
|
765 |
init_toplevelP, welcomeP]; |
|
5832 | 766 |
|
767 |
||
768 |
end; |
|
769 |
||
770 |
||
6196 | 771 |
(*install the Pure outer syntax*) |
5832 | 772 |
OuterSyntax.add_keywords IsarSyn.keywords; |
773 |
OuterSyntax.add_parsers IsarSyn.parsers; |