doc-src/TutorialI/Misc/case_splits.thy
changeset 9721 7e51c9f3d5a0
parent 9541 d17c0b34d5c8
child 9723 a977245dfc8a
equal deleted inserted replaced
9720:3b7b72db57f1 9721:7e51c9f3d5a0
    79 text{*\noindent
    79 text{*\noindent
    80 or globally:
    80 or globally:
    81 *}
    81 *}
    82 lemmas [split del] = list.split;
    82 lemmas [split del] = list.split;
    83 
    83 
       
    84 text{*
       
    85 The above split rules intentionally only affect the conclusion of a
       
    86 subgoal.  If you want to split an \isa{if} or \isa{case}-expression in
       
    87 the assumptions, you have to apply \isa{split\_if\_asm} or $t$\isa{.split_asm}:
       
    88 *}
       
    89 
       
    90 lemma "if xs = [] then ys ~= [] else ys = [] ==> xs @ ys ~= []"
       
    91 apply(simp only: split: split_if_asm);
       
    92 
       
    93 txt{*\noindent
       
    94 In contrast to splitting the conclusion, this actually creates two
       
    95 separate subgoals (which are solved by \isa{simp\_all}):
       
    96 \begin{isabelle}
       
    97 \ \isadigit{1}{\isachardot}\ {\isasymlbrakk}\mbox{xs}\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}{\isacharsemicolon}\ \mbox{ys}\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharat}\ \mbox{ys}\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}\isanewline
       
    98 \ \isadigit{2}{\isachardot}\ {\isasymlbrakk}\mbox{xs}\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}{\isacharsemicolon}\ \mbox{ys}\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ \mbox{xs}\ {\isacharat}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}
       
    99 \end{isabelle}
       
   100 If you need to split both in the assumptions and the conclusion,
       
   101 use $t$\isa{.splits} which subsumes $t$\isa{.split} and $t$\isa{.split_asm}.
       
   102 *}
       
   103 
    84 (*<*)
   104 (*<*)
       
   105 by(simp_all)
    85 end
   106 end
    86 (*>*)
   107 (*>*)