9722
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
9924
|
3 |
\def\isabellecontext{types}%
|
11866
|
4 |
\isamarkupfalse%
|
9673
|
5 |
\isacommand{types}\ number\ \ \ \ \ \ \ {\isacharequal}\ nat\isanewline
|
|
6 |
\ \ \ \ \ \ gate\ \ \ \ \ \ \ \ \ {\isacharequal}\ {\isachardoublequote}bool\ {\isasymRightarrow}\ bool\ {\isasymRightarrow}\ bool{\isachardoublequote}\isanewline
|
11866
|
7 |
\ \ \ \ \ \ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}alist\ {\isacharequal}\ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b{\isacharparenright}list{\isachardoublequote}\isamarkupfalse%
|
|
8 |
%
|
8749
|
9 |
\begin{isamarkuptext}%
|
11428
|
10 |
\noindent
|
8749
|
11 |
Internally all synonyms are fully expanded. As a consequence Isabelle's
|
|
12 |
output never contains synonyms. Their main purpose is to improve the
|
8771
|
13 |
readability of theories. Synonyms can be used just like any other
|
11456
|
14 |
type. Here, we declare two constants of type \isa{gate}:%
|
8749
|
15 |
\end{isamarkuptext}%
|
11866
|
16 |
\isamarkuptrue%
|
9673
|
17 |
\isacommand{consts}\ nand\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
|
11866
|
18 |
\ \ \ \ \ \ \ xor\ \ {\isacharcolon}{\isacharcolon}\ gate\isamarkupfalse%
|
|
19 |
%
|
10878
|
20 |
\isamarkupsubsection{Constant Definitions%
|
10788
|
21 |
}
|
11866
|
22 |
\isamarkuptrue%
|
10788
|
23 |
%
|
8749
|
24 |
\begin{isamarkuptext}%
|
11428
|
25 |
\label{sec:ConstDefinitions}\indexbold{definitions}%
|
11456
|
26 |
The constants \isa{nand} and \isa{xor} above are non-recursive and can
|
|
27 |
be defined directly:%
|
8749
|
28 |
\end{isamarkuptext}%
|
11866
|
29 |
\isamarkuptrue%
|
9673
|
30 |
\isacommand{defs}\ nand{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequote}nand\ A\ B\ {\isasymequiv}\ {\isasymnot}{\isacharparenleft}A\ {\isasymand}\ B{\isacharparenright}{\isachardoublequote}\isanewline
|
11866
|
31 |
\ \ \ \ \ xor{\isacharunderscore}def{\isacharcolon}\ \ {\isachardoublequote}xor\ A\ B\ \ {\isasymequiv}\ A\ {\isasymand}\ {\isasymnot}B\ {\isasymor}\ {\isasymnot}A\ {\isasymand}\ B{\isachardoublequote}\isamarkupfalse%
|
|
32 |
%
|
8749
|
33 |
\begin{isamarkuptext}%
|
|
34 |
\noindent%
|
11456
|
35 |
Here \commdx{defs} is a keyword and
|
10788
|
36 |
\isa{nand{\isacharunderscore}def} and \isa{xor{\isacharunderscore}def} are user-supplied names.
|
8749
|
37 |
The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality
|
9541
|
38 |
that must be used in constant definitions.
|
11457
|
39 |
Pattern-matching is not allowed: each definition must be of
|
|
40 |
the form $f\,x@1\,\dots\,x@n~\isasymequiv~t$.
|
|
41 |
Section~\ref{sec:Simp-with-Defs} explains how definitions are used
|
|
42 |
in proofs.
|
|
43 |
|
11456
|
44 |
A \commdx{constdefs} command combines the effects of \isacommand{consts} and
|
|
45 |
\isacommand{defs}. For instance, we can introduce \isa{nand} and \isa{xor} by a
|
|
46 |
single command:%
|
8749
|
47 |
\end{isamarkuptext}%
|
11866
|
48 |
\isamarkuptrue%
|
9673
|
49 |
\isacommand{constdefs}\ nor\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
|
|
50 |
\ \ \ \ \ \ \ \ \ {\isachardoublequote}nor\ A\ B\ {\isasymequiv}\ {\isasymnot}{\isacharparenleft}A\ {\isasymor}\ B{\isacharparenright}{\isachardoublequote}\isanewline
|
10788
|
51 |
\ \ \ \ \ \ \ \ \ \ xor{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
|
11866
|
52 |
\ \ \ \ \ \ \ \ \ {\isachardoublequote}xor{\isadigit{2}}\ A\ B\ {\isasymequiv}\ {\isacharparenleft}A\ {\isasymor}\ B{\isacharparenright}\ {\isasymand}\ {\isacharparenleft}{\isasymnot}A\ {\isasymor}\ {\isasymnot}B{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
|
|
53 |
%
|
8749
|
54 |
\begin{isamarkuptext}%
|
11428
|
55 |
\noindent
|
|
56 |
The default name of each definition is $f$\isa{{\isacharunderscore}def}, where
|
8749
|
57 |
$f$ is the name of the defined constant.%
|
|
58 |
\end{isamarkuptext}%
|
11866
|
59 |
\isamarkuptrue%
|
|
60 |
\isamarkupfalse%
|
9722
|
61 |
\end{isabellebody}%
|
9145
|
62 |
%%% Local Variables:
|
|
63 |
%%% mode: latex
|
|
64 |
%%% TeX-master: "root"
|
|
65 |
%%% End:
|