doc-src/TutorialI/ToyList/document/ToyList.tex
changeset 10362 c6b197ccf1f1
parent 10328 bf33cbd76c05
child 10395 7ef380745743
equal deleted inserted replaced
10361:c20f78a9606f 10362:c6b197ccf1f1
   232 \noindent
   232 \noindent
   233 This time not even the base case is solved automatically:%
   233 This time not even the base case is solved automatically:%
   234 \end{isamarkuptxt}%
   234 \end{isamarkuptxt}%
   235 \isacommand{apply}{\isacharparenleft}auto{\isacharparenright}%
   235 \isacommand{apply}{\isacharparenleft}auto{\isacharparenright}%
   236 \begin{isamarkuptxt}%
   236 \begin{isamarkuptxt}%
   237 \begin{isabelle}
   237 \begin{isabelle}%
   238 ~1.~rev~ys~=~rev~ys~@~[]\isanewline
   238 \ {\isadigit{1}}{\isachardot}\ rev\ ys\ {\isacharequal}\ rev\ ys\ {\isacharat}\ {\isacharbrackleft}{\isacharbrackright}%
   239 ~2. \dots
   239 \end{isabelle}
   240 \end{isabelle}
   240 Again, we need to abandon this proof attempt and prove another simple lemma
   241 Again, we need to abandon this proof attempt and prove another simple lemma first.
   241 first. In the future the step of abandoning an incomplete proof before
   242 In the future the step of abandoning an incomplete proof before embarking on
   242 embarking on the proof of a lemma usually remains implicit.%
   243 the proof of a lemma usually remains implicit.%
       
   244 \end{isamarkuptxt}%
   243 \end{isamarkuptxt}%
   245 %
   244 %
   246 \isamarkupsubsubsection{Second lemma: \isa{xs\ {\isacharat}\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs}}
   245 \isamarkupsubsubsection{Second lemma: \isa{xs\ {\isacharat}\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs}}
   247 %
   246 %
   248 \begin{isamarkuptext}%
   247 \begin{isamarkuptext}%
   252 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ xs{\isacharparenright}\isanewline
   251 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ xs{\isacharparenright}\isanewline
   253 \isacommand{apply}{\isacharparenleft}auto{\isacharparenright}%
   252 \isacommand{apply}{\isacharparenleft}auto{\isacharparenright}%
   254 \begin{isamarkuptxt}%
   253 \begin{isamarkuptxt}%
   255 \noindent
   254 \noindent
   256 leads to the desired message \isa{No\ subgoals{\isacharbang}}:
   255 leads to the desired message \isa{No\ subgoals{\isacharbang}}:
   257 \begin{isabelle}
   256 \begin{isabelle}%
   258 xs~@~[]~=~xs\isanewline
   257 xs\ {\isacharat}\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs\isanewline
   259 No~subgoals!
   258 No\ subgoals{\isacharbang}%
   260 \end{isabelle}
   259 \end{isabelle}
   261 
       
   262 We still need to confirm that the proof is now finished:%
   260 We still need to confirm that the proof is now finished:%
   263 \end{isamarkuptxt}%
   261 \end{isamarkuptxt}%
   264 \isacommand{done}%
   262 \isacommand{done}%
   265 \begin{isamarkuptext}%
   263 \begin{isamarkuptext}%
   266 \noindent\indexbold{done}%
   264 \noindent\indexbold{done}%
   282 \isacommand{apply}{\isacharparenleft}auto{\isacharparenright}%
   280 \isacommand{apply}{\isacharparenleft}auto{\isacharparenright}%
   283 \begin{isamarkuptxt}%
   281 \begin{isamarkuptxt}%
   284 \noindent
   282 \noindent
   285 we find that this time \isa{auto} solves the base case, but the
   283 we find that this time \isa{auto} solves the base case, but the
   286 induction step merely simplifies to
   284 induction step merely simplifies to
   287 \begin{isabelle}
   285 \begin{isabelle}%
   288 ~1.~{\isasymAnd}a~list.\isanewline
   286 \ {\isadigit{1}}{\isachardot}\ {\isasymAnd}a\ list{\isachardot}\isanewline
   289 ~~~~~~~rev~(list~@~ys)~=~rev~ys~@~rev~list~{\isasymLongrightarrow}\isanewline
   287 \ \ \ \ \ \ \ rev\ {\isacharparenleft}list\ {\isacharat}\ ys{\isacharparenright}\ {\isacharequal}\ rev\ ys\ {\isacharat}\ rev\ list\ {\isasymLongrightarrow}\isanewline
   290 ~~~~~~~(rev~ys~@~rev~list)~@~a~\#~[]~=~rev~ys~@~rev~list~@~a~\#~[]
   288 \ \ \ \ \ \ \ {\isacharparenleft}rev\ ys\ {\isacharat}\ rev\ list{\isacharparenright}\ {\isacharat}\ a\ {\isacharhash}\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ rev\ ys\ {\isacharat}\ rev\ list\ {\isacharat}\ a\ {\isacharhash}\ {\isacharbrackleft}{\isacharbrackright}%
   291 \end{isabelle}
   289 \end{isabelle}
   292 Now we need to remember that \isa{{\isacharat}} associates to the right, and that
   290 Now we need to remember that \isa{{\isacharat}} associates to the right, and that
   293 \isa{{\isacharhash}} and \isa{{\isacharat}} have the same priority (namely the \isa{{\isadigit{6}}{\isadigit{5}}}
   291 \isa{{\isacharhash}} and \isa{{\isacharat}} have the same priority (namely the \isa{{\isadigit{6}}{\isadigit{5}}}
   294 in their \isacommand{infixr} annotation). Thus the conclusion really is
   292 in their \isacommand{infixr} annotation). Thus the conclusion really is
   295 \begin{isabelle}
   293 \begin{isabelle}