doc-src/TutorialI/Recdef/document/Nested1.tex
changeset 10878 b254d5ad6dd4
parent 10267 325ead6d9457
child 11277 a2bff98d6e5d
equal deleted inserted replaced
10877:6417de2029b0 10878:b254d5ad6dd4
     3 \def\isabellecontext{Nested{\isadigit{1}}}%
     3 \def\isabellecontext{Nested{\isadigit{1}}}%
     4 %
     4 %
     5 \begin{isamarkuptext}%
     5 \begin{isamarkuptext}%
     6 \noindent
     6 \noindent
     7 Although the definition of \isa{trev} is quite natural, we will have
     7 Although the definition of \isa{trev} is quite natural, we will have
     8 overcome a minor difficulty in convincing Isabelle of is termination.
     8 to overcome a minor difficulty in convincing Isabelle of its termination.
     9 It is precisely this difficulty that is the \textit{raison d'\^etre} of
     9 It is precisely this difficulty that is the \textit{raison d'\^etre} of
    10 this subsection.
    10 this subsection.
    11 
    11 
    12 Defining \isa{trev} by \isacommand{recdef} rather than \isacommand{primrec}
    12 Defining \isa{trev} by \isacommand{recdef} rather than \isacommand{primrec}
    13 simplifies matters because we are now free to use the recursion equation
    13 simplifies matters because we are now free to use the recursion equation
    25 \ \ \ \ \ t\ {\isasymin}\ set\ ts\ {\isasymlongrightarrow}\ size\ t\ {\isacharless}\ Suc\ {\isacharparenleft}term{\isacharunderscore}list{\isacharunderscore}size\ ts{\isacharparenright}%
    25 \ \ \ \ \ t\ {\isasymin}\ set\ ts\ {\isasymlongrightarrow}\ size\ t\ {\isacharless}\ Suc\ {\isacharparenleft}term{\isacharunderscore}list{\isacharunderscore}size\ ts{\isacharparenright}%
    26 \end{isabelle}
    26 \end{isabelle}
    27 where \isa{set} returns the set of elements of a list
    27 where \isa{set} returns the set of elements of a list
    28 and \isa{term{\isacharunderscore}list{\isacharunderscore}size\ {\isacharcolon}{\isacharcolon}\ term\ list\ {\isasymRightarrow}\ nat} is an auxiliary
    28 and \isa{term{\isacharunderscore}list{\isacharunderscore}size\ {\isacharcolon}{\isacharcolon}\ term\ list\ {\isasymRightarrow}\ nat} is an auxiliary
    29 function automatically defined by Isabelle
    29 function automatically defined by Isabelle
    30 (when \isa{term} was defined).  First we have to understand why the
    30 (while processing the declaration of \isa{term}).  First we have to understand why the
    31 recursive call of \isa{trev} underneath \isa{map} leads to the above
    31 recursive call of \isa{trev} underneath \isa{map} leads to the above
    32 condition. The reason is that \isacommand{recdef} ``knows'' that \isa{map}
    32 condition. The reason is that \isacommand{recdef} ``knows'' that \isa{map}
    33 will apply \isa{trev} only to elements of \isa{ts}. Thus the above
    33 will apply \isa{trev} only to elements of \isa{ts}. Thus the 
    34 condition expresses that the size of the argument \isa{t\ {\isasymin}\ set\ ts} of any
    34 condition expresses that the size of the argument \isa{t\ {\isasymin}\ set\ ts} of any
    35 recursive call of \isa{trev} is strictly less than \isa{size\ {\isacharparenleft}App\ f\ ts{\isacharparenright}\ {\isacharequal}\ Suc\ {\isacharparenleft}term{\isacharunderscore}list{\isacharunderscore}size\ ts{\isacharparenright}}.  We will now prove the termination condition and
    35 recursive call of \isa{trev} is strictly less than \isa{size\ {\isacharparenleft}App\ f\ ts{\isacharparenright}},
       
    36 which equals \isa{Suc\ {\isacharparenleft}term{\isacharunderscore}list{\isacharunderscore}size\ ts{\isacharparenright}}.  We will now prove the termination condition and
    36 continue with our definition.  Below we return to the question of how
    37 continue with our definition.  Below we return to the question of how
    37 \isacommand{recdef} ``knows'' about \isa{map}.%
    38 \isacommand{recdef} ``knows'' about \isa{map}.%
    38 \end{isamarkuptext}%
    39 \end{isamarkuptext}%
    39 \end{isabellebody}%
    40 \end{isabellebody}%
    40 %%% Local Variables:
    41 %%% Local Variables: