author | wenzelm |
Wed, 01 Aug 2012 23:33:26 +0200 | |
changeset 48641 | 92b48b8abfe4 |
parent 47416 | df8fc0567a3d |
child 48642 | 1737bdb896bb |
permissions | -rw-r--r-- |
5832 | 1 |
(* Title: Pure/Isar/isar_syn.ML |
2 |
Author: Markus Wenzel, TU Muenchen |
|
3 |
||
6353 | 4 |
Isar/Pure outer syntax. |
5832 | 5 |
*) |
6 |
||
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
7 |
structure Isar_Syn: sig end = |
5832 | 8 |
struct |
9 |
||
7749 | 10 |
(** markup commands **) |
5832 | 11 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
12 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
13 |
Outer_Syntax.markup_command Thy_Output.Markup |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
14 |
("header", Keyword.diag) "theory header" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
15 |
(Parse.doc_source >> Isar_Cmd.header_markup); |
6353 | 16 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
17 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
18 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 19 |
("chapter", Keyword.thy_heading1) "chapter heading" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
20 |
(Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
5958 | 21 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
22 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
23 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 24 |
("section", Keyword.thy_heading2) "section heading" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
25 |
(Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
5958 | 26 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
27 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
28 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 29 |
("subsection", Keyword.thy_heading3) "subsection heading" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
30 |
(Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
31 |
|
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
32 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
33 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 34 |
("subsubsection", Keyword.thy_heading4) "subsubsection heading" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
35 |
(Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
5958 | 36 |
|
24868 | 37 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
38 |
Outer_Syntax.markup_command Thy_Output.MarkupEnv |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
39 |
("text", Keyword.thy_decl) "formal comment (theory)" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
40 |
(Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
7172 | 41 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
42 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
43 |
Outer_Syntax.markup_command Thy_Output.Verbatim |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
44 |
("text_raw", Keyword.thy_decl) "raw document preparation text" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
45 |
(Parse.opt_target -- Parse.doc_source >> Isar_Cmd.local_theory_markup); |
7172 | 46 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
47 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
48 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 49 |
("sect", Keyword.tag_proof Keyword.prf_heading2) "formal comment (proof)" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
50 |
(Parse.doc_source >> Isar_Cmd.proof_markup); |
7172 | 51 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
52 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
53 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 54 |
("subsect", Keyword.tag_proof Keyword.prf_heading3) "formal comment (proof)" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
55 |
(Parse.doc_source >> Isar_Cmd.proof_markup); |
7172 | 56 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
57 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
58 |
Outer_Syntax.markup_command Thy_Output.Markup |
46969 | 59 |
("subsubsect", Keyword.tag_proof Keyword.prf_heading4) "formal comment (proof)" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
60 |
(Parse.doc_source >> Isar_Cmd.proof_markup); |
7172 | 61 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
62 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
63 |
Outer_Syntax.markup_command Thy_Output.MarkupEnv |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
64 |
("txt", Keyword.tag_proof Keyword.prf_decl) "formal comment (proof)" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
65 |
(Parse.doc_source >> Isar_Cmd.proof_markup); |
7172 | 66 |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
67 |
val _ = |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
68 |
Outer_Syntax.markup_command Thy_Output.Verbatim |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
69 |
("txt_raw", Keyword.tag_proof Keyword.prf_decl) "raw document preparation text (proof)" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
70 |
(Parse.doc_source >> Isar_Cmd.proof_markup); |
7775 | 71 |
|
5832 | 72 |
|
6886 | 73 |
|
30142
8d6145694bb5
moved find_theorems.ML and find_consts.ML to Pure/Tools, collecting main implementation in one place each;
wenzelm
parents:
29882
diff
changeset
|
74 |
(** theory commands **) |
6886 | 75 |
|
5832 | 76 |
(* classes and sorts *) |
77 |
||
24868 | 78 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
79 |
Outer_Syntax.command ("classes", Keyword.thy_decl) "declare type classes" |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
80 |
(Scan.repeat1 (Parse.binding -- Scan.optional ((Parse.$$$ "\<subseteq>" || Parse.$$$ "<") |-- |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
81 |
Parse.!!! (Parse.list1 Parse.class)) []) |
36950 | 82 |
>> (Toplevel.theory o fold AxClass.axiomatize_class_cmd)); |
5832 | 83 |
|
24868 | 84 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
85 |
Outer_Syntax.command ("classrel", Keyword.thy_decl) "state inclusion of type classes (axiomatic!)" |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
86 |
(Parse.and_list1 (Parse.class -- ((Parse.$$$ "\<subseteq>" || Parse.$$$ "<") |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
87 |
|-- Parse.!!! Parse.class)) |
24932
86ef9a828a9e
AxClass.axiomatize and Specification: renamed XXX_i to XXX, and XXX to XXX_cmd;
wenzelm
parents:
24914
diff
changeset
|
88 |
>> (Toplevel.theory o AxClass.axiomatize_classrel_cmd)); |
5832 | 89 |
|
24868 | 90 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
91 |
Outer_Syntax.local_theory ("default_sort", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
92 |
"declare default sort for explicit type variables" |
36950 | 93 |
(Parse.sort >> (fn s => fn lthy => Local_Theory.set_defsort (Syntax.read_sort lthy s) lthy)); |
5832 | 94 |
|
95 |
||
96 |
(* types *) |
|
97 |
||
24868 | 98 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
99 |
Outer_Syntax.local_theory ("typedecl", Keyword.thy_decl) "type declaration" |
36950 | 100 |
(Parse.type_args -- Parse.binding -- Parse.opt_mixfix |
35835 | 101 |
>> (fn ((args, a), mx) => Typedecl.typedecl (a, map (rpair dummyS) args, mx) #> snd)); |
5832 | 102 |
|
24868 | 103 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
104 |
Outer_Syntax.local_theory ("type_synonym", Keyword.thy_decl) "declare type abbreviation" |
45837 | 105 |
(Parse.type_args -- Parse.binding -- |
106 |
(Parse.$$$ "=" |-- Parse.!!! (Parse.typ -- Parse.opt_mixfix')) |
|
107 |
>> (fn ((args, a), (rhs, mx)) => snd o Typedecl.abbrev_cmd (a, args, mx) rhs)); |
|
5832 | 108 |
|
24868 | 109 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
110 |
Outer_Syntax.command ("nonterminal", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
111 |
"declare syntactic type constructors (grammar nonterminal symbols)" |
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42359
diff
changeset
|
112 |
(Parse.and_list1 Parse.binding >> (Toplevel.theory o Sign.add_nonterminals_global)); |
5832 | 113 |
|
24868 | 114 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
115 |
Outer_Syntax.command ("arities", Keyword.thy_decl) "state type arities (axiomatic!)" |
36950 | 116 |
(Scan.repeat1 Parse.arity >> (Toplevel.theory o fold AxClass.axiomatize_arity_cmd)); |
5832 | 117 |
|
118 |
||
119 |
(* consts and syntax *) |
|
120 |
||
24868 | 121 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
122 |
Outer_Syntax.command ("judgment", Keyword.thy_decl) "declare object-logic judgment" |
36950 | 123 |
(Parse.const_binding >> (Toplevel.theory o Object_Logic.add_judgment_cmd)); |
8227 | 124 |
|
24868 | 125 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
126 |
Outer_Syntax.command ("consts", Keyword.thy_decl) "declare constants" |
36950 | 127 |
(Scan.repeat1 Parse.const_binding >> (Toplevel.theory o Sign.add_consts)); |
5832 | 128 |
|
12142 | 129 |
val mode_spec = |
36950 | 130 |
(Parse.$$$ "output" >> K ("", false)) || |
131 |
Parse.name -- Scan.optional (Parse.$$$ "output" >> K false) true; |
|
9731 | 132 |
|
14900 | 133 |
val opt_mode = |
36950 | 134 |
Scan.optional (Parse.$$$ "(" |-- Parse.!!! (mode_spec --| Parse.$$$ ")")) Syntax.mode_default; |
5832 | 135 |
|
24868 | 136 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
137 |
Outer_Syntax.command ("syntax", Keyword.thy_decl) "declare syntactic constants" |
42299 | 138 |
(opt_mode -- Scan.repeat1 Parse.const_decl >> (Toplevel.theory o uncurry Sign.add_modesyntax)); |
5832 | 139 |
|
24868 | 140 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
141 |
Outer_Syntax.command ("no_syntax", Keyword.thy_decl) "delete syntax declarations" |
42299 | 142 |
(opt_mode -- Scan.repeat1 Parse.const_decl >> (Toplevel.theory o uncurry Sign.del_modesyntax)); |
15748 | 143 |
|
5832 | 144 |
|
145 |
(* translations *) |
|
146 |
||
147 |
val trans_pat = |
|
42326 | 148 |
Scan.optional |
149 |
(Parse.$$$ "(" |-- Parse.!!! (Parse.xname --| Parse.$$$ ")")) "logic" |
|
150 |
-- Parse.inner_syntax Parse.string; |
|
5832 | 151 |
|
152 |
fun trans_arrow toks = |
|
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
153 |
((Parse.$$$ "\<rightharpoonup>" || Parse.$$$ "=>") >> K Syntax.Parse_Rule || |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
154 |
(Parse.$$$ "\<leftharpoondown>" || Parse.$$$ "<=") >> K Syntax.Print_Rule || |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
155 |
(Parse.$$$ "\<rightleftharpoons>" || Parse.$$$ "==") >> K Syntax.Parse_Print_Rule) toks; |
5832 | 156 |
|
157 |
val trans_line = |
|
36950 | 158 |
trans_pat -- Parse.!!! (trans_arrow -- trans_pat) |
5832 | 159 |
>> (fn (left, (arr, right)) => arr (left, right)); |
160 |
||
24868 | 161 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
162 |
Outer_Syntax.command ("translations", Keyword.thy_decl) "declare syntax translation rules" |
42204 | 163 |
(Scan.repeat1 trans_line >> (Toplevel.theory o Isar_Cmd.translations)); |
5832 | 164 |
|
24868 | 165 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
166 |
Outer_Syntax.command ("no_translations", Keyword.thy_decl) "remove syntax translation rules" |
42204 | 167 |
(Scan.repeat1 trans_line >> (Toplevel.theory o Isar_Cmd.no_translations)); |
19260 | 168 |
|
5832 | 169 |
|
170 |
(* axioms and definitions *) |
|
171 |
||
24868 | 172 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
173 |
Outer_Syntax.command ("axioms", Keyword.thy_decl) "state arbitrary propositions (axiomatic!)" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
174 |
(Scan.repeat1 Parse_Spec.spec >> |
37861 | 175 |
(fn spec => Toplevel.theory (fn thy => |
176 |
(legacy_feature "Old 'axioms' command -- use 'axiomatization' instead"; |
|
177 |
Isar_Cmd.add_axioms spec thy)))); |
|
5832 | 178 |
|
19631 | 179 |
val opt_unchecked_overloaded = |
36950 | 180 |
Scan.optional (Parse.$$$ "(" |-- Parse.!!! |
181 |
(((Parse.$$$ "unchecked" >> K true) -- Scan.optional (Parse.$$$ "overloaded" >> K true) false || |
|
182 |
Parse.$$$ "overloaded" >> K (false, true)) --| Parse.$$$ ")")) (false, false); |
|
19631 | 183 |
|
24868 | 184 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
185 |
Outer_Syntax.command ("defs", Keyword.thy_decl) "define constants" |
35852
4e3fe0b8687b
minor renovation of old-style 'axioms' -- make it an alias of iterated 'axiomatization';
wenzelm
parents:
35835
diff
changeset
|
186 |
(opt_unchecked_overloaded -- |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
187 |
Scan.repeat1 (Parse_Spec.thm_name ":" -- Parse.prop >> (fn ((x, y), z) => ((x, z), y))) |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
188 |
>> (Toplevel.theory o Isar_Cmd.add_defs)); |
6370 | 189 |
|
14642 | 190 |
|
21601
6588b947d631
simplified syntax for 'definition', 'abbreviation';
wenzelm
parents:
21527
diff
changeset
|
191 |
(* constant definitions and abbreviations *) |
6588b947d631
simplified syntax for 'definition', 'abbreviation';
wenzelm
parents:
21527
diff
changeset
|
192 |
|
24868 | 193 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
194 |
Outer_Syntax.local_theory' ("definition", Keyword.thy_decl) "constant definition" |
44192
a32ca9165928
less verbosity in batch mode -- spam reduction and notable performance improvement;
wenzelm
parents:
44187
diff
changeset
|
195 |
(Parse_Spec.constdef >> (fn args => #2 oo Specification.definition_cmd args)); |
18780 | 196 |
|
24868 | 197 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
198 |
Outer_Syntax.local_theory' ("abbreviation", Keyword.thy_decl) "constant abbreviation" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
199 |
(opt_mode -- (Scan.option Parse_Spec.constdecl -- Parse.prop) |
36950 | 200 |
>> (fn (mode, args) => Specification.abbreviation_cmd mode args)); |
19659 | 201 |
|
24868 | 202 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
203 |
Outer_Syntax.local_theory ("type_notation", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
204 |
"add concrete syntax for type constructors" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
205 |
(opt_mode -- Parse.and_list1 (Parse.type_const -- Parse.mixfix) |
36950 | 206 |
>> (fn (mode, args) => Specification.type_notation_cmd true mode args)); |
35413 | 207 |
|
208 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
209 |
Outer_Syntax.local_theory ("no_type_notation", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
210 |
"delete concrete syntax for type constructors" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
211 |
(opt_mode -- Parse.and_list1 (Parse.type_const -- Parse.mixfix) |
36950 | 212 |
>> (fn (mode, args) => Specification.type_notation_cmd false mode args)); |
35413 | 213 |
|
214 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
215 |
Outer_Syntax.local_theory ("notation", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
216 |
"add concrete syntax for constants / fixed variables" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
217 |
(opt_mode -- Parse.and_list1 (Parse.const -- Parse_Spec.locale_mixfix) |
36950 | 218 |
>> (fn (mode, args) => Specification.notation_cmd true mode args)); |
24950 | 219 |
|
220 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
221 |
Outer_Syntax.local_theory ("no_notation", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
222 |
"delete concrete syntax for constants / fixed variables" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
223 |
(opt_mode -- Parse.and_list1 (Parse.const -- Parse_Spec.locale_mixfix) |
36950 | 224 |
>> (fn (mode, args) => Specification.notation_cmd false mode args)); |
19076 | 225 |
|
5832 | 226 |
|
18616 | 227 |
(* constant specifications *) |
228 |
||
24868 | 229 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
230 |
Outer_Syntax.command ("axiomatization", Keyword.thy_decl) "axiomatic constant specification" |
36950 | 231 |
(Scan.optional Parse.fixes [] -- |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
232 |
Scan.optional (Parse.where_ |-- Parse.!!! (Parse.and_list1 Parse_Spec.specs)) [] |
36950 | 233 |
>> (fn (x, y) => Toplevel.theory (#2 o Specification.axiomatization_cmd x y))); |
18616 | 234 |
|
235 |
||
5914 | 236 |
(* theorems *) |
237 |
||
26988
742e26213212
more uniform treatment of OuterSyntax.local_theory commands;
wenzelm
parents:
26888
diff
changeset
|
238 |
fun theorems kind = |
45600
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
239 |
Parse_Spec.name_facts -- Parse.for_fixes |
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
240 |
>> (fn (facts, fixes) => #2 oo Specification.theorems_cmd kind facts fixes); |
12712 | 241 |
|
24868 | 242 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
243 |
Outer_Syntax.local_theory' ("theorems", Keyword.thy_decl) "define theorems" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
244 |
(theorems Thm.theoremK); |
5914 | 245 |
|
24868 | 246 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
247 |
Outer_Syntax.local_theory' ("lemmas", Keyword.thy_decl) "define lemmas" (theorems Thm.lemmaK); |
5914 | 248 |
|
24868 | 249 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
250 |
Outer_Syntax.local_theory' ("declare", Keyword.thy_decl) "declare theorems" |
45600
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
251 |
(Parse.and_list1 Parse_Spec.xthms1 -- Parse.for_fixes |
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
252 |
>> (fn (facts, fixes) => |
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
253 |
#2 oo Specification.theorems_cmd "" [(Attrib.empty_binding, flat facts)] fixes)); |
9589 | 254 |
|
5914 | 255 |
|
5832 | 256 |
(* name space entry path *) |
257 |
||
36176
3fe7e97ccca8
replaced generic 'hide' command by more conventional 'hide_class', 'hide_type', 'hide_const', 'hide_fact' -- frees some popular keywords;
wenzelm
parents:
36174
diff
changeset
|
258 |
fun hide_names name hide what = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
259 |
Outer_Syntax.command (name, Keyword.thy_decl) ("hide " ^ what ^ " from name space") |
36950 | 260 |
((Parse.opt_keyword "open" >> not) -- Scan.repeat1 Parse.xname >> |
36176
3fe7e97ccca8
replaced generic 'hide' command by more conventional 'hide_class', 'hide_type', 'hide_const', 'hide_fact' -- frees some popular keywords;
wenzelm
parents:
36174
diff
changeset
|
261 |
(Toplevel.theory o uncurry hide)); |
3fe7e97ccca8
replaced generic 'hide' command by more conventional 'hide_class', 'hide_type', 'hide_const', 'hide_fact' -- frees some popular keywords;
wenzelm
parents:
36174
diff
changeset
|
262 |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
263 |
val _ = hide_names "hide_class" Isar_Cmd.hide_class "classes"; |
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
264 |
val _ = hide_names "hide_type" Isar_Cmd.hide_type "types"; |
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
265 |
val _ = hide_names "hide_const" Isar_Cmd.hide_const "constants"; |
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
266 |
val _ = hide_names "hide_fact" Isar_Cmd.hide_fact "facts"; |
5832 | 267 |
|
268 |
||
269 |
(* use ML text *) |
|
270 |
||
24868 | 271 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
272 |
Outer_Syntax.command ("use", Keyword.tag_ml Keyword.thy_decl) "ML text from file" |
37949
48a874444164
moved management of auxiliary theory source files to Thy_Load -- as theory data instead of accidental loader state;
wenzelm
parents:
37873
diff
changeset
|
273 |
(Parse.path >> (fn path => Toplevel.generic_theory (Thy_Load.exec_ml path))); |
7891 | 274 |
|
24868 | 275 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
276 |
Outer_Syntax.command ("ML", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
277 |
"ML text within theory or local theory" |
36950 | 278 |
(Parse.ML_source >> (fn (txt, pos) => |
30579
4169ddbfe1f9
command 'use', 'ML': apply ML environment to theory and target as well;
wenzelm
parents:
30576
diff
changeset
|
279 |
Toplevel.generic_theory |
37949
48a874444164
moved management of auxiliary theory source files to Thy_Load -- as theory data instead of accidental loader state;
wenzelm
parents:
37873
diff
changeset
|
280 |
(ML_Context.exec (fn () => ML_Context.eval_text true pos txt) #> |
48a874444164
moved management of auxiliary theory source files to Thy_Load -- as theory data instead of accidental loader state;
wenzelm
parents:
37873
diff
changeset
|
281 |
Local_Theory.propagate_ml_env))); |
30579
4169ddbfe1f9
command 'use', 'ML': apply ML environment to theory and target as well;
wenzelm
parents:
30576
diff
changeset
|
282 |
|
4169ddbfe1f9
command 'use', 'ML': apply ML environment to theory and target as well;
wenzelm
parents:
30576
diff
changeset
|
283 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
284 |
Outer_Syntax.command ("ML_prf", Keyword.tag_proof Keyword.prf_decl) "ML text within proof" |
36950 | 285 |
(Parse.ML_source >> (fn (txt, pos) => |
28269 | 286 |
Toplevel.proof (Proof.map_context (Context.proof_map |
37949
48a874444164
moved management of auxiliary theory source files to Thy_Load -- as theory data instead of accidental loader state;
wenzelm
parents:
37873
diff
changeset
|
287 |
(ML_Context.exec (fn () => ML_Context.eval_text true pos txt))) #> Proof.propagate_ml_env))); |
28269 | 288 |
|
289 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
290 |
Outer_Syntax.command ("ML_val", Keyword.tag_ml Keyword.diag) "diagnostic ML text" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
291 |
(Parse.ML_source >> Isar_Cmd.ml_diag true); |
26396 | 292 |
|
293 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
294 |
Outer_Syntax.command ("ML_command", Keyword.tag_ml Keyword.diag) "diagnostic ML text (silent)" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
295 |
(Parse.ML_source >> (Toplevel.no_timing oo Isar_Cmd.ml_diag false)); |
5832 | 296 |
|
24868 | 297 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
298 |
Outer_Syntax.command ("setup", Keyword.tag_ml Keyword.thy_decl) "ML theory setup" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
299 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.global_setup)); |
30461 | 300 |
|
301 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
302 |
Outer_Syntax.local_theory ("local_setup", Keyword.tag_ml Keyword.thy_decl) "ML local theory setup" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
303 |
(Parse.ML_source >> Isar_Cmd.local_setup); |
5832 | 304 |
|
24868 | 305 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
306 |
Outer_Syntax.command ("attribute_setup", Keyword.tag_ml Keyword.thy_decl) "define attribute in ML" |
42813
6c841fa92fa2
optional description for 'attribute_setup' and 'method_setup';
wenzelm
parents:
42496
diff
changeset
|
307 |
(Parse.position Parse.name -- |
6c841fa92fa2
optional description for 'attribute_setup' and 'method_setup';
wenzelm
parents:
42496
diff
changeset
|
308 |
Parse.!!! (Parse.$$$ "=" |-- Parse.ML_source -- Scan.optional Parse.text "") |
36950 | 309 |
>> (fn (name, (txt, cmt)) => Toplevel.theory (Attrib.attribute_setup name txt cmt))); |
30526 | 310 |
|
311 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
312 |
Outer_Syntax.command ("method_setup", Keyword.tag_ml Keyword.thy_decl) "define proof method in ML" |
42813
6c841fa92fa2
optional description for 'attribute_setup' and 'method_setup';
wenzelm
parents:
42496
diff
changeset
|
313 |
(Parse.position Parse.name -- |
6c841fa92fa2
optional description for 'attribute_setup' and 'method_setup';
wenzelm
parents:
42496
diff
changeset
|
314 |
Parse.!!! (Parse.$$$ "=" |-- Parse.ML_source -- Scan.optional Parse.text "") |
36950 | 315 |
>> (fn (name, (txt, cmt)) => Toplevel.theory (Method.method_setup name txt cmt))); |
9197 | 316 |
|
24868 | 317 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
318 |
Outer_Syntax.local_theory ("declaration", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
319 |
"generic ML declaration" |
40784 | 320 |
(Parse.opt_keyword "pervasive" -- Parse.ML_source |
321 |
>> (fn (pervasive, txt) => Isar_Cmd.declaration {syntax = false, pervasive = pervasive} txt)); |
|
322 |
||
323 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
324 |
Outer_Syntax.local_theory ("syntax_declaration", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
325 |
"generic ML declaration" |
40784 | 326 |
(Parse.opt_keyword "pervasive" -- Parse.ML_source |
327 |
>> (fn (pervasive, txt) => Isar_Cmd.declaration {syntax = true, pervasive = pervasive} txt)); |
|
22088 | 328 |
|
24868 | 329 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
330 |
Outer_Syntax.local_theory ("simproc_setup", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
331 |
"define simproc in ML" |
42464 | 332 |
(Parse.position Parse.name -- |
36950 | 333 |
(Parse.$$$ "(" |-- Parse.enum1 "|" Parse.term --| Parse.$$$ ")" --| Parse.$$$ "=") -- |
334 |
Parse.ML_source -- Scan.optional (Parse.$$$ "identifier" |-- Scan.repeat1 Parse.xname) [] |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
335 |
>> (fn (((a, b), c), d) => Isar_Cmd.simproc_setup a b c d)); |
22202 | 336 |
|
5832 | 337 |
|
338 |
(* translation functions *) |
|
339 |
||
36950 | 340 |
val trfun = Parse.opt_keyword "advanced" -- Parse.ML_source; |
14642 | 341 |
|
24868 | 342 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
343 |
Outer_Syntax.command ("parse_ast_translation", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
344 |
"install parse ast translation functions" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
345 |
(trfun >> (Toplevel.theory o Isar_Cmd.parse_ast_translation)); |
5832 | 346 |
|
24868 | 347 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
348 |
Outer_Syntax.command ("parse_translation", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
349 |
"install parse translation functions" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
350 |
(trfun >> (Toplevel.theory o Isar_Cmd.parse_translation)); |
5832 | 351 |
|
24868 | 352 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
353 |
Outer_Syntax.command ("print_translation", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
354 |
"install print translation functions" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
355 |
(trfun >> (Toplevel.theory o Isar_Cmd.print_translation)); |
5832 | 356 |
|
24868 | 357 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
358 |
Outer_Syntax.command ("typed_print_translation", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
359 |
"install typed print translation functions" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
360 |
(trfun >> (Toplevel.theory o Isar_Cmd.typed_print_translation)); |
5832 | 361 |
|
24868 | 362 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
363 |
Outer_Syntax.command ("print_ast_translation", Keyword.tag_ml Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
364 |
"install print ast translation functions" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
365 |
(trfun >> (Toplevel.theory o Isar_Cmd.print_ast_translation)); |
5832 | 366 |
|
367 |
||
368 |
(* oracles *) |
|
369 |
||
24868 | 370 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
371 |
Outer_Syntax.command ("oracle", Keyword.tag_ml Keyword.thy_decl) "declare oracle" |
36950 | 372 |
(Parse.position Parse.name -- (Parse.$$$ "=" |-- Parse.ML_source) >> |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
373 |
(fn (x, y) => Toplevel.theory (Isar_Cmd.oracle x y))); |
5832 | 374 |
|
375 |
||
47057 | 376 |
(* bundled declarations *) |
377 |
||
378 |
val _ = |
|
379 |
Outer_Syntax.local_theory ("bundle", Keyword.thy_decl) "define bundle of declarations" |
|
380 |
((Parse.binding --| Parse.$$$ "=") -- Parse_Spec.xthms1 -- Parse.for_fixes |
|
381 |
>> (uncurry Bundle.bundle_cmd)); |
|
382 |
||
383 |
val _ = |
|
384 |
Outer_Syntax.command ("include", Keyword.prf_decl) |
|
385 |
"include declarations from bundle in proof body" |
|
47066
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
386 |
(Scan.repeat1 (Parse.position Parse.xname) |
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
387 |
>> (Toplevel.print oo (Toplevel.proof o Bundle.include_cmd))); |
47057 | 388 |
|
389 |
val _ = |
|
390 |
Outer_Syntax.command ("including", Keyword.prf_decl) |
|
391 |
"include declarations from bundle in goal refinement" |
|
47066
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
392 |
(Scan.repeat1 (Parse.position Parse.xname) |
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
393 |
>> (Toplevel.print oo (Toplevel.proof o Bundle.including_cmd))); |
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
394 |
|
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
395 |
val _ = |
47057 | 396 |
Outer_Syntax.improper_command ("print_bundles", Keyword.diag) "print bundles of declarations" |
397 |
(Scan.succeed (Toplevel.no_timing o Toplevel.unknown_context o |
|
398 |
Toplevel.keep (Bundle.print_bundles o Toplevel.context_of))); |
|
399 |
||
400 |
||
47069 | 401 |
(* local theories *) |
402 |
||
403 |
val _ = |
|
404 |
Outer_Syntax.command ("context", Keyword.thy_decl) "begin local theory context" |
|
47253
a00c5c88d8f3
more general context command with auxiliary fixes/assumes etc.;
wenzelm
parents:
47069
diff
changeset
|
405 |
((Parse.position Parse.xname >> (fn name => |
a00c5c88d8f3
more general context command with auxiliary fixes/assumes etc.;
wenzelm
parents:
47069
diff
changeset
|
406 |
Toplevel.print o Toplevel.begin_local_theory true (Named_Target.context_cmd name)) || |
a00c5c88d8f3
more general context command with auxiliary fixes/assumes etc.;
wenzelm
parents:
47069
diff
changeset
|
407 |
Scan.optional Parse_Spec.includes [] -- Scan.repeat Parse_Spec.context_element |
a00c5c88d8f3
more general context command with auxiliary fixes/assumes etc.;
wenzelm
parents:
47069
diff
changeset
|
408 |
>> (fn (incls, elems) => Toplevel.open_target (Bundle.context_cmd incls elems))) |
47069 | 409 |
--| Parse.begin); |
410 |
||
411 |
||
12061 | 412 |
(* locales *) |
413 |
||
12758 | 414 |
val locale_val = |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
415 |
Parse_Spec.locale_expression false -- |
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
416 |
Scan.optional (Parse.$$$ "+" |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] || |
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
417 |
Scan.repeat1 Parse_Spec.context_element >> pair ([], []); |
12061 | 418 |
|
24868 | 419 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
420 |
Outer_Syntax.command ("locale", Keyword.thy_decl) "define named proof context" |
36950 | 421 |
(Parse.binding -- |
422 |
Scan.optional (Parse.$$$ "=" |-- Parse.!!! locale_val) (([], []), []) -- Parse.opt_begin |
|
27681 | 423 |
>> (fn ((name, (expr, elems)), begin) => |
21843 | 424 |
(begin ? Toplevel.print) o Toplevel.begin_local_theory begin |
41585
45d7da4e4ccf
added before_exit continuation for named targets (locale, class etc.), e.g. for final check/cleanup as in VC management;
wenzelm
parents:
41536
diff
changeset
|
425 |
(Expression.add_locale_cmd I name Binding.empty expr elems #> snd))); |
28085
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
28084
diff
changeset
|
426 |
|
41270 | 427 |
fun parse_interpretation_arguments mandatory = |
428 |
Parse.!!! (Parse_Spec.locale_expression mandatory) -- |
|
429 |
Scan.optional |
|
430 |
(Parse.where_ |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []; |
|
431 |
||
24868 | 432 |
val _ = |
47416 | 433 |
Outer_Syntax.command ("sublocale", Keyword.thy_schematic_goal) |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
434 |
"prove sublocale relation between a locale and a locale expression" |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
435 |
(Parse.position Parse.xname --| (Parse.$$$ "\<subseteq>" || Parse.$$$ "<") -- |
41270 | 436 |
parse_interpretation_arguments false |
437 |
>> (fn (loc, (expr, equations)) => |
|
41585
45d7da4e4ccf
added before_exit continuation for named targets (locale, class etc.), e.g. for final check/cleanup as in VC management;
wenzelm
parents:
41536
diff
changeset
|
438 |
Toplevel.print o Toplevel.theory_to_proof (Expression.sublocale_cmd I loc expr equations))); |
28895 | 439 |
|
440 |
val _ = |
|
47416 | 441 |
Outer_Syntax.command ("interpretation", Keyword.thy_schematic_goal) |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
442 |
"prove interpretation of locale expression in theory" |
41270 | 443 |
(parse_interpretation_arguments true |
30727
519f8f0fcbf3
interpretation/interpret: prefixes within locale expression are mandatory by default;
wenzelm
parents:
30703
diff
changeset
|
444 |
>> (fn (expr, equations) => Toplevel.print o |
519f8f0fcbf3
interpretation/interpret: prefixes within locale expression are mandatory by default;
wenzelm
parents:
30703
diff
changeset
|
445 |
Toplevel.theory_to_proof (Expression.interpretation_cmd expr equations))); |
29223 | 446 |
|
447 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
448 |
Outer_Syntax.command ("interpret", Keyword.tag_proof Keyword.prf_goal) |
29223 | 449 |
"prove interpretation of locale expression in proof context" |
41270 | 450 |
(parse_interpretation_arguments true |
38108 | 451 |
>> (fn (expr, equations) => Toplevel.print o |
452 |
Toplevel.proof' (Expression.interpret_cmd expr equations))); |
|
29223 | 453 |
|
15703 | 454 |
|
22299 | 455 |
(* classes *) |
456 |
||
24868 | 457 |
val class_val = |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
458 |
Parse_Spec.class_expression -- |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
459 |
Scan.optional (Parse.$$$ "+" |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] || |
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
460 |
Scan.repeat1 Parse_Spec.context_element >> pair []; |
22299 | 461 |
|
24868 | 462 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
463 |
Outer_Syntax.command ("class", Keyword.thy_decl) "define type class" |
36950 | 464 |
(Parse.binding -- Scan.optional (Parse.$$$ "=" |-- class_val) ([], []) -- Parse.opt_begin |
26516 | 465 |
>> (fn ((name, (supclasses, elems)), begin) => |
24938 | 466 |
(begin ? Toplevel.print) o Toplevel.begin_local_theory begin |
41585
45d7da4e4ccf
added before_exit continuation for named targets (locale, class etc.), e.g. for final check/cleanup as in VC management;
wenzelm
parents:
41536
diff
changeset
|
467 |
(Class_Declaration.class_cmd I name supclasses elems #> snd))); |
22299 | 468 |
|
24868 | 469 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
470 |
Outer_Syntax.local_theory_to_proof ("subclass", Keyword.thy_goal) "prove a subclass relation" |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
471 |
(Parse.class >> Class_Declaration.subclass_cmd I); |
24914
95cda5dd58d5
added proper subclass concept; improved class target
haftmann
parents:
24871
diff
changeset
|
472 |
|
95cda5dd58d5
added proper subclass concept; improved class target
haftmann
parents:
24871
diff
changeset
|
473 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
474 |
Outer_Syntax.command ("instantiation", Keyword.thy_decl) "instantiate and prove type arity" |
36950 | 475 |
(Parse.multi_arity --| Parse.begin |
25462 | 476 |
>> (fn arities => Toplevel.print o |
38348
cf7b2121ad9d
moved instantiation target formally to class_target.ML
haftmann
parents:
38342
diff
changeset
|
477 |
Toplevel.begin_local_theory true (Class.instantiation_cmd arities))); |
24589 | 478 |
|
25485 | 479 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
480 |
Outer_Syntax.command ("instance", Keyword.thy_goal) "prove type arity or subclass relation" |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
481 |
((Parse.class -- |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
482 |
((Parse.$$$ "\<subseteq>" || Parse.$$$ "<") |-- Parse.!!! Parse.class) >> Class.classrel_cmd || |
36950 | 483 |
Parse.multi_arity >> Class.instance_arity_cmd) |
484 |
>> (Toplevel.print oo Toplevel.theory_to_proof) || |
|
485 |
Scan.succeed |
|
486 |
(Toplevel.print o Toplevel.local_theory_to_proof NONE (Class.instantiation_instance I))); |
|
22299 | 487 |
|
488 |
||
25519 | 489 |
(* arbitrary overloading *) |
490 |
||
491 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
492 |
Outer_Syntax.command ("overloading", Keyword.thy_decl) "overloaded definitions" |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
493 |
(Scan.repeat1 (Parse.name --| (Parse.$$$ "\<equiv>" || Parse.$$$ "==") -- Parse.term -- |
36950 | 494 |
Scan.optional (Parse.$$$ "(" |-- (Parse.$$$ "unchecked" >> K false) --| Parse.$$$ ")") true |
495 |
>> Parse.triple1) --| Parse.begin |
|
25519 | 496 |
>> (fn operations => Toplevel.print o |
38342
09d4a04d5c2e
moved overloading target formally to overloading.ML
haftmann
parents:
38108
diff
changeset
|
497 |
Toplevel.begin_local_theory true (Overloading.overloading_cmd operations))); |
25519 | 498 |
|
499 |
||
22866 | 500 |
(* code generation *) |
501 |
||
24868 | 502 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
503 |
Outer_Syntax.command ("code_datatype", Keyword.thy_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
504 |
"define set of code datatype constructors" |
36950 | 505 |
(Scan.repeat1 Parse.term >> (Toplevel.theory o Code.add_datatype_cmd)); |
22866 | 506 |
|
507 |
||
5832 | 508 |
|
509 |
(** proof commands **) |
|
510 |
||
511 |
(* statements *) |
|
512 |
||
36317
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
513 |
fun gen_theorem schematic kind = |
36953
2af1ad9aa1a3
renamed structure OuterSyntax to Outer_Syntax, keeping the old name as alias for some time;
wenzelm
parents:
36952
diff
changeset
|
514 |
Outer_Syntax.local_theory_to_proof' |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
515 |
(if schematic then ("schematic_" ^ kind, Keyword.thy_schematic_goal) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
516 |
else (kind, Keyword.thy_goal)) |
36317
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
517 |
("state " ^ (if schematic then "schematic " ^ kind else kind)) |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
518 |
(Scan.optional (Parse_Spec.opt_thm_name ":" --| |
47067
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
519 |
Scan.ahead (Parse_Spec.includes >> K "" || |
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
520 |
Parse_Spec.locale_keyword || Parse_Spec.statement_keyword)) Attrib.empty_binding -- |
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
521 |
Scan.optional Parse_Spec.includes [] -- |
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
522 |
Parse_Spec.general_statement >> (fn ((a, includes), (elems, concl)) => |
36317
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
523 |
((if schematic then Specification.schematic_theorem_cmd else Specification.theorem_cmd) |
47067
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
524 |
kind NONE (K I) a includes elems concl))); |
5832 | 525 |
|
36317
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
526 |
val _ = gen_theorem false Thm.theoremK; |
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
527 |
val _ = gen_theorem false Thm.lemmaK; |
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
528 |
val _ = gen_theorem false Thm.corollaryK; |
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
529 |
val _ = gen_theorem true Thm.theoremK; |
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
530 |
val _ = gen_theorem true Thm.lemmaK; |
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
531 |
val _ = gen_theorem true Thm.corollaryK; |
5832 | 532 |
|
24868 | 533 |
val _ = |
47069 | 534 |
Outer_Syntax.local_theory_to_proof ("notepad", Keyword.thy_decl) "begin proof context" |
40960 | 535 |
(Parse.begin >> K Proof.begin_notepad); |
536 |
||
537 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
538 |
Outer_Syntax.command ("have", Keyword.tag_proof Keyword.prf_goal) "state local goal" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
539 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.have)); |
17353 | 540 |
|
24868 | 541 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
542 |
Outer_Syntax.command ("hence", Keyword.tag_proof Keyword.prf_goal) "abbreviates \"then have\"" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
543 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.hence)); |
17353 | 544 |
|
24868 | 545 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
546 |
Outer_Syntax.command ("show", Keyword.tag_proof Keyword.prf_asm_goal) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
547 |
"state local goal, solving current obligation" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
548 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.show)); |
5832 | 549 |
|
24868 | 550 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
551 |
Outer_Syntax.command ("thus", Keyword.tag_proof Keyword.prf_asm_goal) "abbreviates \"then show\"" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
552 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.thus)); |
6501 | 553 |
|
5832 | 554 |
|
5914 | 555 |
(* facts *) |
5832 | 556 |
|
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
557 |
val facts = Parse.and_list1 Parse_Spec.xthms1; |
9197 | 558 |
|
24868 | 559 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
560 |
Outer_Syntax.command ("then", Keyword.tag_proof Keyword.prf_chain) "forward chaining" |
17900 | 561 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.chain)); |
5832 | 562 |
|
24868 | 563 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
564 |
Outer_Syntax.command ("from", Keyword.tag_proof Keyword.prf_chain) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
565 |
"forward chaining from given facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
566 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.from_thmss_cmd))); |
5914 | 567 |
|
24868 | 568 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
569 |
Outer_Syntax.command ("with", Keyword.tag_proof Keyword.prf_chain) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
570 |
"forward chaining from given and current facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
571 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.with_thmss_cmd))); |
6878 | 572 |
|
24868 | 573 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
574 |
Outer_Syntax.command ("note", Keyword.tag_proof Keyword.prf_decl) "define facts" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
575 |
(Parse_Spec.name_facts >> (Toplevel.print oo (Toplevel.proof o Proof.note_thmss_cmd))); |
5832 | 576 |
|
24868 | 577 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
578 |
Outer_Syntax.command ("using", Keyword.tag_proof Keyword.prf_decl) "augment goal facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
579 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.using_cmd))); |
18544 | 580 |
|
24868 | 581 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
582 |
Outer_Syntax.command ("unfolding", Keyword.tag_proof Keyword.prf_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
583 |
"unfold definitions in goal and facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
584 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.unfolding_cmd))); |
12926 | 585 |
|
5832 | 586 |
|
587 |
(* proof context *) |
|
588 |
||
24868 | 589 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
590 |
Outer_Syntax.command ("fix", Keyword.tag_proof Keyword.prf_asm) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
591 |
"fix local variables (Skolem constants)" |
36950 | 592 |
(Parse.fixes >> (Toplevel.print oo (Toplevel.proof o Proof.fix_cmd))); |
11890 | 593 |
|
24868 | 594 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
595 |
Outer_Syntax.command ("assume", Keyword.tag_proof Keyword.prf_asm) "assume propositions" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
596 |
(Parse_Spec.statement >> (Toplevel.print oo (Toplevel.proof o Proof.assume_cmd))); |
5832 | 597 |
|
24868 | 598 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
599 |
Outer_Syntax.command ("presume", Keyword.tag_proof Keyword.prf_asm) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
600 |
"assume propositions, to be established later" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
601 |
(Parse_Spec.statement >> (Toplevel.print oo (Toplevel.proof o Proof.presume_cmd))); |
6850 | 602 |
|
24868 | 603 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
604 |
Outer_Syntax.command ("def", Keyword.tag_proof Keyword.prf_asm) "local definition" |
36950 | 605 |
(Parse.and_list1 |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
606 |
(Parse_Spec.opt_thm_name ":" -- |
36950 | 607 |
((Parse.binding -- Parse.opt_mixfix) -- |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
608 |
((Parse.$$$ "\<equiv>" || Parse.$$$ "==") |-- Parse.!!! Parse.termp))) |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
609 |
>> (Toplevel.print oo (Toplevel.proof o Proof.def_cmd))); |
6953 | 610 |
|
24868 | 611 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
612 |
Outer_Syntax.command ("obtain", Keyword.tag_proof Keyword.prf_asm_goal) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
613 |
"generalized elimination" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
614 |
(Parse.parname -- Scan.optional (Parse.fixes --| Parse.where_) [] -- Parse_Spec.statement |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
615 |
>> (fn ((x, y), z) => Toplevel.print o Toplevel.proof' (Obtain.obtain_cmd x y z))); |
5832 | 616 |
|
24868 | 617 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
618 |
Outer_Syntax.command ("guess", Keyword.tag_proof Keyword.prf_asm_goal) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
619 |
"wild guessing (unstructured)" |
36950 | 620 |
(Scan.optional Parse.fixes [] >> (Toplevel.print oo (Toplevel.proof' o Obtain.guess_cmd))); |
17854 | 621 |
|
24868 | 622 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
623 |
Outer_Syntax.command ("let", Keyword.tag_proof Keyword.prf_decl) "bind text variables" |
36950 | 624 |
(Parse.and_list1 (Parse.and_list1 Parse.term -- (Parse.$$$ "=" |-- Parse.term)) |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
625 |
>> (Toplevel.print oo (Toplevel.proof o Proof.let_bind_cmd))); |
5832 | 626 |
|
36505
79c1d2bbe5a9
ProofContext.read_const: allow for type constraint (for fixed variable);
wenzelm
parents:
36452
diff
changeset
|
627 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
628 |
Outer_Syntax.command ("write", Keyword.tag_proof Keyword.prf_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
629 |
"add concrete syntax for constants / fixed variables" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
630 |
(opt_mode -- Parse.and_list1 (Parse.const -- Parse_Spec.locale_mixfix) |
36505
79c1d2bbe5a9
ProofContext.read_const: allow for type constraint (for fixed variable);
wenzelm
parents:
36452
diff
changeset
|
631 |
>> (fn (mode, args) => Toplevel.print o Toplevel.proof (Proof.write_cmd mode args))); |
79c1d2bbe5a9
ProofContext.read_const: allow for type constraint (for fixed variable);
wenzelm
parents:
36452
diff
changeset
|
632 |
|
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
633 |
val case_spec = |
36950 | 634 |
(Parse.$$$ "(" |-- |
42496 | 635 |
Parse.!!! (Parse.xname -- Scan.repeat1 (Parse.maybe Parse.binding) --| Parse.$$$ ")") || |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
636 |
Parse.xname >> rpair []) -- Parse_Spec.opt_attribs >> Parse.triple1; |
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
637 |
|
24868 | 638 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
639 |
Outer_Syntax.command ("case", Keyword.tag_proof Keyword.prf_asm) "invoke local context" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
640 |
(case_spec >> (Toplevel.print oo (Toplevel.proof o Proof.invoke_case_cmd))); |
8370 | 641 |
|
5832 | 642 |
|
643 |
(* proof structure *) |
|
644 |
||
24868 | 645 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
646 |
Outer_Syntax.command ("{", Keyword.tag_proof Keyword.prf_open) "begin explicit proof block" |
17900 | 647 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.begin_block)); |
5832 | 648 |
|
24868 | 649 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
650 |
Outer_Syntax.command ("}", Keyword.tag_proof Keyword.prf_close) "end explicit proof block" |
20305 | 651 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.end_block)); |
6687 | 652 |
|
24868 | 653 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
654 |
Outer_Syntax.command ("next", Keyword.tag_proof Keyword.prf_block) "enter next proof block" |
17900 | 655 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.next_block)); |
5832 | 656 |
|
657 |
||
658 |
(* end proof *) |
|
659 |
||
24868 | 660 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
661 |
Outer_Syntax.command ("qed", Keyword.tag_proof Keyword.qed_block) "conclude (sub-)proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
662 |
(Scan.option Method.parse >> Isar_Cmd.qed); |
5832 | 663 |
|
24868 | 664 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
665 |
Outer_Syntax.command ("by", Keyword.tag_proof Keyword.qed) "terminal backward proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
666 |
(Method.parse -- Scan.option Method.parse >> Isar_Cmd.terminal_proof); |
6404 | 667 |
|
24868 | 668 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
669 |
Outer_Syntax.command ("..", Keyword.tag_proof Keyword.qed) "default proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
670 |
(Scan.succeed Isar_Cmd.default_proof); |
8966 | 671 |
|
24868 | 672 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
673 |
Outer_Syntax.command (".", Keyword.tag_proof Keyword.qed) "immediate proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
674 |
(Scan.succeed Isar_Cmd.immediate_proof); |
6404 | 675 |
|
24868 | 676 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
677 |
Outer_Syntax.command ("done", Keyword.tag_proof Keyword.qed) "done proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
678 |
(Scan.succeed Isar_Cmd.done_proof); |
5832 | 679 |
|
24868 | 680 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
681 |
Outer_Syntax.command ("sorry", Keyword.tag_proof Keyword.qed) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
682 |
"skip proof (quick-and-dirty mode only!)" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
683 |
(Scan.succeed Isar_Cmd.skip_proof); |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
6886
diff
changeset
|
684 |
|
24868 | 685 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
686 |
Outer_Syntax.command ("oops", Keyword.tag_proof Keyword.qed_global) "forget proof" |
18561 | 687 |
(Scan.succeed Toplevel.forget_proof); |
8210 | 688 |
|
5832 | 689 |
|
690 |
(* proof steps *) |
|
691 |
||
24868 | 692 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
693 |
Outer_Syntax.command ("defer", Keyword.tag_proof Keyword.prf_script) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
694 |
"shuffle internal proof state" |
36950 | 695 |
(Scan.option Parse.nat >> (Toplevel.print oo (Toplevel.proofs o Proof.defer))); |
8165 | 696 |
|
24868 | 697 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
698 |
Outer_Syntax.command ("prefer", Keyword.tag_proof Keyword.prf_script) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
699 |
"shuffle internal proof state" |
36950 | 700 |
(Parse.nat >> (Toplevel.print oo (Toplevel.proofs o Proof.prefer))); |
8165 | 701 |
|
24868 | 702 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
703 |
Outer_Syntax.command ("apply", Keyword.tag_proof Keyword.prf_script) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
704 |
"initial refinement step (unstructured)" |
22117 | 705 |
(Method.parse >> (Toplevel.print oo (Toplevel.proofs o Proof.apply))); |
5832 | 706 |
|
24868 | 707 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
708 |
Outer_Syntax.command ("apply_end", Keyword.tag_proof Keyword.prf_script) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
709 |
"terminal refinement (unstructured)" |
22117 | 710 |
(Method.parse >> (Toplevel.print oo (Toplevel.proofs o Proof.apply_end))); |
5832 | 711 |
|
24868 | 712 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
713 |
Outer_Syntax.command ("proof", Keyword.tag_proof Keyword.prf_block) "backward proof" |
22117 | 714 |
(Scan.option Method.parse >> (fn m => Toplevel.print o |
33390 | 715 |
Toplevel.actual_proof (Proof_Node.applys (Proof.proof m)) o |
27563 | 716 |
Toplevel.skip_proof (fn i => i + 1))); |
5832 | 717 |
|
718 |
||
6773 | 719 |
(* calculational proof commands *) |
720 |
||
6878 | 721 |
val calc_args = |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
722 |
Scan.option (Parse.$$$ "(" |-- Parse.!!! ((Parse_Spec.xthms1 --| Parse.$$$ ")"))); |
6878 | 723 |
|
24868 | 724 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
725 |
Outer_Syntax.command ("also", Keyword.tag_proof Keyword.prf_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
726 |
"combine calculation and current facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
727 |
(calc_args >> (Toplevel.proofs' o Calculation.also_cmd)); |
6773 | 728 |
|
24868 | 729 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
730 |
Outer_Syntax.command ("finally", Keyword.tag_proof Keyword.prf_chain) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
731 |
"combine calculation and current facts, exhibit result" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
732 |
(calc_args >> (Toplevel.proofs' o Calculation.finally_cmd)); |
6773 | 733 |
|
24868 | 734 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
735 |
Outer_Syntax.command ("moreover", Keyword.tag_proof Keyword.prf_decl) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
736 |
"augment calculation by current facts" |
17900 | 737 |
(Scan.succeed (Toplevel.proof' Calculation.moreover)); |
8562 | 738 |
|
24868 | 739 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
740 |
Outer_Syntax.command ("ultimately", Keyword.tag_proof Keyword.prf_chain) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
741 |
"augment calculation by current facts, exhibit result" |
17900 | 742 |
(Scan.succeed (Toplevel.proof' Calculation.ultimately)); |
8588 | 743 |
|
6773 | 744 |
|
6742 | 745 |
(* proof navigation *) |
5944 | 746 |
|
24868 | 747 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
748 |
Outer_Syntax.command ("back", Keyword.tag_proof Keyword.prf_script) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
749 |
"backtracking of proof command" |
33390 | 750 |
(Scan.succeed (Toplevel.print o Toplevel.actual_proof Proof_Node.back o Toplevel.skip_proof I)); |
6742 | 751 |
|
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
752 |
|
27614
f38c25d106a7
renamed IsarCmd.nested_command to OuterSyntax.prepare_command;
wenzelm
parents:
27575
diff
changeset
|
753 |
(* nested commands *) |
25578 | 754 |
|
29309 | 755 |
val props_text = |
43775
b361c7d184e7
added Parse.properties (again) -- allow empty list like Parse_Value.properties but unlike Parse.properties of ef86de9c98aa;
wenzelm
parents:
43227
diff
changeset
|
756 |
Scan.optional Parse.properties [] -- Parse.position Parse.string |
36950 | 757 |
>> (fn (props, (str, pos)) => |
758 |
(Position.of_properties (Position.default_properties pos props), str)); |
|
29309 | 759 |
|
25578 | 760 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
761 |
Outer_Syntax.improper_command ("Isabelle.command", Keyword.control) "nested Isabelle command" |
29309 | 762 |
(props_text :|-- (fn (pos, str) => |
36953
2af1ad9aa1a3
renamed structure OuterSyntax to Outer_Syntax, keeping the old name as alias for some time;
wenzelm
parents:
36952
diff
changeset
|
763 |
(case Outer_Syntax.parse pos str of |
27838
0340fd7cccc3
Isabelle.command: inline former OuterSyntax.prepare_command;
wenzelm
parents:
27831
diff
changeset
|
764 |
[tr] => Scan.succeed (K tr) |
43947
9b00f09f7721
defer evaluation of Scan.message, for improved performance in the frequent situation where failure is handled later (e.g. via ||);
wenzelm
parents:
43775
diff
changeset
|
765 |
| _ => Scan.fail_with (K (fn () => "exactly one command expected"))) |
9b00f09f7721
defer evaluation of Scan.message, for improved performance in the frequent situation where failure is handled later (e.g. via ||);
wenzelm
parents:
43775
diff
changeset
|
766 |
handle ERROR msg => Scan.fail_with (K (fn () => msg)))); |
25578 | 767 |
|
768 |
||
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
769 |
|
5832 | 770 |
(** diagnostic commands (for interactive mode only) **) |
771 |
||
36950 | 772 |
val opt_modes = |
773 |
Scan.optional (Parse.$$$ "(" |-- Parse.!!! (Scan.repeat1 Parse.xname --| Parse.$$$ ")")) []; |
|
774 |
||
775 |
val opt_bang = Scan.optional (Parse.$$$ "!" >> K true) false; |
|
8464 | 776 |
|
24868 | 777 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
778 |
Outer_Syntax.improper_command ("pretty_setmargin", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
779 |
"change default margin for pretty printing" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
780 |
(Parse.nat >> |
38870 | 781 |
(fn n => Toplevel.no_timing o Toplevel.imperative (fn () => Pretty.margin_default := n))); |
7124 | 782 |
|
24868 | 783 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
784 |
Outer_Syntax.improper_command ("help", Keyword.diag) "print outer syntax commands" |
36953
2af1ad9aa1a3
renamed structure OuterSyntax to Outer_Syntax, keeping the old name as alias for some time;
wenzelm
parents:
36952
diff
changeset
|
785 |
(Scan.succeed (Toplevel.no_timing o Toplevel.imperative Outer_Syntax.print_outer_syntax)); |
21714 | 786 |
|
24868 | 787 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
788 |
Outer_Syntax.improper_command ("print_commands", Keyword.diag) "print outer syntax commands" |
36953
2af1ad9aa1a3
renamed structure OuterSyntax to Outer_Syntax, keeping the old name as alias for some time;
wenzelm
parents:
36952
diff
changeset
|
789 |
(Scan.succeed (Toplevel.no_timing o Toplevel.imperative Outer_Syntax.print_outer_syntax)); |
5832 | 790 |
|
24868 | 791 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
792 |
Outer_Syntax.improper_command ("print_configs", Keyword.diag) "print configuration options" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
793 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_configs)); |
23989 | 794 |
|
24868 | 795 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
796 |
Outer_Syntax.improper_command ("print_context", Keyword.diag) "print theory context name" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
797 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_context)); |
7308 | 798 |
|
24868 | 799 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
800 |
Outer_Syntax.improper_command ("print_theory", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
801 |
"print logical theory contents (verbose!)" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
802 |
(opt_bang >> (Toplevel.no_timing oo Isar_Cmd.print_theory)); |
5832 | 803 |
|
24868 | 804 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
805 |
Outer_Syntax.improper_command ("print_syntax", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
806 |
"print inner syntax of context (verbose!)" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
807 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_syntax)); |
5832 | 808 |
|
24868 | 809 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
810 |
Outer_Syntax.improper_command ("print_abbrevs", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
811 |
"print constant abbreviation of context" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
812 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_abbrevs)); |
21726 | 813 |
|
24868 | 814 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
815 |
Outer_Syntax.improper_command ("print_theorems", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
816 |
"print theorems of local theory or proof context" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
817 |
(opt_bang >> (Toplevel.no_timing oo Isar_Cmd.print_theorems)); |
5881 | 818 |
|
24868 | 819 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
820 |
Outer_Syntax.improper_command ("print_locales", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
821 |
"print locales of this theory" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
822 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_locales)); |
12061 | 823 |
|
24868 | 824 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
825 |
Outer_Syntax.improper_command ("print_classes", Keyword.diag) "print classes of this theory" |
42359 | 826 |
(Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory o |
827 |
Toplevel.keep (Class.print_classes o Toplevel.context_of))); |
|
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
828 |
|
24868 | 829 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
830 |
Outer_Syntax.improper_command ("print_locale", Keyword.diag) "print locale of this theory" |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
831 |
(opt_bang -- Parse.position Parse.xname >> (Toplevel.no_timing oo Isar_Cmd.print_locale)); |
12061 | 832 |
|
24868 | 833 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
834 |
Outer_Syntax.improper_command ("print_interps", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
835 |
"print interpretations of locale for this theory or proof context" |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
836 |
(Parse.position Parse.xname >> (Toplevel.no_timing oo Isar_Cmd.print_registrations)); |
32804
ca430e6aee1c
Propagation of mixins for interpretation; reactivated diagnostic command print_interps.
ballarin
parents:
31869
diff
changeset
|
837 |
|
ca430e6aee1c
Propagation of mixins for interpretation; reactivated diagnostic command print_interps.
ballarin
parents:
31869
diff
changeset
|
838 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
839 |
Outer_Syntax.improper_command ("print_dependencies", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
840 |
"print dependencies of locale expression" |
41435 | 841 |
(opt_bang -- Parse_Spec.locale_expression true >> |
842 |
(Toplevel.no_timing oo Isar_Cmd.print_dependencies)); |
|
843 |
||
844 |
val _ = |
|
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
845 |
Outer_Syntax.improper_command ("print_attributes", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
846 |
"print attributes of this theory" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
847 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_attributes)); |
5832 | 848 |
|
24868 | 849 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
850 |
Outer_Syntax.improper_command ("print_simpset", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
851 |
"print context of Simplifier" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
852 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_simpset)); |
16027 | 853 |
|
24868 | 854 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
855 |
Outer_Syntax.improper_command ("print_rules", Keyword.diag) "print intro/elim rules" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
856 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_rules)); |
12383 | 857 |
|
24868 | 858 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
859 |
Outer_Syntax.improper_command ("print_trans_rules", Keyword.diag) "print transitivity rules" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
860 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_trans_rules)); |
9221 | 861 |
|
24868 | 862 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
863 |
Outer_Syntax.improper_command ("print_methods", Keyword.diag) "print methods of this theory" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
864 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_methods)); |
5832 | 865 |
|
24868 | 866 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
867 |
Outer_Syntax.improper_command ("print_antiquotations", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
868 |
"print antiquotations (global)" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
869 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_antiquotations)); |
9221 | 870 |
|
24868 | 871 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
872 |
Outer_Syntax.improper_command ("thy_deps", Keyword.diag) "visualize theory dependencies" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
873 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.thy_deps)); |
22485 | 874 |
|
24868 | 875 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
876 |
Outer_Syntax.improper_command ("class_deps", Keyword.diag) "visualize class dependencies" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
877 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.class_deps)); |
20574 | 878 |
|
24868 | 879 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
880 |
Outer_Syntax.improper_command ("thm_deps", Keyword.diag) "visualize theorem dependencies" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
881 |
(Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.thm_deps)); |
9454 | 882 |
|
24868 | 883 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
884 |
Outer_Syntax.improper_command ("print_binds", Keyword.diag) "print term bindings of proof context" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
885 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_binds)); |
5832 | 886 |
|
24868 | 887 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
888 |
Outer_Syntax.improper_command ("print_facts", Keyword.diag) "print facts of proof context" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
889 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_facts)); |
5832 | 890 |
|
24868 | 891 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
892 |
Outer_Syntax.improper_command ("print_cases", Keyword.diag) "print cases of proof context" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
893 |
(Scan.succeed (Toplevel.no_timing o Isar_Cmd.print_cases)); |
8370 | 894 |
|
24868 | 895 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
896 |
Outer_Syntax.improper_command ("print_statement", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
897 |
"print theorems as long statements" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
898 |
(opt_modes -- Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.print_stmts)); |
19269 | 899 |
|
24868 | 900 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
901 |
Outer_Syntax.improper_command ("thm", Keyword.diag) "print theorems" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
902 |
(opt_modes -- Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.print_thms)); |
5832 | 903 |
|
24868 | 904 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
905 |
Outer_Syntax.improper_command ("prf", Keyword.diag) "print proof terms of theorems" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
906 |
(opt_modes -- Scan.option Parse_Spec.xthms1 |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
907 |
>> (Toplevel.no_timing oo Isar_Cmd.print_prfs false)); |
11524
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
908 |
|
24868 | 909 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
910 |
Outer_Syntax.improper_command ("full_prf", Keyword.diag) "print full proof terms of theorems" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
911 |
(opt_modes -- Scan.option Parse_Spec.xthms1 >> (Toplevel.no_timing oo Isar_Cmd.print_prfs true)); |
11524
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
912 |
|
24868 | 913 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
914 |
Outer_Syntax.improper_command ("prop", Keyword.diag) "read and print proposition" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
915 |
(opt_modes -- Parse.term >> (Toplevel.no_timing oo Isar_Cmd.print_prop)); |
5832 | 916 |
|
24868 | 917 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
918 |
Outer_Syntax.improper_command ("term", Keyword.diag) "read and print term" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
919 |
(opt_modes -- Parse.term >> (Toplevel.no_timing oo Isar_Cmd.print_term)); |
5832 | 920 |
|
24868 | 921 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
922 |
Outer_Syntax.improper_command ("typ", Keyword.diag) "read and print type" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
923 |
(opt_modes -- Parse.typ >> (Toplevel.no_timing oo Isar_Cmd.print_type)); |
5832 | 924 |
|
24868 | 925 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
926 |
Outer_Syntax.improper_command ("print_codesetup", Keyword.diag) "print code generator setup" |
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
927 |
(Scan.succeed |
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
928 |
(Toplevel.no_timing o Toplevel.unknown_theory o Toplevel.keep |
24219 | 929 |
(Code.print_codesetup o Toplevel.theory_of))); |
5832 | 930 |
|
26184 | 931 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
932 |
Outer_Syntax.improper_command ("unused_thms", Keyword.diag) "find unused theorems" |
36950 | 933 |
(Scan.option ((Scan.repeat1 (Scan.unless Parse.minus Parse.name) --| Parse.minus) -- |
934 |
Scan.option (Scan.repeat1 (Scan.unless Parse.minus Parse.name))) >> |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
935 |
(Toplevel.no_timing oo Isar_Cmd.unused_thms)); |
26184 | 936 |
|
5832 | 937 |
|
30142
8d6145694bb5
moved find_theorems.ML and find_consts.ML to Pure/Tools, collecting main implementation in one place each;
wenzelm
parents:
29882
diff
changeset
|
938 |
|
5832 | 939 |
(** system commands (for interactive mode only) **) |
940 |
||
24868 | 941 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
942 |
Outer_Syntax.improper_command ("cd", Keyword.control) "change current working directory" |
40395
4985aaade799
mark 'cd' and 'commit' as control command -- not usable in asynchronous document model, likely to cause confusion in Proof General;
wenzelm
parents:
39214
diff
changeset
|
943 |
(Parse.path >> (fn path => Toplevel.no_timing o Toplevel.imperative (fn () => File.cd path))); |
5832 | 944 |
|
24868 | 945 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
946 |
Outer_Syntax.improper_command ("pwd", Keyword.diag) "print current working directory" |
40395
4985aaade799
mark 'cd' and 'commit' as control command -- not usable in asynchronous document model, likely to cause confusion in Proof General;
wenzelm
parents:
39214
diff
changeset
|
947 |
(Scan.succeed (Toplevel.no_timing o |
41944
b97091ae583a
Path.print is the official way to show file-system paths to users -- note that Path.implode often indicates violation of the abstract datatype;
wenzelm
parents:
41585
diff
changeset
|
948 |
Toplevel.imperative (fn () => writeln (Path.print (File.pwd ()))))); |
5832 | 949 |
|
24868 | 950 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
951 |
Outer_Syntax.improper_command ("use_thy", Keyword.control) "use theory file" |
36950 | 952 |
(Parse.name >> (fn name => |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
953 |
Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.use_thy name))); |
5832 | 954 |
|
24868 | 955 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
956 |
Outer_Syntax.improper_command ("remove_thy", Keyword.control) "remove theory from loader database" |
36950 | 957 |
(Parse.name >> (fn name => |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
958 |
Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.remove_thy name))); |
7102 | 959 |
|
24868 | 960 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
961 |
Outer_Syntax.improper_command ("kill_thy", Keyword.control) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
962 |
"kill theory -- try to remove from loader database" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
963 |
(Parse.name >> (fn name => |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
964 |
Toplevel.no_timing o Toplevel.imperative (fn () => Thy_Info.kill_thy name))); |
7931 | 965 |
|
24868 | 966 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
967 |
Outer_Syntax.improper_command ("display_drafts", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
968 |
"display raw source files with symbols" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
969 |
(Scan.repeat1 Parse.path >> (Toplevel.no_timing oo Isar_Cmd.display_drafts)); |
14934 | 970 |
|
24868 | 971 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
972 |
Outer_Syntax.improper_command ("print_drafts", Keyword.diag) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
973 |
"print raw source files with symbols" |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
974 |
(Scan.repeat1 Parse.path >> (Toplevel.no_timing oo Isar_Cmd.print_drafts)); |
14934 | 975 |
|
39165 | 976 |
val _ = (* FIXME tty only *) |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
977 |
Outer_Syntax.improper_command ("pr", Keyword.diag) "print current proof state (if present)" |
39165 | 978 |
(opt_modes -- Scan.option Parse.nat >> (fn (modes, limit) => |
979 |
Toplevel.no_timing o Toplevel.keep (fn state => |
|
980 |
(case limit of NONE => () | SOME n => Goal_Display.goals_limit_default := n; |
|
981 |
Toplevel.quiet := false; |
|
982 |
Print_Mode.with_modes modes (Toplevel.print_state true) state)))); |
|
7199 | 983 |
|
24868 | 984 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
985 |
Outer_Syntax.improper_command ("disable_pr", Keyword.control) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
986 |
"disable printing of toplevel state" |
39165 | 987 |
(Scan.succeed (Toplevel.no_timing o Toplevel.imperative (fn () => Toplevel.quiet := true))); |
5832 | 988 |
|
24868 | 989 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
990 |
Outer_Syntax.improper_command ("enable_pr", Keyword.control) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
991 |
"enable printing of toplevel state" |
39165 | 992 |
(Scan.succeed (Toplevel.no_timing o Toplevel.imperative (fn () => Toplevel.quiet := false))); |
7222 | 993 |
|
24868 | 994 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
995 |
Outer_Syntax.improper_command ("commit", Keyword.control) |
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
996 |
"commit current session to ML database" |
36950 | 997 |
(Parse.opt_unit >> K (Toplevel.no_timing o Toplevel.imperative Secure.commit)); |
5832 | 998 |
|
24868 | 999 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
1000 |
Outer_Syntax.improper_command ("quit", Keyword.control) "quit Isabelle" |
37977
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37949
diff
changeset
|
1001 |
(Parse.opt_unit >> (Toplevel.no_timing oo K (Toplevel.imperative quit))); |
5832 | 1002 |
|
24868 | 1003 |
val _ = |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
1004 |
Outer_Syntax.improper_command ("exit", Keyword.control) "exit Isar loop" |
37977
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37949
diff
changeset
|
1005 |
(Scan.succeed |
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37949
diff
changeset
|
1006 |
(Toplevel.no_timing o Toplevel.keep (fn state => |
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37949
diff
changeset
|
1007 |
(Context.set_thread_data (try Toplevel.generic_theory_of state); |
38888
8248cda328de
moved Toplevel.run_command to Pure/PIDE/document.ML;
wenzelm
parents:
38870
diff
changeset
|
1008 |
raise Runtime.TERMINATE)))); |
5832 | 1009 |
|
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1010 |
|
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1011 |
|
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1012 |
(** end **) |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1013 |
|
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1014 |
val _ = |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1015 |
Outer_Syntax.command ("end", Keyword.tag_theory Keyword.thy_end) "end context" |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1016 |
(Scan.succeed |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1017 |
(Toplevel.exit o Toplevel.end_local_theory o Toplevel.close_target o |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1018 |
Toplevel.end_proof (K Proof.end_notepad))); |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1019 |
|
5832 | 1020 |
end; |
27614
f38c25d106a7
renamed IsarCmd.nested_command to OuterSyntax.prepare_command;
wenzelm
parents:
27575
diff
changeset
|
1021 |