wenzelm@26782
|
1 |
(* $Id$ *)
|
wenzelm@26782
|
2 |
|
wenzelm@26782
|
3 |
theory Generic
|
wenzelm@26894
|
4 |
imports Main
|
wenzelm@26782
|
5 |
begin
|
wenzelm@26782
|
6 |
|
wenzelm@26782
|
7 |
chapter {* Generic tools and packages \label{ch:gen-tools} *}
|
wenzelm@26782
|
8 |
|
wenzelm@27040
|
9 |
section {* Configuration options *}
|
wenzelm@26782
|
10 |
|
wenzelm@26782
|
11 |
text {*
|
wenzelm@26782
|
12 |
Isabelle/Pure maintains a record of named configuration options
|
wenzelm@26782
|
13 |
within the theory or proof context, with values of type @{ML_type
|
wenzelm@26782
|
14 |
bool}, @{ML_type int}, or @{ML_type string}. Tools may declare
|
wenzelm@26782
|
15 |
options in ML, and then refer to these values (relative to the
|
wenzelm@26782
|
16 |
context). Thus global reference variables are easily avoided. The
|
wenzelm@26782
|
17 |
user may change the value of a configuration option by means of an
|
wenzelm@26782
|
18 |
associated attribute of the same name. This form of context
|
wenzelm@26782
|
19 |
declaration works particularly well with commands such as @{command
|
wenzelm@26782
|
20 |
"declare"} or @{command "using"}.
|
wenzelm@26782
|
21 |
|
wenzelm@26782
|
22 |
For historical reasons, some tools cannot take the full proof
|
wenzelm@26782
|
23 |
context into account and merely refer to the background theory.
|
wenzelm@26782
|
24 |
This is accommodated by configuration options being declared as
|
wenzelm@26782
|
25 |
``global'', which may not be changed within a local context.
|
wenzelm@26782
|
26 |
|
wenzelm@26782
|
27 |
\begin{matharray}{rcll}
|
wenzelm@26782
|
28 |
@{command_def "print_configs"} & : & \isarkeep{theory~|~proof} \\
|
wenzelm@26782
|
29 |
\end{matharray}
|
wenzelm@26782
|
30 |
|
wenzelm@26782
|
31 |
\begin{rail}
|
wenzelm@26782
|
32 |
name ('=' ('true' | 'false' | int | name))?
|
wenzelm@26782
|
33 |
\end{rail}
|
wenzelm@26782
|
34 |
|
wenzelm@26782
|
35 |
\begin{descr}
|
wenzelm@26782
|
36 |
|
wenzelm@26782
|
37 |
\item [@{command "print_configs"}] prints the available
|
wenzelm@26782
|
38 |
configuration options, with names, types, and current values.
|
wenzelm@26782
|
39 |
|
wenzelm@26782
|
40 |
\item [@{text "name = value"}] as an attribute expression modifies
|
wenzelm@26782
|
41 |
the named option, with the syntax of the value depending on the
|
wenzelm@26782
|
42 |
option's type. For @{ML_type bool} the default value is @{text
|
wenzelm@26782
|
43 |
true}. Any attempt to change a global option in a local context is
|
wenzelm@26782
|
44 |
ignored.
|
wenzelm@26782
|
45 |
|
wenzelm@26782
|
46 |
\end{descr}
|
wenzelm@26782
|
47 |
*}
|
wenzelm@26782
|
48 |
|
wenzelm@26782
|
49 |
|
wenzelm@27040
|
50 |
section {* Basic proof tools *}
|
wenzelm@26782
|
51 |
|
wenzelm@26782
|
52 |
subsection {* Miscellaneous methods and attributes \label{sec:misc-meth-att} *}
|
wenzelm@26782
|
53 |
|
wenzelm@26782
|
54 |
text {*
|
wenzelm@26782
|
55 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
56 |
@{method_def unfold} & : & \isarmeth \\
|
wenzelm@26782
|
57 |
@{method_def fold} & : & \isarmeth \\
|
wenzelm@26782
|
58 |
@{method_def insert} & : & \isarmeth \\[0.5ex]
|
wenzelm@26782
|
59 |
@{method_def erule}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
60 |
@{method_def drule}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
61 |
@{method_def frule}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
62 |
@{method_def succeed} & : & \isarmeth \\
|
wenzelm@26782
|
63 |
@{method_def fail} & : & \isarmeth \\
|
wenzelm@26782
|
64 |
\end{matharray}
|
wenzelm@26782
|
65 |
|
wenzelm@26782
|
66 |
\begin{rail}
|
wenzelm@26782
|
67 |
('fold' | 'unfold' | 'insert') thmrefs
|
wenzelm@26782
|
68 |
;
|
wenzelm@26782
|
69 |
('erule' | 'drule' | 'frule') ('('nat')')? thmrefs
|
wenzelm@26782
|
70 |
;
|
wenzelm@26782
|
71 |
\end{rail}
|
wenzelm@26782
|
72 |
|
wenzelm@26782
|
73 |
\begin{descr}
|
wenzelm@26782
|
74 |
|
wenzelm@26782
|
75 |
\item [@{method unfold}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} and @{method
|
wenzelm@26782
|
76 |
fold}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}] expand (or fold back) the
|
wenzelm@26782
|
77 |
given definitions throughout all goals; any chained facts provided
|
wenzelm@26782
|
78 |
are inserted into the goal and subject to rewriting as well.
|
wenzelm@26782
|
79 |
|
wenzelm@26782
|
80 |
\item [@{method insert}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}] inserts
|
wenzelm@26782
|
81 |
theorems as facts into all goals of the proof state. Note that
|
wenzelm@26782
|
82 |
current facts indicated for forward chaining are ignored.
|
wenzelm@26782
|
83 |
|
wenzelm@26782
|
84 |
\item [@{method erule}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}, @{method
|
wenzelm@26782
|
85 |
drule}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}, and @{method frule}~@{text
|
wenzelm@26782
|
86 |
"a\<^sub>1 \<dots> a\<^sub>n"}] are similar to the basic @{method rule}
|
wenzelm@26782
|
87 |
method (see \secref{sec:pure-meth-att}), but apply rules by
|
wenzelm@26782
|
88 |
elim-resolution, destruct-resolution, and forward-resolution,
|
wenzelm@26782
|
89 |
respectively \cite{isabelle-ref}. The optional natural number
|
wenzelm@26782
|
90 |
argument (default 0) specifies additional assumption steps to be
|
wenzelm@26782
|
91 |
performed here.
|
wenzelm@26782
|
92 |
|
wenzelm@26782
|
93 |
Note that these methods are improper ones, mainly serving for
|
wenzelm@26782
|
94 |
experimentation and tactic script emulation. Different modes of
|
wenzelm@26782
|
95 |
basic rule application are usually expressed in Isar at the proof
|
wenzelm@26782
|
96 |
language level, rather than via implicit proof state manipulations.
|
wenzelm@26782
|
97 |
For example, a proper single-step elimination would be done using
|
wenzelm@26782
|
98 |
the plain @{method rule} method, with forward chaining of current
|
wenzelm@26782
|
99 |
facts.
|
wenzelm@26782
|
100 |
|
wenzelm@26782
|
101 |
\item [@{method succeed}] yields a single (unchanged) result; it is
|
wenzelm@26782
|
102 |
the identity of the ``@{text ","}'' method combinator (cf.\
|
wenzelm@26782
|
103 |
\secref{sec:syn-meth}).
|
wenzelm@26782
|
104 |
|
wenzelm@26782
|
105 |
\item [@{method fail}] yields an empty result sequence; it is the
|
wenzelm@26782
|
106 |
identity of the ``@{text "|"}'' method combinator (cf.\
|
wenzelm@26782
|
107 |
\secref{sec:syn-meth}).
|
wenzelm@26782
|
108 |
|
wenzelm@26782
|
109 |
\end{descr}
|
wenzelm@26782
|
110 |
|
wenzelm@26782
|
111 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
112 |
@{attribute_def tagged} & : & \isaratt \\
|
wenzelm@26782
|
113 |
@{attribute_def untagged} & : & \isaratt \\[0.5ex]
|
wenzelm@26782
|
114 |
@{attribute_def THEN} & : & \isaratt \\
|
wenzelm@26782
|
115 |
@{attribute_def COMP} & : & \isaratt \\[0.5ex]
|
wenzelm@26782
|
116 |
@{attribute_def unfolded} & : & \isaratt \\
|
wenzelm@26782
|
117 |
@{attribute_def folded} & : & \isaratt \\[0.5ex]
|
wenzelm@26782
|
118 |
@{attribute_def rotated} & : & \isaratt \\
|
wenzelm@26782
|
119 |
@{attribute_def (Pure) elim_format} & : & \isaratt \\
|
wenzelm@26782
|
120 |
@{attribute_def standard}@{text "\<^sup>*"} & : & \isaratt \\
|
wenzelm@26782
|
121 |
@{attribute_def no_vars}@{text "\<^sup>*"} & : & \isaratt \\
|
wenzelm@26782
|
122 |
\end{matharray}
|
wenzelm@26782
|
123 |
|
wenzelm@26782
|
124 |
\begin{rail}
|
wenzelm@26782
|
125 |
'tagged' nameref
|
wenzelm@26782
|
126 |
;
|
wenzelm@26782
|
127 |
'untagged' name
|
wenzelm@26782
|
128 |
;
|
wenzelm@26782
|
129 |
('THEN' | 'COMP') ('[' nat ']')? thmref
|
wenzelm@26782
|
130 |
;
|
wenzelm@26782
|
131 |
('unfolded' | 'folded') thmrefs
|
wenzelm@26782
|
132 |
;
|
wenzelm@26782
|
133 |
'rotated' ( int )?
|
wenzelm@26782
|
134 |
\end{rail}
|
wenzelm@26782
|
135 |
|
wenzelm@26782
|
136 |
\begin{descr}
|
wenzelm@26782
|
137 |
|
wenzelm@26782
|
138 |
\item [@{attribute tagged}~@{text "name arg"} and @{attribute
|
wenzelm@26782
|
139 |
untagged}~@{text name}] add and remove \emph{tags} of some theorem.
|
wenzelm@26782
|
140 |
Tags may be any list of string pairs that serve as formal comment.
|
wenzelm@26782
|
141 |
The first string is considered the tag name, the second its
|
wenzelm@26782
|
142 |
argument. Note that @{attribute untagged} removes any tags of the
|
wenzelm@26782
|
143 |
same name.
|
wenzelm@26782
|
144 |
|
wenzelm@26782
|
145 |
\item [@{attribute THEN}~@{text a} and @{attribute COMP}~@{text a}]
|
wenzelm@26782
|
146 |
compose rules by resolution. @{attribute THEN} resolves with the
|
wenzelm@26782
|
147 |
first premise of @{text a} (an alternative position may be also
|
wenzelm@26782
|
148 |
specified); the @{attribute COMP} version skips the automatic
|
wenzelm@26782
|
149 |
lifting process that is normally intended (cf.\ @{ML "op RS"} and
|
wenzelm@26782
|
150 |
@{ML "op COMP"} in \cite[\S5]{isabelle-ref}).
|
wenzelm@26782
|
151 |
|
wenzelm@26782
|
152 |
\item [@{attribute unfolded}~@{text "a\<^sub>1 \<dots> a\<^sub>n"} and
|
wenzelm@26782
|
153 |
@{attribute folded}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}] expand and fold
|
wenzelm@26782
|
154 |
back again the given definitions throughout a rule.
|
wenzelm@26782
|
155 |
|
wenzelm@26782
|
156 |
\item [@{attribute rotated}~@{text n}] rotate the premises of a
|
wenzelm@26782
|
157 |
theorem by @{text n} (default 1).
|
wenzelm@26782
|
158 |
|
wenzelm@26782
|
159 |
\item [@{attribute Pure.elim_format}] turns a destruction rule into
|
wenzelm@26844
|
160 |
elimination rule format, by resolving with the rule @{prop "PROP A \<Longrightarrow>
|
wenzelm@26844
|
161 |
(PROP A \<Longrightarrow> PROP B) \<Longrightarrow> PROP B"}.
|
wenzelm@26782
|
162 |
|
wenzelm@26782
|
163 |
Note that the Classical Reasoner (\secref{sec:classical}) provides
|
wenzelm@26782
|
164 |
its own version of this operation.
|
wenzelm@26782
|
165 |
|
wenzelm@26782
|
166 |
\item [@{attribute standard}] puts a theorem into the standard form
|
wenzelm@26782
|
167 |
of object-rules at the outermost theory level. Note that this
|
wenzelm@26782
|
168 |
operation violates the local proof context (including active
|
wenzelm@26782
|
169 |
locales).
|
wenzelm@26782
|
170 |
|
wenzelm@26782
|
171 |
\item [@{attribute no_vars}] replaces schematic variables by free
|
wenzelm@26782
|
172 |
ones; this is mainly for tuning output of pretty printed theorems.
|
wenzelm@26782
|
173 |
|
wenzelm@26782
|
174 |
\end{descr}
|
wenzelm@26782
|
175 |
*}
|
wenzelm@26782
|
176 |
|
wenzelm@26782
|
177 |
|
wenzelm@26782
|
178 |
subsection {* Further tactic emulations \label{sec:tactics} *}
|
wenzelm@26782
|
179 |
|
wenzelm@26782
|
180 |
text {*
|
wenzelm@26782
|
181 |
The following improper proof methods emulate traditional tactics.
|
wenzelm@26782
|
182 |
These admit direct access to the goal state, which is normally
|
wenzelm@26782
|
183 |
considered harmful! In particular, this may involve both numbered
|
wenzelm@26782
|
184 |
goal addressing (default 1), and dynamic instantiation within the
|
wenzelm@26782
|
185 |
scope of some subgoal.
|
wenzelm@26782
|
186 |
|
wenzelm@26782
|
187 |
\begin{warn}
|
wenzelm@26782
|
188 |
Dynamic instantiations refer to universally quantified parameters
|
wenzelm@26782
|
189 |
of a subgoal (the dynamic context) rather than fixed variables and
|
wenzelm@26782
|
190 |
term abbreviations of a (static) Isar context.
|
wenzelm@26782
|
191 |
\end{warn}
|
wenzelm@26782
|
192 |
|
wenzelm@26782
|
193 |
Tactic emulation methods, unlike their ML counterparts, admit
|
wenzelm@26782
|
194 |
simultaneous instantiation from both dynamic and static contexts.
|
wenzelm@26782
|
195 |
If names occur in both contexts goal parameters hide locally fixed
|
wenzelm@26782
|
196 |
variables. Likewise, schematic variables refer to term
|
wenzelm@26782
|
197 |
abbreviations, if present in the static context. Otherwise the
|
wenzelm@26782
|
198 |
schematic variable is interpreted as a schematic variable and left
|
wenzelm@26782
|
199 |
to be solved by unification with certain parts of the subgoal.
|
wenzelm@26782
|
200 |
|
wenzelm@26782
|
201 |
Note that the tactic emulation proof methods in Isabelle/Isar are
|
wenzelm@26782
|
202 |
consistently named @{text foo_tac}. Note also that variable names
|
wenzelm@26782
|
203 |
occurring on left hand sides of instantiations must be preceded by a
|
wenzelm@26782
|
204 |
question mark if they coincide with a keyword or contain dots. This
|
wenzelm@26782
|
205 |
is consistent with the attribute @{attribute "where"} (see
|
wenzelm@26782
|
206 |
\secref{sec:pure-meth-att}).
|
wenzelm@26782
|
207 |
|
wenzelm@26782
|
208 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
209 |
@{method_def rule_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
210 |
@{method_def erule_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
211 |
@{method_def drule_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
212 |
@{method_def frule_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
213 |
@{method_def cut_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
214 |
@{method_def thin_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
215 |
@{method_def subgoal_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
216 |
@{method_def rename_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
217 |
@{method_def rotate_tac}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
218 |
@{method_def tactic}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
219 |
\end{matharray}
|
wenzelm@26782
|
220 |
|
wenzelm@26782
|
221 |
\begin{rail}
|
wenzelm@26782
|
222 |
( 'rule\_tac' | 'erule\_tac' | 'drule\_tac' | 'frule\_tac' | 'cut\_tac' | 'thin\_tac' ) goalspec?
|
wenzelm@26782
|
223 |
( insts thmref | thmrefs )
|
wenzelm@26782
|
224 |
;
|
wenzelm@26782
|
225 |
'subgoal\_tac' goalspec? (prop +)
|
wenzelm@26782
|
226 |
;
|
wenzelm@26782
|
227 |
'rename\_tac' goalspec? (name +)
|
wenzelm@26782
|
228 |
;
|
wenzelm@26782
|
229 |
'rotate\_tac' goalspec? int?
|
wenzelm@26782
|
230 |
;
|
wenzelm@26782
|
231 |
'tactic' text
|
wenzelm@26782
|
232 |
;
|
wenzelm@26782
|
233 |
|
wenzelm@26782
|
234 |
insts: ((name '=' term) + 'and') 'in'
|
wenzelm@26782
|
235 |
;
|
wenzelm@26782
|
236 |
\end{rail}
|
wenzelm@26782
|
237 |
|
wenzelm@26782
|
238 |
\begin{descr}
|
wenzelm@26782
|
239 |
|
wenzelm@26782
|
240 |
\item [@{method rule_tac} etc.] do resolution of rules with explicit
|
wenzelm@26782
|
241 |
instantiation. This works the same way as the ML tactics @{ML
|
wenzelm@26782
|
242 |
res_inst_tac} etc. (see \cite[\S3]{isabelle-ref}).
|
wenzelm@26782
|
243 |
|
wenzelm@26782
|
244 |
Multiple rules may be only given if there is no instantiation; then
|
wenzelm@26782
|
245 |
@{method rule_tac} is the same as @{ML resolve_tac} in ML (see
|
wenzelm@26782
|
246 |
\cite[\S3]{isabelle-ref}).
|
wenzelm@26782
|
247 |
|
wenzelm@26782
|
248 |
\item [@{method cut_tac}] inserts facts into the proof state as
|
wenzelm@26782
|
249 |
assumption of a subgoal, see also @{ML cut_facts_tac} in
|
wenzelm@26782
|
250 |
\cite[\S3]{isabelle-ref}. Note that the scope of schematic
|
wenzelm@26782
|
251 |
variables is spread over the main goal statement. Instantiations
|
wenzelm@26782
|
252 |
may be given as well, see also ML tactic @{ML cut_inst_tac} in
|
wenzelm@26782
|
253 |
\cite[\S3]{isabelle-ref}.
|
wenzelm@26782
|
254 |
|
wenzelm@26782
|
255 |
\item [@{method thin_tac}~@{text \<phi>}] deletes the specified
|
wenzelm@26782
|
256 |
assumption from a subgoal; note that @{text \<phi>} may contain schematic
|
wenzelm@26782
|
257 |
variables. See also @{ML thin_tac} in \cite[\S3]{isabelle-ref}.
|
wenzelm@26782
|
258 |
|
wenzelm@26782
|
259 |
\item [@{method subgoal_tac}~@{text \<phi>}] adds @{text \<phi>} as an
|
wenzelm@26782
|
260 |
assumption to a subgoal. See also @{ML subgoal_tac} and @{ML
|
wenzelm@26782
|
261 |
subgoals_tac} in \cite[\S3]{isabelle-ref}.
|
wenzelm@26782
|
262 |
|
wenzelm@26782
|
263 |
\item [@{method rename_tac}~@{text "x\<^sub>1 \<dots> x\<^sub>n"}] renames
|
wenzelm@26782
|
264 |
parameters of a goal according to the list @{text "x\<^sub>1, \<dots>,
|
wenzelm@26782
|
265 |
x\<^sub>n"}, which refers to the \emph{suffix} of variables.
|
wenzelm@26782
|
266 |
|
wenzelm@26782
|
267 |
\item [@{method rotate_tac}~@{text n}] rotates the assumptions of a
|
wenzelm@26782
|
268 |
goal by @{text n} positions: from right to left if @{text n} is
|
wenzelm@26782
|
269 |
positive, and from left to right if @{text n} is negative; the
|
wenzelm@26782
|
270 |
default value is 1. See also @{ML rotate_tac} in
|
wenzelm@26782
|
271 |
\cite[\S3]{isabelle-ref}.
|
wenzelm@26782
|
272 |
|
wenzelm@26782
|
273 |
\item [@{method tactic}~@{text "text"}] produces a proof method from
|
wenzelm@26782
|
274 |
any ML text of type @{ML_type tactic}. Apart from the usual ML
|
wenzelm@26782
|
275 |
environment and the current implicit theory context, the ML code may
|
wenzelm@26782
|
276 |
refer to the following locally bound values:
|
wenzelm@26782
|
277 |
|
wenzelm@26782
|
278 |
%FIXME check
|
wenzelm@26782
|
279 |
{\footnotesize\begin{verbatim}
|
wenzelm@26782
|
280 |
val ctxt : Proof.context
|
wenzelm@26782
|
281 |
val facts : thm list
|
wenzelm@26782
|
282 |
val thm : string -> thm
|
wenzelm@26782
|
283 |
val thms : string -> thm list
|
wenzelm@26782
|
284 |
\end{verbatim}}
|
wenzelm@26782
|
285 |
|
wenzelm@26782
|
286 |
Here @{ML_text ctxt} refers to the current proof context, @{ML_text
|
wenzelm@26782
|
287 |
facts} indicates any current facts for forward-chaining, and @{ML
|
wenzelm@26782
|
288 |
thm}~/~@{ML thms} retrieve named facts (including global theorems)
|
wenzelm@26782
|
289 |
from the context.
|
wenzelm@26782
|
290 |
|
wenzelm@26782
|
291 |
\end{descr}
|
wenzelm@26782
|
292 |
*}
|
wenzelm@26782
|
293 |
|
wenzelm@26782
|
294 |
|
wenzelm@27040
|
295 |
section {* The Simplifier \label{sec:simplifier} *}
|
wenzelm@26782
|
296 |
|
wenzelm@27040
|
297 |
subsection {* Simplification methods *}
|
wenzelm@26782
|
298 |
|
wenzelm@26782
|
299 |
text {*
|
wenzelm@26782
|
300 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
301 |
@{method_def simp} & : & \isarmeth \\
|
wenzelm@26782
|
302 |
@{method_def simp_all} & : & \isarmeth \\
|
wenzelm@26782
|
303 |
\end{matharray}
|
wenzelm@26782
|
304 |
|
wenzelm@26782
|
305 |
\indexouternonterm{simpmod}
|
wenzelm@26782
|
306 |
\begin{rail}
|
wenzelm@26782
|
307 |
('simp' | 'simp\_all') ('!' ?) opt? (simpmod *)
|
wenzelm@26782
|
308 |
;
|
wenzelm@26782
|
309 |
|
wenzelm@26782
|
310 |
opt: '(' ('no\_asm' | 'no\_asm\_simp' | 'no\_asm\_use' | 'asm\_lr' | 'depth\_limit' ':' nat) ')'
|
wenzelm@26782
|
311 |
;
|
wenzelm@26782
|
312 |
simpmod: ('add' | 'del' | 'only' | 'cong' (() | 'add' | 'del') |
|
wenzelm@26782
|
313 |
'split' (() | 'add' | 'del')) ':' thmrefs
|
wenzelm@26782
|
314 |
;
|
wenzelm@26782
|
315 |
\end{rail}
|
wenzelm@26782
|
316 |
|
wenzelm@26782
|
317 |
\begin{descr}
|
wenzelm@26782
|
318 |
|
wenzelm@26782
|
319 |
\item [@{method simp}] invokes the Simplifier, after declaring
|
wenzelm@26782
|
320 |
additional rules according to the arguments given. Note that the
|
wenzelm@26782
|
321 |
\railtterm{only} modifier first removes all other rewrite rules,
|
wenzelm@26782
|
322 |
congruences, and looper tactics (including splits), and then behaves
|
wenzelm@26782
|
323 |
like \railtterm{add}.
|
wenzelm@26782
|
324 |
|
wenzelm@26782
|
325 |
\medskip The \railtterm{cong} modifiers add or delete Simplifier
|
wenzelm@26782
|
326 |
congruence rules (see also \cite{isabelle-ref}), the default is to
|
wenzelm@26782
|
327 |
add.
|
wenzelm@26782
|
328 |
|
wenzelm@26782
|
329 |
\medskip The \railtterm{split} modifiers add or delete rules for the
|
wenzelm@26782
|
330 |
Splitter (see also \cite{isabelle-ref}), the default is to add.
|
wenzelm@26782
|
331 |
This works only if the Simplifier method has been properly setup to
|
wenzelm@26782
|
332 |
include the Splitter (all major object logics such HOL, HOLCF, FOL,
|
wenzelm@26782
|
333 |
ZF do this already).
|
wenzelm@26782
|
334 |
|
wenzelm@26782
|
335 |
\item [@{method simp_all}] is similar to @{method simp}, but acts on
|
wenzelm@26782
|
336 |
all goals (backwards from the last to the first one).
|
wenzelm@26782
|
337 |
|
wenzelm@26782
|
338 |
\end{descr}
|
wenzelm@26782
|
339 |
|
wenzelm@26782
|
340 |
By default the Simplifier methods take local assumptions fully into
|
wenzelm@26782
|
341 |
account, using equational assumptions in the subsequent
|
wenzelm@26782
|
342 |
normalization process, or simplifying assumptions themselves (cf.\
|
wenzelm@26782
|
343 |
@{ML asm_full_simp_tac} in \cite[\S10]{isabelle-ref}). In
|
wenzelm@26782
|
344 |
structured proofs this is usually quite well behaved in practice:
|
wenzelm@26782
|
345 |
just the local premises of the actual goal are involved, additional
|
wenzelm@26782
|
346 |
facts may be inserted via explicit forward-chaining (via @{command
|
wenzelm@26782
|
347 |
"then"}, @{command "from"}, @{command "using"} etc.). The full
|
wenzelm@26782
|
348 |
context of premises is only included if the ``@{text "!"}'' (bang)
|
wenzelm@26782
|
349 |
argument is given, which should be used with some care, though.
|
wenzelm@26782
|
350 |
|
wenzelm@26782
|
351 |
Additional Simplifier options may be specified to tune the behavior
|
wenzelm@26782
|
352 |
further (mostly for unstructured scripts with many accidental local
|
wenzelm@26782
|
353 |
facts): ``@{text "(no_asm)"}'' means assumptions are ignored
|
wenzelm@26782
|
354 |
completely (cf.\ @{ML simp_tac}), ``@{text "(no_asm_simp)"}'' means
|
wenzelm@26782
|
355 |
assumptions are used in the simplification of the conclusion but are
|
wenzelm@26782
|
356 |
not themselves simplified (cf.\ @{ML asm_simp_tac}), and ``@{text
|
wenzelm@26782
|
357 |
"(no_asm_use)"}'' means assumptions are simplified but are not used
|
wenzelm@26782
|
358 |
in the simplification of each other or the conclusion (cf.\ @{ML
|
wenzelm@26782
|
359 |
full_simp_tac}). For compatibility reasons, there is also an option
|
wenzelm@26782
|
360 |
``@{text "(asm_lr)"}'', which means that an assumption is only used
|
wenzelm@26782
|
361 |
for simplifying assumptions which are to the right of it (cf.\ @{ML
|
wenzelm@26782
|
362 |
asm_lr_simp_tac}).
|
wenzelm@26782
|
363 |
|
wenzelm@26782
|
364 |
Giving an option ``@{text "(depth_limit: n)"}'' limits the number of
|
wenzelm@26782
|
365 |
recursive invocations of the simplifier during conditional
|
wenzelm@26782
|
366 |
rewriting.
|
wenzelm@26782
|
367 |
|
wenzelm@26782
|
368 |
\medskip The Splitter package is usually configured to work as part
|
wenzelm@26782
|
369 |
of the Simplifier. The effect of repeatedly applying @{ML
|
wenzelm@26782
|
370 |
split_tac} can be simulated by ``@{text "(simp only: split:
|
wenzelm@26782
|
371 |
a\<^sub>1 \<dots> a\<^sub>n)"}''. There is also a separate @{text split}
|
wenzelm@26782
|
372 |
method available for single-step case splitting.
|
wenzelm@26782
|
373 |
*}
|
wenzelm@26782
|
374 |
|
wenzelm@26782
|
375 |
|
wenzelm@27040
|
376 |
subsection {* Declaring rules *}
|
wenzelm@26782
|
377 |
|
wenzelm@26782
|
378 |
text {*
|
wenzelm@26782
|
379 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
380 |
@{command_def "print_simpset"}@{text "\<^sup>*"} & : & \isarkeep{theory~|~proof} \\
|
wenzelm@26782
|
381 |
@{attribute_def simp} & : & \isaratt \\
|
wenzelm@26782
|
382 |
@{attribute_def cong} & : & \isaratt \\
|
wenzelm@26782
|
383 |
@{attribute_def split} & : & \isaratt \\
|
wenzelm@26782
|
384 |
\end{matharray}
|
wenzelm@26782
|
385 |
|
wenzelm@26782
|
386 |
\begin{rail}
|
wenzelm@26782
|
387 |
('simp' | 'cong' | 'split') (() | 'add' | 'del')
|
wenzelm@26782
|
388 |
;
|
wenzelm@26782
|
389 |
\end{rail}
|
wenzelm@26782
|
390 |
|
wenzelm@26782
|
391 |
\begin{descr}
|
wenzelm@26782
|
392 |
|
wenzelm@26782
|
393 |
\item [@{command "print_simpset"}] prints the collection of rules
|
wenzelm@26782
|
394 |
declared to the Simplifier, which is also known as ``simpset''
|
wenzelm@26782
|
395 |
internally \cite{isabelle-ref}.
|
wenzelm@26782
|
396 |
|
wenzelm@26782
|
397 |
\item [@{attribute simp}] declares simplification rules.
|
wenzelm@26782
|
398 |
|
wenzelm@26782
|
399 |
\item [@{attribute cong}] declares congruence rules.
|
wenzelm@26782
|
400 |
|
wenzelm@26782
|
401 |
\item [@{attribute split}] declares case split rules.
|
wenzelm@26782
|
402 |
|
wenzelm@26782
|
403 |
\end{descr}
|
wenzelm@26782
|
404 |
*}
|
wenzelm@26782
|
405 |
|
wenzelm@26782
|
406 |
|
wenzelm@27040
|
407 |
subsection {* Simplification procedures *}
|
wenzelm@26782
|
408 |
|
wenzelm@26782
|
409 |
text {*
|
wenzelm@26782
|
410 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
411 |
@{command_def "simproc_setup"} & : & \isarkeep{local{\dsh}theory} \\
|
wenzelm@26782
|
412 |
simproc & : & \isaratt \\
|
wenzelm@26782
|
413 |
\end{matharray}
|
wenzelm@26782
|
414 |
|
wenzelm@26782
|
415 |
\begin{rail}
|
wenzelm@26782
|
416 |
'simproc\_setup' name '(' (term + '|') ')' '=' text \\ ('identifier' (nameref+))?
|
wenzelm@26782
|
417 |
;
|
wenzelm@26782
|
418 |
|
wenzelm@26782
|
419 |
'simproc' (('add' ':')? | 'del' ':') (name+)
|
wenzelm@26782
|
420 |
;
|
wenzelm@26782
|
421 |
\end{rail}
|
wenzelm@26782
|
422 |
|
wenzelm@26782
|
423 |
\begin{descr}
|
wenzelm@26782
|
424 |
|
wenzelm@26782
|
425 |
\item [@{command "simproc_setup"}] defines a named simplification
|
wenzelm@26782
|
426 |
procedure that is invoked by the Simplifier whenever any of the
|
wenzelm@26782
|
427 |
given term patterns match the current redex. The implementation,
|
wenzelm@26782
|
428 |
which is provided as ML source text, needs to be of type @{ML_type
|
wenzelm@26782
|
429 |
"morphism -> simpset -> cterm -> thm option"}, where the @{ML_type
|
wenzelm@26782
|
430 |
cterm} represents the current redex @{text r} and the result is
|
wenzelm@26782
|
431 |
supposed to be some proven rewrite rule @{text "r \<equiv> r'"} (or a
|
wenzelm@26782
|
432 |
generalized version), or @{ML NONE} to indicate failure. The
|
wenzelm@26782
|
433 |
@{ML_type simpset} argument holds the full context of the current
|
wenzelm@26782
|
434 |
Simplifier invocation, including the actual Isar proof context. The
|
wenzelm@26782
|
435 |
@{ML_type morphism} informs about the difference of the original
|
wenzelm@26782
|
436 |
compilation context wrt.\ the one of the actual application later
|
wenzelm@26782
|
437 |
on. The optional @{keyword "identifier"} specifies theorems that
|
wenzelm@26782
|
438 |
represent the logical content of the abstract theory of this
|
wenzelm@26782
|
439 |
simproc.
|
wenzelm@26782
|
440 |
|
wenzelm@26782
|
441 |
Morphisms and identifiers are only relevant for simprocs that are
|
wenzelm@26782
|
442 |
defined within a local target context, e.g.\ in a locale.
|
wenzelm@26782
|
443 |
|
wenzelm@26782
|
444 |
\item [@{text "simproc add: name"} and @{text "simproc del: name"}]
|
wenzelm@26782
|
445 |
add or delete named simprocs to the current Simplifier context. The
|
wenzelm@26782
|
446 |
default is to add a simproc. Note that @{command "simproc_setup"}
|
wenzelm@26782
|
447 |
already adds the new simproc to the subsequent context.
|
wenzelm@26782
|
448 |
|
wenzelm@26782
|
449 |
\end{descr}
|
wenzelm@26782
|
450 |
*}
|
wenzelm@26782
|
451 |
|
wenzelm@26782
|
452 |
|
wenzelm@27040
|
453 |
subsection {* Forward simplification *}
|
wenzelm@26782
|
454 |
|
wenzelm@26782
|
455 |
text {*
|
wenzelm@26782
|
456 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
457 |
@{attribute_def simplified} & : & \isaratt \\
|
wenzelm@26782
|
458 |
\end{matharray}
|
wenzelm@26782
|
459 |
|
wenzelm@26782
|
460 |
\begin{rail}
|
wenzelm@26782
|
461 |
'simplified' opt? thmrefs?
|
wenzelm@26782
|
462 |
;
|
wenzelm@26782
|
463 |
|
wenzelm@26789
|
464 |
opt: '(' ('no\_asm' | 'no\_asm\_simp' | 'no\_asm\_use') ')'
|
wenzelm@26782
|
465 |
;
|
wenzelm@26782
|
466 |
\end{rail}
|
wenzelm@26782
|
467 |
|
wenzelm@26782
|
468 |
\begin{descr}
|
wenzelm@26782
|
469 |
|
wenzelm@26782
|
470 |
\item [@{attribute simplified}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}]
|
wenzelm@26782
|
471 |
causes a theorem to be simplified, either by exactly the specified
|
wenzelm@26782
|
472 |
rules @{text "a\<^sub>1, \<dots>, a\<^sub>n"}, or the implicit Simplifier
|
wenzelm@26782
|
473 |
context if no arguments are given. The result is fully simplified
|
wenzelm@26782
|
474 |
by default, including assumptions and conclusion; the options @{text
|
wenzelm@26782
|
475 |
no_asm} etc.\ tune the Simplifier in the same way as the for the
|
wenzelm@26782
|
476 |
@{text simp} method.
|
wenzelm@26782
|
477 |
|
wenzelm@26782
|
478 |
Note that forward simplification restricts the simplifier to its
|
wenzelm@26782
|
479 |
most basic operation of term rewriting; solver and looper tactics
|
wenzelm@26782
|
480 |
\cite{isabelle-ref} are \emph{not} involved here. The @{text
|
wenzelm@26782
|
481 |
simplified} attribute should be only rarely required under normal
|
wenzelm@26782
|
482 |
circumstances.
|
wenzelm@26782
|
483 |
|
wenzelm@26782
|
484 |
\end{descr}
|
wenzelm@26782
|
485 |
*}
|
wenzelm@26782
|
486 |
|
wenzelm@26782
|
487 |
|
wenzelm@27040
|
488 |
subsection {* Low-level equational reasoning *}
|
wenzelm@26782
|
489 |
|
wenzelm@26782
|
490 |
text {*
|
wenzelm@26782
|
491 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
492 |
@{method_def subst}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
493 |
@{method_def hypsubst}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
494 |
@{method_def split}@{text "\<^sup>*"} & : & \isarmeth \\
|
wenzelm@26782
|
495 |
\end{matharray}
|
wenzelm@26782
|
496 |
|
wenzelm@26782
|
497 |
\begin{rail}
|
wenzelm@26782
|
498 |
'subst' ('(' 'asm' ')')? ('(' (nat+) ')')? thmref
|
wenzelm@26782
|
499 |
;
|
wenzelm@26782
|
500 |
'split' ('(' 'asm' ')')? thmrefs
|
wenzelm@26782
|
501 |
;
|
wenzelm@26782
|
502 |
\end{rail}
|
wenzelm@26782
|
503 |
|
wenzelm@26782
|
504 |
These methods provide low-level facilities for equational reasoning
|
wenzelm@26782
|
505 |
that are intended for specialized applications only. Normally,
|
wenzelm@26782
|
506 |
single step calculations would be performed in a structured text
|
wenzelm@26782
|
507 |
(see also \secref{sec:calculation}), while the Simplifier methods
|
wenzelm@26782
|
508 |
provide the canonical way for automated normalization (see
|
wenzelm@26782
|
509 |
\secref{sec:simplifier}).
|
wenzelm@26782
|
510 |
|
wenzelm@26782
|
511 |
\begin{descr}
|
wenzelm@26782
|
512 |
|
wenzelm@26782
|
513 |
\item [@{method subst}~@{text eq}] performs a single substitution
|
wenzelm@26782
|
514 |
step using rule @{text eq}, which may be either a meta or object
|
wenzelm@26782
|
515 |
equality.
|
wenzelm@26782
|
516 |
|
wenzelm@26782
|
517 |
\item [@{method subst}~@{text "(asm) eq"}] substitutes in an
|
wenzelm@26782
|
518 |
assumption.
|
wenzelm@26782
|
519 |
|
wenzelm@26782
|
520 |
\item [@{method subst}~@{text "(i \<dots> j) eq"}] performs several
|
wenzelm@26782
|
521 |
substitutions in the conclusion. The numbers @{text i} to @{text j}
|
wenzelm@26782
|
522 |
indicate the positions to substitute at. Positions are ordered from
|
wenzelm@26782
|
523 |
the top of the term tree moving down from left to right. For
|
wenzelm@26782
|
524 |
example, in @{text "(a + b) + (c + d)"} there are three positions
|
wenzelm@26782
|
525 |
where commutativity of @{text "+"} is applicable: 1 refers to the
|
wenzelm@26782
|
526 |
whole term, 2 to @{text "a + b"} and 3 to @{text "c + d"}.
|
wenzelm@26782
|
527 |
|
wenzelm@26782
|
528 |
If the positions in the list @{text "(i \<dots> j)"} are non-overlapping
|
wenzelm@26782
|
529 |
(e.g.\ @{text "(2 3)"} in @{text "(a + b) + (c + d)"}) you may
|
wenzelm@26782
|
530 |
assume all substitutions are performed simultaneously. Otherwise
|
wenzelm@26782
|
531 |
the behaviour of @{text subst} is not specified.
|
wenzelm@26782
|
532 |
|
wenzelm@26782
|
533 |
\item [@{method subst}~@{text "(asm) (i \<dots> j) eq"}] performs the
|
wenzelm@26782
|
534 |
substitutions in the assumptions. Positions @{text "1 \<dots> i\<^sub>1"}
|
wenzelm@26782
|
535 |
refer to assumption 1, positions @{text "i\<^sub>1 + 1 \<dots> i\<^sub>2"}
|
wenzelm@26782
|
536 |
to assumption 2, and so on.
|
wenzelm@26782
|
537 |
|
wenzelm@26782
|
538 |
\item [@{method hypsubst}] performs substitution using some
|
wenzelm@26782
|
539 |
assumption; this only works for equations of the form @{text "x =
|
wenzelm@26782
|
540 |
t"} where @{text x} is a free or bound variable.
|
wenzelm@26782
|
541 |
|
wenzelm@26782
|
542 |
\item [@{method split}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}] performs
|
wenzelm@26782
|
543 |
single-step case splitting using the given rules. By default,
|
wenzelm@26782
|
544 |
splitting is performed in the conclusion of a goal; the @{text
|
wenzelm@26782
|
545 |
"(asm)"} option indicates to operate on assumptions instead.
|
wenzelm@26782
|
546 |
|
wenzelm@26782
|
547 |
Note that the @{method simp} method already involves repeated
|
wenzelm@26782
|
548 |
application of split rules as declared in the current context.
|
wenzelm@26782
|
549 |
|
wenzelm@26782
|
550 |
\end{descr}
|
wenzelm@26782
|
551 |
*}
|
wenzelm@26782
|
552 |
|
wenzelm@26782
|
553 |
|
wenzelm@27040
|
554 |
section {* The Classical Reasoner \label{sec:classical} *}
|
wenzelm@26782
|
555 |
|
wenzelm@27040
|
556 |
subsection {* Basic methods *}
|
wenzelm@26782
|
557 |
|
wenzelm@26782
|
558 |
text {*
|
wenzelm@26782
|
559 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
560 |
@{method_def rule} & : & \isarmeth \\
|
wenzelm@26782
|
561 |
@{method_def contradiction} & : & \isarmeth \\
|
wenzelm@26782
|
562 |
@{method_def intro} & : & \isarmeth \\
|
wenzelm@26782
|
563 |
@{method_def elim} & : & \isarmeth \\
|
wenzelm@26782
|
564 |
\end{matharray}
|
wenzelm@26782
|
565 |
|
wenzelm@26782
|
566 |
\begin{rail}
|
wenzelm@26782
|
567 |
('rule' | 'intro' | 'elim') thmrefs?
|
wenzelm@26782
|
568 |
;
|
wenzelm@26782
|
569 |
\end{rail}
|
wenzelm@26782
|
570 |
|
wenzelm@26782
|
571 |
\begin{descr}
|
wenzelm@26782
|
572 |
|
wenzelm@26782
|
573 |
\item [@{method rule}] as offered by the Classical Reasoner is a
|
wenzelm@26782
|
574 |
refinement over the primitive one (see \secref{sec:pure-meth-att}).
|
wenzelm@26782
|
575 |
Both versions essentially work the same, but the classical version
|
wenzelm@26782
|
576 |
observes the classical rule context in addition to that of
|
wenzelm@26782
|
577 |
Isabelle/Pure.
|
wenzelm@26782
|
578 |
|
wenzelm@26782
|
579 |
Common object logics (HOL, ZF, etc.) declare a rich collection of
|
wenzelm@26782
|
580 |
classical rules (even if these would qualify as intuitionistic
|
wenzelm@26782
|
581 |
ones), but only few declarations to the rule context of
|
wenzelm@26782
|
582 |
Isabelle/Pure (\secref{sec:pure-meth-att}).
|
wenzelm@26782
|
583 |
|
wenzelm@26782
|
584 |
\item [@{method contradiction}] solves some goal by contradiction,
|
wenzelm@26782
|
585 |
deriving any result from both @{text "\<not> A"} and @{text A}. Chained
|
wenzelm@26782
|
586 |
facts, which are guaranteed to participate, may appear in either
|
wenzelm@26782
|
587 |
order.
|
wenzelm@26782
|
588 |
|
wenzelm@26901
|
589 |
\item [@{method intro} and @{method elim}] repeatedly refine some
|
wenzelm@26901
|
590 |
goal by intro- or elim-resolution, after having inserted any chained
|
wenzelm@26901
|
591 |
facts. Exactly the rules given as arguments are taken into account;
|
wenzelm@26901
|
592 |
this allows fine-tuned decomposition of a proof problem, in contrast
|
wenzelm@26901
|
593 |
to common automated tools.
|
wenzelm@26782
|
594 |
|
wenzelm@26782
|
595 |
\end{descr}
|
wenzelm@26782
|
596 |
*}
|
wenzelm@26782
|
597 |
|
wenzelm@26782
|
598 |
|
wenzelm@27040
|
599 |
subsection {* Automated methods *}
|
wenzelm@26782
|
600 |
|
wenzelm@26782
|
601 |
text {*
|
wenzelm@26782
|
602 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
603 |
@{method_def blast} & : & \isarmeth \\
|
wenzelm@26782
|
604 |
@{method_def fast} & : & \isarmeth \\
|
wenzelm@26782
|
605 |
@{method_def slow} & : & \isarmeth \\
|
wenzelm@26782
|
606 |
@{method_def best} & : & \isarmeth \\
|
wenzelm@26782
|
607 |
@{method_def safe} & : & \isarmeth \\
|
wenzelm@26782
|
608 |
@{method_def clarify} & : & \isarmeth \\
|
wenzelm@26782
|
609 |
\end{matharray}
|
wenzelm@26782
|
610 |
|
wenzelm@26782
|
611 |
\indexouternonterm{clamod}
|
wenzelm@26782
|
612 |
\begin{rail}
|
wenzelm@26782
|
613 |
'blast' ('!' ?) nat? (clamod *)
|
wenzelm@26782
|
614 |
;
|
wenzelm@26782
|
615 |
('fast' | 'slow' | 'best' | 'safe' | 'clarify') ('!' ?) (clamod *)
|
wenzelm@26782
|
616 |
;
|
wenzelm@26782
|
617 |
|
wenzelm@26782
|
618 |
clamod: (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del') ':' thmrefs
|
wenzelm@26782
|
619 |
;
|
wenzelm@26782
|
620 |
\end{rail}
|
wenzelm@26782
|
621 |
|
wenzelm@26782
|
622 |
\begin{descr}
|
wenzelm@26782
|
623 |
|
wenzelm@26782
|
624 |
\item [@{method blast}] refers to the classical tableau prover (see
|
wenzelm@26782
|
625 |
@{ML blast_tac} in \cite[\S11]{isabelle-ref}). The optional
|
wenzelm@26782
|
626 |
argument specifies a user-supplied search bound (default 20).
|
wenzelm@26782
|
627 |
|
wenzelm@26782
|
628 |
\item [@{method fast}, @{method slow}, @{method best}, @{method
|
wenzelm@26782
|
629 |
safe}, and @{method clarify}] refer to the generic classical
|
wenzelm@26782
|
630 |
reasoner. See @{ML fast_tac}, @{ML slow_tac}, @{ML best_tac}, @{ML
|
wenzelm@26782
|
631 |
safe_tac}, and @{ML clarify_tac} in \cite[\S11]{isabelle-ref} for
|
wenzelm@26782
|
632 |
more information.
|
wenzelm@26782
|
633 |
|
wenzelm@26782
|
634 |
\end{descr}
|
wenzelm@26782
|
635 |
|
wenzelm@26782
|
636 |
Any of the above methods support additional modifiers of the context
|
wenzelm@26782
|
637 |
of classical rules. Their semantics is analogous to the attributes
|
wenzelm@26782
|
638 |
given before. Facts provided by forward chaining are inserted into
|
wenzelm@26782
|
639 |
the goal before commencing proof search. The ``@{text
|
wenzelm@26782
|
640 |
"!"}''~argument causes the full context of assumptions to be
|
wenzelm@26782
|
641 |
included as well.
|
wenzelm@26782
|
642 |
*}
|
wenzelm@26782
|
643 |
|
wenzelm@26782
|
644 |
|
wenzelm@27040
|
645 |
subsection {* Combined automated methods \label{sec:clasimp} *}
|
wenzelm@26782
|
646 |
|
wenzelm@26782
|
647 |
text {*
|
wenzelm@26782
|
648 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
649 |
@{method_def auto} & : & \isarmeth \\
|
wenzelm@26782
|
650 |
@{method_def force} & : & \isarmeth \\
|
wenzelm@26782
|
651 |
@{method_def clarsimp} & : & \isarmeth \\
|
wenzelm@26782
|
652 |
@{method_def fastsimp} & : & \isarmeth \\
|
wenzelm@26782
|
653 |
@{method_def slowsimp} & : & \isarmeth \\
|
wenzelm@26782
|
654 |
@{method_def bestsimp} & : & \isarmeth \\
|
wenzelm@26782
|
655 |
\end{matharray}
|
wenzelm@26782
|
656 |
|
wenzelm@26782
|
657 |
\indexouternonterm{clasimpmod}
|
wenzelm@26782
|
658 |
\begin{rail}
|
wenzelm@26782
|
659 |
'auto' '!'? (nat nat)? (clasimpmod *)
|
wenzelm@26782
|
660 |
;
|
wenzelm@26782
|
661 |
('force' | 'clarsimp' | 'fastsimp' | 'slowsimp' | 'bestsimp') '!'? (clasimpmod *)
|
wenzelm@26782
|
662 |
;
|
wenzelm@26782
|
663 |
|
wenzelm@26782
|
664 |
clasimpmod: ('simp' (() | 'add' | 'del' | 'only') |
|
wenzelm@26782
|
665 |
('cong' | 'split') (() | 'add' | 'del') |
|
wenzelm@26782
|
666 |
'iff' (((() | 'add') '?'?) | 'del') |
|
wenzelm@26782
|
667 |
(('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del')) ':' thmrefs
|
wenzelm@26782
|
668 |
\end{rail}
|
wenzelm@26782
|
669 |
|
wenzelm@26782
|
670 |
\begin{descr}
|
wenzelm@26782
|
671 |
|
wenzelm@26782
|
672 |
\item [@{method auto}, @{method force}, @{method clarsimp}, @{method
|
wenzelm@26782
|
673 |
fastsimp}, @{method slowsimp}, and @{method bestsimp}] provide
|
wenzelm@26782
|
674 |
access to Isabelle's combined simplification and classical reasoning
|
wenzelm@26782
|
675 |
tactics. These correspond to @{ML auto_tac}, @{ML force_tac}, @{ML
|
wenzelm@26782
|
676 |
clarsimp_tac}, and Classical Reasoner tactics with the Simplifier
|
wenzelm@26782
|
677 |
added as wrapper, see \cite[\S11]{isabelle-ref} for more
|
wenzelm@26782
|
678 |
information. The modifier arguments correspond to those given in
|
wenzelm@26782
|
679 |
\secref{sec:simplifier} and \secref{sec:classical}. Just note that
|
wenzelm@26782
|
680 |
the ones related to the Simplifier are prefixed by \railtterm{simp}
|
wenzelm@26782
|
681 |
here.
|
wenzelm@26782
|
682 |
|
wenzelm@26782
|
683 |
Facts provided by forward chaining are inserted into the goal before
|
wenzelm@26782
|
684 |
doing the search. The ``@{text "!"}'' argument causes the full
|
wenzelm@26782
|
685 |
context of assumptions to be included as well.
|
wenzelm@26782
|
686 |
|
wenzelm@26782
|
687 |
\end{descr}
|
wenzelm@26782
|
688 |
*}
|
wenzelm@26782
|
689 |
|
wenzelm@26782
|
690 |
|
wenzelm@27040
|
691 |
subsection {* Declaring rules *}
|
wenzelm@26782
|
692 |
|
wenzelm@26782
|
693 |
text {*
|
wenzelm@26782
|
694 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
695 |
@{command_def "print_claset"}@{text "\<^sup>*"} & : & \isarkeep{theory~|~proof} \\
|
wenzelm@26782
|
696 |
@{attribute_def intro} & : & \isaratt \\
|
wenzelm@26782
|
697 |
@{attribute_def elim} & : & \isaratt \\
|
wenzelm@26782
|
698 |
@{attribute_def dest} & : & \isaratt \\
|
wenzelm@26782
|
699 |
@{attribute_def rule} & : & \isaratt \\
|
wenzelm@26782
|
700 |
@{attribute_def iff} & : & \isaratt \\
|
wenzelm@26782
|
701 |
\end{matharray}
|
wenzelm@26782
|
702 |
|
wenzelm@26782
|
703 |
\begin{rail}
|
wenzelm@26782
|
704 |
('intro' | 'elim' | 'dest') ('!' | () | '?') nat?
|
wenzelm@26782
|
705 |
;
|
wenzelm@26782
|
706 |
'rule' 'del'
|
wenzelm@26782
|
707 |
;
|
wenzelm@26782
|
708 |
'iff' (((() | 'add') '?'?) | 'del')
|
wenzelm@26782
|
709 |
;
|
wenzelm@26782
|
710 |
\end{rail}
|
wenzelm@26782
|
711 |
|
wenzelm@26782
|
712 |
\begin{descr}
|
wenzelm@26782
|
713 |
|
wenzelm@26782
|
714 |
\item [@{command "print_claset"}] prints the collection of rules
|
wenzelm@26782
|
715 |
declared to the Classical Reasoner, which is also known as
|
wenzelm@26782
|
716 |
``claset'' internally \cite{isabelle-ref}.
|
wenzelm@26782
|
717 |
|
wenzelm@26782
|
718 |
\item [@{attribute intro}, @{attribute elim}, and @{attribute dest}]
|
wenzelm@26782
|
719 |
declare introduction, elimination, and destruction rules,
|
wenzelm@26782
|
720 |
respectively. By default, rules are considered as \emph{unsafe}
|
wenzelm@26782
|
721 |
(i.e.\ not applied blindly without backtracking), while ``@{text
|
wenzelm@26782
|
722 |
"!"}'' classifies as \emph{safe}. Rule declarations marked by
|
wenzelm@26782
|
723 |
``@{text "?"}'' coincide with those of Isabelle/Pure, cf.\
|
wenzelm@26782
|
724 |
\secref{sec:pure-meth-att} (i.e.\ are only applied in single steps
|
wenzelm@26782
|
725 |
of the @{method rule} method). The optional natural number
|
wenzelm@26782
|
726 |
specifies an explicit weight argument, which is ignored by automated
|
wenzelm@26782
|
727 |
tools, but determines the search order of single rule steps.
|
wenzelm@26782
|
728 |
|
wenzelm@26782
|
729 |
\item [@{attribute rule}~@{text del}] deletes introduction,
|
wenzelm@26782
|
730 |
elimination, or destruction rules from the context.
|
wenzelm@26782
|
731 |
|
wenzelm@26782
|
732 |
\item [@{attribute iff}] declares logical equivalences to the
|
wenzelm@26782
|
733 |
Simplifier and the Classical reasoner at the same time.
|
wenzelm@26782
|
734 |
Non-conditional rules result in a ``safe'' introduction and
|
wenzelm@26782
|
735 |
elimination pair; conditional ones are considered ``unsafe''. Rules
|
wenzelm@26782
|
736 |
with negative conclusion are automatically inverted (using @{text
|
wenzelm@26789
|
737 |
"\<not>"}-elimination internally).
|
wenzelm@26782
|
738 |
|
wenzelm@26782
|
739 |
The ``@{text "?"}'' version of @{attribute iff} declares rules to
|
wenzelm@26782
|
740 |
the Isabelle/Pure context only, and omits the Simplifier
|
wenzelm@26782
|
741 |
declaration.
|
wenzelm@26782
|
742 |
|
wenzelm@26782
|
743 |
\end{descr}
|
wenzelm@26782
|
744 |
*}
|
wenzelm@26782
|
745 |
|
wenzelm@26782
|
746 |
|
wenzelm@27040
|
747 |
subsection {* Classical operations *}
|
wenzelm@26782
|
748 |
|
wenzelm@26782
|
749 |
text {*
|
wenzelm@26782
|
750 |
\begin{matharray}{rcl}
|
wenzelm@26782
|
751 |
@{attribute_def swapped} & : & \isaratt \\
|
wenzelm@26782
|
752 |
\end{matharray}
|
wenzelm@26782
|
753 |
|
wenzelm@26782
|
754 |
\begin{descr}
|
wenzelm@26782
|
755 |
|
wenzelm@26782
|
756 |
\item [@{attribute swapped}] turns an introduction rule into an
|
wenzelm@26782
|
757 |
elimination, by resolving with the classical swap principle @{text
|
wenzelm@26782
|
758 |
"(\<not> B \<Longrightarrow> A) \<Longrightarrow> (\<not> A \<Longrightarrow> B)"}.
|
wenzelm@26782
|
759 |
|
wenzelm@26782
|
760 |
\end{descr}
|
wenzelm@26782
|
761 |
*}
|
wenzelm@26782
|
762 |
|
wenzelm@26782
|
763 |
|
wenzelm@26790
|
764 |
section {* General logic setup \label{sec:object-logic} *}
|
wenzelm@26790
|
765 |
|
wenzelm@26790
|
766 |
text {*
|
wenzelm@26790
|
767 |
\begin{matharray}{rcl}
|
wenzelm@26790
|
768 |
@{command_def "judgment"} & : & \isartrans{theory}{theory} \\
|
wenzelm@26790
|
769 |
@{method_def atomize} & : & \isarmeth \\
|
wenzelm@26790
|
770 |
@{attribute_def atomize} & : & \isaratt \\
|
wenzelm@26790
|
771 |
@{attribute_def rule_format} & : & \isaratt \\
|
wenzelm@26790
|
772 |
@{attribute_def rulify} & : & \isaratt \\
|
wenzelm@26790
|
773 |
\end{matharray}
|
wenzelm@26790
|
774 |
|
wenzelm@26790
|
775 |
The very starting point for any Isabelle object-logic is a ``truth
|
wenzelm@26790
|
776 |
judgment'' that links object-level statements to the meta-logic
|
wenzelm@26790
|
777 |
(with its minimal language of @{text prop} that covers universal
|
wenzelm@26790
|
778 |
quantification @{text "\<And>"} and implication @{text "\<Longrightarrow>"}).
|
wenzelm@26790
|
779 |
|
wenzelm@26790
|
780 |
Common object-logics are sufficiently expressive to internalize rule
|
wenzelm@26790
|
781 |
statements over @{text "\<And>"} and @{text "\<Longrightarrow>"} within their own
|
wenzelm@26790
|
782 |
language. This is useful in certain situations where a rule needs
|
wenzelm@26790
|
783 |
to be viewed as an atomic statement from the meta-level perspective,
|
wenzelm@26790
|
784 |
e.g.\ @{text "\<And>x. x \<in> A \<Longrightarrow> P x"} versus @{text "\<forall>x \<in> A. P x"}.
|
wenzelm@26790
|
785 |
|
wenzelm@26790
|
786 |
From the following language elements, only the @{method atomize}
|
wenzelm@26790
|
787 |
method and @{attribute rule_format} attribute are occasionally
|
wenzelm@26790
|
788 |
required by end-users, the rest is for those who need to setup their
|
wenzelm@26790
|
789 |
own object-logic. In the latter case existing formulations of
|
wenzelm@26790
|
790 |
Isabelle/FOL or Isabelle/HOL may be taken as realistic examples.
|
wenzelm@26790
|
791 |
|
wenzelm@26790
|
792 |
Generic tools may refer to the information provided by object-logic
|
wenzelm@26790
|
793 |
declarations internally.
|
wenzelm@26790
|
794 |
|
wenzelm@26790
|
795 |
\begin{rail}
|
wenzelm@26790
|
796 |
'judgment' constdecl
|
wenzelm@26790
|
797 |
;
|
wenzelm@26790
|
798 |
'atomize' ('(' 'full' ')')?
|
wenzelm@26790
|
799 |
;
|
wenzelm@26790
|
800 |
'rule\_format' ('(' 'noasm' ')')?
|
wenzelm@26790
|
801 |
;
|
wenzelm@26790
|
802 |
\end{rail}
|
wenzelm@26790
|
803 |
|
wenzelm@26790
|
804 |
\begin{descr}
|
wenzelm@26790
|
805 |
|
wenzelm@26790
|
806 |
\item [@{command "judgment"}~@{text "c :: \<sigma> (mx)"}] declares
|
wenzelm@26790
|
807 |
constant @{text c} as the truth judgment of the current
|
wenzelm@26790
|
808 |
object-logic. Its type @{text \<sigma>} should specify a coercion of the
|
wenzelm@26790
|
809 |
category of object-level propositions to @{text prop} of the Pure
|
wenzelm@26790
|
810 |
meta-logic; the mixfix annotation @{text "(mx)"} would typically
|
wenzelm@26790
|
811 |
just link the object language (internally of syntactic category
|
wenzelm@26790
|
812 |
@{text logic}) with that of @{text prop}. Only one @{command
|
wenzelm@26790
|
813 |
"judgment"} declaration may be given in any theory development.
|
wenzelm@26790
|
814 |
|
wenzelm@26790
|
815 |
\item [@{method atomize} (as a method)] rewrites any non-atomic
|
wenzelm@26790
|
816 |
premises of a sub-goal, using the meta-level equations declared via
|
wenzelm@26790
|
817 |
@{attribute atomize} (as an attribute) beforehand. As a result,
|
wenzelm@26790
|
818 |
heavily nested goals become amenable to fundamental operations such
|
wenzelm@26790
|
819 |
as resolution (cf.\ the @{method rule} method). Giving the ``@{text
|
wenzelm@26790
|
820 |
"(full)"}'' option here means to turn the whole subgoal into an
|
wenzelm@26790
|
821 |
object-statement (if possible), including the outermost parameters
|
wenzelm@26790
|
822 |
and assumptions as well.
|
wenzelm@26790
|
823 |
|
wenzelm@26790
|
824 |
A typical collection of @{attribute atomize} rules for a particular
|
wenzelm@26790
|
825 |
object-logic would provide an internalization for each of the
|
wenzelm@26790
|
826 |
connectives of @{text "\<And>"}, @{text "\<Longrightarrow>"}, and @{text "\<equiv>"}.
|
wenzelm@26790
|
827 |
Meta-level conjunction should be covered as well (this is
|
wenzelm@26790
|
828 |
particularly important for locales, see \secref{sec:locale}).
|
wenzelm@26790
|
829 |
|
wenzelm@26790
|
830 |
\item [@{attribute rule_format}] rewrites a theorem by the
|
wenzelm@26790
|
831 |
equalities declared as @{attribute rulify} rules in the current
|
wenzelm@26790
|
832 |
object-logic. By default, the result is fully normalized, including
|
wenzelm@26790
|
833 |
assumptions and conclusions at any depth. The @{text "(no_asm)"}
|
wenzelm@26790
|
834 |
option restricts the transformation to the conclusion of a rule.
|
wenzelm@26790
|
835 |
|
wenzelm@26790
|
836 |
In common object-logics (HOL, FOL, ZF), the effect of @{attribute
|
wenzelm@26790
|
837 |
rule_format} is to replace (bounded) universal quantification
|
wenzelm@26790
|
838 |
(@{text "\<forall>"}) and implication (@{text "\<longrightarrow>"}) by the corresponding
|
wenzelm@26790
|
839 |
rule statements over @{text "\<And>"} and @{text "\<Longrightarrow>"}.
|
wenzelm@26790
|
840 |
|
wenzelm@26790
|
841 |
\end{descr}
|
wenzelm@26790
|
842 |
*}
|
wenzelm@26790
|
843 |
|
wenzelm@26782
|
844 |
end
|