7046
|
1 |
|
7167
|
2 |
\chapter{Isabelle/HOL Tools and Packages}\label{ch:hol-tools}
|
7135
|
3 |
|
7990
|
4 |
\section{Miscellaneous attributes}
|
|
5 |
|
|
6 |
\indexisaratt{rulify}\indexisaratt{rulify-prems}
|
|
7 |
\begin{matharray}{rcl}
|
|
8 |
rulify & : & \isaratt \\
|
|
9 |
rulify_prems & : & \isaratt \\
|
|
10 |
\end{matharray}
|
|
11 |
|
|
12 |
\begin{descr}
|
|
13 |
|
|
14 |
\item [$rulify$] puts a theorem into object-rule form, replacing implication
|
|
15 |
and universal quantification of HOL by the corresponding meta-logical
|
|
16 |
connectives. This is the same operation as performed by the
|
|
17 |
\texttt{qed_spec_mp} ML function.
|
|
18 |
|
|
19 |
\item [$rulify_prems$] is similar to $rulify$, but acts on the premises of a
|
|
20 |
rule.
|
|
21 |
|
|
22 |
\end{descr}
|
|
23 |
|
|
24 |
|
7135
|
25 |
\section{Primitive types}
|
|
26 |
|
7141
|
27 |
\indexisarcmd{typedecl}\indexisarcmd{typedef}
|
|
28 |
\begin{matharray}{rcl}
|
|
29 |
\isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
|
|
30 |
\isarcmd{typedef} & : & \isartrans{theory}{proof(prove)} \\
|
|
31 |
\end{matharray}
|
|
32 |
|
|
33 |
\begin{rail}
|
|
34 |
'typedecl' typespec infix? comment?
|
|
35 |
;
|
|
36 |
'typedef' parname? typespec infix? \\ '=' term comment?
|
|
37 |
;
|
|
38 |
\end{rail}
|
|
39 |
|
7167
|
40 |
\begin{descr}
|
7141
|
41 |
\item [$\isarkeyword{typedecl}~(\vec\alpha)t$] is similar to the original
|
|
42 |
$\isarkeyword{typedecl}$ of Isabelle/Pure (see \S\ref{sec:types-pure}), but
|
|
43 |
also declares type arity $t :: (term, \dots, term) term$, making $t$ an
|
|
44 |
actual HOL type constructor.
|
|
45 |
\item [$\isarkeyword{typedef}~(\vec\alpha)t = A$] sets up a goal stating
|
|
46 |
non-emptiness of the set $A$. After finishing the proof, the theory will be
|
7175
|
47 |
augmented by a Gordon/HOL-style type definition. See \cite{isabelle-HOL}
|
7335
|
48 |
for more information. Note that user-level theories usually do not directly
|
|
49 |
refer to the HOL $\isarkeyword{typedef}$ primitive, but use more advanced
|
|
50 |
packages such as $\isarkeyword{record}$ (see \S\ref{sec:record}) and
|
7175
|
51 |
$\isarkeyword{datatype}$ (see \S\ref{sec:datatype}).
|
7167
|
52 |
\end{descr}
|
7141
|
53 |
|
|
54 |
|
|
55 |
\section{Records}\label{sec:record}
|
|
56 |
|
|
57 |
%FIXME record_split method
|
|
58 |
\indexisarcmd{record}
|
|
59 |
\begin{matharray}{rcl}
|
|
60 |
\isarcmd{record} & : & \isartrans{theory}{theory} \\
|
|
61 |
\end{matharray}
|
|
62 |
|
|
63 |
\begin{rail}
|
|
64 |
'record' typespec '=' (type '+')? (field +)
|
|
65 |
;
|
7135
|
66 |
|
7141
|
67 |
field: name '::' type comment?
|
|
68 |
;
|
|
69 |
\end{rail}
|
|
70 |
|
7167
|
71 |
\begin{descr}
|
7141
|
72 |
\item [$\isarkeyword{record}~(\vec\alpha)t = \tau + \vec c :: \vec\sigma$]
|
|
73 |
defines extensible record type $(\vec\alpha)t$, derived from the optional
|
|
74 |
parent record $\tau$ by adding new field components $\vec c :: \vec\sigma$.
|
7335
|
75 |
See \cite{isabelle-HOL,NaraschewskiW-TPHOLs98} for more information only
|
|
76 |
simply-typed extensible records.
|
7167
|
77 |
\end{descr}
|
7141
|
78 |
|
|
79 |
|
|
80 |
\section{Datatypes}\label{sec:datatype}
|
|
81 |
|
7167
|
82 |
\indexisarcmd{datatype}\indexisarcmd{rep-datatype}
|
7141
|
83 |
\begin{matharray}{rcl}
|
|
84 |
\isarcmd{datatype} & : & \isartrans{theory}{theory} \\
|
|
85 |
\isarcmd{rep_datatype} & : & \isartrans{theory}{theory} \\
|
|
86 |
\end{matharray}
|
|
87 |
|
|
88 |
\railalias{repdatatype}{rep\_datatype}
|
|
89 |
\railterm{repdatatype}
|
|
90 |
|
|
91 |
\begin{rail}
|
7175
|
92 |
'datatype' (parname? typespec infix? \\ '=' (constructor + '|') + 'and')
|
7141
|
93 |
;
|
|
94 |
repdatatype (name * ) \\ 'distinct' thmrefs 'inject' thmrefs 'induction' thmrefs
|
|
95 |
;
|
|
96 |
|
7175
|
97 |
constructor: name (type * ) mixfix? comment?
|
7141
|
98 |
;
|
|
99 |
\end{rail}
|
|
100 |
|
7167
|
101 |
\begin{descr}
|
7319
|
102 |
\item [$\isarkeyword{datatype}$] defines inductive datatypes in HOL.
|
|
103 |
\item [$\isarkeyword{rep_datatype}$] represents existing types as inductive
|
|
104 |
ones, generating the standard infrastructure of derived concepts (primitive
|
|
105 |
recursion etc.).
|
7167
|
106 |
\end{descr}
|
7141
|
107 |
|
7319
|
108 |
See \cite{isabelle-HOL} for more details on datatypes. Note that the theory
|
7335
|
109 |
syntax above has been slightly simplified over the old version, usually
|
|
110 |
requiring more quotes and less parentheses.
|
7319
|
111 |
|
7135
|
112 |
|
|
113 |
\section{Recursive functions}
|
|
114 |
|
7141
|
115 |
\indexisarcmd{primrec}\indexisarcmd{recdef}
|
|
116 |
\begin{matharray}{rcl}
|
|
117 |
\isarcmd{primrec} & : & \isartrans{theory}{theory} \\
|
|
118 |
\isarcmd{recdef} & : & \isartrans{theory}{theory} \\
|
|
119 |
%FIXME
|
|
120 |
% \isarcmd{defer_recdef} & : & \isartrans{theory}{theory} \\
|
|
121 |
\end{matharray}
|
|
122 |
|
|
123 |
\begin{rail}
|
|
124 |
'primrec' parname? (thmdecl? prop comment? + )
|
|
125 |
;
|
|
126 |
'recdef' name term (term comment? +) \\ ('congs' thmrefs)? ('simpset' name)?
|
|
127 |
;
|
|
128 |
\end{rail}
|
|
129 |
|
7167
|
130 |
\begin{descr}
|
7319
|
131 |
\item [$\isarkeyword{primrec}$] defines primitive recursive functions over
|
|
132 |
datatypes.
|
|
133 |
\item [$\isarkeyword{recdef}$] defines general well-founded recursive
|
|
134 |
functions (using the TFL package).
|
7167
|
135 |
\end{descr}
|
7141
|
136 |
|
7335
|
137 |
See \cite{isabelle-HOL} for more information on both mechanisms.
|
7319
|
138 |
|
7141
|
139 |
|
7135
|
140 |
\section{(Co)Inductive sets}
|
|
141 |
|
7167
|
142 |
\indexisarcmd{inductive}\indexisarcmd{coinductive}\indexisarcmd{inductive-cases}
|
7990
|
143 |
\indexisaratt{mono}
|
7141
|
144 |
\begin{matharray}{rcl}
|
|
145 |
\isarcmd{inductive} & : & \isartrans{theory}{theory} \\
|
|
146 |
\isarcmd{coinductive} & : & \isartrans{theory}{theory} \\
|
7990
|
147 |
mono & : & \isaratt \\
|
7141
|
148 |
\isarcmd{inductive_cases} & : & \isartrans{theory}{theory} \\
|
|
149 |
\end{matharray}
|
|
150 |
|
|
151 |
\railalias{condefs}{con\_defs}
|
|
152 |
\railalias{indcases}{inductive\_cases}
|
|
153 |
\railterm{condefs,indcases}
|
|
154 |
|
|
155 |
\begin{rail}
|
|
156 |
('inductive' | 'coinductive') (term comment? +) \\
|
|
157 |
'intrs' attributes? (thmdecl? prop comment? +) \\
|
|
158 |
'monos' thmrefs comment? \\ condefs thmrefs comment?
|
|
159 |
;
|
|
160 |
indcases thmdef? nameref ':' \\ (prop +) comment?
|
|
161 |
;
|
7990
|
162 |
'mono' (() | 'add' | 'del')
|
|
163 |
;
|
7141
|
164 |
\end{rail}
|
|
165 |
|
7167
|
166 |
\begin{descr}
|
7319
|
167 |
\item [$\isarkeyword{inductive}$ and $\isarkeyword{coinductive}$] define
|
|
168 |
(co)inductive sets from the given introduction rules.
|
7990
|
169 |
\item [$mono$] adds or deletes monotonicity rules from the theory or proof
|
|
170 |
context (the default is to add). These rule are involved in the automated
|
|
171 |
monotonicity proof of $\isarkeyword{inductive}$.
|
7319
|
172 |
\item [$\isarkeyword{inductive_cases}$] creates simplified instances of
|
|
173 |
elimination rules of (co)inductive sets.
|
7167
|
174 |
\end{descr}
|
7141
|
175 |
|
7319
|
176 |
See \cite{isabelle-HOL} for more information. Note that
|
7987
|
177 |
$\isarkeyword{inductive_cases}$ corresponds to the \texttt{mk_cases} ML
|
|
178 |
function.
|
7319
|
179 |
|
7141
|
180 |
|
|
181 |
\section{Proof by induction}
|
|
182 |
|
7319
|
183 |
\indexisarmeth{induct}
|
|
184 |
\begin{matharray}{rcl}
|
|
185 |
induct & : & \isarmeth \\
|
|
186 |
\end{matharray}
|
|
187 |
|
|
188 |
The $induct$ method provides a uniform interface to induction over datatypes,
|
7507
|
189 |
inductive sets, recursive functions etc. Basically, it is just an interface
|
7319
|
190 |
to the $rule$ method applied to appropriate instances of the corresponding
|
|
191 |
induction rules.
|
|
192 |
|
|
193 |
\begin{rail}
|
|
194 |
'induct' (inst * 'and') kind?
|
|
195 |
;
|
|
196 |
|
|
197 |
inst: term term?
|
|
198 |
;
|
7507
|
199 |
kind: ('type' | 'set' | 'function' | 'rule') ':' nameref
|
7319
|
200 |
;
|
|
201 |
\end{rail}
|
|
202 |
|
|
203 |
\begin{descr}
|
|
204 |
\item [$induct~insts~kind$] abbreviates method $rule~R$, where $R$ is the
|
7507
|
205 |
induction rule specified by $kind$ and instantiated by $insts$. The rule is
|
|
206 |
either that of some type, set, or recursive function (defined via TFL), or
|
|
207 |
given explicitly.
|
|
208 |
|
|
209 |
The instantiation basically consists of a list of $P$ $x$ (induction
|
|
210 |
predicate and variable) specifications, where $P$ is optional. If $kind$ is
|
7466
|
211 |
omitted, the default is to pick a datatype induction rule according to the
|
|
212 |
type of some induction variable, which may not be omitted that case.
|
7319
|
213 |
\end{descr}
|
7141
|
214 |
|
7046
|
215 |
|
7390
|
216 |
\section{Arithmetic}
|
|
217 |
|
|
218 |
\indexisarmeth{arith}
|
|
219 |
\begin{matharray}{rcl}
|
|
220 |
arith & : & \isarmeth \\
|
|
221 |
\end{matharray}
|
|
222 |
|
|
223 |
The $arith$ method decides linear arithmetic problems (on types $nat$, $int$,
|
|
224 |
$real$). Note that a simpler (but faster) version of arithmetic reasoning is
|
|
225 |
already performed by the Simplifier.
|
|
226 |
|
|
227 |
|
7046
|
228 |
%%% Local Variables:
|
|
229 |
%%% mode: latex
|
|
230 |
%%% TeX-master: "isar-ref"
|
|
231 |
%%% End:
|