1 \begin{isabelle}% |
1 \begin{isabelle}% |
2 \isacommand{types}~number~~~~~~~=~nat\isanewline |
2 \isacommand{types}\ number\ \ \ \ \ \ \ =\ nat\isanewline |
3 ~~~~~~gate~~~~~~~~~=~{"}bool~{\isasymRightarrow}~bool~{\isasymRightarrow}~bool{"}\isanewline |
3 \ \ \ \ \ \ gate\ \ \ \ \ \ \ \ \ =\ {"}bool\ {\isasymRightarrow}\ bool\ {\isasymRightarrow}\ bool{"}\isanewline |
4 ~~~~~~('a,'b)alist~=~{"}('a~*~'b)list{"}% |
4 \ \ \ \ \ \ ('a,'b)alist\ =\ {"}('a\ *\ 'b)list{"}% |
5 \begin{isamarkuptext}% |
5 \begin{isamarkuptext}% |
6 \noindent\indexbold{*types}% |
6 \noindent\indexbold{*types}% |
7 Internally all synonyms are fully expanded. As a consequence Isabelle's |
7 Internally all synonyms are fully expanded. As a consequence Isabelle's |
8 output never contains synonyms. Their main purpose is to improve the |
8 output never contains synonyms. Their main purpose is to improve the |
9 readability of theories. Synonyms can be used just like any other |
9 readability of theories. Synonyms can be used just like any other |
10 type:% |
10 type:% |
11 \end{isamarkuptext}% |
11 \end{isamarkuptext}% |
12 \isacommand{consts}~nand~::~gate\isanewline |
12 \isacommand{consts}\ nand\ ::\ gate\isanewline |
13 ~~~~~~~exor~::~gate% |
13 \ \ \ \ \ \ \ exor\ ::\ gate% |
14 \begin{isamarkuptext}% |
14 \begin{isamarkuptext}% |
15 \subsection{Constant definitions} |
15 \subsection{Constant definitions} |
16 \label{sec:ConstDefinitions} |
16 \label{sec:ConstDefinitions} |
17 \indexbold{definition} |
17 \indexbold{definition} |
18 |
18 |
19 The above constants \isa{nand} and \isa{exor} are non-recursive and can |
19 The above constants \isa{nand} and \isa{exor} are non-recursive and can |
20 therefore be defined directly by% |
20 therefore be defined directly by% |
21 \end{isamarkuptext}% |
21 \end{isamarkuptext}% |
22 \isacommand{defs}~nand\_def:~{"}nand~A~B~{\isasymequiv}~{\isasymnot}(A~{\isasymand}~B){"}\isanewline |
22 \isacommand{defs}\ nand\_def:\ {"}nand\ A\ B\ {\isasymequiv}\ {\isasymnot}(A\ {\isasymand}\ B){"}\isanewline |
23 ~~~~~exor\_def:~{"}exor~A~B~{\isasymequiv}~A~{\isasymand}~{\isasymnot}B~{\isasymor}~{\isasymnot}A~{\isasymand}~B{"}% |
23 \ \ \ \ \ exor\_def:\ {"}exor\ A\ B\ {\isasymequiv}\ A\ {\isasymand}\ {\isasymnot}B\ {\isasymor}\ {\isasymnot}A\ {\isasymand}\ B{"}% |
24 \begin{isamarkuptext}% |
24 \begin{isamarkuptext}% |
25 \noindent% |
25 \noindent% |
26 where \isacommand{defs}\indexbold{*defs} is a keyword and \isa{nand_def} and |
26 where \isacommand{defs}\indexbold{*defs} is a keyword and \isa{nand_def} and |
27 \isa{exor_def} are user-supplied names. |
27 \isa{exor_def} are user-supplied names. |
28 The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality |
28 The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality |
29 that should only be used in constant definitions. |
29 that must be used in constant definitions. |
30 Declarations and definitions can also be merged% |
30 Declarations and definitions can also be merged% |
31 \end{isamarkuptext}% |
31 \end{isamarkuptext}% |
32 \isacommand{constdefs}~nor~::~gate\isanewline |
32 \isacommand{constdefs}\ nor\ ::\ gate\isanewline |
33 ~~~~~~~~~{"}nor~A~B~{\isasymequiv}~{\isasymnot}(A~{\isasymor}~B){"}\isanewline |
33 \ \ \ \ \ \ \ \ \ {"}nor\ A\ B\ {\isasymequiv}\ {\isasymnot}(A\ {\isasymor}\ B){"}\isanewline |
34 ~~~~~~~~~~exor2~::~gate\isanewline |
34 \ \ \ \ \ \ \ \ \ \ exor2\ ::\ gate\isanewline |
35 ~~~~~~~~~{"}exor2~A~B~{\isasymequiv}~(A~{\isasymor}~B)~{\isasymand}~({\isasymnot}A~{\isasymor}~{\isasymnot}B){"}% |
35 \ \ \ \ \ \ \ \ \ {"}exor2\ A\ B\ {\isasymequiv}\ (A\ {\isasymor}\ B)\ {\isasymand}\ ({\isasymnot}A\ {\isasymor}\ {\isasymnot}B){"}% |
36 \begin{isamarkuptext}% |
36 \begin{isamarkuptext}% |
37 \noindent\indexbold{*constdefs}% |
37 \noindent\indexbold{*constdefs}% |
38 in which case the default name of each definition is \isa{$f$_def}, where |
38 in which case the default name of each definition is \isa{$f$_def}, where |
39 $f$ is the name of the defined constant.% |
39 $f$ is the name of the defined constant.% |
40 \end{isamarkuptext}% |
40 \end{isamarkuptext}% |