929 \begin{quote}\em |
929 \begin{quote}\em |
930 Do not manipulate the proof state into a particular form by applying |
930 Do not manipulate the proof state into a particular form by applying |
931 tactics but state the desired form explicitly and let the tactic verify |
931 tactics but state the desired form explicitly and let the tactic verify |
932 that from this form the original goal follows. |
932 that from this form the original goal follows. |
933 \end{quote} |
933 \end{quote} |
934 This yields more readable and also more robust proofs.% |
934 This yields more readable and also more robust proofs. |
935 \end{isamarkuptext}% |
935 |
936 \isamarkuptrue% |
936 \subsubsection{General case distinctions} |
|
937 |
|
938 As an important application of raw proof blocks we show how to deal |
|
939 with general case distinctions --- more specific kinds are treated in |
|
940 \S\ref{sec:CaseDistinction}. Imagine that you would like to prove some |
|
941 goal by distinguishing $n$ cases $P_1$, \dots, $P_n$. You show that |
|
942 the $n$ cases are exhaustive (i.e.\ $P_1 \lor \dots \lor P_n$) and |
|
943 that each case $P_i$ implies the goal. Taken together, this proves the |
|
944 goal. The corresponding Isar proof pattern (for $n = 3$) is very handy:% |
|
945 \end{isamarkuptext}% |
|
946 \isamarkuptrue% |
|
947 % |
|
948 \renewcommand{\isamarkupcmt}[1]{#1} |
|
949 \isamarkupfalse% |
|
950 \isacommand{proof}\ {\isacharminus}\isanewline |
|
951 \ \ \isamarkupfalse% |
|
952 \isacommand{have}\ {\isachardoublequote}P\isactrlisub {\isadigit{1}}\ {\isasymor}\ P\isactrlisub {\isadigit{2}}\ {\isasymor}\ P\isactrlisub {\isadigit{3}}{\isachardoublequote}\ \isamarkupfalse% |
|
953 \ % |
|
954 \isamarkupcmt{\dots% |
|
955 } |
|
956 \isanewline |
|
957 \ \ \isamarkupfalse% |
|
958 \isacommand{moreover}\isanewline |
|
959 \ \ \isamarkupfalse% |
|
960 \isacommand{{\isacharbraceleft}}\ \isamarkupfalse% |
|
961 \isacommand{assume}\ P\isactrlisub {\isadigit{1}}\isanewline |
|
962 \ \ \ \ % |
|
963 \isamarkupcmt{\dots% |
|
964 } |
|
965 \isanewline |
|
966 \ \ \ \ \isamarkupfalse% |
|
967 \isacommand{have}\ {\isacharquery}thesis\ \isamarkupfalse% |
|
968 \ % |
|
969 \isamarkupcmt{\dots% |
|
970 } |
|
971 \ \isamarkupfalse% |
|
972 \isacommand{{\isacharbraceright}}\isanewline |
|
973 \ \ \isamarkupfalse% |
|
974 \isacommand{moreover}\isanewline |
|
975 \ \ \isamarkupfalse% |
|
976 \isacommand{{\isacharbraceleft}}\ \isamarkupfalse% |
|
977 \isacommand{assume}\ P\isactrlisub {\isadigit{2}}\isanewline |
|
978 \ \ \ \ % |
|
979 \isamarkupcmt{\dots% |
|
980 } |
|
981 \isanewline |
|
982 \ \ \ \ \isamarkupfalse% |
|
983 \isacommand{have}\ {\isacharquery}thesis\ \isamarkupfalse% |
|
984 \ % |
|
985 \isamarkupcmt{\dots% |
|
986 } |
|
987 \ \isamarkupfalse% |
|
988 \isacommand{{\isacharbraceright}}\isanewline |
|
989 \ \ \isamarkupfalse% |
|
990 \isacommand{moreover}\isanewline |
|
991 \ \ \isamarkupfalse% |
|
992 \isacommand{{\isacharbraceleft}}\ \isamarkupfalse% |
|
993 \isacommand{assume}\ P\isactrlisub {\isadigit{3}}\isanewline |
|
994 \ \ \ \ % |
|
995 \isamarkupcmt{\dots% |
|
996 } |
|
997 \isanewline |
|
998 \ \ \ \ \isamarkupfalse% |
|
999 \isacommand{have}\ {\isacharquery}thesis\ \isamarkupfalse% |
|
1000 \ % |
|
1001 \isamarkupcmt{\dots% |
|
1002 } |
|
1003 \ \isamarkupfalse% |
|
1004 \isacommand{{\isacharbraceright}}\isanewline |
|
1005 \ \ \isamarkupfalse% |
|
1006 \isacommand{ultimately}\ \isamarkupfalse% |
|
1007 \isacommand{show}\ {\isacharquery}thesis\ \isamarkupfalse% |
|
1008 \isacommand{by}\ blast\isanewline |
|
1009 \isamarkupfalse% |
|
1010 \isacommand{qed}\isamarkupfalse% |
|
1011 % |
|
1012 \renewcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}} |
937 % |
1013 % |
938 \isamarkupsubsection{Further refinements% |
1014 \isamarkupsubsection{Further refinements% |
939 } |
1015 } |
940 \isamarkuptrue% |
1016 \isamarkuptrue% |
941 % |
1017 % |
1018 % |
1094 % |
1019 \begin{isamarkuptext}% |
1095 \begin{isamarkuptext}% |
1020 \noindent The concrete syntax is dropped at the end of the proof and the |
1096 \noindent The concrete syntax is dropped at the end of the proof and the |
1021 theorem becomes \begin{isabelle}% |
1097 theorem becomes \begin{isabelle}% |
1022 {\isasymlbrakk}{\isasymAnd}x\ y{\isachardot}\ {\isacharquery}f\ x\ y\ {\isacharequal}\ {\isacharquery}f\ y\ x{\isacharsemicolon}\isanewline |
1098 {\isasymlbrakk}{\isasymAnd}x\ y{\isachardot}\ {\isacharquery}f\ x\ y\ {\isacharequal}\ {\isacharquery}f\ y\ x{\isacharsemicolon}\isanewline |
1023 \isaindent{\ \ \ }{\isasymAnd}x\ y\ z{\isachardot}\ {\isacharquery}r\ x\ y\ {\isasymLongrightarrow}\ {\isacharquery}r\ {\isacharparenleft}{\isacharquery}f\ x\ z{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f\ y\ z{\isacharparenright}{\isacharsemicolon}\ {\isacharquery}r\ {\isacharquery}x\ {\isacharquery}y{\isasymrbrakk}\isanewline |
1099 \isaindent{\ }{\isasymAnd}x\ y\ z{\isachardot}\ {\isacharquery}r\ x\ y\ {\isasymLongrightarrow}\ {\isacharquery}r\ {\isacharparenleft}{\isacharquery}f\ x\ z{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f\ y\ z{\isacharparenright}{\isacharsemicolon}\ {\isacharquery}r\ {\isacharquery}x\ {\isacharquery}y{\isasymrbrakk}\isanewline |
1024 {\isasymLongrightarrow}\ {\isacharquery}r\ {\isacharparenleft}{\isacharquery}f\ {\isacharquery}z\ {\isacharquery}x{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f\ {\isacharquery}z\ {\isacharquery}y{\isacharparenright}% |
1100 {\isasymLongrightarrow}\ {\isacharquery}r\ {\isacharparenleft}{\isacharquery}f\ {\isacharquery}z\ {\isacharquery}x{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f\ {\isacharquery}z\ {\isacharquery}y{\isacharparenright}% |
1025 \end{isabelle} |
1101 \end{isabelle} |
1026 \tweakskip% |
1102 \tweakskip% |
1027 \end{isamarkuptext}% |
1103 \end{isamarkuptext}% |
1028 \isamarkuptrue% |
1104 \isamarkuptrue% |