doc-src/TutorialI/Inductive/document/AB.tex
changeset 17056 05fc32a23b8b
parent 16585 02cf78f0afce
child 17175 1eced27ee0e1
equal deleted inserted replaced
17055:eacce1cd716a 17056:05fc32a23b8b
     1 %
     1 %
     2 \begin{isabellebody}%
     2 \begin{isabellebody}%
     3 \def\isabellecontext{AB}%
     3 \def\isabellecontext{AB}%
     4 \isamarkupfalse%
     4 %
       
     5 \isadelimtheory
       
     6 %
       
     7 \endisadelimtheory
       
     8 %
       
     9 \isatagtheory
       
    10 %
       
    11 \endisatagtheory
       
    12 {\isafoldtheory}%
       
    13 %
       
    14 \isadelimtheory
       
    15 %
       
    16 \endisadelimtheory
       
    17 \isamarkuptrue%
     5 %
    18 %
     6 \isamarkupsection{Case Study: A Context Free Grammar%
    19 \isamarkupsection{Case Study: A Context Free Grammar%
     7 }
    20 }
     8 \isamarkuptrue%
    21 \isamarkuptrue%
     9 %
    22 %
    26 the original proof \cite[p.\ts81]{HopcroftUllman} and our formal version.
    39 the original proof \cite[p.\ts81]{HopcroftUllman} and our formal version.
    27 
    40 
    28 We start by fixing the alphabet, which consists only of \isa{a}'s
    41 We start by fixing the alphabet, which consists only of \isa{a}'s
    29 and~\isa{b}'s:%
    42 and~\isa{b}'s:%
    30 \end{isamarkuptext}%
    43 \end{isamarkuptext}%
    31 \isamarkuptrue%
    44 \isamarkupfalse%
    32 \isacommand{datatype}\ alfa\ {\isacharequal}\ a\ {\isacharbar}\ b\isamarkupfalse%
    45 \isacommand{datatype}\ alfa\ {\isacharequal}\ a\ {\isacharbar}\ b\isamarkuptrue%
    33 %
    46 %
    34 \begin{isamarkuptext}%
    47 \begin{isamarkuptext}%
    35 \noindent
    48 \noindent
    36 For convenience we include the following easy lemmas as simplification rules:%
    49 For convenience we include the following easy lemmas as simplification rules:%
    37 \end{isamarkuptext}%
    50 \end{isamarkuptext}%
    38 \isamarkuptrue%
    51 \isamarkupfalse%
    39 \isacommand{lemma}\ {\isacharbrackleft}simp{\isacharbrackright}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}x\ {\isasymnoteq}\ a{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharequal}\ b{\isacharparenright}\ {\isasymand}\ {\isacharparenleft}x\ {\isasymnoteq}\ b{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharequal}\ a{\isacharparenright}{\isachardoublequote}\isanewline
    52 \isacommand{lemma}\ {\isacharbrackleft}simp{\isacharbrackright}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}x\ {\isasymnoteq}\ a{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharequal}\ b{\isacharparenright}\ {\isasymand}\ {\isacharparenleft}x\ {\isasymnoteq}\ b{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharequal}\ a{\isacharparenright}{\isachardoublequote}\isanewline
    40 \isamarkupfalse%
    53 %
    41 \isacommand{by}\ {\isacharparenleft}case{\isacharunderscore}tac\ x{\isacharcomma}\ auto{\isacharparenright}\isamarkupfalse%
    54 \isadelimproof
       
    55 %
       
    56 \endisadelimproof
       
    57 %
       
    58 \isatagproof
       
    59 \isamarkupfalse%
       
    60 \isacommand{by}\ {\isacharparenleft}case{\isacharunderscore}tac\ x{\isacharcomma}\ auto{\isacharparenright}%
       
    61 \endisatagproof
       
    62 {\isafoldproof}%
       
    63 %
       
    64 \isadelimproof
       
    65 %
       
    66 \endisadelimproof
       
    67 \isamarkuptrue%
    42 %
    68 %
    43 \begin{isamarkuptext}%
    69 \begin{isamarkuptext}%
    44 \noindent
    70 \noindent
    45 Words over this alphabet are of type \isa{alfa\ list}, and
    71 Words over this alphabet are of type \isa{alfa\ list}, and
    46 the three nonterminals are declared as sets of such words:%
    72 the three nonterminals are declared as sets of such words:%
    47 \end{isamarkuptext}%
    73 \end{isamarkuptext}%
    48 \isamarkuptrue%
    74 \isamarkupfalse%
    49 \isacommand{consts}\ S\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}alfa\ list\ set{\isachardoublequote}\isanewline
    75 \isacommand{consts}\ S\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}alfa\ list\ set{\isachardoublequote}\isanewline
    50 \ \ \ \ \ \ \ A\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}alfa\ list\ set{\isachardoublequote}\isanewline
    76 \ \ \ \ \ \ \ A\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}alfa\ list\ set{\isachardoublequote}\isanewline
    51 \ \ \ \ \ \ \ B\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}alfa\ list\ set{\isachardoublequote}\isamarkupfalse%
    77 \ \ \ \ \ \ \ B\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}alfa\ list\ set{\isachardoublequote}\isamarkuptrue%
    52 %
    78 %
    53 \begin{isamarkuptext}%
    79 \begin{isamarkuptext}%
    54 \noindent
    80 \noindent
    55 The productions above are recast as a \emph{mutual} inductive
    81 The productions above are recast as a \emph{mutual} inductive
    56 definition\index{inductive definition!simultaneous}
    82 definition\index{inductive definition!simultaneous}
    57 of \isa{S}, \isa{A} and~\isa{B}:%
    83 of \isa{S}, \isa{A} and~\isa{B}:%
    58 \end{isamarkuptext}%
    84 \end{isamarkuptext}%
    59 \isamarkuptrue%
    85 \isamarkupfalse%
    60 \isacommand{inductive}\ S\ A\ B\isanewline
    86 \isacommand{inductive}\ S\ A\ B\isanewline
    61 \isakeyword{intros}\isanewline
    87 \isakeyword{intros}\isanewline
    62 \ \ {\isachardoublequote}{\isacharbrackleft}{\isacharbrackright}\ {\isasymin}\ S{\isachardoublequote}\isanewline
    88 \ \ {\isachardoublequote}{\isacharbrackleft}{\isacharbrackright}\ {\isasymin}\ S{\isachardoublequote}\isanewline
    63 \ \ {\isachardoublequote}w\ {\isasymin}\ A\ {\isasymLongrightarrow}\ b{\isacharhash}w\ {\isasymin}\ S{\isachardoublequote}\isanewline
    89 \ \ {\isachardoublequote}w\ {\isasymin}\ A\ {\isasymLongrightarrow}\ b{\isacharhash}w\ {\isasymin}\ S{\isachardoublequote}\isanewline
    64 \ \ {\isachardoublequote}w\ {\isasymin}\ B\ {\isasymLongrightarrow}\ a{\isacharhash}w\ {\isasymin}\ S{\isachardoublequote}\isanewline
    90 \ \ {\isachardoublequote}w\ {\isasymin}\ B\ {\isasymLongrightarrow}\ a{\isacharhash}w\ {\isasymin}\ S{\isachardoublequote}\isanewline
    65 \isanewline
    91 \isanewline
    66 \ \ {\isachardoublequote}w\ {\isasymin}\ S\ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ a{\isacharhash}w\ \ \ {\isasymin}\ A{\isachardoublequote}\isanewline
    92 \ \ {\isachardoublequote}w\ {\isasymin}\ S\ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ a{\isacharhash}w\ \ \ {\isasymin}\ A{\isachardoublequote}\isanewline
    67 \ \ {\isachardoublequote}{\isasymlbrakk}\ v{\isasymin}A{\isacharsemicolon}\ w{\isasymin}A\ {\isasymrbrakk}\ {\isasymLongrightarrow}\ b{\isacharhash}v{\isacharat}w\ {\isasymin}\ A{\isachardoublequote}\isanewline
    93 \ \ {\isachardoublequote}{\isasymlbrakk}\ v{\isasymin}A{\isacharsemicolon}\ w{\isasymin}A\ {\isasymrbrakk}\ {\isasymLongrightarrow}\ b{\isacharhash}v{\isacharat}w\ {\isasymin}\ A{\isachardoublequote}\isanewline
    68 \isanewline
    94 \isanewline
    69 \ \ {\isachardoublequote}w\ {\isasymin}\ S\ \ \ \ \ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ b{\isacharhash}w\ \ \ {\isasymin}\ B{\isachardoublequote}\isanewline
    95 \ \ {\isachardoublequote}w\ {\isasymin}\ S\ \ \ \ \ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ b{\isacharhash}w\ \ \ {\isasymin}\ B{\isachardoublequote}\isanewline
    70 \ \ {\isachardoublequote}{\isasymlbrakk}\ v\ {\isasymin}\ B{\isacharsemicolon}\ w\ {\isasymin}\ B\ {\isasymrbrakk}\ {\isasymLongrightarrow}\ a{\isacharhash}v{\isacharat}w\ {\isasymin}\ B{\isachardoublequote}\isamarkupfalse%
    96 \ \ {\isachardoublequote}{\isasymlbrakk}\ v\ {\isasymin}\ B{\isacharsemicolon}\ w\ {\isasymin}\ B\ {\isasymrbrakk}\ {\isasymLongrightarrow}\ a{\isacharhash}v{\isacharat}w\ {\isasymin}\ B{\isachardoublequote}\isamarkuptrue%
    71 %
    97 %
    72 \begin{isamarkuptext}%
    98 \begin{isamarkuptext}%
    73 \noindent
    99 \noindent
    74 First we show that all words in \isa{S} contain the same number of \isa{a}'s and \isa{b}'s. Since the definition of \isa{S} is by mutual
   100 First we show that all words in \isa{S} contain the same number of \isa{a}'s and \isa{b}'s. Since the definition of \isa{S} is by mutual
    75 induction, so is the proof: we show at the same time that all words in
   101 induction, so is the proof: we show at the same time that all words in
    76 \isa{A} contain one more \isa{a} than \isa{b} and all words in \isa{B} contains one more \isa{b} than \isa{a}.%
   102 \isa{A} contain one more \isa{a} than \isa{b} and all words in \isa{B} contains one more \isa{b} than \isa{a}.%
    77 \end{isamarkuptext}%
   103 \end{isamarkuptext}%
    78 \isamarkuptrue%
   104 \isamarkupfalse%
    79 \isacommand{lemma}\ correctness{\isacharcolon}\isanewline
   105 \isacommand{lemma}\ correctness{\isacharcolon}\isanewline
    80 \ \ {\isachardoublequote}{\isacharparenleft}w\ {\isasymin}\ S\ {\isasymlongrightarrow}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}{\isacharparenright}\ \ \ \ \ {\isasymand}\isanewline
   106 \ \ {\isachardoublequote}{\isacharparenleft}w\ {\isasymin}\ S\ {\isasymlongrightarrow}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}{\isacharparenright}\ \ \ \ \ {\isasymand}\isanewline
    81 \ \ \ {\isacharparenleft}w\ {\isasymin}\ A\ {\isasymlongrightarrow}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}\ {\isasymand}\isanewline
   107 \ \ \ {\isacharparenleft}w\ {\isasymin}\ A\ {\isasymlongrightarrow}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}\ {\isasymand}\isanewline
    82 \ \ \ {\isacharparenleft}w\ {\isasymin}\ B\ {\isasymlongrightarrow}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
   108 \ \ \ {\isacharparenleft}w\ {\isasymin}\ B\ {\isasymlongrightarrow}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequote}%
       
   109 \isadelimproof
       
   110 %
       
   111 \endisadelimproof
       
   112 %
       
   113 \isatagproof
       
   114 \isamarkuptrue%
    83 %
   115 %
    84 \begin{isamarkuptxt}%
   116 \begin{isamarkuptxt}%
    85 \noindent
   117 \noindent
    86 These propositions are expressed with the help of the predefined \isa{filter} function on lists, which has the convenient syntax \isa{{\isacharbrackleft}x{\isasymin}xs{\isachardot}\ P\ x{\isacharbrackright}}, the list of all elements \isa{x} in \isa{xs} such that \isa{P\ x}
   118 These propositions are expressed with the help of the predefined \isa{filter} function on lists, which has the convenient syntax \isa{{\isacharbrackleft}x{\isasymin}xs{\isachardot}\ P\ x{\isacharbrackright}}, the list of all elements \isa{x} in \isa{xs} such that \isa{P\ x}
    87 holds. Remember that on lists \isa{size} and \isa{length} are synonymous.
   119 holds. Remember that on lists \isa{size} and \isa{length} are synonymous.
    88 
   120 
    89 The proof itself is by rule induction and afterwards automatic:%
   121 The proof itself is by rule induction and afterwards automatic:%
    90 \end{isamarkuptxt}%
   122 \end{isamarkuptxt}%
    91 \isamarkuptrue%
   123 \isamarkupfalse%
    92 \isacommand{by}\ {\isacharparenleft}rule\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}induct{\isacharcomma}\ auto{\isacharparenright}\isamarkupfalse%
   124 \isacommand{by}\ {\isacharparenleft}rule\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}induct{\isacharcomma}\ auto{\isacharparenright}%
       
   125 \endisatagproof
       
   126 {\isafoldproof}%
       
   127 %
       
   128 \isadelimproof
       
   129 %
       
   130 \endisadelimproof
       
   131 \isamarkuptrue%
    93 %
   132 %
    94 \begin{isamarkuptext}%
   133 \begin{isamarkuptext}%
    95 \noindent
   134 \noindent
    96 This may seem surprising at first, and is indeed an indication of the power
   135 This may seem surprising at first, and is indeed an indication of the power
    97 of inductive definitions. But it is also quite straightforward. For example,
   136 of inductive definitions. But it is also quite straightforward. For example,
   123 move to the right. At this point we also start generalizing from \isa{a}'s
   162 move to the right. At this point we also start generalizing from \isa{a}'s
   124 and \isa{b}'s to an arbitrary property \isa{P}. Otherwise we would have
   163 and \isa{b}'s to an arbitrary property \isa{P}. Otherwise we would have
   125 to prove the desired lemma twice, once as stated above and once with the
   164 to prove the desired lemma twice, once as stated above and once with the
   126 roles of \isa{a}'s and \isa{b}'s interchanged.%
   165 roles of \isa{a}'s and \isa{b}'s interchanged.%
   127 \end{isamarkuptext}%
   166 \end{isamarkuptext}%
   128 \isamarkuptrue%
   167 \isamarkupfalse%
   129 \isacommand{lemma}\ step{\isadigit{1}}{\isacharcolon}\ {\isachardoublequote}{\isasymforall}i\ {\isacharless}\ size\ w{\isachardot}\isanewline
   168 \isacommand{lemma}\ step{\isadigit{1}}{\isacharcolon}\ {\isachardoublequote}{\isasymforall}i\ {\isacharless}\ size\ w{\isachardot}\isanewline
   130 \ \ {\isasymbar}{\isacharparenleft}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ {\isacharparenleft}i{\isacharplus}{\isadigit{1}}{\isacharparenright}\ w{\isachardot}\ P\ x{\isacharbrackright}{\isacharparenright}{\isacharminus}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ {\isacharparenleft}i{\isacharplus}{\isadigit{1}}{\isacharparenright}\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharparenright}{\isacharparenright}\isanewline
   169 \ \ {\isasymbar}{\isacharparenleft}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ {\isacharparenleft}i{\isacharplus}{\isadigit{1}}{\isacharparenright}\ w{\isachardot}\ P\ x{\isacharbrackright}{\isacharparenright}{\isacharminus}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ {\isacharparenleft}i{\isacharplus}{\isadigit{1}}{\isacharparenright}\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharparenright}{\isacharparenright}\isanewline
   131 \ \ \ {\isacharminus}\ {\isacharparenleft}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ P\ x{\isacharbrackright}{\isacharparenright}{\isacharminus}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharparenright}{\isacharparenright}{\isasymbar}\ {\isasymle}\ {\isadigit{1}}{\isachardoublequote}\isamarkupfalse%
   170 \ \ \ {\isacharminus}\ {\isacharparenleft}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ P\ x{\isacharbrackright}{\isacharparenright}{\isacharminus}int{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharparenright}{\isacharparenright}{\isasymbar}\ {\isasymle}\ {\isadigit{1}}{\isachardoublequote}%
       
   171 \isadelimproof
       
   172 %
       
   173 \endisadelimproof
       
   174 %
       
   175 \isatagproof
       
   176 \isamarkuptrue%
   132 %
   177 %
   133 \begin{isamarkuptxt}%
   178 \begin{isamarkuptxt}%
   134 \noindent
   179 \noindent
   135 The lemma is a bit hard to read because of the coercion function
   180 The lemma is a bit hard to read because of the coercion function
   136 \isa{int\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ int}. It is required because \isa{size} returns
   181 \isa{int\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ int}. It is required because \isa{size} returns
   141 
   186 
   142 The proof is by induction on \isa{w}, with a trivial base case, and a not
   187 The proof is by induction on \isa{w}, with a trivial base case, and a not
   143 so trivial induction step. Since it is essentially just arithmetic, we do not
   188 so trivial induction step. Since it is essentially just arithmetic, we do not
   144 discuss it.%
   189 discuss it.%
   145 \end{isamarkuptxt}%
   190 \end{isamarkuptxt}%
   146 \isamarkuptrue%
   191 \isamarkupfalse%
   147 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ w{\isacharparenright}\isanewline
   192 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ w{\isacharparenright}\isanewline
   148 \isamarkupfalse%
   193 \isamarkupfalse%
   149 \isacommand{apply}{\isacharparenleft}auto\ simp\ add{\isacharcolon}\ abs{\isacharunderscore}if\ take{\isacharunderscore}Cons\ split{\isacharcolon}\ nat{\isachardot}split{\isacharparenright}\isanewline
   194 \isacommand{apply}{\isacharparenleft}auto\ simp\ add{\isacharcolon}\ abs{\isacharunderscore}if\ take{\isacharunderscore}Cons\ split{\isacharcolon}\ nat{\isachardot}split{\isacharparenright}\isanewline
   150 \isamarkupfalse%
   195 \isamarkupfalse%
   151 \isacommand{done}\isamarkupfalse%
   196 \isacommand{done}%
       
   197 \endisatagproof
       
   198 {\isafoldproof}%
       
   199 %
       
   200 \isadelimproof
       
   201 %
       
   202 \endisadelimproof
       
   203 \isamarkuptrue%
   152 %
   204 %
   153 \begin{isamarkuptext}%
   205 \begin{isamarkuptext}%
   154 Finally we come to the above-mentioned lemma about cutting in half a word with two more elements of one sort than of the other sort:%
   206 Finally we come to the above-mentioned lemma about cutting in half a word with two more elements of one sort than of the other sort:%
   155 \end{isamarkuptext}%
   207 \end{isamarkuptext}%
   156 \isamarkuptrue%
   208 \isamarkupfalse%
   157 \isacommand{lemma}\ part{\isadigit{1}}{\isacharcolon}\isanewline
   209 \isacommand{lemma}\ part{\isadigit{1}}{\isacharcolon}\isanewline
   158 \ {\isachardoublequote}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{2}}\ {\isasymLongrightarrow}\isanewline
   210 \ {\isachardoublequote}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{2}}\ {\isasymLongrightarrow}\isanewline
   159 \ \ {\isasymexists}i{\isasymle}size\ w{\isachardot}\ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{1}}{\isachardoublequote}\isamarkupfalse%
   211 \ \ {\isasymexists}i{\isasymle}size\ w{\isachardot}\ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{1}}{\isachardoublequote}%
       
   212 \isadelimproof
       
   213 %
       
   214 \endisadelimproof
       
   215 %
       
   216 \isatagproof
       
   217 \isamarkuptrue%
   160 %
   218 %
   161 \begin{isamarkuptxt}%
   219 \begin{isamarkuptxt}%
   162 \noindent
   220 \noindent
   163 This is proved by \isa{force} with the help of the intermediate value theorem,
   221 This is proved by \isa{force} with the help of the intermediate value theorem,
   164 instantiated appropriately and with its first premise disposed of by lemma
   222 instantiated appropriately and with its first premise disposed of by lemma
   165 \isa{step{\isadigit{1}}}:%
   223 \isa{step{\isadigit{1}}}:%
   166 \end{isamarkuptxt}%
   224 \end{isamarkuptxt}%
   167 \isamarkuptrue%
   225 \isamarkupfalse%
   168 \isacommand{apply}{\isacharparenleft}insert\ nat{\isadigit{0}}{\isacharunderscore}intermed{\isacharunderscore}int{\isacharunderscore}val{\isacharbrackleft}OF\ step{\isadigit{1}}{\isacharcomma}\ of\ {\isachardoublequote}P{\isachardoublequote}\ {\isachardoublequote}w{\isachardoublequote}\ {\isachardoublequote}{\isadigit{1}}{\isachardoublequote}{\isacharbrackright}{\isacharparenright}\isanewline
   226 \isacommand{apply}{\isacharparenleft}insert\ nat{\isadigit{0}}{\isacharunderscore}intermed{\isacharunderscore}int{\isacharunderscore}val{\isacharbrackleft}OF\ step{\isadigit{1}}{\isacharcomma}\ of\ {\isachardoublequote}P{\isachardoublequote}\ {\isachardoublequote}w{\isachardoublequote}\ {\isachardoublequote}{\isadigit{1}}{\isachardoublequote}{\isacharbrackright}{\isacharparenright}\isanewline
   169 \isamarkupfalse%
   227 \isamarkupfalse%
   170 \isacommand{by}\ force\isamarkupfalse%
   228 \isacommand{by}\ force%
       
   229 \endisatagproof
       
   230 {\isafoldproof}%
       
   231 %
       
   232 \isadelimproof
       
   233 %
       
   234 \endisadelimproof
       
   235 \isamarkuptrue%
   171 %
   236 %
   172 \begin{isamarkuptext}%
   237 \begin{isamarkuptext}%
   173 \noindent
   238 \noindent
   174 
   239 
   175 Lemma \isa{part{\isadigit{1}}} tells us only about the prefix \isa{take\ i\ w}.
   240 Lemma \isa{part{\isadigit{1}}} tells us only about the prefix \isa{take\ i\ w}.
   176 An easy lemma deals with the suffix \isa{drop\ i\ w}:%
   241 An easy lemma deals with the suffix \isa{drop\ i\ w}:%
   177 \end{isamarkuptext}%
   242 \end{isamarkuptext}%
   178 \isamarkuptrue%
   243 \isamarkupfalse%
   179 \isacommand{lemma}\ part{\isadigit{2}}{\isacharcolon}\isanewline
   244 \isacommand{lemma}\ part{\isadigit{2}}{\isacharcolon}\isanewline
   180 \ \ {\isachardoublequote}{\isasymlbrakk}size{\isacharbrackleft}x{\isasymin}take\ i\ w\ {\isacharat}\ drop\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\isanewline
   245 \ \ {\isachardoublequote}{\isasymlbrakk}size{\isacharbrackleft}x{\isasymin}take\ i\ w\ {\isacharat}\ drop\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\isanewline
   181 \ \ \ \ size{\isacharbrackleft}x{\isasymin}take\ i\ w\ {\isacharat}\ drop\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{2}}{\isacharsemicolon}\isanewline
   246 \ \ \ \ size{\isacharbrackleft}x{\isasymin}take\ i\ w\ {\isacharat}\ drop\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{2}}{\isacharsemicolon}\isanewline
   182 \ \ \ \ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{1}}{\isasymrbrakk}\isanewline
   247 \ \ \ \ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}take\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{1}}{\isasymrbrakk}\isanewline
   183 \ \ \ {\isasymLongrightarrow}\ size{\isacharbrackleft}x{\isasymin}drop\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}drop\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{1}}{\isachardoublequote}\isanewline
   248 \ \ \ {\isasymLongrightarrow}\ size{\isacharbrackleft}x{\isasymin}drop\ i\ w{\isachardot}\ P\ x{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}drop\ i\ w{\isachardot}\ {\isasymnot}P\ x{\isacharbrackright}{\isacharplus}{\isadigit{1}}{\isachardoublequote}\isanewline
   184 \isamarkupfalse%
   249 %
   185 \isacommand{by}{\isacharparenleft}simp\ del{\isacharcolon}\ append{\isacharunderscore}take{\isacharunderscore}drop{\isacharunderscore}id{\isacharparenright}\isamarkupfalse%
   250 \isadelimproof
       
   251 %
       
   252 \endisadelimproof
       
   253 %
       
   254 \isatagproof
       
   255 \isamarkupfalse%
       
   256 \isacommand{by}{\isacharparenleft}simp\ del{\isacharcolon}\ append{\isacharunderscore}take{\isacharunderscore}drop{\isacharunderscore}id{\isacharparenright}%
       
   257 \endisatagproof
       
   258 {\isafoldproof}%
       
   259 %
       
   260 \isadelimproof
       
   261 %
       
   262 \endisadelimproof
       
   263 \isamarkuptrue%
   186 %
   264 %
   187 \begin{isamarkuptext}%
   265 \begin{isamarkuptext}%
   188 \noindent
   266 \noindent
   189 In the proof we have disabled the normally useful lemma
   267 In the proof we have disabled the normally useful lemma
   190 \begin{isabelle}
   268 \begin{isabelle}
   197 \end{isabelle}
   275 \end{isabelle}
   198 
   276 
   199 To dispose of trivial cases automatically, the rules of the inductive
   277 To dispose of trivial cases automatically, the rules of the inductive
   200 definition are declared simplification rules:%
   278 definition are declared simplification rules:%
   201 \end{isamarkuptext}%
   279 \end{isamarkuptext}%
   202 \isamarkuptrue%
   280 \isamarkupfalse%
   203 \isacommand{declare}\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}intros{\isacharbrackleft}simp{\isacharbrackright}\isamarkupfalse%
   281 \isacommand{declare}\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}intros{\isacharbrackleft}simp{\isacharbrackright}\isamarkuptrue%
   204 %
   282 %
   205 \begin{isamarkuptext}%
   283 \begin{isamarkuptext}%
   206 \noindent
   284 \noindent
   207 This could have been done earlier but was not necessary so far.
   285 This could have been done earlier but was not necessary so far.
   208 
   286 
   209 The completeness theorem tells us that if a word has the same number of
   287 The completeness theorem tells us that if a word has the same number of
   210 \isa{a}'s and \isa{b}'s, then it is in \isa{S}, and similarly 
   288 \isa{a}'s and \isa{b}'s, then it is in \isa{S}, and similarly 
   211 for \isa{A} and \isa{B}:%
   289 for \isa{A} and \isa{B}:%
   212 \end{isamarkuptext}%
   290 \end{isamarkuptext}%
   213 \isamarkuptrue%
   291 \isamarkupfalse%
   214 \isacommand{theorem}\ completeness{\isacharcolon}\isanewline
   292 \isacommand{theorem}\ completeness{\isacharcolon}\isanewline
   215 \ \ {\isachardoublequote}{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ \ \ \ \ {\isasymlongrightarrow}\ w\ {\isasymin}\ S{\isacharparenright}\ {\isasymand}\isanewline
   293 \ \ {\isachardoublequote}{\isacharparenleft}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ \ \ \ \ {\isasymlongrightarrow}\ w\ {\isasymin}\ S{\isacharparenright}\ {\isasymand}\isanewline
   216 \ \ \ {\isacharparenleft}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}\ {\isasymlongrightarrow}\ w\ {\isasymin}\ A{\isacharparenright}\ {\isasymand}\isanewline
   294 \ \ \ {\isacharparenleft}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}\ {\isasymlongrightarrow}\ w\ {\isasymin}\ A{\isacharparenright}\ {\isasymand}\isanewline
   217 \ \ \ {\isacharparenleft}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}\ {\isasymlongrightarrow}\ w\ {\isasymin}\ B{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
   295 \ \ \ {\isacharparenleft}size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}b{\isacharbrackright}\ {\isacharequal}\ size{\isacharbrackleft}x{\isasymin}w{\isachardot}\ x{\isacharequal}a{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}\ {\isasymlongrightarrow}\ w\ {\isasymin}\ B{\isacharparenright}{\isachardoublequote}%
       
   296 \isadelimproof
       
   297 %
       
   298 \endisadelimproof
       
   299 %
       
   300 \isatagproof
       
   301 \isamarkuptrue%
   218 %
   302 %
   219 \begin{isamarkuptxt}%
   303 \begin{isamarkuptxt}%
   220 \noindent
   304 \noindent
   221 The proof is by induction on \isa{w}. Structural induction would fail here
   305 The proof is by induction on \isa{w}. Structural induction would fail here
   222 because, as we can see from the grammar, we need to make bigger steps than
   306 because, as we can see from the grammar, we need to make bigger steps than
   223 merely appending a single letter at the front. Hence we induct on the length
   307 merely appending a single letter at the front. Hence we induct on the length
   224 of \isa{w}, using the induction rule \isa{length{\isacharunderscore}induct}:%
   308 of \isa{w}, using the induction rule \isa{length{\isacharunderscore}induct}:%
   225 \end{isamarkuptxt}%
   309 \end{isamarkuptxt}%
   226 \isamarkuptrue%
   310 \isamarkupfalse%
   227 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ w\ rule{\isacharcolon}\ length{\isacharunderscore}induct{\isacharparenright}\isamarkupfalse%
   311 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ w\ rule{\isacharcolon}\ length{\isacharunderscore}induct{\isacharparenright}\isamarkuptrue%
   228 \isamarkupfalse%
       
   229 %
   312 %
   230 \begin{isamarkuptxt}%
   313 \begin{isamarkuptxt}%
   231 \noindent
   314 \noindent
   232 The \isa{rule} parameter tells \isa{induct{\isacharunderscore}tac} explicitly which induction
   315 The \isa{rule} parameter tells \isa{induct{\isacharunderscore}tac} explicitly which induction
   233 rule to use. For details see \S\ref{sec:complete-ind} below.
   316 rule to use. For details see \S\ref{sec:complete-ind} below.
   235 holds for all words shorter than \isa{w}.
   318 holds for all words shorter than \isa{w}.
   236 
   319 
   237 The proof continues with a case distinction on \isa{w},
   320 The proof continues with a case distinction on \isa{w},
   238 on whether \isa{w} is empty or not.%
   321 on whether \isa{w} is empty or not.%
   239 \end{isamarkuptxt}%
   322 \end{isamarkuptxt}%
   240 \isamarkuptrue%
   323 \isamarkupfalse%
   241 \isacommand{apply}{\isacharparenleft}case{\isacharunderscore}tac\ w{\isacharparenright}\isanewline
   324 \isacommand{apply}{\isacharparenleft}case{\isacharunderscore}tac\ w{\isacharparenright}\isanewline
   242 \ \isamarkupfalse%
   325 \ \isamarkupfalse%
   243 \isacommand{apply}{\isacharparenleft}simp{\isacharunderscore}all{\isacharparenright}\isamarkupfalse%
   326 \isacommand{apply}{\isacharparenleft}simp{\isacharunderscore}all{\isacharparenright}\isamarkuptrue%
   244 \isamarkupfalse%
       
   245 %
   327 %
   246 \begin{isamarkuptxt}%
   328 \begin{isamarkuptxt}%
   247 \noindent
   329 \noindent
   248 Simplification disposes of the base case and leaves only a conjunction
   330 Simplification disposes of the base case and leaves only a conjunction
   249 of two step cases to be proved:
   331 of two step cases to be proved:
   254 We only consider the first case in detail.
   336 We only consider the first case in detail.
   255 
   337 
   256 After breaking the conjunction up into two cases, we can apply
   338 After breaking the conjunction up into two cases, we can apply
   257 \isa{part{\isadigit{1}}} to the assumption that \isa{w} contains two more \isa{a}'s than \isa{b}'s.%
   339 \isa{part{\isadigit{1}}} to the assumption that \isa{w} contains two more \isa{a}'s than \isa{b}'s.%
   258 \end{isamarkuptxt}%
   340 \end{isamarkuptxt}%
   259 \isamarkuptrue%
   341 \isamarkupfalse%
   260 \isacommand{apply}{\isacharparenleft}rule\ conjI{\isacharparenright}\isanewline
   342 \isacommand{apply}{\isacharparenleft}rule\ conjI{\isacharparenright}\isanewline
   261 \ \isamarkupfalse%
   343 \ \isamarkupfalse%
   262 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isanewline
   344 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isanewline
   263 \ \isamarkupfalse%
   345 \ \isamarkupfalse%
   264 \isacommand{apply}{\isacharparenleft}frule\ part{\isadigit{1}}{\isacharbrackleft}of\ {\isachardoublequote}{\isasymlambda}x{\isachardot}\ x{\isacharequal}a{\isachardoublequote}{\isacharcomma}\ simplified{\isacharbrackright}{\isacharparenright}\isanewline
   346 \isacommand{apply}{\isacharparenleft}frule\ part{\isadigit{1}}{\isacharbrackleft}of\ {\isachardoublequote}{\isasymlambda}x{\isachardot}\ x{\isacharequal}a{\isachardoublequote}{\isacharcomma}\ simplified{\isacharbrackright}{\isacharparenright}\isanewline
   265 \ \isamarkupfalse%
   347 \ \isamarkupfalse%
   266 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isamarkupfalse%
   348 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isamarkuptrue%
   267 %
   349 %
   268 \begin{isamarkuptxt}%
   350 \begin{isamarkuptxt}%
   269 \noindent
   351 \noindent
   270 This yields an index \isa{i\ {\isasymle}\ length\ v} such that
   352 This yields an index \isa{i\ {\isasymle}\ length\ v} such that
   271 \begin{isabelle}%
   353 \begin{isabelle}%
   274 With the help of \isa{part{\isadigit{2}}} it follows that
   356 With the help of \isa{part{\isadigit{2}}} it follows that
   275 \begin{isabelle}%
   357 \begin{isabelle}%
   276 \ \ \ \ \ length\ {\isacharbrackleft}x{\isasymin}drop\ i\ v\ {\isachardot}\ x\ {\isacharequal}\ a{\isacharbrackright}\ {\isacharequal}\ length\ {\isacharbrackleft}x{\isasymin}drop\ i\ v\ {\isachardot}\ x\ {\isacharequal}\ b{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}%
   358 \ \ \ \ \ length\ {\isacharbrackleft}x{\isasymin}drop\ i\ v\ {\isachardot}\ x\ {\isacharequal}\ a{\isacharbrackright}\ {\isacharequal}\ length\ {\isacharbrackleft}x{\isasymin}drop\ i\ v\ {\isachardot}\ x\ {\isacharequal}\ b{\isacharbrackright}\ {\isacharplus}\ {\isadigit{1}}%
   277 \end{isabelle}%
   359 \end{isabelle}%
   278 \end{isamarkuptxt}%
   360 \end{isamarkuptxt}%
   279 \ \isamarkuptrue%
   361 \ \isamarkupfalse%
   280 \isacommand{apply}{\isacharparenleft}drule\ part{\isadigit{2}}{\isacharbrackleft}of\ {\isachardoublequote}{\isasymlambda}x{\isachardot}\ x{\isacharequal}a{\isachardoublequote}{\isacharcomma}\ simplified{\isacharbrackright}{\isacharparenright}\isanewline
   362 \isacommand{apply}{\isacharparenleft}drule\ part{\isadigit{2}}{\isacharbrackleft}of\ {\isachardoublequote}{\isasymlambda}x{\isachardot}\ x{\isacharequal}a{\isachardoublequote}{\isacharcomma}\ simplified{\isacharbrackright}{\isacharparenright}\isanewline
   281 \ \ \isamarkupfalse%
   363 \ \ \isamarkupfalse%
   282 \isacommand{apply}{\isacharparenleft}assumption{\isacharparenright}\isamarkupfalse%
   364 \isacommand{apply}{\isacharparenleft}assumption{\isacharparenright}\isamarkuptrue%
   283 %
   365 %
   284 \begin{isamarkuptxt}%
   366 \begin{isamarkuptxt}%
   285 \noindent
   367 \noindent
   286 Now it is time to decompose \isa{v} in the conclusion \isa{b\ {\isacharhash}\ v\ {\isasymin}\ A}
   368 Now it is time to decompose \isa{v} in the conclusion \isa{b\ {\isacharhash}\ v\ {\isasymin}\ A}
   287 into \isa{take\ i\ v\ {\isacharat}\ drop\ i\ v},%
   369 into \isa{take\ i\ v\ {\isacharat}\ drop\ i\ v},%
   288 \end{isamarkuptxt}%
   370 \end{isamarkuptxt}%
   289 \ \isamarkuptrue%
   371 \ \isamarkupfalse%
   290 \isacommand{apply}{\isacharparenleft}rule{\isacharunderscore}tac\ n{\isadigit{1}}{\isacharequal}i\ \isakeyword{and}\ t{\isacharequal}v\ \isakeyword{in}\ subst{\isacharbrackleft}OF\ append{\isacharunderscore}take{\isacharunderscore}drop{\isacharunderscore}id{\isacharbrackright}{\isacharparenright}\isamarkupfalse%
   372 \isacommand{apply}{\isacharparenleft}rule{\isacharunderscore}tac\ n{\isadigit{1}}{\isacharequal}i\ \isakeyword{and}\ t{\isacharequal}v\ \isakeyword{in}\ subst{\isacharbrackleft}OF\ append{\isacharunderscore}take{\isacharunderscore}drop{\isacharunderscore}id{\isacharbrackright}{\isacharparenright}\isamarkuptrue%
   291 %
   373 %
   292 \begin{isamarkuptxt}%
   374 \begin{isamarkuptxt}%
   293 \noindent
   375 \noindent
   294 (the variables \isa{n{\isadigit{1}}} and \isa{t} are the result of composing the
   376 (the variables \isa{n{\isadigit{1}}} and \isa{t} are the result of composing the
   295 theorems \isa{subst} and \isa{append{\isacharunderscore}take{\isacharunderscore}drop{\isacharunderscore}id})
   377 theorems \isa{subst} and \isa{append{\isacharunderscore}take{\isacharunderscore}drop{\isacharunderscore}id})
   296 after which the appropriate rule of the grammar reduces the goal
   378 after which the appropriate rule of the grammar reduces the goal
   297 to the two subgoals \isa{take\ i\ v\ {\isasymin}\ A} and \isa{drop\ i\ v\ {\isasymin}\ A}:%
   379 to the two subgoals \isa{take\ i\ v\ {\isasymin}\ A} and \isa{drop\ i\ v\ {\isasymin}\ A}:%
   298 \end{isamarkuptxt}%
   380 \end{isamarkuptxt}%
   299 \ \isamarkuptrue%
   381 \ \isamarkupfalse%
   300 \isacommand{apply}{\isacharparenleft}rule\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}intros{\isacharparenright}\isamarkupfalse%
   382 \isacommand{apply}{\isacharparenleft}rule\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}intros{\isacharparenright}\isamarkuptrue%
   301 %
   383 %
   302 \begin{isamarkuptxt}%
   384 \begin{isamarkuptxt}%
   303 Both subgoals follow from the induction hypothesis because both \isa{take\ i\ v} and \isa{drop\ i\ v} are shorter than \isa{w}:%
   385 Both subgoals follow from the induction hypothesis because both \isa{take\ i\ v} and \isa{drop\ i\ v} are shorter than \isa{w}:%
   304 \end{isamarkuptxt}%
   386 \end{isamarkuptxt}%
   305 \ \ \isamarkuptrue%
   387 \ \ \isamarkupfalse%
   306 \isacommand{apply}{\isacharparenleft}force\ simp\ add{\isacharcolon}\ min{\isacharunderscore}less{\isacharunderscore}iff{\isacharunderscore}disj{\isacharparenright}\isanewline
   388 \isacommand{apply}{\isacharparenleft}force\ simp\ add{\isacharcolon}\ min{\isacharunderscore}less{\isacharunderscore}iff{\isacharunderscore}disj{\isacharparenright}\isanewline
   307 \ \isamarkupfalse%
   389 \ \isamarkupfalse%
   308 \isacommand{apply}{\isacharparenleft}force\ split\ add{\isacharcolon}\ nat{\isacharunderscore}diff{\isacharunderscore}split{\isacharparenright}\isamarkupfalse%
   390 \isacommand{apply}{\isacharparenleft}force\ split\ add{\isacharcolon}\ nat{\isacharunderscore}diff{\isacharunderscore}split{\isacharparenright}\isamarkuptrue%
   309 %
   391 %
   310 \begin{isamarkuptxt}%
   392 \begin{isamarkuptxt}%
   311 The case \isa{w\ {\isacharequal}\ b\ {\isacharhash}\ v} is proved analogously:%
   393 The case \isa{w\ {\isacharequal}\ b\ {\isacharhash}\ v} is proved analogously:%
   312 \end{isamarkuptxt}%
   394 \end{isamarkuptxt}%
   313 \isamarkuptrue%
   395 \isamarkupfalse%
   314 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isanewline
   396 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isanewline
   315 \isamarkupfalse%
   397 \isamarkupfalse%
   316 \isacommand{apply}{\isacharparenleft}frule\ part{\isadigit{1}}{\isacharbrackleft}of\ {\isachardoublequote}{\isasymlambda}x{\isachardot}\ x{\isacharequal}b{\isachardoublequote}{\isacharcomma}\ simplified{\isacharbrackright}{\isacharparenright}\isanewline
   398 \isacommand{apply}{\isacharparenleft}frule\ part{\isadigit{1}}{\isacharbrackleft}of\ {\isachardoublequote}{\isasymlambda}x{\isachardot}\ x{\isacharequal}b{\isachardoublequote}{\isacharcomma}\ simplified{\isacharbrackright}{\isacharparenright}\isanewline
   317 \isamarkupfalse%
   399 \isamarkupfalse%
   318 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isanewline
   400 \isacommand{apply}{\isacharparenleft}clarify{\isacharparenright}\isanewline
   325 \isamarkupfalse%
   407 \isamarkupfalse%
   326 \isacommand{apply}{\isacharparenleft}rule\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}intros{\isacharparenright}\isanewline
   408 \isacommand{apply}{\isacharparenleft}rule\ S{\isacharunderscore}A{\isacharunderscore}B{\isachardot}intros{\isacharparenright}\isanewline
   327 \ \isamarkupfalse%
   409 \ \isamarkupfalse%
   328 \isacommand{apply}{\isacharparenleft}force\ simp\ add{\isacharcolon}\ min{\isacharunderscore}less{\isacharunderscore}iff{\isacharunderscore}disj{\isacharparenright}\isanewline
   410 \isacommand{apply}{\isacharparenleft}force\ simp\ add{\isacharcolon}\ min{\isacharunderscore}less{\isacharunderscore}iff{\isacharunderscore}disj{\isacharparenright}\isanewline
   329 \isamarkupfalse%
   411 \isamarkupfalse%
   330 \isacommand{by}{\isacharparenleft}force\ simp\ add{\isacharcolon}\ min{\isacharunderscore}less{\isacharunderscore}iff{\isacharunderscore}disj\ split\ add{\isacharcolon}\ nat{\isacharunderscore}diff{\isacharunderscore}split{\isacharparenright}\isamarkupfalse%
   412 \isacommand{by}{\isacharparenleft}force\ simp\ add{\isacharcolon}\ min{\isacharunderscore}less{\isacharunderscore}iff{\isacharunderscore}disj\ split\ add{\isacharcolon}\ nat{\isacharunderscore}diff{\isacharunderscore}split{\isacharparenright}%
       
   413 \endisatagproof
       
   414 {\isafoldproof}%
       
   415 %
       
   416 \isadelimproof
       
   417 %
       
   418 \endisadelimproof
       
   419 \isamarkuptrue%
   331 %
   420 %
   332 \begin{isamarkuptext}%
   421 \begin{isamarkuptext}%
   333 We conclude this section with a comparison of our proof with 
   422 We conclude this section with a comparison of our proof with 
   334 Hopcroft\index{Hopcroft, J. E.} and Ullman's\index{Ullman, J. D.}
   423 Hopcroft\index{Hopcroft, J. E.} and Ullman's\index{Ullman, J. D.}
   335 \cite[p.\ts81]{HopcroftUllman}.
   424 \cite[p.\ts81]{HopcroftUllman}.
   352 even have overlooked the slight difficulty lurking in the omitted
   441 even have overlooked the slight difficulty lurking in the omitted
   353 cases.  Such errors are found in many pen-and-paper proofs when they
   442 cases.  Such errors are found in many pen-and-paper proofs when they
   354 are scrutinized formally.%
   443 are scrutinized formally.%
   355 \index{grammars!defining inductively|)}%
   444 \index{grammars!defining inductively|)}%
   356 \end{isamarkuptext}%
   445 \end{isamarkuptext}%
   357 \isamarkuptrue%
   446 %
   358 \isamarkupfalse%
   447 \isadelimtheory
       
   448 %
       
   449 \endisadelimtheory
       
   450 %
       
   451 \isatagtheory
       
   452 %
       
   453 \endisatagtheory
       
   454 {\isafoldtheory}%
       
   455 %
       
   456 \isadelimtheory
       
   457 %
       
   458 \endisadelimtheory
   359 \end{isabellebody}%
   459 \end{isabellebody}%
   360 %%% Local Variables:
   460 %%% Local Variables:
   361 %%% mode: latex
   461 %%% mode: latex
   362 %%% TeX-master: "root"
   462 %%% TeX-master: "root"
   363 %%% End:
   463 %%% End: