diff -r f38ccabb2edc -r fe5ceb6e9a7d doc-src/IsarRef/Thy/First_Order_Logic.thy --- a/doc-src/IsarRef/Thy/First_Order_Logic.thy Thu Feb 12 21:15:54 2009 +0100 +++ b/doc-src/IsarRef/Thy/First_Order_Logic.thy Thu Feb 12 22:23:09 2009 +0100 @@ -168,7 +168,7 @@ end -subsection {* Propositional logic *} +subsection {* Propositional logic \label{sec:framework-ex-prop} *} text {* We axiomatize basic connectives of propositional logic: implication, @@ -183,15 +183,15 @@ axiomatization disj :: "o \ o \ o" (infixr "\" 30) where - disjE [elim]: "A \ B \ (A \ C) \ (B \ C) \ C" and disjI\<^isub>1 [intro]: "A \ A \ B" and - disjI\<^isub>2 [intro]: "B \ A \ B" + disjI\<^isub>2 [intro]: "B \ A \ B" and + disjE [elim]: "A \ B \ (A \ C) \ (B \ C) \ C" axiomatization conj :: "o \ o \ o" (infixr "\" 35) where conjI [intro]: "A \ B \ A \ B" and - conjD\<^isub>1 [dest]: "A \ B \ A" and - conjD\<^isub>2 [dest]: "A \ B \ B" + conjD\<^isub>1: "A \ B \ A" and + conjD\<^isub>2: "A \ B \ B" text {* \noindent The conjunctive destructions have the disadvantage that @@ -205,8 +205,8 @@ assumes "A \ B" obtains A and B proof - from `A \ B` show A .. - from `A \ B` show B .. + from `A \ B` show A by (rule conjD\<^isub>1) + from `A \ B` show B by (rule conjD\<^isub>2) qed text {* @@ -326,7 +326,7 @@ end -subsection {* Quantifiers *} +subsection {* Quantifiers \label{sec:framework-ex-quant} *} text {* Representing quantifiers is easy, thanks to the higher-order nature @@ -363,4 +363,156 @@ then show "\x. R x y" .. -- {* @{text "\"} introduction *} qed + +subsection {* Canonical reasoning patterns *} + +text {* + The main rules of first-order predicate logic from + \secref{sec:framework-ex-prop} and \secref{sec:framework-ex-quant} + can now be summarized as follows, using the native Isar statement + format of \secref{sec:framework-stmt}. + + \medskip + \begin{tabular}{l} + @{text "impI: \ A \ B \ A \ B"} \\ + @{text "impD: \ A \ B \ A \ B"} \\[1ex] + + @{text "disjI\<^isub>1: \ A \ A \ B"} \\ + @{text "disjI\<^isub>2: \ B \ A \ B"} \\ + @{text "disjE: \ A \ B \ A \ B"} \\[1ex] + + @{text "conjI: \ A \ B \ A \ B"} \\ + @{text "conjE: \ A \ B \ A \ B"} \\[1ex] + + @{text "falseE: \ \ \ A"} \\ + @{text "trueI: \ \"} \\[1ex] + + @{text "notI: \ A \ \ \ \ A"} \\ + @{text "notE: \ \ A \ A \ B"} \\[1ex] + + @{text "allI: \ \x. B x \ \x. B x"} \\ + @{text "allE: \ \x. B x \ B a"} \\[1ex] + + @{text "exI: \ B a \ \x. B x"} \\ + @{text "exE: \ \x. B x \ a \ B a"} + \end{tabular} + \medskip + + \noindent This essentially provides a declarative reading of Pure + rules as Isar reasoning patterns: the rule statements tells how a + canonical proof outline shall look like. Since the above rules have + already been declared as @{attribute intro}, @{attribute elim}, + @{attribute dest} --- each according to its particular shape --- we + can immediately write Isar proof texts as follows. +*} + +(*<*) +theorem "\A. PROP A \ PROP A" +proof - +(*>*) + + txt_raw {*\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "A \ B" + proof + assume A + show B sorry %noproof + qed + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "A \ B" and A sorry %noproof + then have B .. + + txt_raw {*\end{minipage}\\[3ex]\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have A sorry %noproof + then have "A \ B" .. + + have B sorry %noproof + then have "A \ B" .. + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "A \ B" sorry %noproof + then have C + proof + assume A + then show C sorry %noproof + next + assume B + then show C sorry %noproof + qed + + txt_raw {*\end{minipage}\\[3ex]\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have A and B sorry %noproof + then have "A \ B" .. + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "A \ B" sorry %noproof + then obtain A and B .. + + txt_raw {*\end{minipage}\\[3ex]\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\" sorry %noproof + then have A .. + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\" .. + + txt_raw {*\end{minipage}\\[3ex]\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\ A" + proof + assume A + then show "\" sorry %noproof + qed + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\ A" and A sorry %noproof + then have B .. + + txt_raw {*\end{minipage}\\[3ex]\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\x. B x" + proof + fix x + show "B x" sorry %noproof + qed + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\x. B x" sorry %noproof + then have "B a" .. + + txt_raw {*\end{minipage}\\[3ex]\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\x. B x" + proof + show "B a" sorry %noproof + qed + + txt_raw {*\end{minipage}\qquad\begin{minipage}[t]{0.4\textwidth}*}(*<*)next(*>*) + + have "\x. B x" sorry %noproof + then obtain a where "B a" .. + + txt_raw {*\end{minipage}*} + +(*<*) +qed +(*>*) + +text {* + \bigskip\noindent Of course, these proofs are merely examples. As + sketched in \secref{sec:framework-subproof}, there is a fair amount + of flexibility in expressing Pure deductions in Isar. Here the user + is asked to express himself adequately, aiming at proof texts of + literary quality. +*} + end %visible