doc-src/TutorialI/Types/document/Pairs.tex
changeset 13778 61272514e3b5
parent 13750 b5cd10cb106b
child 13791 3b6ff7ceaf27
equal deleted inserted replaced
13777:23e743ac9cec 13778:61272514e3b5
    99 This subgoal is easily proved by simplification. Thus we could have combined
    99 This subgoal is easily proved by simplification. Thus we could have combined
   100 simplification and splitting in one command that proves the goal outright:%
   100 simplification and splitting in one command that proves the goal outright:%
   101 \end{isamarkuptxt}%
   101 \end{isamarkuptxt}%
   102 \isamarkuptrue%
   102 \isamarkuptrue%
   103 \isamarkupfalse%
   103 \isamarkupfalse%
   104 \isanewline
       
   105 \isamarkupfalse%
   104 \isamarkupfalse%
   106 \isacommand{by}{\isacharparenleft}simp\ split{\isacharcolon}\ split{\isacharunderscore}split{\isacharparenright}\isamarkupfalse%
   105 \isacommand{by}{\isacharparenleft}simp\ split{\isacharcolon}\ split{\isacharunderscore}split{\isacharparenright}\isamarkupfalse%
   107 %
   106 %
   108 \begin{isamarkuptext}%
   107 \begin{isamarkuptext}%
   109 Let us look at a second example:%
   108 Let us look at a second example:%
   119 \end{isabelle}
   118 \end{isabelle}
   120 A paired \isa{let} reduces to a paired $\lambda$-abstraction, which
   119 A paired \isa{let} reduces to a paired $\lambda$-abstraction, which
   121 can be split as above. The same is true for paired set comprehension:%
   120 can be split as above. The same is true for paired set comprehension:%
   122 \end{isamarkuptxt}%
   121 \end{isamarkuptxt}%
   123 \isamarkuptrue%
   122 \isamarkuptrue%
   124 \isanewline
       
   125 \isamarkupfalse%
   123 \isamarkupfalse%
   126 \isacommand{lemma}\ {\isachardoublequote}p\ {\isasymin}\ {\isacharbraceleft}{\isacharparenleft}x{\isacharcomma}y{\isacharparenright}{\isachardot}\ x{\isacharequal}y{\isacharbraceright}\ {\isasymlongrightarrow}\ fst\ p\ {\isacharequal}\ snd\ p{\isachardoublequote}\isanewline
   124 \isacommand{lemma}\ {\isachardoublequote}p\ {\isasymin}\ {\isacharbraceleft}{\isacharparenleft}x{\isacharcomma}y{\isacharparenright}{\isachardot}\ x{\isacharequal}y{\isacharbraceright}\ {\isasymlongrightarrow}\ fst\ p\ {\isacharequal}\ snd\ p{\isachardoublequote}\isanewline
   127 \isamarkupfalse%
   125 \isamarkupfalse%
   128 \isacommand{apply}\ simp\isamarkupfalse%
   126 \isacommand{apply}\ simp\isamarkupfalse%
   129 %
   127 %
   135 as above. If you are worried about the strange form of the premise:
   133 as above. If you are worried about the strange form of the premise:
   136 \isa{split\ op\ {\isacharequal}} is short for \isa{{\isasymlambda}{\isacharparenleft}x{\isacharcomma}y{\isacharparenright}{\isachardot}\ x{\isacharequal}y}.
   134 \isa{split\ op\ {\isacharequal}} is short for \isa{{\isasymlambda}{\isacharparenleft}x{\isacharcomma}y{\isacharparenright}{\isachardot}\ x{\isacharequal}y}.
   137 The same proof procedure works for%
   135 The same proof procedure works for%
   138 \end{isamarkuptxt}%
   136 \end{isamarkuptxt}%
   139 \isamarkuptrue%
   137 \isamarkuptrue%
   140 \isanewline
       
   141 \isamarkupfalse%
   138 \isamarkupfalse%
   142 \isacommand{lemma}\ {\isachardoublequote}p\ {\isasymin}\ {\isacharbraceleft}{\isacharparenleft}x{\isacharcomma}y{\isacharparenright}{\isachardot}\ x{\isacharequal}y{\isacharbraceright}\ {\isasymLongrightarrow}\ fst\ p\ {\isacharequal}\ snd\ p{\isachardoublequote}\isamarkupfalse%
   139 \isacommand{lemma}\ {\isachardoublequote}p\ {\isasymin}\ {\isacharbraceleft}{\isacharparenleft}x{\isacharcomma}y{\isacharparenright}{\isachardot}\ x{\isacharequal}y{\isacharbraceright}\ {\isasymLongrightarrow}\ fst\ p\ {\isacharequal}\ snd\ p{\isachardoublequote}\isamarkupfalse%
   143 %
   140 %
   144 \begin{isamarkuptxt}%
   141 \begin{isamarkuptxt}%
   145 \noindent
   142 \noindent
   148 
   145 
   149 However, splitting \isa{split} is not always a solution, as no \isa{split}
   146 However, splitting \isa{split} is not always a solution, as no \isa{split}
   150 may be present in the goal. Consider the following function:%
   147 may be present in the goal. Consider the following function:%
   151 \end{isamarkuptxt}%
   148 \end{isamarkuptxt}%
   152 \isamarkuptrue%
   149 \isamarkuptrue%
   153 \isanewline
       
   154 \isamarkupfalse%
   150 \isamarkupfalse%
   155 \isacommand{consts}\ swap\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b\ {\isasymRightarrow}\ {\isacharprime}b\ {\isasymtimes}\ {\isacharprime}a{\isachardoublequote}\isanewline
   151 \isacommand{consts}\ swap\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b\ {\isasymRightarrow}\ {\isacharprime}b\ {\isasymtimes}\ {\isacharprime}a{\isachardoublequote}\isanewline
   156 \isamarkupfalse%
   152 \isamarkupfalse%
   157 \isacommand{primrec}\isanewline
   153 \isacommand{primrec}\isanewline
   158 \ \ {\isachardoublequote}swap\ {\isacharparenleft}x{\isacharcomma}y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}y{\isacharcomma}x{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
   154 \ \ {\isachardoublequote}swap\ {\isacharparenleft}x{\isacharcomma}y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}y{\isacharcomma}x{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
   190 In case the term to be split is a quantified variable, there are more options.
   186 In case the term to be split is a quantified variable, there are more options.
   191 You can split \emph{all} \isa{{\isasymAnd}}-quantified variables in a goal
   187 You can split \emph{all} \isa{{\isasymAnd}}-quantified variables in a goal
   192 with the rewrite rule \isa{split{\isacharunderscore}paired{\isacharunderscore}all}:%
   188 with the rewrite rule \isa{split{\isacharunderscore}paired{\isacharunderscore}all}:%
   193 \end{isamarkuptxt}%
   189 \end{isamarkuptxt}%
   194 \isamarkuptrue%
   190 \isamarkuptrue%
   195 \isanewline
       
   196 \isamarkupfalse%
   191 \isamarkupfalse%
   197 \isacommand{lemma}\ {\isachardoublequote}{\isasymAnd}p\ q{\isachardot}\ swap{\isacharparenleft}swap\ p{\isacharparenright}\ {\isacharequal}\ q\ {\isasymlongrightarrow}\ p\ {\isacharequal}\ q{\isachardoublequote}\isanewline
   192 \isacommand{lemma}\ {\isachardoublequote}{\isasymAnd}p\ q{\isachardot}\ swap{\isacharparenleft}swap\ p{\isacharparenright}\ {\isacharequal}\ q\ {\isasymlongrightarrow}\ p\ {\isacharequal}\ q{\isachardoublequote}\isanewline
   198 \isamarkupfalse%
   193 \isamarkupfalse%
   199 \isacommand{apply}{\isacharparenleft}simp\ only{\isacharcolon}\ split{\isacharunderscore}paired{\isacharunderscore}all{\isacharparenright}\isamarkupfalse%
   194 \isacommand{apply}{\isacharparenleft}simp\ only{\isacharcolon}\ split{\isacharunderscore}paired{\isacharunderscore}all{\isacharparenright}\isamarkupfalse%
   200 %
   195 %
   220 of the simplifier.
   215 of the simplifier.
   221 The following command could fail (here it does not)
   216 The following command could fail (here it does not)
   222 where two separate \isa{simp} applications succeed.%
   217 where two separate \isa{simp} applications succeed.%
   223 \end{isamarkuptext}%
   218 \end{isamarkuptext}%
   224 \isamarkuptrue%
   219 \isamarkuptrue%
   225 \isanewline
   220 \isamarkupfalse%
   226 \isamarkupfalse%
   221 \isacommand{apply}{\isacharparenleft}simp\ add{\isacharcolon}\ split{\isacharunderscore}paired{\isacharunderscore}all{\isacharparenright}\isanewline
   227 \isacommand{apply}{\isacharparenleft}simp\ add{\isacharcolon}\ split{\isacharunderscore}paired{\isacharunderscore}all{\isacharparenright}\isamarkupfalse%
   222 \isamarkupfalse%
   228 \isamarkupfalse%
   223 \isamarkupfalse%
   229 %
   224 %
   230 \begin{isamarkuptext}%
   225 \begin{isamarkuptext}%
   231 \noindent
   226 \noindent
   232 Finally, the simplifier automatically splits all \isa{{\isasymforall}} and
   227 Finally, the simplifier automatically splits all \isa{{\isasymforall}} and
   249 \hfill
   244 \hfill
   250 (\isa{split{\isacharunderscore}paired{\isacharunderscore}Ex})
   245 (\isa{split{\isacharunderscore}paired{\isacharunderscore}Ex})
   251 \end{center}%
   246 \end{center}%
   252 \end{isamarkuptext}%
   247 \end{isamarkuptext}%
   253 \isamarkuptrue%
   248 \isamarkuptrue%
   254 \isanewline
       
   255 \isamarkupfalse%
   249 \isamarkupfalse%
   256 \end{isabellebody}%
   250 \end{isabellebody}%
   257 %%% Local Variables:
   251 %%% Local Variables:
   258 %%% mode: latex
   252 %%% mode: latex
   259 %%% TeX-master: "root"
   253 %%% TeX-master: "root"