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