text\<open>
The following theory development illustrates the foundations of
Higher-Order Logic. The ``HOL'' logic that is given here resembles \<^cite>\<open>"Gordon:1985:HOL"\<close> and its predecessor \<^cite>\<open>"church40"\<close>, but
the order of axiomatizations and defined connectives has be adapted to
modern presentations of \<open>\<lambda>\<close>-calculus and Constructive Type Theory. Thus
it fits nicely to the underlying Natural Deduction framework of
Isabelle/Pure and Isabelle/Isar. \<close>
section \<open>HOL syntax within Pure\<close>
class type
default_sort type
typedecl o instance o :: type .. instance"fun" :: (type, type) type ..
lemmanotE [elim]: assumes"\ A" and A shows B proof - from\<open>\<not> A\<close> have "A \<longrightarrow> False" by (simp only: not_def) from this and\<open>A\<close> have "False" .. thenshow B .. qed
lemmanotE': "A \ \ A \ B" by (rule notE)
lemmas contradiction = notEnotE' \ \proof by contradiction in any order\
definition conj :: "o \ o \ o" (infixr \\\ 35) where"A \ B \ \C. (A \ B \ C) \ C"
lemma conjI [intro]: assumes A and B shows"A \ B" unfolding conj_def proof fix C show"(A \ B \ C) \ C" proof assume"A \ B \ C" alsonote\<open>A\<close> alsonote\<open>B\<close> finallyshow C . qed qed
lemma conjE [elim]: assumes"A \ B" obtains A and B proof from\<open>A \<and> B\<close> have *: "(A \<longrightarrow> B \<longrightarrow> C) \<longrightarrow> C" for C unfolding conj_def .. show A proof - note * [of A] alsohave"A \ B \ A" proof assume A thenshow"B \ A" .. qed finallyshow ?thesis . qed show B proof - note * [of B] alsohave"A \ B \ B" proof show"B \ B" .. qed finallyshow ?thesis . qed qed
definition disj :: "o \ o \ o" (infixr \\\ 30) where"A \ B \ \C. (A \ C) \ (B \ C) \ C"
lemma disjI1 [intro]: assumes A shows"A \ B" unfolding disj_def proof fix C show"(A \ C) \ (B \ C) \ C" proof assume"A \ C" from this and\<open>A\<close> have C .. thenshow"(B \ C) \ C" .. qed qed
lemma disjI2 [intro]: assumes B shows"A \ B" unfolding disj_def proof fix C show"(A \ C) \ (B \ C) \ C" proof show"(B \ C) \ C" proof assume"B \ C" from this and\<open>B\<close> show C .. qed qed qed
lemma disjE [elim]: assumes"A \ B" obtains (a) A | (b) B proof - from\<open>A \<or> B\<close> have "(A \<longrightarrow> thesis) \<longrightarrow> (B \<longrightarrow> thesis) \<longrightarrow> thesis" unfolding disj_def .. alsohave"A \ thesis" proof assume A thenshow thesis by (rule a) qed alsohave"B \ thesis" proof assume B thenshow thesis by (rule b) qed finallyshow thesis . qed
definition Ex :: "('a \ o) \ o" (binder \\\ 10) where"\x. P x \ \C. (\x. P x \ C) \ C"
lemma exI [intro]: "P a \ \x. P x" unfolding Ex_def proof fix C assume"P a" show"(\x. P x \ C) \ C" proof assume"\x. P x \ C" thenhave"P a \ C" .. from this and\<open>P a\<close> show C .. qed qed
lemma exE [elim]: assumes"\x. P x" obtains (that) x where"P x" proof - from\<open>\<exists>x. P x\<close> have "(\<forall>x. P x \<longrightarrow> thesis) \<longrightarrow> thesis" unfolding Ex_def .. alsohave"\x. P x \ thesis" proof fix x show"P x \ thesis" proof assume"P x" thenshow thesis by (rule that) qed qed finallyshow thesis . qed
subsubsection \<open>Extensional equality\<close>
axiomatization equal :: "'a \ 'a \ o" (infixl \=\ 50) where refl [intro]: "x = x" and subst: "x = y \ P x \ P y"
abbreviation not_equal :: "'a \ 'a \ o" (infixl \\\ 50) where"x \ y \ \ (x = y)"
abbreviation iff :: "o \ o \ o" (infixr \\\ 25) where"A \ B \ A = B"
axiomatization where ext [intro]: "(\x. f x = g x) \ f = g" and iff [intro]: "(A \ B) \ (B \ A) \ A \ B" for f g :: "'a \ 'b"
lemma sym [sym]: "y = x"if"x = y" using that by (rule subst) (rule refl)
lemma [trans]: "x = y \ P y \ P x" by (rule subst) (rule sym)
lemma [trans]: "P x \ x = y \ P y" by (rule subst)
lemma arg_cong: "f x = f y"if"x = y" using that by (rule subst) (rule refl)
lemma fun_cong: "f x = g x"if"f = g" using that by (rule subst) (rule refl)
lemma trans [trans]: "x = y \ y = z \ x = z" by (rule subst)
lemma iff1 [elim]: "A \ B \ A \ B" by (rule subst)
lemma iff2 [elim]: "A \ B \ B \ A" by (rule subst) (rule sym)
subsection \<open>Cantor's Theorem\<close>
text\<open>
Cantor's Theorem states that there is no surjection from a set to its
powerset. The subsequent formulation uses elementary \<open>\<lambda>\<close>-calculus and
predicate logic, with standard introduction and elimination rules. \<close>
lemma iff_contradiction: assumes *: "\ A \ A" shows C proof (rule notE) show"\ A" proof assume A with * have"\ A" .. from this and\<open>A\<close> show False .. qed with * show A .. qed
theorem Cantor: "\ (\f :: 'a \ 'a \ o. \A. \x. A = f x)" proof assume"\f :: 'a \ 'a \ o. \A. \x. A = f x" thenobtain f :: "'a \ 'a \ o" where *: "\A. \x. A = f x" .. let ?D = "\x. \ f x x" from * have"\x. ?D = f x" .. thenobtain a where"?D = f a" .. thenhave"?D a \ f a a" using refl by (rule subst) thenhave"\ f a a \ f a a" . thenshow False by (rule iff_contradiction) qed
subsection \<open>Characterization of Classical Logic\<close>
text\<open>
The subsequent rules of classical reasoning are all equivalent. \<close>
locale classical = assumes classical: "(\ A \ A) \ A" \<comment> \<open>predicate definition and hypothetical context\<close> begin
lemma classical_contradiction: assumes"\ A \ False" shows A proof (rule classical) assume"\ A" thenhave False by (rule assms) thenshow A .. qed
lemma double_negation: assumes"\ \ A" shows A proof (rule classical_contradiction) assume"\ A" with\<open>\<not> \<not> A\<close> show False by (rule contradiction) qed
lemma tertium_non_datur: "A \ \ A" proof (rule double_negation) show"\ \ (A \ \ A)" proof assume"\ (A \ \ A)" have"\ A" proof assume A thenhave"A \ \ A" .. with\<open>\<not> (A \<or> \<not> A)\<close> show False by (rule contradiction) qed thenhave"A \ \ A" .. with\<open>\<not> (A \<or> \<not> A)\<close> show False by (rule contradiction) qed qed
lemma classical_cases: obtains A | "\ A" using tertium_non_datur proof assume A thenshow thesis .. next assume"\ A" thenshow thesis .. qed
end
lemma classical_if_cases: classical if cases: "\A C. (A \ C) \ (\ A \ C) \ C" proof fix A assume *: "\ A \ A" show A proof (rule cases) assume A thenshow A . next assume"\ A" thenshow A by (rule *) qed qed
section \<open>Peirce's Law\<close>
text\<open>
Peirce's Law is another characterization of classical reasoning. Its
statement only requires implication. \<close>
theorem (in classical) Peirce's_Law: "((A \ B) \ A) \ A" proof assume *: "(A \ B) \ A" show A proof (rule classical) assume"\ A" have"A \ B" proof assume A with\<open>\<not> A\<close> show B by (rule contradiction) qed with * show A .. qed qed
text\<open> \<^medskip>
It follows a derivation of the classical law of tertium-non-datur by
means of Hilbert's choice operator (due to Berghofer, Beeson, Harrison,
based on a proofby Diaconescu). \<^medskip> \<close>
theorem Diaconescu: "A \ \ A" proof - let ?P = "\x. (A \ x) \ \ x" let ?Q = "\x. (A \ \ x) \ x"
have a: "?P (Eps ?P)" proof (rule someI) have"\ False" .. thenshow"?P False" .. qed have b: "?Q (Eps ?Q)" proof (rule someI) have True .. thenshow"?Q True" .. qed
from a show ?thesis proof assume"A \ Eps ?P" thenhave A .. thenshow ?thesis .. next assume"\ Eps ?P" from b show ?thesis proof assume"A \ \ Eps ?Q" thenhave A .. thenshow ?thesis .. next assume"Eps ?Q" have neq: "?P \ ?Q" proof assume"?P = ?Q" thenhave"Eps ?P \ Eps ?Q" by (rule arg_cong) alsonote\<open>Eps ?Q\<close> finallyhave"Eps ?P" . with\<open>\<not> Eps ?P\<close> show False by (rule contradiction) qed have"\ A" proof assume A have"?P = ?Q" proof (rule ext) show"?P x \ ?Q x" for x proof assume"?P x" thenshow"?Q x" proof assume"\ x" with\<open>A\<close> have "A \<and> \<not> x" .. thenshow ?thesis .. next assume"A \ x" thenhave x .. thenshow ?thesis .. qed next assume"?Q x" thenshow"?P x" proof assume"A \ \ x" thenhave"\ x" .. thenshow ?thesis .. next assume x with\<open>A\<close> have "A \<and> x" .. thenshow ?thesis .. qed qed qed with neq show False by (rule contradiction) qed thenshow ?thesis .. qed qed qed
text\<open>
This means, the hypothetical predicate \<^const>\<open>classical\<close> always holds
unconditionally (with all consequences). \<close>
interpretation classical proof (rule classical_if_cases) fix A C assume *: "A \ C" and **: "\ A \ C" from Diaconescu [of A] show C proof assume A thenshow C by (rule *) next assume"\ A" thenshow C by (rule **) qed qed
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.