| author | wenzelm |
| Fri, 04 Dec 2009 15:25:30 +0100 | |
| changeset 33975 | c3b822d234f4 |
| parent 33515 | d066e8369a33 |
| child 39836 | a194f39cfcb4 |
| permissions | -rw-r--r-- |
| 27056 | 1 |
theory Misc |
2 |
imports Main |
|
3 |
begin |
|
4 |
||
|
28779
698960f08652
separate section "Inspecting the syntax" for print_syntax;
wenzelm
parents:
28778
diff
changeset
|
5 |
chapter {* Other commands *}
|
| 27056 | 6 |
|
7 |
section {* Inspecting the context *}
|
|
8 |
||
9 |
text {*
|
|
10 |
\begin{matharray}{rcl}
|
|
|
28761
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
11 |
@{command_def "print_commands"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
12 |
@{command_def "print_theory"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
13 |
@{command_def "print_methods"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
14 |
@{command_def "print_attributes"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
15 |
@{command_def "print_theorems"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
16 |
@{command_def "find_theorems"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
| 29894 | 17 |
@{command_def "find_consts"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
28761
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
18 |
@{command_def "thm_deps"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
19 |
@{command_def "print_facts"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
20 |
@{command_def "print_binds"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
|
| 27056 | 21 |
\end{matharray}
|
22 |
||
23 |
\begin{rail}
|
|
|
33515
d066e8369a33
print_theorems: suppress concealed (global) facts, unless "!" option is given;
wenzelm
parents:
30168
diff
changeset
|
24 |
('print\_theory' | 'print\_theorems') ('!'?)
|
| 27056 | 25 |
; |
26 |
||
| 29894 | 27 |
'find\_theorems' (('(' (nat)? ('with\_dups')? ')')?) (thmcriterion *)
|
| 27056 | 28 |
; |
| 29894 | 29 |
thmcriterion: ('-'?) ('name' ':' nameref | 'intro' | 'elim' | 'dest' |
|
|
29893
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
30 |
'solves' | 'simp' ':' term | term) |
| 27056 | 31 |
; |
| 29894 | 32 |
'find\_consts' (constcriterion *) |
33 |
; |
|
34 |
constcriterion: ('-'?) ('name' ':' nameref | 'strict' ':' type | type)
|
|
35 |
; |
|
| 27056 | 36 |
'thm\_deps' thmrefs |
37 |
; |
|
38 |
\end{rail}
|
|
39 |
||
40 |
These commands print certain parts of the theory and proof context. |
|
41 |
Note that there are some further ones available, such as for the set |
|
42 |
of rules declared for simplifications. |
|
43 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
44 |
\begin{description}
|
| 27056 | 45 |
|
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
46 |
\item @{command "print_commands"} prints Isabelle's outer theory
|
| 27056 | 47 |
syntax, including keywords and command. |
48 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
49 |
\item @{command "print_theory"} prints the main logical content of
|
| 27056 | 50 |
the theory context; the ``@{text "!"}'' option indicates extra
|
51 |
verbosity. |
|
52 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
53 |
\item @{command "print_methods"} prints all proof methods
|
| 27056 | 54 |
available in the current theory context. |
55 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
56 |
\item @{command "print_attributes"} prints all attributes
|
| 27056 | 57 |
available in the current theory context. |
58 |
||
|
33515
d066e8369a33
print_theorems: suppress concealed (global) facts, unless "!" option is given;
wenzelm
parents:
30168
diff
changeset
|
59 |
\item @{command "print_theorems"} prints theorems resulting from the
|
|
d066e8369a33
print_theorems: suppress concealed (global) facts, unless "!" option is given;
wenzelm
parents:
30168
diff
changeset
|
60 |
last command; the ``@{text "!"}'' option indicates extra verbosity.
|
| 27056 | 61 |
|
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
62 |
\item @{command "find_theorems"}~@{text criteria} retrieves facts
|
| 27056 | 63 |
from the theory or proof context matching all of given search |
64 |
criteria. The criterion @{text "name: p"} selects all theorems
|
|
65 |
whose fully qualified name matches pattern @{text p}, which may
|
|
66 |
contain ``@{text "*"}'' wildcards. The criteria @{text intro},
|
|
67 |
@{text elim}, and @{text dest} select theorems that match the
|
|
68 |
current goal as introduction, elimination or destruction rules, |
|
| 29896 | 69 |
respectively. The criterion @{text "solves"} returns all rules
|
|
29893
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
70 |
that would directly solve the current goal. The criterion |
|
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
71 |
@{text "simp: t"} selects all rewrite rules whose left-hand side
|
|
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
72 |
matches the given term. The criterion term @{text t} selects all
|
|
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
73 |
theorems that contain the pattern @{text t} -- as usual, patterns
|
|
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
74 |
may contain occurrences of the dummy ``@{text _}'', schematic
|
|
defab1c6a6b5
FindTheorems solves: update documentation (by Timothy Bourke)
kleing
parents:
28779
diff
changeset
|
75 |
variables, and type constraints. |
| 27056 | 76 |
|
77 |
Criteria can be preceded by ``@{text "-"}'' to select theorems that
|
|
78 |
do \emph{not} match. Note that giving the empty list of criteria
|
|
79 |
yields \emph{all} currently known facts. An optional limit for the
|
|
80 |
number of printed facts may be given; the default is 40. By |
|
81 |
default, duplicates are removed from the search result. Use |
|
82 |
@{text with_dups} to display duplicates.
|
|
| 29894 | 83 |
|
84 |
\item @{command "find_consts"}~@{text criteria} prints all constants
|
|
85 |
whose type meets all of the given criteria. The criterion @{text
|
|
86 |
"strict: ty"} is met by any type that matches the type pattern |
|
87 |
@{text ty}. Patterns may contain both the dummy type ``@{text _}''
|
|
88 |
and sort constraints. The criterion @{text ty} is similar, but it
|
|
89 |
also matches against subtypes. The criterion @{text "name: p"} and
|
|
90 |
the prefix ``@{text "-"}'' function as described for @{command
|
|
91 |
"find_theorems"}. |
|
92 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
93 |
\item @{command "thm_deps"}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}
|
| 27056 | 94 |
visualizes dependencies of facts, using Isabelle's graph browser |
95 |
tool (see also \cite{isabelle-sys}).
|
|
96 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
97 |
\item @{command "print_facts"} prints all local facts of the
|
| 27056 | 98 |
current context, both named and unnamed ones. |
99 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
100 |
\item @{command "print_binds"} prints all term abbreviations
|
| 27056 | 101 |
present in the context. |
102 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
103 |
\end{description}
|
| 27056 | 104 |
*} |
105 |
||
106 |
||
107 |
section {* History commands \label{sec:history} *}
|
|
108 |
||
109 |
text {*
|
|
110 |
\begin{matharray}{rcl}
|
|
|
28761
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
111 |
@{command_def "undo"}^{{ * }{ * }} & : & @{text "any \<rightarrow> any"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
112 |
@{command_def "linear_undo"}^{{ * }{ * }} & : & @{text "any \<rightarrow> any"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
113 |
@{command_def "kill"}^{{ * }{ * }} & : & @{text "any \<rightarrow> any"} \\
|
| 27056 | 114 |
\end{matharray}
|
115 |
||
116 |
The Isabelle/Isar top-level maintains a two-stage history, for |
|
117 |
theory and proof state transformation. Basically, any command can |
|
118 |
be undone using @{command "undo"}, excluding mere diagnostic
|
|
| 27598 | 119 |
elements. Note that a theorem statement with a \emph{finished}
|
120 |
proof is treated as a single unit by @{command "undo"}. In
|
|
121 |
contrast, the variant @{command "linear_undo"} admits to step back
|
|
122 |
into the middle of a proof. The @{command "kill"} command aborts
|
|
123 |
the current history node altogether, discontinuing a proof or even |
|
124 |
the whole theory. This operation is \emph{not} undo-able.
|
|
| 27056 | 125 |
|
126 |
\begin{warn}
|
|
127 |
History commands should never be used with user interfaces such as |
|
128 |
Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes
|
|
129 |
care of stepping forth and back itself. Interfering by manual |
|
| 27598 | 130 |
@{command "undo"}, @{command "linear_undo"}, or even @{command
|
131 |
"kill"} commands would quickly result in utter confusion. |
|
| 27056 | 132 |
\end{warn}
|
133 |
*} |
|
134 |
||
135 |
||
136 |
section {* System commands *}
|
|
137 |
||
138 |
text {*
|
|
139 |
\begin{matharray}{rcl}
|
|
|
28761
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
140 |
@{command_def "cd"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
141 |
@{command_def "pwd"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
|
|
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
wenzelm
parents:
28760
diff
changeset
|
142 |
@{command_def "use_thy"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
|
| 27056 | 143 |
\end{matharray}
|
144 |
||
145 |
\begin{rail}
|
|
146 |
('cd' | 'use\_thy' | 'update\_thy') name
|
|
147 |
; |
|
148 |
\end{rail}
|
|
149 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
150 |
\begin{description}
|
| 27056 | 151 |
|
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
152 |
\item @{command "cd"}~@{text path} changes the current directory
|
| 27056 | 153 |
of the Isabelle process. |
154 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
155 |
\item @{command "pwd"} prints the current working directory.
|
| 27056 | 156 |
|
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
157 |
\item @{command "use_thy"}~@{text A} preload theory @{text A}.
|
| 27056 | 158 |
These system commands are scarcely used when working interactively, |
159 |
since loading of theories is done automatically as required. |
|
160 |
||
|
28760
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
wenzelm
parents:
27598
diff
changeset
|
161 |
\end{description}
|
| 27056 | 162 |
*} |
163 |
||
164 |
end |