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