author | wenzelm |
Thu, 27 Mar 2014 17:56:13 +0100 | |
changeset 56304 | 40274e4f5ebf |
parent 56275 | 600f432ab556 |
child 56333 | 38f1422ef473 |
permissions | -rw-r--r-- |
5832 | 1 |
(* Title: Pure/Isar/isar_syn.ML |
52546 | 2 |
Author: Makarius |
5832 | 3 |
|
52546 | 4 |
Outer syntax for Isabelle/Pure. |
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 |
48642 | 14 |
@{command_spec "header"} "theory header" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
15 |
(Parse.document_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 |
48642 | 19 |
@{command_spec "chapter"} "chapter heading" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
20 |
(Parse.opt_target -- Parse.document_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 |
48642 | 24 |
@{command_spec "section"} "section heading" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
25 |
(Parse.opt_target -- Parse.document_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 |
48642 | 29 |
@{command_spec "subsection"} "subsection heading" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
30 |
(Parse.opt_target -- Parse.document_source >> Isar_Cmd.local_theory_markup); |
46961
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 |
48642 | 34 |
@{command_spec "subsubsection"} "subsubsection heading" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
35 |
(Parse.opt_target -- Parse.document_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 |
48642 | 39 |
@{command_spec "text"} "formal comment (theory)" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
40 |
(Parse.opt_target -- Parse.document_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 |
48642 | 44 |
@{command_spec "text_raw"} "raw document preparation text" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
45 |
(Parse.opt_target -- Parse.document_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 |
48642 | 49 |
@{command_spec "sect"} "formal comment (proof)" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
50 |
(Parse.document_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 |
48642 | 54 |
@{command_spec "subsect"} "formal comment (proof)" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
55 |
(Parse.document_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 |
48642 | 59 |
@{command_spec "subsubsect"} "formal comment (proof)" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
60 |
(Parse.document_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 |
48642 | 64 |
@{command_spec "txt"} "formal comment (proof)" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
65 |
(Parse.document_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 |
48642 | 69 |
@{command_spec "txt_raw"} "raw document preparation text (proof)" |
51627
589daaf48dba
tuned signature -- agree with markup terminology;
wenzelm
parents:
51585
diff
changeset
|
70 |
(Parse.document_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 |
|
55385
169e12bbf9a3
discontinued axiomatic 'classes', 'classrel', 'arities';
wenzelm
parents:
55141
diff
changeset
|
76 |
(* sorts *) |
5832 | 77 |
|
24868 | 78 |
val _ = |
48642 | 79 |
Outer_Syntax.local_theory @{command_spec "default_sort"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
80 |
"declare default sort for explicit type variables" |
36950 | 81 |
(Parse.sort >> (fn s => fn lthy => Local_Theory.set_defsort (Syntax.read_sort lthy s) lthy)); |
5832 | 82 |
|
83 |
||
84 |
(* types *) |
|
85 |
||
24868 | 86 |
val _ = |
48642 | 87 |
Outer_Syntax.local_theory @{command_spec "typedecl"} "type declaration" |
36950 | 88 |
(Parse.type_args -- Parse.binding -- Parse.opt_mixfix |
35835 | 89 |
>> (fn ((args, a), mx) => Typedecl.typedecl (a, map (rpair dummyS) args, mx) #> snd)); |
5832 | 90 |
|
24868 | 91 |
val _ = |
48642 | 92 |
Outer_Syntax.local_theory @{command_spec "type_synonym"} "declare type abbreviation" |
45837 | 93 |
(Parse.type_args -- Parse.binding -- |
48643 | 94 |
(@{keyword "="} |-- Parse.!!! (Parse.typ -- Parse.opt_mixfix')) |
45837 | 95 |
>> (fn ((args, a), (rhs, mx)) => snd o Typedecl.abbrev_cmd (a, args, mx) rhs)); |
5832 | 96 |
|
24868 | 97 |
val _ = |
48642 | 98 |
Outer_Syntax.command @{command_spec "nonterminal"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
99 |
"declare syntactic type constructors (grammar nonterminal symbols)" |
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42359
diff
changeset
|
100 |
(Parse.and_list1 Parse.binding >> (Toplevel.theory o Sign.add_nonterminals_global)); |
5832 | 101 |
|
102 |
||
103 |
(* consts and syntax *) |
|
104 |
||
24868 | 105 |
val _ = |
48642 | 106 |
Outer_Syntax.command @{command_spec "judgment"} "declare object-logic judgment" |
36950 | 107 |
(Parse.const_binding >> (Toplevel.theory o Object_Logic.add_judgment_cmd)); |
8227 | 108 |
|
24868 | 109 |
val _ = |
48642 | 110 |
Outer_Syntax.command @{command_spec "consts"} "declare constants" |
56239 | 111 |
(Scan.repeat1 Parse.const_binding >> (Toplevel.theory o Sign.add_consts_cmd)); |
5832 | 112 |
|
12142 | 113 |
val mode_spec = |
48643 | 114 |
(@{keyword "output"} >> K ("", false)) || |
115 |
Parse.name -- Scan.optional (@{keyword "output"} >> K false) true; |
|
9731 | 116 |
|
14900 | 117 |
val opt_mode = |
48643 | 118 |
Scan.optional (@{keyword "("} |-- Parse.!!! (mode_spec --| @{keyword ")"})) Syntax.mode_default; |
5832 | 119 |
|
24868 | 120 |
val _ = |
50214 | 121 |
Outer_Syntax.command @{command_spec "syntax"} "add raw syntax clauses" |
56239 | 122 |
(opt_mode -- Scan.repeat1 Parse.const_decl |
56240 | 123 |
>> (Toplevel.theory o uncurry Sign.add_syntax_cmd)); |
5832 | 124 |
|
24868 | 125 |
val _ = |
50214 | 126 |
Outer_Syntax.command @{command_spec "no_syntax"} "delete raw syntax clauses" |
56239 | 127 |
(opt_mode -- Scan.repeat1 Parse.const_decl |
56240 | 128 |
>> (Toplevel.theory o uncurry Sign.del_syntax_cmd)); |
15748 | 129 |
|
5832 | 130 |
|
131 |
(* translations *) |
|
132 |
||
133 |
val trans_pat = |
|
42326 | 134 |
Scan.optional |
56006 | 135 |
(@{keyword "("} |-- Parse.!!! (Parse.inner_syntax Parse.xname --| @{keyword ")"})) "logic" |
42326 | 136 |
-- Parse.inner_syntax Parse.string; |
5832 | 137 |
|
138 |
fun trans_arrow toks = |
|
48643 | 139 |
((@{keyword "\<rightharpoonup>"} || @{keyword "=>"}) >> K Syntax.Parse_Rule || |
140 |
(@{keyword "\<leftharpoondown>"} || @{keyword "<="}) >> K Syntax.Print_Rule || |
|
141 |
(@{keyword "\<rightleftharpoons>"} || @{keyword "=="}) >> K Syntax.Parse_Print_Rule) toks; |
|
5832 | 142 |
|
143 |
val trans_line = |
|
36950 | 144 |
trans_pat -- Parse.!!! (trans_arrow -- trans_pat) |
5832 | 145 |
>> (fn (left, (arr, right)) => arr (left, right)); |
146 |
||
24868 | 147 |
val _ = |
50214 | 148 |
Outer_Syntax.command @{command_spec "translations"} "add syntax translation rules" |
42204 | 149 |
(Scan.repeat1 trans_line >> (Toplevel.theory o Isar_Cmd.translations)); |
5832 | 150 |
|
24868 | 151 |
val _ = |
50214 | 152 |
Outer_Syntax.command @{command_spec "no_translations"} "delete syntax translation rules" |
42204 | 153 |
(Scan.repeat1 trans_line >> (Toplevel.theory o Isar_Cmd.no_translations)); |
19260 | 154 |
|
5832 | 155 |
|
156 |
(* axioms and definitions *) |
|
157 |
||
19631 | 158 |
val opt_unchecked_overloaded = |
48643 | 159 |
Scan.optional (@{keyword "("} |-- Parse.!!! |
160 |
(((@{keyword "unchecked"} >> K true) -- |
|
161 |
Scan.optional (@{keyword "overloaded"} >> K true) false || |
|
162 |
@{keyword "overloaded"} >> K (false, true)) --| @{keyword ")"})) (false, false); |
|
19631 | 163 |
|
24868 | 164 |
val _ = |
48642 | 165 |
Outer_Syntax.command @{command_spec "defs"} "define constants" |
35852
4e3fe0b8687b
minor renovation of old-style 'axioms' -- make it an alias of iterated 'axiomatization';
wenzelm
parents:
35835
diff
changeset
|
166 |
(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
|
167 |
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
|
168 |
>> (Toplevel.theory o Isar_Cmd.add_defs)); |
6370 | 169 |
|
14642 | 170 |
|
21601
6588b947d631
simplified syntax for 'definition', 'abbreviation';
wenzelm
parents:
21527
diff
changeset
|
171 |
(* constant definitions and abbreviations *) |
6588b947d631
simplified syntax for 'definition', 'abbreviation';
wenzelm
parents:
21527
diff
changeset
|
172 |
|
24868 | 173 |
val _ = |
48642 | 174 |
Outer_Syntax.local_theory' @{command_spec "definition"} "constant definition" |
44192
a32ca9165928
less verbosity in batch mode -- spam reduction and notable performance improvement;
wenzelm
parents:
44187
diff
changeset
|
175 |
(Parse_Spec.constdef >> (fn args => #2 oo Specification.definition_cmd args)); |
18780 | 176 |
|
24868 | 177 |
val _ = |
48642 | 178 |
Outer_Syntax.local_theory' @{command_spec "abbreviation"} "constant abbreviation" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
179 |
(opt_mode -- (Scan.option Parse_Spec.constdecl -- Parse.prop) |
36950 | 180 |
>> (fn (mode, args) => Specification.abbreviation_cmd mode args)); |
19659 | 181 |
|
24868 | 182 |
val _ = |
48642 | 183 |
Outer_Syntax.local_theory @{command_spec "type_notation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
184 |
"add concrete syntax for type constructors" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
185 |
(opt_mode -- Parse.and_list1 (Parse.type_const -- Parse.mixfix) |
36950 | 186 |
>> (fn (mode, args) => Specification.type_notation_cmd true mode args)); |
35413 | 187 |
|
188 |
val _ = |
|
48642 | 189 |
Outer_Syntax.local_theory @{command_spec "no_type_notation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
190 |
"delete concrete syntax for type constructors" |
42300
0d1cbc1fe579
notation: proper markup for type constructor / constant;
wenzelm
parents:
42299
diff
changeset
|
191 |
(opt_mode -- Parse.and_list1 (Parse.type_const -- Parse.mixfix) |
36950 | 192 |
>> (fn (mode, args) => Specification.type_notation_cmd false mode args)); |
35413 | 193 |
|
194 |
val _ = |
|
48642 | 195 |
Outer_Syntax.local_theory @{command_spec "notation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
196 |
"add concrete syntax for constants / fixed variables" |
51654
8450b944e58a
just one syntax category "mixfix" -- check structure annotation semantically;
wenzelm
parents:
51627
diff
changeset
|
197 |
(opt_mode -- Parse.and_list1 (Parse.const -- Parse.mixfix) |
36950 | 198 |
>> (fn (mode, args) => Specification.notation_cmd true mode args)); |
24950 | 199 |
|
200 |
val _ = |
|
48642 | 201 |
Outer_Syntax.local_theory @{command_spec "no_notation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
202 |
"delete concrete syntax for constants / fixed variables" |
51654
8450b944e58a
just one syntax category "mixfix" -- check structure annotation semantically;
wenzelm
parents:
51627
diff
changeset
|
203 |
(opt_mode -- Parse.and_list1 (Parse.const -- Parse.mixfix) |
36950 | 204 |
>> (fn (mode, args) => Specification.notation_cmd false mode args)); |
19076 | 205 |
|
5832 | 206 |
|
18616 | 207 |
(* constant specifications *) |
208 |
||
24868 | 209 |
val _ = |
48642 | 210 |
Outer_Syntax.command @{command_spec "axiomatization"} "axiomatic constant specification" |
36950 | 211 |
(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
|
212 |
Scan.optional (Parse.where_ |-- Parse.!!! (Parse.and_list1 Parse_Spec.specs)) [] |
36950 | 213 |
>> (fn (x, y) => Toplevel.theory (#2 o Specification.axiomatization_cmd x y))); |
18616 | 214 |
|
215 |
||
5914 | 216 |
(* theorems *) |
217 |
||
26988
742e26213212
more uniform treatment of OuterSyntax.local_theory commands;
wenzelm
parents:
26888
diff
changeset
|
218 |
fun theorems kind = |
45600
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
219 |
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
|
220 |
>> (fn (facts, fixes) => #2 oo Specification.theorems_cmd kind facts fixes); |
12712 | 221 |
|
24868 | 222 |
val _ = |
48642 | 223 |
Outer_Syntax.local_theory' @{command_spec "theorems"} "define theorems" |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
224 |
(theorems Thm.theoremK); |
5914 | 225 |
|
24868 | 226 |
val _ = |
48642 | 227 |
Outer_Syntax.local_theory' @{command_spec "lemmas"} "define lemmas" (theorems Thm.lemmaK); |
5914 | 228 |
|
24868 | 229 |
val _ = |
48642 | 230 |
Outer_Syntax.local_theory' @{command_spec "declare"} "declare theorems" |
45600
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
231 |
(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
|
232 |
>> (fn (facts, fixes) => |
1bbbac9a0cb0
'lemmas' / 'theorems' commands allow 'for' fixes and standardize the result before storing;
wenzelm
parents:
45488
diff
changeset
|
233 |
#2 oo Specification.theorems_cmd "" [(Attrib.empty_binding, flat facts)] fixes)); |
9589 | 234 |
|
5914 | 235 |
|
56005
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
236 |
(* hide names *) |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
237 |
|
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
238 |
local |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
239 |
|
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
240 |
fun hide_names command_spec what hide parse prep = |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
241 |
Outer_Syntax.command command_spec ("hide " ^ what ^ " from name space") |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
242 |
((Parse.opt_keyword "open" >> not) -- Scan.repeat1 parse >> (fn (fully, args) => |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
243 |
(Toplevel.theory (fn thy => |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
244 |
let val ctxt = Proof_Context.init_global thy |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
245 |
in fold (hide fully o prep ctxt) args thy end)))); |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
246 |
|
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
247 |
in |
5832 | 248 |
|
56005
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
249 |
val _ = |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
250 |
hide_names @{command_spec "hide_class"} "classes" Sign.hide_class Parse.class |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
251 |
Proof_Context.read_class; |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
252 |
|
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
253 |
val _ = |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
254 |
hide_names @{command_spec "hide_type"} "types" Sign.hide_type Parse.type_const |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
255 |
((#1 o dest_Type) oo Proof_Context.read_type_name {proper = true, strict = false}); |
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
|
256 |
|
56005
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
257 |
val _ = |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
258 |
hide_names @{command_spec "hide_const"} "constants" Sign.hide_const Parse.const |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
259 |
((#1 o dest_Const) oo Proof_Context.read_const {proper = true, strict = false}); |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
260 |
|
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
261 |
val _ = |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
262 |
hide_names @{command_spec "hide_fact"} "facts" Global_Theory.hide_fact |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
263 |
(Parse.position Parse.xname) (Global_Theory.check_fact o Proof_Context.theory_of); |
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
264 |
|
4f4fc80b0613
simplified / modernized hide commands: proper outer parsers and PIDE markup via check;
wenzelm
parents:
55997
diff
changeset
|
265 |
end; |
5832 | 266 |
|
267 |
||
268 |
(* use ML text *) |
|
269 |
||
24868 | 270 |
val _ = |
56275
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
271 |
Outer_Syntax.command @{command_spec "SML_file"} "read and evaluate Standard ML file" |
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
272 |
(Resources.provide_parse_files "SML_file" >> (fn files => Toplevel.theory (fn thy => |
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
273 |
let |
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
274 |
val ([{lines, pos, ...}], thy') = files thy; |
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
275 |
val source = {delimited = true, text = cat_lines lines, pos = pos}; |
56304
40274e4f5ebf
redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents:
56275
diff
changeset
|
276 |
val flags = {SML = true, redirect = true, verbose = true}; |
56275
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
277 |
in |
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
278 |
thy' |> Context.theory_map |
56304
40274e4f5ebf
redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents:
56275
diff
changeset
|
279 |
(ML_Context.exec (fn () => ML_Context.eval_source flags source)) |
56275
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
280 |
end))); |
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
281 |
|
600f432ab556
added command 'SML_file' for Standard ML without Isabelle/ML add-ons;
wenzelm
parents:
56240
diff
changeset
|
282 |
val _ = |
48642 | 283 |
Outer_Syntax.command @{command_spec "ML"} "ML text within theory or local theory" |
55828
42ac3cfb89f6
clarified language markup: added "delimited" property;
wenzelm
parents:
55795
diff
changeset
|
284 |
(Parse.ML_source >> (fn source => |
30579
4169ddbfe1f9
command 'use', 'ML': apply ML environment to theory and target as well;
wenzelm
parents:
30576
diff
changeset
|
285 |
Toplevel.generic_theory |
56304
40274e4f5ebf
redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents:
56275
diff
changeset
|
286 |
(ML_Context.exec (fn () => |
40274e4f5ebf
redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents:
56275
diff
changeset
|
287 |
ML_Context.eval_source (ML_Compiler.verbose true ML_Compiler.flags) source) #> |
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
|
288 |
Local_Theory.propagate_ml_env))); |
30579
4169ddbfe1f9
command 'use', 'ML': apply ML environment to theory and target as well;
wenzelm
parents:
30576
diff
changeset
|
289 |
|
4169ddbfe1f9
command 'use', 'ML': apply ML environment to theory and target as well;
wenzelm
parents:
30576
diff
changeset
|
290 |
val _ = |
48642 | 291 |
Outer_Syntax.command @{command_spec "ML_prf"} "ML text within proof" |
55828
42ac3cfb89f6
clarified language markup: added "delimited" property;
wenzelm
parents:
55795
diff
changeset
|
292 |
(Parse.ML_source >> (fn source => |
28269 | 293 |
Toplevel.proof (Proof.map_context (Context.proof_map |
56304
40274e4f5ebf
redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents:
56275
diff
changeset
|
294 |
(ML_Context.exec (fn () => |
40274e4f5ebf
redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents:
56275
diff
changeset
|
295 |
ML_Context.eval_source (ML_Compiler.verbose true ML_Compiler.flags) source))) #> |
55828
42ac3cfb89f6
clarified language markup: added "delimited" property;
wenzelm
parents:
55795
diff
changeset
|
296 |
Proof.propagate_ml_env))); |
28269 | 297 |
|
298 |
val _ = |
|
48642 | 299 |
Outer_Syntax.command @{command_spec "ML_val"} "diagnostic ML text" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
300 |
(Parse.ML_source >> Isar_Cmd.ml_diag true); |
26396 | 301 |
|
302 |
val _ = |
|
48642 | 303 |
Outer_Syntax.command @{command_spec "ML_command"} "diagnostic ML text (silent)" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
304 |
(Parse.ML_source >> Isar_Cmd.ml_diag false); |
5832 | 305 |
|
24868 | 306 |
val _ = |
48642 | 307 |
Outer_Syntax.command @{command_spec "setup"} "ML theory setup" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
308 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.global_setup)); |
30461 | 309 |
|
310 |
val _ = |
|
48642 | 311 |
Outer_Syntax.local_theory @{command_spec "local_setup"} "ML local theory setup" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
312 |
(Parse.ML_source >> Isar_Cmd.local_setup); |
5832 | 313 |
|
24868 | 314 |
val _ = |
48642 | 315 |
Outer_Syntax.command @{command_spec "attribute_setup"} "define attribute in ML" |
42813
6c841fa92fa2
optional description for 'attribute_setup' and 'method_setup';
wenzelm
parents:
42496
diff
changeset
|
316 |
(Parse.position Parse.name -- |
48643 | 317 |
Parse.!!! (@{keyword "="} |-- Parse.ML_source -- Scan.optional Parse.text "") |
36950 | 318 |
>> (fn (name, (txt, cmt)) => Toplevel.theory (Attrib.attribute_setup name txt cmt))); |
30526 | 319 |
|
320 |
val _ = |
|
48642 | 321 |
Outer_Syntax.command @{command_spec "method_setup"} "define proof method in ML" |
42813
6c841fa92fa2
optional description for 'attribute_setup' and 'method_setup';
wenzelm
parents:
42496
diff
changeset
|
322 |
(Parse.position Parse.name -- |
48643 | 323 |
Parse.!!! (@{keyword "="} |-- Parse.ML_source -- Scan.optional Parse.text "") |
36950 | 324 |
>> (fn (name, (txt, cmt)) => Toplevel.theory (Method.method_setup name txt cmt))); |
9197 | 325 |
|
24868 | 326 |
val _ = |
48642 | 327 |
Outer_Syntax.local_theory @{command_spec "declaration"} "generic ML declaration" |
40784 | 328 |
(Parse.opt_keyword "pervasive" -- Parse.ML_source |
329 |
>> (fn (pervasive, txt) => Isar_Cmd.declaration {syntax = false, pervasive = pervasive} txt)); |
|
330 |
||
331 |
val _ = |
|
48642 | 332 |
Outer_Syntax.local_theory @{command_spec "syntax_declaration"} "generic ML syntax declaration" |
40784 | 333 |
(Parse.opt_keyword "pervasive" -- Parse.ML_source |
334 |
>> (fn (pervasive, txt) => Isar_Cmd.declaration {syntax = true, pervasive = pervasive} txt)); |
|
22088 | 335 |
|
24868 | 336 |
val _ = |
48642 | 337 |
Outer_Syntax.local_theory @{command_spec "simproc_setup"} "define simproc in ML" |
42464 | 338 |
(Parse.position Parse.name -- |
48643 | 339 |
(@{keyword "("} |-- Parse.enum1 "|" Parse.term --| @{keyword ")"} --| @{keyword "="}) -- |
340 |
Parse.ML_source -- Scan.optional (@{keyword "identifier"} |-- Scan.repeat1 Parse.xname) [] |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
341 |
>> (fn (((a, b), c), d) => Isar_Cmd.simproc_setup a b c d)); |
22202 | 342 |
|
5832 | 343 |
|
344 |
(* translation functions *) |
|
345 |
||
24868 | 346 |
val _ = |
48642 | 347 |
Outer_Syntax.command @{command_spec "parse_ast_translation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
348 |
"install parse ast translation functions" |
52143 | 349 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.parse_ast_translation)); |
5832 | 350 |
|
24868 | 351 |
val _ = |
48642 | 352 |
Outer_Syntax.command @{command_spec "parse_translation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
353 |
"install parse translation functions" |
52143 | 354 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.parse_translation)); |
5832 | 355 |
|
24868 | 356 |
val _ = |
48642 | 357 |
Outer_Syntax.command @{command_spec "print_translation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
358 |
"install print translation functions" |
52143 | 359 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.print_translation)); |
5832 | 360 |
|
24868 | 361 |
val _ = |
48642 | 362 |
Outer_Syntax.command @{command_spec "typed_print_translation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
363 |
"install typed print translation functions" |
52143 | 364 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.typed_print_translation)); |
5832 | 365 |
|
24868 | 366 |
val _ = |
48642 | 367 |
Outer_Syntax.command @{command_spec "print_ast_translation"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
368 |
"install print ast translation functions" |
52143 | 369 |
(Parse.ML_source >> (Toplevel.theory o Isar_Cmd.print_ast_translation)); |
5832 | 370 |
|
371 |
||
372 |
(* oracles *) |
|
373 |
||
24868 | 374 |
val _ = |
48642 | 375 |
Outer_Syntax.command @{command_spec "oracle"} "declare oracle" |
48643 | 376 |
(Parse.position Parse.name -- (@{keyword "="} |-- Parse.ML_source) >> |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
377 |
(fn (x, y) => Toplevel.theory (Isar_Cmd.oracle x y))); |
5832 | 378 |
|
379 |
||
47057 | 380 |
(* bundled declarations *) |
381 |
||
382 |
val _ = |
|
48642 | 383 |
Outer_Syntax.local_theory @{command_spec "bundle"} "define bundle of declarations" |
48643 | 384 |
((Parse.binding --| @{keyword "="}) -- Parse_Spec.xthms1 -- Parse.for_fixes |
47057 | 385 |
>> (uncurry Bundle.bundle_cmd)); |
386 |
||
387 |
val _ = |
|
48642 | 388 |
Outer_Syntax.command @{command_spec "include"} |
47057 | 389 |
"include declarations from bundle in proof body" |
47066
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
390 |
(Scan.repeat1 (Parse.position Parse.xname) |
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
391 |
>> (Toplevel.print oo (Toplevel.proof o Bundle.include_cmd))); |
47057 | 392 |
|
393 |
val _ = |
|
48642 | 394 |
Outer_Syntax.command @{command_spec "including"} |
47057 | 395 |
"include declarations from bundle in goal refinement" |
47066
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
396 |
(Scan.repeat1 (Parse.position Parse.xname) |
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
397 |
>> (Toplevel.print oo (Toplevel.proof o Bundle.including_cmd))); |
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
398 |
|
8a6124d09ff5
basic support for nested contexts including bundles;
wenzelm
parents:
47057
diff
changeset
|
399 |
val _ = |
48642 | 400 |
Outer_Syntax.improper_command @{command_spec "print_bundles"} |
401 |
"print bundles of declarations" |
|
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
402 |
(Scan.succeed (Toplevel.unknown_context o |
47057 | 403 |
Toplevel.keep (Bundle.print_bundles o Toplevel.context_of))); |
404 |
||
405 |
||
47069 | 406 |
(* local theories *) |
407 |
||
408 |
val _ = |
|
48642 | 409 |
Outer_Syntax.command @{command_spec "context"} "begin local theory context" |
47253
a00c5c88d8f3
more general context command with auxiliary fixes/assumes etc.;
wenzelm
parents:
47069
diff
changeset
|
410 |
((Parse.position Parse.xname >> (fn name => |
a00c5c88d8f3
more general context command with auxiliary fixes/assumes etc.;
wenzelm
parents:
47069
diff
changeset
|
411 |
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
|
412 |
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
|
413 |
>> (fn (incls, elems) => Toplevel.open_target (Bundle.context_cmd incls elems))) |
47069 | 414 |
--| Parse.begin); |
415 |
||
416 |
||
12061 | 417 |
(* locales *) |
418 |
||
12758 | 419 |
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
|
420 |
Parse_Spec.locale_expression false -- |
48643 | 421 |
Scan.optional (@{keyword "+"} |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] || |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
422 |
Scan.repeat1 Parse_Spec.context_element >> pair ([], []); |
12061 | 423 |
|
24868 | 424 |
val _ = |
48642 | 425 |
Outer_Syntax.command @{command_spec "locale"} "define named proof context" |
36950 | 426 |
(Parse.binding -- |
48643 | 427 |
Scan.optional (@{keyword "="} |-- Parse.!!! locale_val) (([], []), []) -- Parse.opt_begin |
27681 | 428 |
>> (fn ((name, (expr, elems)), begin) => |
21843 | 429 |
(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
|
430 |
(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
|
431 |
|
53988 | 432 |
fun interpretation_args mandatory = |
41270 | 433 |
Parse.!!! (Parse_Spec.locale_expression mandatory) -- |
434 |
Scan.optional |
|
435 |
(Parse.where_ |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []; |
|
436 |
||
24868 | 437 |
val _ = |
48642 | 438 |
Outer_Syntax.command @{command_spec "sublocale"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
439 |
"prove sublocale relation between a locale and a locale expression" |
51737
718866dda2fa
target-sensitive user-level commands interpretation and sublocale
haftmann
parents:
51717
diff
changeset
|
440 |
((Parse.position Parse.xname --| (@{keyword "\<subseteq>"} || @{keyword "<"}) -- |
53988 | 441 |
interpretation_args false >> (fn (loc, (expr, equations)) => |
442 |
Toplevel.print o |
|
443 |
Toplevel.theory_to_proof (Expression.sublocale_global_cmd I loc expr equations))) |
|
444 |
|| interpretation_args false >> (fn (expr, equations) => |
|
445 |
Toplevel.print o |
|
446 |
Toplevel.local_theory_to_proof NONE (Expression.sublocale_cmd expr equations))); |
|
28895 | 447 |
|
448 |
val _ = |
|
48642 | 449 |
Outer_Syntax.command @{command_spec "interpretation"} |
51737
718866dda2fa
target-sensitive user-level commands interpretation and sublocale
haftmann
parents:
51717
diff
changeset
|
450 |
"prove interpretation of locale expression in local theory" |
53988 | 451 |
(interpretation_args true >> (fn (expr, equations) => |
452 |
Toplevel.print o |
|
453 |
Toplevel.local_theory_to_proof NONE (Expression.interpretation_cmd expr equations))); |
|
29223 | 454 |
|
455 |
val _ = |
|
48642 | 456 |
Outer_Syntax.command @{command_spec "interpret"} |
29223 | 457 |
"prove interpretation of locale expression in proof context" |
53988 | 458 |
(interpretation_args true >> (fn (expr, equations) => |
459 |
Toplevel.print o |
|
460 |
Toplevel.proof' (Expression.interpret_cmd expr equations))); |
|
29223 | 461 |
|
15703 | 462 |
|
22299 | 463 |
(* classes *) |
464 |
||
24868 | 465 |
val class_val = |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
466 |
Parse_Spec.class_expression -- |
48643 | 467 |
Scan.optional (@{keyword "+"} |-- Parse.!!! (Scan.repeat1 Parse_Spec.context_element)) [] || |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
468 |
Scan.repeat1 Parse_Spec.context_element >> pair []; |
22299 | 469 |
|
24868 | 470 |
val _ = |
48642 | 471 |
Outer_Syntax.command @{command_spec "class"} "define type class" |
48643 | 472 |
(Parse.binding -- Scan.optional (@{keyword "="} |-- class_val) ([], []) -- Parse.opt_begin |
26516 | 473 |
>> (fn ((name, (supclasses, elems)), begin) => |
24938 | 474 |
(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
|
475 |
(Class_Declaration.class_cmd I name supclasses elems #> snd))); |
22299 | 476 |
|
24868 | 477 |
val _ = |
48642 | 478 |
Outer_Syntax.local_theory_to_proof @{command_spec "subclass"} "prove a subclass relation" |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
479 |
(Parse.class >> Class_Declaration.subclass_cmd I); |
24914
95cda5dd58d5
added proper subclass concept; improved class target
haftmann
parents:
24871
diff
changeset
|
480 |
|
95cda5dd58d5
added proper subclass concept; improved class target
haftmann
parents:
24871
diff
changeset
|
481 |
val _ = |
48642 | 482 |
Outer_Syntax.command @{command_spec "instantiation"} "instantiate and prove type arity" |
36950 | 483 |
(Parse.multi_arity --| Parse.begin |
25462 | 484 |
>> (fn arities => Toplevel.print o |
38348
cf7b2121ad9d
moved instantiation target formally to class_target.ML
haftmann
parents:
38342
diff
changeset
|
485 |
Toplevel.begin_local_theory true (Class.instantiation_cmd arities))); |
24589 | 486 |
|
25485 | 487 |
val _ = |
48642 | 488 |
Outer_Syntax.command @{command_spec "instance"} "prove type arity or subclass relation" |
46922
3717f3878714
source positions for locale and class expressions;
wenzelm
parents:
45837
diff
changeset
|
489 |
((Parse.class -- |
48643 | 490 |
((@{keyword "\<subseteq>"} || @{keyword "<"}) |-- Parse.!!! Parse.class) >> Class.classrel_cmd || |
36950 | 491 |
Parse.multi_arity >> Class.instance_arity_cmd) |
492 |
>> (Toplevel.print oo Toplevel.theory_to_proof) || |
|
493 |
Scan.succeed |
|
494 |
(Toplevel.print o Toplevel.local_theory_to_proof NONE (Class.instantiation_instance I))); |
|
22299 | 495 |
|
496 |
||
25519 | 497 |
(* arbitrary overloading *) |
498 |
||
499 |
val _ = |
|
48642 | 500 |
Outer_Syntax.command @{command_spec "overloading"} "overloaded definitions" |
48643 | 501 |
(Scan.repeat1 (Parse.name --| (@{keyword "\<equiv>"} || @{keyword "=="}) -- Parse.term -- |
502 |
Scan.optional (@{keyword "("} |-- (@{keyword "unchecked"} >> K false) --| @{keyword ")"}) true |
|
36950 | 503 |
>> Parse.triple1) --| Parse.begin |
25519 | 504 |
>> (fn operations => Toplevel.print o |
38342
09d4a04d5c2e
moved overloading target formally to overloading.ML
haftmann
parents:
38108
diff
changeset
|
505 |
Toplevel.begin_local_theory true (Overloading.overloading_cmd operations))); |
25519 | 506 |
|
507 |
||
22866 | 508 |
(* code generation *) |
509 |
||
24868 | 510 |
val _ = |
48642 | 511 |
Outer_Syntax.command @{command_spec "code_datatype"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
512 |
"define set of code datatype constructors" |
36950 | 513 |
(Scan.repeat1 Parse.term >> (Toplevel.theory o Code.add_datatype_cmd)); |
22866 | 514 |
|
515 |
||
5832 | 516 |
|
517 |
(** proof commands **) |
|
518 |
||
519 |
(* statements *) |
|
520 |
||
53988 | 521 |
fun theorem spec schematic kind = |
48645 | 522 |
Outer_Syntax.local_theory_to_proof' spec |
36317
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
523 |
("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
|
524 |
(Scan.optional (Parse_Spec.opt_thm_name ":" --| |
47067
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
525 |
Scan.ahead (Parse_Spec.includes >> K "" || |
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
526 |
Parse_Spec.locale_keyword || Parse_Spec.statement_keyword)) Attrib.empty_binding -- |
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
527 |
Scan.optional Parse_Spec.includes [] -- |
4ef29b0c568f
optional 'includes' element for long theorem statements;
wenzelm
parents:
47066
diff
changeset
|
528 |
Parse_Spec.general_statement >> (fn ((a, includes), (elems, concl)) => |
36317
506d732cb522
explicit 'schematic_theorem' etc. for schematic theorem statements;
wenzelm
parents:
36178
diff
changeset
|
529 |
((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
|
530 |
kind NONE (K I) a includes elems concl))); |
5832 | 531 |
|
53988 | 532 |
val _ = theorem @{command_spec "theorem"} false Thm.theoremK; |
533 |
val _ = theorem @{command_spec "lemma"} false Thm.lemmaK; |
|
534 |
val _ = theorem @{command_spec "corollary"} false Thm.corollaryK; |
|
535 |
val _ = theorem @{command_spec "schematic_theorem"} true Thm.theoremK; |
|
536 |
val _ = theorem @{command_spec "schematic_lemma"} true Thm.lemmaK; |
|
537 |
val _ = theorem @{command_spec "schematic_corollary"} true Thm.corollaryK; |
|
5832 | 538 |
|
24868 | 539 |
val _ = |
48642 | 540 |
Outer_Syntax.local_theory_to_proof @{command_spec "notepad"} "begin proof context" |
40960 | 541 |
(Parse.begin >> K Proof.begin_notepad); |
542 |
||
543 |
val _ = |
|
48642 | 544 |
Outer_Syntax.command @{command_spec "have"} "state local goal" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
545 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.have)); |
17353 | 546 |
|
24868 | 547 |
val _ = |
50214 | 548 |
Outer_Syntax.command @{command_spec "hence"} "old-style alias of \"then have\"" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
549 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.hence)); |
17353 | 550 |
|
24868 | 551 |
val _ = |
48642 | 552 |
Outer_Syntax.command @{command_spec "show"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
553 |
"state local goal, solving current obligation" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
554 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.show)); |
5832 | 555 |
|
24868 | 556 |
val _ = |
50214 | 557 |
Outer_Syntax.command @{command_spec "thus"} "old-style alias of \"then show\"" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
558 |
(Parse_Spec.statement >> ((Toplevel.print oo Toplevel.proof') o Isar_Cmd.thus)); |
6501 | 559 |
|
5832 | 560 |
|
5914 | 561 |
(* facts *) |
5832 | 562 |
|
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
563 |
val facts = Parse.and_list1 Parse_Spec.xthms1; |
9197 | 564 |
|
24868 | 565 |
val _ = |
48642 | 566 |
Outer_Syntax.command @{command_spec "then"} "forward chaining" |
17900 | 567 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.chain)); |
5832 | 568 |
|
24868 | 569 |
val _ = |
48642 | 570 |
Outer_Syntax.command @{command_spec "from"} "forward chaining from given 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.from_thmss_cmd))); |
5914 | 572 |
|
24868 | 573 |
val _ = |
48642 | 574 |
Outer_Syntax.command @{command_spec "with"} "forward chaining from given and current facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
575 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.with_thmss_cmd))); |
6878 | 576 |
|
24868 | 577 |
val _ = |
48642 | 578 |
Outer_Syntax.command @{command_spec "note"} "define facts" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
579 |
(Parse_Spec.name_facts >> (Toplevel.print oo (Toplevel.proof o Proof.note_thmss_cmd))); |
5832 | 580 |
|
24868 | 581 |
val _ = |
48642 | 582 |
Outer_Syntax.command @{command_spec "using"} "augment goal facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
583 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.using_cmd))); |
18544 | 584 |
|
24868 | 585 |
val _ = |
48642 | 586 |
Outer_Syntax.command @{command_spec "unfolding"} "unfold definitions in goal and facts" |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
587 |
(facts >> (Toplevel.print oo (Toplevel.proof o Proof.unfolding_cmd))); |
12926 | 588 |
|
5832 | 589 |
|
590 |
(* proof context *) |
|
591 |
||
24868 | 592 |
val _ = |
48642 | 593 |
Outer_Syntax.command @{command_spec "fix"} "fix local variables (Skolem constants)" |
36950 | 594 |
(Parse.fixes >> (Toplevel.print oo (Toplevel.proof o Proof.fix_cmd))); |
11890 | 595 |
|
24868 | 596 |
val _ = |
48642 | 597 |
Outer_Syntax.command @{command_spec "assume"} "assume propositions" |
36952
338c3f8229e4
renamed structure SpecParse to Parse_Spec, keeping the old name as alias for some time;
wenzelm
parents:
36951
diff
changeset
|
598 |
(Parse_Spec.statement >> (Toplevel.print oo (Toplevel.proof o Proof.assume_cmd))); |
5832 | 599 |
|
24868 | 600 |
val _ = |
48642 | 601 |
Outer_Syntax.command @{command_spec "presume"} "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
|
602 |
(Parse_Spec.statement >> (Toplevel.print oo (Toplevel.proof o Proof.presume_cmd))); |
6850 | 603 |
|
24868 | 604 |
val _ = |
50214 | 605 |
Outer_Syntax.command @{command_spec "def"} "local definition (non-polymorphic)" |
36950 | 606 |
(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
|
607 |
(Parse_Spec.opt_thm_name ":" -- |
36950 | 608 |
((Parse.binding -- Parse.opt_mixfix) -- |
48643 | 609 |
((@{keyword "\<equiv>"} || @{keyword "=="}) |-- Parse.!!! Parse.termp))) |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
610 |
>> (Toplevel.print oo (Toplevel.proof o Proof.def_cmd))); |
6953 | 611 |
|
24868 | 612 |
val _ = |
48642 | 613 |
Outer_Syntax.command @{command_spec "obtain"} "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 _ = |
48642 | 618 |
Outer_Syntax.command @{command_spec "guess"} "wild guessing (unstructured)" |
36950 | 619 |
(Scan.optional Parse.fixes [] >> (Toplevel.print oo (Toplevel.proof' o Obtain.guess_cmd))); |
17854 | 620 |
|
24868 | 621 |
val _ = |
48642 | 622 |
Outer_Syntax.command @{command_spec "let"} "bind text variables" |
48643 | 623 |
(Parse.and_list1 (Parse.and_list1 Parse.term -- (@{keyword "="} |-- Parse.term)) |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36317
diff
changeset
|
624 |
>> (Toplevel.print oo (Toplevel.proof o Proof.let_bind_cmd))); |
5832 | 625 |
|
36505
79c1d2bbe5a9
ProofContext.read_const: allow for type constraint (for fixed variable);
wenzelm
parents:
36452
diff
changeset
|
626 |
val _ = |
48642 | 627 |
Outer_Syntax.command @{command_spec "write"} "add concrete syntax for constants / fixed variables" |
51654
8450b944e58a
just one syntax category "mixfix" -- check structure annotation semantically;
wenzelm
parents:
51627
diff
changeset
|
628 |
(opt_mode -- Parse.and_list1 (Parse.const -- Parse.mixfix) |
36505
79c1d2bbe5a9
ProofContext.read_const: allow for type constraint (for fixed variable);
wenzelm
parents:
36452
diff
changeset
|
629 |
>> (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
|
630 |
|
24868 | 631 |
val _ = |
48642 | 632 |
Outer_Syntax.command @{command_spec "case"} "invoke local context" |
53377
21693b7c8fbf
more liberal 'case' syntax: allow parentheses without arguments;
wenzelm
parents:
52549
diff
changeset
|
633 |
((@{keyword "("} |-- |
53378
07990ba8c0ea
cases: more position information and PIDE markup;
wenzelm
parents:
53377
diff
changeset
|
634 |
Parse.!!! (Parse.position Parse.xname -- Scan.repeat (Parse.maybe Parse.binding) |
07990ba8c0ea
cases: more position information and PIDE markup;
wenzelm
parents:
53377
diff
changeset
|
635 |
--| @{keyword ")"}) || |
07990ba8c0ea
cases: more position information and PIDE markup;
wenzelm
parents:
53377
diff
changeset
|
636 |
Parse.position Parse.xname >> rpair []) -- Parse_Spec.opt_attribs >> (fn ((c, xs), atts) => |
53377
21693b7c8fbf
more liberal 'case' syntax: allow parentheses without arguments;
wenzelm
parents:
52549
diff
changeset
|
637 |
Toplevel.print o Toplevel.proof (Proof.invoke_case_cmd (c, xs, atts)))); |
8370 | 638 |
|
5832 | 639 |
|
640 |
(* proof structure *) |
|
641 |
||
24868 | 642 |
val _ = |
48642 | 643 |
Outer_Syntax.command @{command_spec "{"} "begin explicit proof block" |
17900 | 644 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.begin_block)); |
5832 | 645 |
|
24868 | 646 |
val _ = |
48642 | 647 |
Outer_Syntax.command @{command_spec "}"} "end explicit proof block" |
20305 | 648 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.end_block)); |
6687 | 649 |
|
24868 | 650 |
val _ = |
48642 | 651 |
Outer_Syntax.command @{command_spec "next"} "enter next proof block" |
17900 | 652 |
(Scan.succeed (Toplevel.print o Toplevel.proof Proof.next_block)); |
5832 | 653 |
|
654 |
||
655 |
(* end proof *) |
|
656 |
||
24868 | 657 |
val _ = |
50214 | 658 |
Outer_Syntax.command @{command_spec "qed"} "conclude proof" |
55795 | 659 |
(Scan.option Method.parse >> (fn m => (Option.map Method.report m; Isar_Cmd.qed m))); |
5832 | 660 |
|
24868 | 661 |
val _ = |
48642 | 662 |
Outer_Syntax.command @{command_spec "by"} "terminal backward proof" |
55795 | 663 |
(Method.parse -- Scan.option Method.parse >> (fn (m1, m2) => |
664 |
(Method.report m1; Option.map Method.report m2; Isar_Cmd.terminal_proof (m1, m2)))); |
|
6404 | 665 |
|
24868 | 666 |
val _ = |
48642 | 667 |
Outer_Syntax.command @{command_spec ".."} "default proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
668 |
(Scan.succeed Isar_Cmd.default_proof); |
8966 | 669 |
|
24868 | 670 |
val _ = |
48642 | 671 |
Outer_Syntax.command @{command_spec "."} "immediate proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
672 |
(Scan.succeed Isar_Cmd.immediate_proof); |
6404 | 673 |
|
24868 | 674 |
val _ = |
48642 | 675 |
Outer_Syntax.command @{command_spec "done"} "done proof" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
676 |
(Scan.succeed Isar_Cmd.done_proof); |
5832 | 677 |
|
24868 | 678 |
val _ = |
48642 | 679 |
Outer_Syntax.command @{command_spec "sorry"} "skip proof (quick-and-dirty mode only!)" |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
37198
diff
changeset
|
680 |
(Scan.succeed Isar_Cmd.skip_proof); |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
6886
diff
changeset
|
681 |
|
24868 | 682 |
val _ = |
48642 | 683 |
Outer_Syntax.command @{command_spec "oops"} "forget proof" |
18561 | 684 |
(Scan.succeed Toplevel.forget_proof); |
8210 | 685 |
|
5832 | 686 |
|
687 |
(* proof steps *) |
|
688 |
||
24868 | 689 |
val _ = |
48642 | 690 |
Outer_Syntax.command @{command_spec "defer"} "shuffle internal proof state" |
49865 | 691 |
(Scan.optional Parse.nat 1 >> (fn n => Toplevel.print o Toplevel.proof (Proof.defer n))); |
8165 | 692 |
|
24868 | 693 |
val _ = |
48642 | 694 |
Outer_Syntax.command @{command_spec "prefer"} "shuffle internal proof state" |
49865 | 695 |
(Parse.nat >> (fn n => Toplevel.print o Toplevel.proof (Proof.prefer n))); |
8165 | 696 |
|
24868 | 697 |
val _ = |
48642 | 698 |
Outer_Syntax.command @{command_spec "apply"} "initial refinement step (unstructured)" |
55795 | 699 |
(Method.parse >> (fn m => |
700 |
(Method.report m; Toplevel.print o Toplevel.proofs (Proof.apply_results m)))); |
|
5832 | 701 |
|
24868 | 702 |
val _ = |
50214 | 703 |
Outer_Syntax.command @{command_spec "apply_end"} "terminal refinement step (unstructured)" |
55795 | 704 |
(Method.parse >> (fn m => |
705 |
(Method.report m; Toplevel.print o Toplevel.proofs (Proof.apply_end_results m)))); |
|
5832 | 706 |
|
24868 | 707 |
val _ = |
50214 | 708 |
Outer_Syntax.command @{command_spec "proof"} "backward proof step" |
55795 | 709 |
(Scan.option Method.parse >> (fn m => |
710 |
(Option.map Method.report m; |
|
711 |
Toplevel.print o |
|
712 |
Toplevel.actual_proof (Proof_Node.applys (Proof.proof_results m)) o |
|
713 |
Toplevel.skip_proof (fn i => i + 1)))); |
|
5832 | 714 |
|
715 |
||
6742 | 716 |
(* proof navigation *) |
5944 | 717 |
|
56065
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
718 |
fun report_back () = |
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
719 |
Output.report (Markup.markup Markup.bad "Explicit backtracking"); |
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
720 |
|
24868 | 721 |
val _ = |
56065
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
722 |
Outer_Syntax.command @{command_spec "back"} "explicit backtracking of proof command" |
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
723 |
(Scan.succeed (Toplevel.print o |
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
724 |
Toplevel.actual_proof (fn prf => (report_back (); Proof_Node.back prf)) o |
600781e03bf6
more explicit markup and explanation of the improper status of 'back', following the AFP style-guide;
wenzelm
parents:
56006
diff
changeset
|
725 |
Toplevel.skip_proof (fn h => (report_back (); h)))); |
6742 | 726 |
|
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
727 |
|
27614
f38c25d106a7
renamed IsarCmd.nested_command to OuterSyntax.prepare_command;
wenzelm
parents:
27575
diff
changeset
|
728 |
(* nested commands *) |
25578 | 729 |
|
29309 | 730 |
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
|
731 |
Scan.optional Parse.properties [] -- Parse.position Parse.string |
36950 | 732 |
>> (fn (props, (str, pos)) => |
733 |
(Position.of_properties (Position.default_properties pos props), str)); |
|
29309 | 734 |
|
25578 | 735 |
val _ = |
50214 | 736 |
Outer_Syntax.improper_command @{command_spec "Isabelle.command"} "evaluate nested Isabelle command" |
29309 | 737 |
(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
|
738 |
(case Outer_Syntax.parse pos str of |
27838
0340fd7cccc3
Isabelle.command: inline former OuterSyntax.prepare_command;
wenzelm
parents:
27831
diff
changeset
|
739 |
[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
|
740 |
| _ => 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
|
741 |
handle ERROR msg => Scan.fail_with (K (fn () => msg)))); |
25578 | 742 |
|
743 |
||
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22573
diff
changeset
|
744 |
|
5832 | 745 |
(** diagnostic commands (for interactive mode only) **) |
746 |
||
36950 | 747 |
val opt_modes = |
48643 | 748 |
Scan.optional (@{keyword "("} |-- Parse.!!! (Scan.repeat1 Parse.xname --| @{keyword ")"})) []; |
36950 | 749 |
|
48643 | 750 |
val opt_bang = Scan.optional (@{keyword "!"} >> K true) false; |
8464 | 751 |
|
53988 | 752 |
val _ = (*Proof General legacy*) |
48642 | 753 |
Outer_Syntax.improper_command @{command_spec "pretty_setmargin"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
754 |
"change default margin for pretty printing" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
755 |
(Parse.nat >> (fn n => Toplevel.imperative (fn () => Pretty.margin_default := n))); |
7124 | 756 |
|
24868 | 757 |
val _ = |
50213 | 758 |
Outer_Syntax.improper_command @{command_spec "help"} |
759 |
"retrieve outer syntax commands according to name patterns" |
|
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
760 |
(Scan.repeat Parse.name >> |
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
761 |
(fn pats => Toplevel.imperative (fn () => Outer_Syntax.help_outer_syntax pats))); |
21714 | 762 |
|
24868 | 763 |
val _ = |
48642 | 764 |
Outer_Syntax.improper_command @{command_spec "print_commands"} "print outer syntax commands" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
765 |
(Scan.succeed (Toplevel.imperative Outer_Syntax.print_outer_syntax)); |
5832 | 766 |
|
24868 | 767 |
val _ = |
52060 | 768 |
Outer_Syntax.improper_command @{command_spec "print_options"} "print configuration options" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
769 |
(Scan.succeed (Toplevel.unknown_context o |
52060 | 770 |
Toplevel.keep (Attrib.print_options o Toplevel.context_of))); |
23989 | 771 |
|
24868 | 772 |
val _ = |
50737 | 773 |
Outer_Syntax.improper_command @{command_spec "print_context"} "print main context" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
774 |
(Scan.succeed (Toplevel.keep Toplevel.print_state_context)); |
7308 | 775 |
|
24868 | 776 |
val _ = |
48642 | 777 |
Outer_Syntax.improper_command @{command_spec "print_theory"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
778 |
"print logical theory contents (verbose!)" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
779 |
(opt_bang >> (fn b => Toplevel.unknown_theory o |
50737 | 780 |
Toplevel.keep (Pretty.writeln o Proof_Display.pretty_full_theory b o Toplevel.theory_of))); |
5832 | 781 |
|
24868 | 782 |
val _ = |
48642 | 783 |
Outer_Syntax.improper_command @{command_spec "print_syntax"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
784 |
"print inner syntax of context (verbose!)" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
785 |
(Scan.succeed (Toplevel.unknown_context o |
50737 | 786 |
Toplevel.keep (Proof_Context.print_syntax o Toplevel.context_of))); |
5832 | 787 |
|
24868 | 788 |
val _ = |
51585 | 789 |
Outer_Syntax.improper_command @{command_spec "print_defn_rules"} |
790 |
"print definitional rewrite rules of context" |
|
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
791 |
(Scan.succeed (Toplevel.unknown_context o |
51585 | 792 |
Toplevel.keep (Local_Defs.print_rules o Toplevel.context_of))); |
793 |
||
794 |
val _ = |
|
48642 | 795 |
Outer_Syntax.improper_command @{command_spec "print_abbrevs"} |
51585 | 796 |
"print constant abbreviations of context" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
797 |
(Scan.succeed (Toplevel.unknown_context o |
50737 | 798 |
Toplevel.keep (Proof_Context.print_abbrevs o Toplevel.context_of))); |
21726 | 799 |
|
24868 | 800 |
val _ = |
48642 | 801 |
Outer_Syntax.improper_command @{command_spec "print_theorems"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
802 |
"print theorems of local theory or proof context" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
803 |
(opt_bang >> Isar_Cmd.print_theorems); |
5881 | 804 |
|
24868 | 805 |
val _ = |
48642 | 806 |
Outer_Syntax.improper_command @{command_spec "print_locales"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
807 |
"print locales of this theory" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
808 |
(Scan.succeed (Toplevel.unknown_theory o |
50737 | 809 |
Toplevel.keep (Locale.print_locales o Toplevel.theory_of))); |
12061 | 810 |
|
24868 | 811 |
val _ = |
48642 | 812 |
Outer_Syntax.improper_command @{command_spec "print_classes"} |
813 |
"print classes of this theory" |
|
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
814 |
(Scan.succeed (Toplevel.unknown_theory o |
42359 | 815 |
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
|
816 |
|
24868 | 817 |
val _ = |
48642 | 818 |
Outer_Syntax.improper_command @{command_spec "print_locale"} |
819 |
"print locale of this theory" |
|
50737 | 820 |
(opt_bang -- Parse.position Parse.xname >> (fn (b, name) => |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
821 |
Toplevel.unknown_theory o |
50737 | 822 |
Toplevel.keep (fn state => Locale.print_locale (Toplevel.theory_of state) b name))); |
12061 | 823 |
|
24868 | 824 |
val _ = |
48642 | 825 |
Outer_Syntax.improper_command @{command_spec "print_interps"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
826 |
"print interpretations of locale for this theory or proof context" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
827 |
(Parse.position Parse.xname >> (fn name => |
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
828 |
Toplevel.unknown_context o |
50737 | 829 |
Toplevel.keep (fn state => Locale.print_registrations (Toplevel.context_of state) name))); |
32804
ca430e6aee1c
Propagation of mixins for interpretation; reactivated diagnostic command print_interps.
ballarin
parents:
31869
diff
changeset
|
830 |
|
ca430e6aee1c
Propagation of mixins for interpretation; reactivated diagnostic command print_interps.
ballarin
parents:
31869
diff
changeset
|
831 |
val _ = |
48642 | 832 |
Outer_Syntax.improper_command @{command_spec "print_dependencies"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
833 |
"print dependencies of locale expression" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
834 |
(opt_bang -- Parse_Spec.locale_expression true >> (fn (b, expr) => |
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
835 |
Toplevel.unknown_context o |
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
836 |
Toplevel.keep (fn state => Expression.print_dependencies (Toplevel.context_of state) b expr))); |
41435 | 837 |
|
838 |
val _ = |
|
48642 | 839 |
Outer_Syntax.improper_command @{command_spec "print_attributes"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
840 |
"print attributes of this theory" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
841 |
(Scan.succeed (Toplevel.unknown_theory o |
55997
9dc5ce83202c
modernized Attrib.check_name/check_src similar to methods (see also a989bdaf8121);
wenzelm
parents:
55828
diff
changeset
|
842 |
Toplevel.keep (Attrib.print_attributes o Toplevel.context_of))); |
5832 | 843 |
|
24868 | 844 |
val _ = |
48642 | 845 |
Outer_Syntax.improper_command @{command_spec "print_simpset"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
846 |
"print context of Simplifier" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
847 |
(Scan.succeed (Toplevel.unknown_context o |
51717
9e7d1c139569
simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents:
51685
diff
changeset
|
848 |
Toplevel.keep (Pretty.writeln o Simplifier.pretty_simpset o Toplevel.context_of))); |
16027 | 849 |
|
24868 | 850 |
val _ = |
48642 | 851 |
Outer_Syntax.improper_command @{command_spec "print_rules"} "print intro/elim rules" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
852 |
(Scan.succeed (Toplevel.unknown_context o |
50737 | 853 |
Toplevel.keep (Context_Rules.print_rules o Toplevel.context_of))); |
12383 | 854 |
|
24868 | 855 |
val _ = |
48642 | 856 |
Outer_Syntax.improper_command @{command_spec "print_methods"} "print methods of this theory" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
857 |
(Scan.succeed (Toplevel.unknown_theory o |
55742
a989bdaf8121
modernized Method.check_name/check_source (with reports) vs. strict Method.the_method (without interning nor reports), e.g. relevant for semantic completion;
wenzelm
parents:
55385
diff
changeset
|
858 |
Toplevel.keep (Method.print_methods o Toplevel.context_of))); |
5832 | 859 |
|
24868 | 860 |
val _ = |
56069
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
861 |
Outer_Syntax.improper_command @{command_spec "print_antiquotations"} |
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
862 |
"print document antiquotations" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
863 |
(Scan.succeed (Toplevel.unknown_context o |
50737 | 864 |
Toplevel.keep (Thy_Output.print_antiquotations o Toplevel.context_of))); |
9221 | 865 |
|
24868 | 866 |
val _ = |
56069
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
867 |
Outer_Syntax.improper_command @{command_spec "print_ML_antiquotations"} |
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
868 |
"print ML antiquotations" |
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
869 |
(Scan.succeed (Toplevel.unknown_context o |
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
870 |
Toplevel.keep (ML_Context.print_antiquotations o Toplevel.context_of))); |
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
871 |
|
451d5b73f8cf
simplified programming interface to define ML antiquotations -- NB: the transformed context ignores updates of the context parser;
wenzelm
parents:
56065
diff
changeset
|
872 |
val _ = |
48642 | 873 |
Outer_Syntax.improper_command @{command_spec "thy_deps"} "visualize theory dependencies" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
874 |
(Scan.succeed Isar_Cmd.thy_deps); |
22485 | 875 |
|
24868 | 876 |
val _ = |
49569
7b6aaf446496
tuned pretty_locale/print_locale, with more basic pretty_locale_deps based on that;
wenzelm
parents:
48997
diff
changeset
|
877 |
Outer_Syntax.improper_command @{command_spec "locale_deps"} "visualize locale dependencies" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
878 |
(Scan.succeed Isar_Cmd.locale_deps); |
49569
7b6aaf446496
tuned pretty_locale/print_locale, with more basic pretty_locale_deps based on that;
wenzelm
parents:
48997
diff
changeset
|
879 |
|
7b6aaf446496
tuned pretty_locale/print_locale, with more basic pretty_locale_deps based on that;
wenzelm
parents:
48997
diff
changeset
|
880 |
val _ = |
48642 | 881 |
Outer_Syntax.improper_command @{command_spec "class_deps"} "visualize class dependencies" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
882 |
(Scan.succeed Isar_Cmd.class_deps); |
20574 | 883 |
|
24868 | 884 |
val _ = |
48642 | 885 |
Outer_Syntax.improper_command @{command_spec "thm_deps"} "visualize theorem dependencies" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
886 |
(Parse_Spec.xthms1 >> Isar_Cmd.thm_deps); |
9454 | 887 |
|
24868 | 888 |
val _ = |
48642 | 889 |
Outer_Syntax.improper_command @{command_spec "print_binds"} "print term bindings of proof context" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
890 |
(Scan.succeed (Toplevel.unknown_context o |
50737 | 891 |
Toplevel.keep (Proof_Context.print_binds o Toplevel.context_of))); |
5832 | 892 |
|
24868 | 893 |
val _ = |
48642 | 894 |
Outer_Syntax.improper_command @{command_spec "print_facts"} "print facts of proof context" |
56158
c2c6d560e7b2
more explicit treatment of verbose mode, which includes concealed entries;
wenzelm
parents:
56155
diff
changeset
|
895 |
(opt_bang >> (fn verbose => Toplevel.unknown_context o |
c2c6d560e7b2
more explicit treatment of verbose mode, which includes concealed entries;
wenzelm
parents:
56155
diff
changeset
|
896 |
Toplevel.keep (fn st => Proof_Context.print_local_facts (Toplevel.context_of st) verbose))); |
5832 | 897 |
|
24868 | 898 |
val _ = |
48642 | 899 |
Outer_Syntax.improper_command @{command_spec "print_cases"} "print cases of proof context" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
900 |
(Scan.succeed (Toplevel.unknown_context o |
50737 | 901 |
Toplevel.keep (Proof_Context.print_cases o Toplevel.context_of))); |
8370 | 902 |
|
24868 | 903 |
val _ = |
48642 | 904 |
Outer_Syntax.improper_command @{command_spec "print_statement"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
905 |
"print theorems as long statements" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
906 |
(opt_modes -- Parse_Spec.xthms1 >> Isar_Cmd.print_stmts); |
19269 | 907 |
|
24868 | 908 |
val _ = |
48642 | 909 |
Outer_Syntax.improper_command @{command_spec "thm"} "print theorems" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
910 |
(opt_modes -- Parse_Spec.xthms1 >> Isar_Cmd.print_thms); |
5832 | 911 |
|
24868 | 912 |
val _ = |
48642 | 913 |
Outer_Syntax.improper_command @{command_spec "prf"} "print proof terms of theorems" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
914 |
(opt_modes -- Scan.option Parse_Spec.xthms1 >> Isar_Cmd.print_prfs false); |
11524
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
915 |
|
24868 | 916 |
val _ = |
48642 | 917 |
Outer_Syntax.improper_command @{command_spec "full_prf"} "print full proof terms of theorems" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
918 |
(opt_modes -- Scan.option Parse_Spec.xthms1 >> Isar_Cmd.print_prfs true); |
11524
197f2e14a714
Added functions for printing primitive proof terms.
berghofe
parents:
11101
diff
changeset
|
919 |
|
24868 | 920 |
val _ = |
48642 | 921 |
Outer_Syntax.improper_command @{command_spec "prop"} "read and print proposition" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
922 |
(opt_modes -- Parse.term >> Isar_Cmd.print_prop); |
5832 | 923 |
|
24868 | 924 |
val _ = |
48642 | 925 |
Outer_Syntax.improper_command @{command_spec "term"} "read and print term" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
926 |
(opt_modes -- Parse.term >> Isar_Cmd.print_term); |
5832 | 927 |
|
24868 | 928 |
val _ = |
48642 | 929 |
Outer_Syntax.improper_command @{command_spec "typ"} "read and print type" |
48792 | 930 |
(opt_modes -- (Parse.typ -- Scan.option (@{keyword "::"} |-- Parse.!!! Parse.sort)) |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
931 |
>> Isar_Cmd.print_type); |
5832 | 932 |
|
24868 | 933 |
val _ = |
48642 | 934 |
Outer_Syntax.improper_command @{command_spec "print_codesetup"} "print code generator setup" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
935 |
(Scan.succeed (Toplevel.unknown_theory o |
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
936 |
Toplevel.keep (Code.print_codesetup o Toplevel.theory_of))); |
5832 | 937 |
|
26184 | 938 |
val _ = |
48642 | 939 |
Outer_Syntax.improper_command @{command_spec "unused_thms"} "find unused theorems" |
36950 | 940 |
(Scan.option ((Scan.repeat1 (Scan.unless Parse.minus Parse.name) --| Parse.minus) -- |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
941 |
Scan.option (Scan.repeat1 (Scan.unless Parse.minus Parse.name))) >> Isar_Cmd.unused_thms); |
26184 | 942 |
|
5832 | 943 |
|
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
|
944 |
|
5832 | 945 |
(** system commands (for interactive mode only) **) |
946 |
||
24868 | 947 |
val _ = |
48642 | 948 |
Outer_Syntax.improper_command @{command_spec "cd"} "change current working directory" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
949 |
(Parse.path >> (fn name => Toplevel.imperative (fn () => File.cd (Path.explode name)))); |
5832 | 950 |
|
24868 | 951 |
val _ = |
48642 | 952 |
Outer_Syntax.improper_command @{command_spec "pwd"} "print current working directory" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
953 |
(Scan.succeed (Toplevel.imperative (fn () => writeln (Path.print (File.pwd ()))))); |
5832 | 954 |
|
24868 | 955 |
val _ = |
48642 | 956 |
Outer_Syntax.improper_command @{command_spec "use_thy"} "use theory file" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
957 |
(Parse.position Parse.name >> |
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
958 |
(fn name => Toplevel.imperative (fn () => Thy_Info.use_thy name))); |
5832 | 959 |
|
24868 | 960 |
val _ = |
48642 | 961 |
Outer_Syntax.improper_command @{command_spec "remove_thy"} "remove theory from loader database" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
962 |
(Parse.name >> (fn name => Toplevel.imperative (fn () => Thy_Info.remove_thy name))); |
7102 | 963 |
|
24868 | 964 |
val _ = |
48642 | 965 |
Outer_Syntax.improper_command @{command_spec "kill_thy"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
966 |
"kill theory -- try to remove from loader database" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
967 |
(Parse.name >> (fn name => Toplevel.imperative (fn () => Thy_Info.kill_thy name))); |
7931 | 968 |
|
53403
c09f4005d6bd
some explicit indication of Proof General legacy;
wenzelm
parents:
53378
diff
changeset
|
969 |
val _ = (*partial Proof General legacy*) |
48642 | 970 |
Outer_Syntax.improper_command @{command_spec "display_drafts"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
971 |
"display raw source files with symbols" |
52549 | 972 |
(Scan.repeat1 Parse.path >> (fn names => |
973 |
Toplevel.imperative (fn () => ignore (Present.display_drafts (map Path.explode names))))); |
|
14934 | 974 |
|
52430 | 975 |
val _ = |
976 |
Outer_Syntax.improper_command @{command_spec "print_state"} |
|
977 |
"print current proof state (if present)" |
|
978 |
(opt_modes >> (fn modes => |
|
979 |
Toplevel.keep (fn state => |
|
980 |
Print_Mode.with_modes modes (Toplevel.print_state true) state))); |
|
981 |
||
53403
c09f4005d6bd
some explicit indication of Proof General legacy;
wenzelm
parents:
53378
diff
changeset
|
982 |
val _ = (*Proof General legacy, e.g. for ProofGeneral-3.7.x*) |
48642 | 983 |
Outer_Syntax.improper_command @{command_spec "pr"} "print current proof state (if present)" |
39165 | 984 |
(opt_modes -- Scan.option Parse.nat >> (fn (modes, limit) => |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
985 |
Toplevel.keep (fn state => |
52438
7b5a5116f3af
back to keyword 'pr' :: diag as required for ProofGeneral command line -- reject this TTY command in Isabelle/jEdit by other means;
wenzelm
parents:
52430
diff
changeset
|
986 |
(if Isabelle_Process.is_active () then error "Illegal TTY command" else (); |
7b5a5116f3af
back to keyword 'pr' :: diag as required for ProofGeneral command line -- reject this TTY command in Isabelle/jEdit by other means;
wenzelm
parents:
52430
diff
changeset
|
987 |
case limit of NONE => () | SOME n => Options.default_put_int @{option goals_limit} n; |
39165 | 988 |
Toplevel.quiet := false; |
989 |
Print_Mode.with_modes modes (Toplevel.print_state true) state)))); |
|
7199 | 990 |
|
53403
c09f4005d6bd
some explicit indication of Proof General legacy;
wenzelm
parents:
53378
diff
changeset
|
991 |
val _ = (*Proof General legacy*) |
48642 | 992 |
Outer_Syntax.improper_command @{command_spec "disable_pr"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
993 |
"disable printing of toplevel state" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
994 |
(Scan.succeed (Toplevel.imperative (fn () => Toplevel.quiet := true))); |
5832 | 995 |
|
53403
c09f4005d6bd
some explicit indication of Proof General legacy;
wenzelm
parents:
53378
diff
changeset
|
996 |
val _ = (*Proof General legacy*) |
48642 | 997 |
Outer_Syntax.improper_command @{command_spec "enable_pr"} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46958
diff
changeset
|
998 |
"enable printing of toplevel state" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
999 |
(Scan.succeed (Toplevel.imperative (fn () => Toplevel.quiet := false))); |
7222 | 1000 |
|
24868 | 1001 |
val _ = |
48642 | 1002 |
Outer_Syntax.improper_command @{command_spec "commit"} |
50214 | 1003 |
"commit current session to ML session image" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1004 |
(Parse.opt_unit >> K (Toplevel.imperative Secure.commit)); |
5832 | 1005 |
|
24868 | 1006 |
val _ = |
48642 | 1007 |
Outer_Syntax.improper_command @{command_spec "quit"} "quit Isabelle" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1008 |
(Parse.opt_unit >> (K (Toplevel.imperative quit))); |
5832 | 1009 |
|
24868 | 1010 |
val _ = |
48642 | 1011 |
Outer_Syntax.improper_command @{command_spec "exit"} "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
|
1012 |
(Scan.succeed |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1013 |
(Toplevel.keep (fn state => |
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
|
1014 |
(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
|
1015 |
raise Runtime.TERMINATE)))); |
5832 | 1016 |
|
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1017 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1018 |
Outer_Syntax.improper_command @{command_spec "welcome"} "print welcome message" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1019 |
(Scan.succeed (Toplevel.imperative (writeln o Session.welcome))); |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1020 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1021 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1022 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1023 |
(** raw Isar read-eval-print loop **) |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1024 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1025 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1026 |
Outer_Syntax.improper_command @{command_spec "init_toplevel"} "init toplevel point-of-interest" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1027 |
(Scan.succeed (Toplevel.imperative Isar.init)); |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1028 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1029 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1030 |
Outer_Syntax.improper_command @{command_spec "linear_undo"} "undo commands" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1031 |
(Scan.optional Parse.nat 1 >> |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1032 |
(fn n => Toplevel.imperative (fn () => Isar.linear_undo n))); |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1033 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1034 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1035 |
Outer_Syntax.improper_command @{command_spec "undo"} "undo commands (skipping closed proofs)" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1036 |
(Scan.optional Parse.nat 1 >> |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1037 |
(fn n => Toplevel.imperative (fn () => Isar.undo n))); |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1038 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1039 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1040 |
Outer_Syntax.improper_command @{command_spec "undos_proof"} |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1041 |
"undo commands (skipping closed proofs)" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1042 |
(Scan.optional Parse.nat 1 >> (fn n => |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1043 |
Toplevel.keep (fn state => |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1044 |
if Toplevel.is_proof state then (Isar.undo n; Isar.print ()) else raise Toplevel.UNDEF))); |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1045 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1046 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1047 |
Outer_Syntax.improper_command @{command_spec "cannot_undo"} |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1048 |
"partial undo -- Proof General legacy" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1049 |
(Parse.name >> |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1050 |
(fn "end" => Toplevel.imperative (fn () => Isar.undo 1) |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1051 |
| txt => Toplevel.imperative (fn () => error ("Cannot undo " ^ quote txt)))); |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1052 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1053 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1054 |
Outer_Syntax.improper_command @{command_spec "kill"} |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1055 |
"kill partial proof or theory development" |
51658
21c10672633b
discontinued Toplevel.no_timing complication -- also recovers timing of diagnostic commands, e.g. 'find_theorems';
wenzelm
parents:
51654
diff
changeset
|
1056 |
(Scan.succeed (Toplevel.imperative Isar.kill)); |
48646
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1057 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1058 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1059 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1060 |
(** extraction of programs from proofs **) |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1061 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1062 |
val parse_vars = Scan.optional (Parse.$$$ "(" |-- Parse.list1 Parse.name --| Parse.$$$ ")") []; |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1063 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1064 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1065 |
Outer_Syntax.command @{command_spec "realizers"} |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1066 |
"specify realizers for primitive axioms / theorems, together with correctness proof" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1067 |
(Scan.repeat1 (Parse.xname -- parse_vars --| Parse.$$$ ":" -- Parse.string -- Parse.string) >> |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1068 |
(fn xs => Toplevel.theory (fn thy => Extraction.add_realizers |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1069 |
(map (fn (((a, vs), s1), s2) => (Global_Theory.get_thm thy a, (vs, s1, s2))) xs) thy))); |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1070 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1071 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1072 |
Outer_Syntax.command @{command_spec "realizability"} |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1073 |
"add equations characterizing realizability" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1074 |
(Scan.repeat1 Parse.string >> (Toplevel.theory o Extraction.add_realizes_eqns)); |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1075 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1076 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1077 |
Outer_Syntax.command @{command_spec "extract_type"} |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1078 |
"add equations characterizing type of extracted program" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1079 |
(Scan.repeat1 Parse.string >> (Toplevel.theory o Extraction.add_typeof_eqns)); |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1080 |
|
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1081 |
val _ = |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1082 |
Outer_Syntax.command @{command_spec "extract"} "extract terms from proofs" |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1083 |
(Scan.repeat1 (Parse.xname -- parse_vars) >> (fn xs => Toplevel.theory (fn thy => |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1084 |
Extraction.extract (map (apfst (Global_Theory.get_thm thy)) xs) thy))); |
91281e9472d8
more official command specifications, including source position;
wenzelm
parents:
48645
diff
changeset
|
1085 |
|
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1086 |
|
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1087 |
|
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1088 |
(** end **) |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1089 |
|
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1090 |
val _ = |
48642 | 1091 |
Outer_Syntax.command @{command_spec "end"} "end context" |
48641
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1092 |
(Scan.succeed |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1093 |
(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
|
1094 |
Toplevel.end_proof (K Proof.end_notepad))); |
92b48b8abfe4
more standard bootstrapping of Pure outer syntax;
wenzelm
parents:
47416
diff
changeset
|
1095 |
|
5832 | 1096 |
end; |
27614
f38c25d106a7
renamed IsarCmd.nested_command to OuterSyntax.prepare_command;
wenzelm
parents:
27575
diff
changeset
|
1097 |