doc-src/TutorialI/Misc/document/types.tex
changeset 11866 fbd097aec213
parent 11457 279da0358aa9
child 13758 ee898d32de21
equal deleted inserted replaced
11865:93d5408eb7d9 11866:fbd097aec213
     1 %
     1 %
     2 \begin{isabellebody}%
     2 \begin{isabellebody}%
     3 \def\isabellecontext{types}%
     3 \def\isabellecontext{types}%
       
     4 \isamarkupfalse%
     4 \isacommand{types}\ number\ \ \ \ \ \ \ {\isacharequal}\ nat\isanewline
     5 \isacommand{types}\ number\ \ \ \ \ \ \ {\isacharequal}\ nat\isanewline
     5 \ \ \ \ \ \ gate\ \ \ \ \ \ \ \ \ {\isacharequal}\ {\isachardoublequote}bool\ {\isasymRightarrow}\ bool\ {\isasymRightarrow}\ bool{\isachardoublequote}\isanewline
     6 \ \ \ \ \ \ gate\ \ \ \ \ \ \ \ \ {\isacharequal}\ {\isachardoublequote}bool\ {\isasymRightarrow}\ bool\ {\isasymRightarrow}\ bool{\isachardoublequote}\isanewline
     6 \ \ \ \ \ \ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}alist\ {\isacharequal}\ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b{\isacharparenright}list{\isachardoublequote}%
     7 \ \ \ \ \ \ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}alist\ {\isacharequal}\ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b{\isacharparenright}list{\isachardoublequote}\isamarkupfalse%
       
     8 %
     7 \begin{isamarkuptext}%
     9 \begin{isamarkuptext}%
     8 \noindent
    10 \noindent
     9 Internally all synonyms are fully expanded.  As a consequence Isabelle's
    11 Internally all synonyms are fully expanded.  As a consequence Isabelle's
    10 output never contains synonyms.  Their main purpose is to improve the
    12 output never contains synonyms.  Their main purpose is to improve the
    11 readability of theories.  Synonyms can be used just like any other
    13 readability of theories.  Synonyms can be used just like any other
    12 type.  Here, we declare two constants of type \isa{gate}:%
    14 type.  Here, we declare two constants of type \isa{gate}:%
    13 \end{isamarkuptext}%
    15 \end{isamarkuptext}%
       
    16 \isamarkuptrue%
    14 \isacommand{consts}\ nand\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
    17 \isacommand{consts}\ nand\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
    15 \ \ \ \ \ \ \ xor\ \ {\isacharcolon}{\isacharcolon}\ gate%
    18 \ \ \ \ \ \ \ xor\ \ {\isacharcolon}{\isacharcolon}\ gate\isamarkupfalse%
       
    19 %
    16 \isamarkupsubsection{Constant Definitions%
    20 \isamarkupsubsection{Constant Definitions%
    17 }
    21 }
       
    22 \isamarkuptrue%
    18 %
    23 %
    19 \begin{isamarkuptext}%
    24 \begin{isamarkuptext}%
    20 \label{sec:ConstDefinitions}\indexbold{definitions}%
    25 \label{sec:ConstDefinitions}\indexbold{definitions}%
    21 The constants \isa{nand} and \isa{xor} above are non-recursive and can 
    26 The constants \isa{nand} and \isa{xor} above are non-recursive and can 
    22 be defined directly:%
    27 be defined directly:%
    23 \end{isamarkuptext}%
    28 \end{isamarkuptext}%
       
    29 \isamarkuptrue%
    24 \isacommand{defs}\ nand{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequote}nand\ A\ B\ {\isasymequiv}\ {\isasymnot}{\isacharparenleft}A\ {\isasymand}\ B{\isacharparenright}{\isachardoublequote}\isanewline
    30 \isacommand{defs}\ nand{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequote}nand\ A\ B\ {\isasymequiv}\ {\isasymnot}{\isacharparenleft}A\ {\isasymand}\ B{\isacharparenright}{\isachardoublequote}\isanewline
    25 \ \ \ \ \ xor{\isacharunderscore}def{\isacharcolon}\ \ {\isachardoublequote}xor\ A\ B\ \ {\isasymequiv}\ A\ {\isasymand}\ {\isasymnot}B\ {\isasymor}\ {\isasymnot}A\ {\isasymand}\ B{\isachardoublequote}%
    31 \ \ \ \ \ xor{\isacharunderscore}def{\isacharcolon}\ \ {\isachardoublequote}xor\ A\ B\ \ {\isasymequiv}\ A\ {\isasymand}\ {\isasymnot}B\ {\isasymor}\ {\isasymnot}A\ {\isasymand}\ B{\isachardoublequote}\isamarkupfalse%
       
    32 %
    26 \begin{isamarkuptext}%
    33 \begin{isamarkuptext}%
    27 \noindent%
    34 \noindent%
    28 Here \commdx{defs} is a keyword and
    35 Here \commdx{defs} is a keyword and
    29 \isa{nand{\isacharunderscore}def} and \isa{xor{\isacharunderscore}def} are user-supplied names.
    36 \isa{nand{\isacharunderscore}def} and \isa{xor{\isacharunderscore}def} are user-supplied names.
    30 The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality
    37 The symbol \indexboldpos{\isasymequiv}{$IsaEq} is a special form of equality
    36 
    43 
    37 A \commdx{constdefs} command combines the effects of \isacommand{consts} and 
    44 A \commdx{constdefs} command combines the effects of \isacommand{consts} and 
    38 \isacommand{defs}.  For instance, we can introduce \isa{nand} and \isa{xor} by a 
    45 \isacommand{defs}.  For instance, we can introduce \isa{nand} and \isa{xor} by a 
    39 single command:%
    46 single command:%
    40 \end{isamarkuptext}%
    47 \end{isamarkuptext}%
       
    48 \isamarkuptrue%
    41 \isacommand{constdefs}\ nor\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
    49 \isacommand{constdefs}\ nor\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
    42 \ \ \ \ \ \ \ \ \ {\isachardoublequote}nor\ A\ B\ {\isasymequiv}\ {\isasymnot}{\isacharparenleft}A\ {\isasymor}\ B{\isacharparenright}{\isachardoublequote}\isanewline
    50 \ \ \ \ \ \ \ \ \ {\isachardoublequote}nor\ A\ B\ {\isasymequiv}\ {\isasymnot}{\isacharparenleft}A\ {\isasymor}\ B{\isacharparenright}{\isachardoublequote}\isanewline
    43 \ \ \ \ \ \ \ \ \ \ xor{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
    51 \ \ \ \ \ \ \ \ \ \ xor{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ gate\isanewline
    44 \ \ \ \ \ \ \ \ \ {\isachardoublequote}xor{\isadigit{2}}\ A\ B\ {\isasymequiv}\ {\isacharparenleft}A\ {\isasymor}\ B{\isacharparenright}\ {\isasymand}\ {\isacharparenleft}{\isasymnot}A\ {\isasymor}\ {\isasymnot}B{\isacharparenright}{\isachardoublequote}%
    52 \ \ \ \ \ \ \ \ \ {\isachardoublequote}xor{\isadigit{2}}\ A\ B\ {\isasymequiv}\ {\isacharparenleft}A\ {\isasymor}\ B{\isacharparenright}\ {\isasymand}\ {\isacharparenleft}{\isasymnot}A\ {\isasymor}\ {\isasymnot}B{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
       
    53 %
    45 \begin{isamarkuptext}%
    54 \begin{isamarkuptext}%
    46 \noindent
    55 \noindent
    47 The default name of each definition is $f$\isa{{\isacharunderscore}def}, where
    56 The default name of each definition is $f$\isa{{\isacharunderscore}def}, where
    48 $f$ is the name of the defined constant.%
    57 $f$ is the name of the defined constant.%
    49 \end{isamarkuptext}%
    58 \end{isamarkuptext}%
       
    59 \isamarkuptrue%
       
    60 \isamarkupfalse%
    50 \end{isabellebody}%
    61 \end{isabellebody}%
    51 %%% Local Variables:
    62 %%% Local Variables:
    52 %%% mode: latex
    63 %%% mode: latex
    53 %%% TeX-master: "root"
    64 %%% TeX-master: "root"
    54 %%% End:
    65 %%% End: