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