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