27 into the goal. Note that command $\PROOFNAME$ without any method actually |
27 into the goal. Note that command $\PROOFNAME$ without any method actually |
28 performs a single reduction step using the $rule$ method (see below); thus a |
28 performs a single reduction step using the $rule$ method (see below); thus a |
29 plain \emph{do-nothing} proof step would be $\PROOF{-}$ rather than |
29 plain \emph{do-nothing} proof step would be $\PROOF{-}$ rather than |
30 $\PROOFNAME$ alone. |
30 $\PROOFNAME$ alone. |
31 \item [$assumption$] solves some goal by assumption. Any facts given are |
31 \item [$assumption$] solves some goal by assumption. Any facts given are |
32 guaranteed to participate in the refinement. |
32 guaranteed to participate in the refinement. Note that ``$\DOT$'' (dot) |
|
33 abbreviates $\BY{assumption}$. |
33 \item [$rule~thms$] applies some rule given as argument in backward manner; |
34 \item [$rule~thms$] applies some rule given as argument in backward manner; |
34 facts are used to reduce the rule before applying it to the goal. Thus |
35 facts are used to reduce the rule before applying it to the goal. Thus |
35 $rule$ without facts is plain \emph{introduction}, while with facts it |
36 $rule$ without facts is plain \emph{introduction}, while with facts it |
36 becomes an \emph{elimination}. |
37 becomes a (generalized) \emph{elimination}. |
37 |
38 |
38 Note that the classical reasoner introduces another version of $rule$ that |
39 Note that the classical reasoner introduces another version of $rule$ that |
39 is able to pick appropriate rules automatically, whenever explicit $thms$ |
40 is able to pick appropriate rules automatically, whenever explicit $thms$ |
40 are omitted (see \S\ref{sec:classical-basic}); that method is the default |
41 are omitted (see \S\ref{sec:classical-basic}); that method is the default |
41 one for initial proof steps, such as $\PROOFNAME$ and ``$\DDOT$'' (two |
42 for $\PROOFNAME$ steps. Note that ``$\DDOT$'' (double-dot) abbreviates |
42 dots). |
43 $\BY{default}$. |
43 \item [$erule~thms$] is similar to $rule$, but applies rules by |
44 \item [$erule~thms$] is similar to $rule$, but applies rules by |
44 elim-resolution. This is an improper method, mainly for experimentation and |
45 elim-resolution. This is an improper method, mainly for experimentation and |
45 porting of old scripts. Actual elimination proofs are usually done with |
46 porting of old scripts. Actual elimination proofs are usually done with |
46 $rule$ (single step, involving facts) or $elim$ (multiple steps, see |
47 $rule$ (single step, involving facts) or $elim$ (repeated steps, see |
47 \S\ref{sec:classical-basic}). |
48 \S\ref{sec:classical-basic}). |
48 \item [$unfold~thms$ and $fold~thms$] expand and fold back again the given |
49 \item [$unfold~thms$ and $fold~thms$] expand and fold back again the given |
49 meta-level definitions throughout all goals; any facts provided are |
50 meta-level definitions throughout all goals; any facts provided are |
50 \emph{ignored}. |
51 \emph{ignored}. |
51 \item [$succeed$] yields a single (unchanged) result; it is the identify of |
52 \item [$succeed$] yields a single (unchanged) result; it is the identify of |
52 the ``\texttt{,}'' method combinator. |
53 the ``\texttt{,}'' method combinator (cf.\ \S\ref{sec:syn-meth}). |
53 \item [$fail$] yields an empty result sequence; it is the identify of the |
54 \item [$fail$] yields an empty result sequence; it is the identify of the |
54 ``\texttt{|}'' method combinator. |
55 ``\texttt{|}'' method combinator (cf.\ \S\ref{sec:syn-meth}). |
55 \end{descr} |
56 \end{descr} |
56 |
57 |
57 |
58 |
58 \section{Miscellaneous attributes} |
59 \section{Miscellaneous attributes} |
59 |
60 |
89 inst: underscore | term |
90 inst: underscore | term |
90 ; |
91 ; |
91 \end{rail} |
92 \end{rail} |
92 |
93 |
93 \begin{descr} |
94 \begin{descr} |
94 \item [$tag~tags$ and $untag~tags$] add and remove $tags$ to the theorem, |
95 \item [$tag~tags$ and $untag~tags$] add and remove $tags$ of the theorem, |
95 respectively. Tags may be any list of strings that serve as comment for |
96 respectively. Tags may be any list of strings that serve as comment for |
96 some tools (e.g.\ $\LEMMANAME$ causes tag ``$lemma$'' to be added to the |
97 some tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the |
97 result). |
98 result). |
98 \item [$OF~thms$, $RS~n~thm$, and $COMP~n~thm$] compose rules. $OF$ applies |
99 \item [$OF~thms$, $RS~n~thm$, and $COMP~n~thm$] compose rules. $OF$ applies |
99 $thms$ in parallel (cf.\ \texttt{MRS} in \cite[\S5]{isabelle-ref}, but note |
100 $thms$ in parallel (cf.\ \texttt{MRS} in \cite[\S5]{isabelle-ref}, but note |
100 the reversed order). Note that premises may be skipped by including $\_$ |
101 the reversed order). Note that premises may be skipped by including $\_$ |
101 (underscore) as argument. |
102 (underscore) as argument. |
102 |
103 |
103 $RS$ resolves with the $n$-th premise of $thm$; $COMP$ is a version of $RS$ |
104 $RS$ resolves with the $n$-th premise of $thm$; $COMP$ is a version of $RS$ |
104 that does not include the automatic lifting process that is normally |
105 that does not include the automatic lifting process that is normally |
105 intended (see also \texttt{RS} and \texttt{COMP} in |
106 intended (cf.\ \texttt{RS} and \texttt{COMP} in \cite[\S5]{isabelle-ref}). |
106 \cite[\S5]{isabelle-ref}). |
|
107 |
107 |
108 \item [$of~\vec t$ and $where~\vec x = \vec t$] perform positional and named |
108 \item [$of~\vec t$ and $where~\vec x = \vec t$] perform positional and named |
109 instantiation, respectively. The terms given in $of$ are substituted for |
109 instantiation, respectively. The terms given in $of$ are substituted for |
110 any schematic variables occurring in a theorem from left to right; |
110 any schematic variables occurring in a theorem from left to right; |
111 ``\texttt{_}'' (underscore) indicates to skip a position. |
111 ``\texttt{_}'' (underscore) indicates to skip a position. |
112 |
112 |
113 \item [$standard$] puts a theorem into the standard form of object-rules, just |
113 \item [$standard$] puts a theorem into the standard form of object-rules, just |
114 as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}). |
114 as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}). |
115 |
115 |
116 \item [$elimify$] turns an destruction rule into an elimination. |
116 \item [$elimify$] turns an destruction rule into an elimination, just as the |
|
117 ML function \texttt{make\_elim} (see \cite{isabelle-ref}). |
117 |
118 |
118 \item [$export$] lifts a local result out of the current proof context, |
119 \item [$export$] lifts a local result out of the current proof context, |
119 generalizing all fixed variables and discharging all assumptions. Note that |
120 generalizing all fixed variables and discharging all assumptions. Note that |
120 (partial) export is usually done automatically behind the scenes. This |
121 (partial) export is usually done automatically behind the scenes. This |
121 attribute is mainly for experimentation. |
122 attribute is mainly for experimentation. |
137 \end{matharray} |
138 \end{matharray} |
138 |
139 |
139 Calculational proof is forward reasoning with implicit application of |
140 Calculational proof is forward reasoning with implicit application of |
140 transitivity rules (such those of $=$, $\le$, $<$). Isabelle/Isar maintains |
141 transitivity rules (such those of $=$, $\le$, $<$). Isabelle/Isar maintains |
141 an auxiliary register $calculation$\indexisarthm{calculation} for accumulating |
142 an auxiliary register $calculation$\indexisarthm{calculation} for accumulating |
142 results obtained by transitivity obtained together with the current result. |
143 results obtained by transitivity composed with the current result. Command |
143 Command $\ALSO$ updates $calculation$ from the most recent result, while |
144 $\ALSO$ updates $calculation$ involving $this$, while $\FINALLY$ exhibits the |
144 $\FINALLY$ exhibits the final result by forward chaining towards the next goal |
145 final $calculation$ by forward chaining towards the next goal statement. Both |
145 statement. Both commands require valid current facts, i.e.\ may occur only |
146 commands require valid current facts, i.e.\ may occur only after commands that |
146 after commands that produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or |
147 produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or some finished proof of |
147 some finished $\HAVENAME$ or $\SHOWNAME$. |
148 $\HAVENAME$, $\SHOWNAME$ etc. |
148 |
149 |
149 Also note that the automatic term abbreviation ``$\dots$'' has its canonical |
150 Also note that the automatic term abbreviation ``$\dots$'' has its canonical |
150 application with calculational proofs. It automatically refers to the |
151 application with calculational proofs. It automatically refers to the |
151 argument\footnote{The argument of a curried infix expression is its right-hand |
152 argument\footnote{The argument of a curried infix expression is its right-hand |
152 side.} of the preceding statement. |
153 side.} of the preceding statement. |
177 precedence). |
178 precedence). |
178 |
179 |
179 \item [$\FINALLY~(thms)$] maintaining $calculation$ in the same way as |
180 \item [$\FINALLY~(thms)$] maintaining $calculation$ in the same way as |
180 $\ALSO$, and concludes the current calculational thread. The final result |
181 $\ALSO$, and concludes the current calculational thread. The final result |
181 is exhibited as fact for forward chaining towards the next goal. Basically, |
182 is exhibited as fact for forward chaining towards the next goal. Basically, |
182 $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$. A typical proof |
183 $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$. Typical proof |
183 idiom is ``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$''. |
184 idioms are``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and |
|
185 ``$\FINALLY~\HAVE{}{\phi}~\DOT$''. |
184 |
186 |
185 \item [$trans$] maintains the set of transitivity rules of the theory or proof |
187 \item [$trans$] maintains the set of transitivity rules of the theory or proof |
186 context, by adding or deleting theorems (the default is to add). |
188 context, by adding or deleting theorems (the default is to add). |
187 \end{descr} |
189 \end{descr} |
188 |
190 |
189 See theory \texttt{HOL/Isar_examples/Group} for a simple application of |
191 %FIXME |
190 calculations for basic equational reasoning. |
192 %See theory \texttt{HOL/Isar_examples/Group} for a simple application of |
191 \texttt{HOL/Isar_examples/KnasterTarski} involves a few more advanced |
193 %calculations for basic equational reasoning. |
192 calculational steps in combination with natural deduction. |
194 %\texttt{HOL/Isar_examples/KnasterTarski} involves a few more advanced |
|
195 %calculational steps in combination with natural deduction. |
193 |
196 |
194 |
197 |
195 \section{Axiomatic Type Classes}\label{sec:axclass} |
198 \section{Axiomatic Type Classes}\label{sec:axclass} |
196 |
199 |
197 \indexisarcmd{axclass}\indexisarcmd{instance}\indexisarmeth{intro-classes} |
200 \indexisarcmd{axclass}\indexisarcmd{instance}\indexisarmeth{intro-classes} |
229 (\vec s)c$] setup up a goal stating the class relation or type arity. The |
232 (\vec s)c$] setup up a goal stating the class relation or type arity. The |
230 proof would usually proceed by the $intro_classes$ method, and then |
233 proof would usually proceed by the $intro_classes$ method, and then |
231 establish the characteristic theorems of the type classes involved. After |
234 establish the characteristic theorems of the type classes involved. After |
232 finishing the proof the theory will be augmented by a type signature |
235 finishing the proof the theory will be augmented by a type signature |
233 declaration corresponding to the resulting theorem. |
236 declaration corresponding to the resulting theorem. |
234 \item [$intro_classes$] iteratively expands the class introduction rules of |
237 \item [$intro_classes$] repeatedly expands the class introduction rules of |
235 this theory. |
238 this theory. |
236 \end{descr} |
239 \end{descr} |
237 |
240 |
238 See theory \texttt{HOL/Isar_examples/Group} for a simple example of using |
241 See theory \texttt{HOL/Isar_examples/Group} for a simple example of using |
239 axiomatic type classes, including instantiation proofs. |
242 axiomatic type classes, including instantiation proofs. |
241 |
244 |
242 \section{The Simplifier} |
245 \section{The Simplifier} |
243 |
246 |
244 \subsection{Simplification methods}\label{sec:simp} |
247 \subsection{Simplification methods}\label{sec:simp} |
245 |
248 |
246 \indexisarmeth{simp}\indexisarmeth{asm-simp} |
249 \indexisarmeth{simp} |
247 \begin{matharray}{rcl} |
250 \begin{matharray}{rcl} |
248 simp & : & \isarmeth \\ |
251 simp & : & \isarmeth \\ |
249 asm_simp & : & \isarmeth \\ |
252 \end{matharray} |
250 \end{matharray} |
253 |
251 |
254 \begin{rail} |
252 \railalias{asmsimp}{asm\_simp} |
255 'simp' (simpmod * ) |
253 \railterm{asmsimp} |
|
254 |
|
255 \begin{rail} |
|
256 ('simp' | asmsimp) (simpmod * ) |
|
257 ; |
256 ; |
258 |
257 |
259 simpmod: ('add' | 'del' | 'only' | 'other') ':' thmrefs |
258 simpmod: ('add' | 'del' | 'only' | 'other') ':' thmrefs |
260 ; |
259 ; |
261 \end{rail} |
260 \end{rail} |
262 |
261 |
263 \begin{descr} |
262 \begin{descr} |
264 \item [$simp$ and $asm_simp$] invoke Isabelle's simplifier, after modifying |
263 \item [$simp$] invokes Isabelle's simplifier, after modifying the context by |
265 the context by adding or deleting given rules. The \railtoken{only} |
264 adding or deleting rules as specified. The \railtoken{only} modifier first |
266 modifier first removes all other rewrite rules and congruences, and then is |
265 removes all other rewrite rules and congruences, and then is like |
267 like \railtoken{add}. In contrast, \railtoken{other} ignores its arguments; |
266 \railtoken{add}. In contrast, \railtoken{other} ignores its arguments; |
268 nevertheless there may be side-effects on the context via attributes. This |
267 nevertheless there may be side-effects on the context via attributes. This |
269 provides a back door for arbitrary context manipulation. |
268 provides a back door for arbitrary context manipulation. |
270 |
269 |
271 Both of these methods are based on \texttt{asm_full_simp_tac}, see |
270 The $simp$ method is based on \texttt{asm_full_simp_tac} (see also |
272 \cite[\S10]{isabelle-ref}; $simp$ removes any premises of the goal, before |
271 \cite[\S10]{isabelle-ref}), but is much better behaved in practice. Only |
|
272 the local premises of the actual goal are involved by default. Additional |
|
273 facts may be insert via forward-chaining (using $\THEN$, $\FROMNAME$ etc.). |
|
274 The full context of assumptions is |
|
275 |
|
276 ; $simp$ removes any premises of the goal, before |
273 inserting the goal facts; $asm_simp$ leaves the premises. Thus $asm_simp$ |
277 inserting the goal facts; $asm_simp$ leaves the premises. Thus $asm_simp$ |
274 may refer to premises that are not explicitly spelled out, potentially |
278 may refer to premises that are not explicitly spelled out, potentially |
275 obscuring the reasoning. The plain $simp$ method is more faithful in the |
279 obscuring the reasoning. The plain $simp$ method is more faithful in the |
276 sense that, apart from the rewrite rules of the current context, \emph{at |
280 sense that, apart from the rewrite rules of the current context, \emph{at |
277 most} the explicitly provided facts may participate in the simplification. |
281 most} the explicitly provided facts may participate in the simplification. |