doc-src/Intro/advanced.tex
changeset 3212 567c093297e6
parent 3114 943f25285a3e
child 3485 f27a30a18a17
equal deleted inserted replaced
3211:57a9b613036e 3212:567c093297e6
   353 sort for type variables.  A constant declaration can specify an
   353 sort for type variables.  A constant declaration can specify an
   354 associated concrete syntax.  The translations section specifies
   354 associated concrete syntax.  The translations section specifies
   355 rewrite rules on abstract syntax trees, handling notations and
   355 rewrite rules on abstract syntax trees, handling notations and
   356 abbreviations.  \index{*ML section} The {\tt ML} section may contain
   356 abbreviations.  \index{*ML section} The {\tt ML} section may contain
   357 code to perform arbitrary syntactic transformations.  The main
   357 code to perform arbitrary syntactic transformations.  The main
   358 declaration forms are discussed below.  The full syntax can be found
   358 declaration forms are discussed below.  There are some more sections
   359 in \iflabelundefined{app:TheorySyntax}{an appendix of the {\it
   359 not presented here, the full syntax can be found in
   360     Reference Manual}}{App.\ts\ref{app:TheorySyntax}}.  Also note that
   360 \iflabelundefined{app:TheorySyntax}{an appendix of the {\it Reference
   361 object-logics may add further theory sections, for example {\tt
   361     Manual}}{App.\ts\ref{app:TheorySyntax}}.  Also note that
   362   typedef}, {\tt datatype} in \HOL.
   362 object-logics may add further theory sections, for example
       
   363 \texttt{typedef}, \texttt{datatype} in \HOL.
   363 
   364 
   364 All the declaration parts can be omitted or repeated and may appear in
   365 All the declaration parts can be omitted or repeated and may appear in
   365 any order, except that the {\ML} section must be last (after the {\tt
   366 any order, except that the {\ML} section must be last (after the {\tt
   366   end} keyword).  In the simplest case, $T$ is just the union of
   367   end} keyword).  In the simplest case, $T$ is just the union of
   367 $S@1$,~\ldots,~$S@n$.  New theories always extend one or more other
   368 $S@1$,~\ldots,~$S@n$.  New theories always extend one or more other
   617 
   618 
   618 The constants \hbox{\verb|op ~&|} and \hbox{\verb|op #|} are declared
   619 The constants \hbox{\verb|op ~&|} and \hbox{\verb|op #|} are declared
   619 automatically, just as in \ML.  Hence you may write propositions like
   620 automatically, just as in \ML.  Hence you may write propositions like
   620 \verb|op #(True) == op ~&(True)|, which asserts that the functions $\lambda
   621 \verb|op #(True) == op ~&(True)|, which asserts that the functions $\lambda
   621 Q.True \xor Q$ and $\lambda Q.True \nand Q$ are identical.
   622 Q.True \xor Q$ and $\lambda Q.True \nand Q$ are identical.
       
   623 
       
   624 \medskip Infix syntax and constant names may be also specified
       
   625 independently. For example, consider this version of $\nand$:
       
   626 \begin{ttbox}
       
   627 consts  nand     :: [o,o] => o         (infixl "~&" 35)
       
   628 \end{ttbox}
   622 
   629 
   623 \bigskip\index{mixfix declarations}
   630 \bigskip\index{mixfix declarations}
   624 {\bf Mixfix} operators may have arbitrary context-free syntaxes.  Let us
   631 {\bf Mixfix} operators may have arbitrary context-free syntaxes.  Let us
   625 add a line to the constant declaration part:
   632 add a line to the constant declaration part:
   626 \begin{ttbox}
   633 \begin{ttbox}