doc-src/TutorialI/Misc/case_splits.thy
changeset 9723 a977245dfc8a
parent 9721 7e51c9f3d5a0
child 9792 bbefb6ce5cb2
equal deleted inserted replaced
9722:a5f86aed785b 9723:a977245dfc8a
     9 
     9 
    10 lemma "\\<forall>xs. if xs = [] then rev xs = [] else rev xs \\<noteq> []";
    10 lemma "\\<forall>xs. if xs = [] then rev xs = [] else rev xs \\<noteq> []";
    11 
    11 
    12 txt{*\noindent
    12 txt{*\noindent
    13 can be split into
    13 can be split into
    14 \begin{isabellepar}%
    14 \begin{isabelle}
    15 ~1.~{\isasymforall}xs.~(xs~=~[]~{\isasymlongrightarrow}~rev~xs~=~[])~{\isasymand}~(xs~{\isasymnoteq}~[]~{\isasymlongrightarrow}~rev~xs~{\isasymnoteq}~[])%
    15 ~1.~{\isasymforall}xs.~(xs~=~[]~{\isasymlongrightarrow}~rev~xs~=~[])~{\isasymand}~(xs~{\isasymnoteq}~[]~{\isasymlongrightarrow}~rev~xs~{\isasymnoteq}~[])%
    16 \end{isabellepar}%
    16 \end{isabelle}
    17 by a degenerate form of simplification
    17 by a degenerate form of simplification
    18 *}
    18 *}
    19 
    19 
    20 apply(simp only: split: split_if);
    20 apply(simp only: split: split_if);
    21 (*<*)oops;(*>*)
    21 (*<*)oops;(*>*)
    32 *}
    32 *}
    33 
    33 
    34 lemma "(case xs of [] \\<Rightarrow> zs | y#ys \\<Rightarrow> y#(ys@zs)) = xs@zs";
    34 lemma "(case xs of [] \\<Rightarrow> zs | y#ys \\<Rightarrow> y#(ys@zs)) = xs@zs";
    35 txt{*\noindent
    35 txt{*\noindent
    36 becomes
    36 becomes
    37 \begin{isabellepar}%
    37 \begin{isabelle}
    38 ~1.~(xs~=~[]~{\isasymlongrightarrow}~zs~=~xs~@~zs)~{\isasymand}\isanewline
    38 ~1.~(xs~=~[]~{\isasymlongrightarrow}~zs~=~xs~@~zs)~{\isasymand}\isanewline
    39 ~~~~({\isasymforall}a~list.~xs~=~a~\#~list~{\isasymlongrightarrow}~a~\#~list~@~zs~=~xs~@~zs)%
    39 ~~~~({\isasymforall}a~list.~xs~=~a~\#~list~{\isasymlongrightarrow}~a~\#~list~@~zs~=~xs~@~zs)%
    40 \end{isabellepar}%
    40 \end{isabelle}
    41 by typing
    41 by typing
    42 *}
    42 *}
    43 
    43 
    44 apply(simp only: split: list.split);
    44 apply(simp only: split: list.split);
    45 (*<*)oops;(*>*)
    45 (*<*)oops;(*>*)