# HG changeset patch # User wenzelm # Date 1007517918 -3600 # Node ID ab207f9c1e1eaa922f46ae341c7be12e4b184609 # Parent 2af9ad81ea5683d7db98788912e518b3c56a1702 added First_Order_Logic.thy; diff -r 2af9ad81ea56 -r ab207f9c1e1e src/FOL/ex/First_Order_Logic.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOL/ex/First_Order_Logic.thy Wed Dec 05 03:05:18 2001 +0100 @@ -0,0 +1,141 @@ +(* Title: FOL/ex/First_Order_Logic.thy + ID: $Id$ + Author: Markus Wenzel, TU Munich + License: GPL (GNU GENERAL PUBLIC LICENSE) +*) + +header {* A simple formulation of First-Order Logic *} + +theory First_Order_Logic = Pure: + +text {* + The subsequent theory development illustrates single-sorted + intuitionistic first-order logic with equality, formulated within + the Pure framework. Actually this is not an example of + Isabelle/FOL, but of Isabelle/Pure. +*} + +subsection {* Syntax *} + +typedecl i +typedecl o + +judgment + Trueprop :: "o \ prop" ("_" 5) + + +subsection {* Propositional logic *} + +consts + false :: o ("\") + imp :: "o \ o \ o" (infixr "\" 25) + conj :: "o \ o \ o" (infixr "\" 35) + disj :: "o \ o \ o" (infixr "\" 30) + +axioms + falseE [elim]: "\ \ A" + + impI [intro]: "(A \ B) \ A \ B" + mp [dest]: "A \ B \ A \ B" + + conjI [intro]: "A \ B \ A \ B" + conjD1: "A \ B \ A" + conjD2: "A \ B \ B" + + disjE [elim]: "A \ B \ (A \ C) \ (B \ C) \ C" + disjI1 [intro]: "A \ A \ B" + disjI2 [intro]: "B \ A \ B" + +theorem conjE [elim]: "A \ B \ (A \ B \ C) \ C" +proof - + assume ab: "A \ B" + assume r: "A \ B \ C" + show C + proof (rule r) + from ab show A by (rule conjD1) + from ab show B by (rule conjD2) + qed +qed + +constdefs + true :: o ("\") + "\ \ \ \ \" + not :: "o \ o" ("\ _" [40] 40) + "\ A \ A \ \" + +theorem trueI [intro]: \ +proof (unfold true_def) + show "\ \ \" .. +qed + +theorem notI [intro]: "(A \ \) \ \ A" +proof (unfold not_def) + assume "A \ \" + thus "A \ \" .. +qed + +theorem notE [elim]: "\ A \ A \ B" +proof (unfold not_def) + assume "A \ \" and A + hence \ .. thus B .. +qed + + +subsection {* Equality *} + +consts + equal :: "i \ i \ o" (infixl "=" 50) + +axioms + refl [intro]: "x = x" + subst: "x = y \ P(x) \ P(y)" + +theorem trans [trans]: "x = y \ y = z \ x = z" + by (rule subst) + +theorem sym [sym]: "x = y \ y = x" +proof - + assume "x = y" + from this and refl show "y = x" by (rule subst) +qed + + +subsection {* Quantifiers *} + +consts + All :: "(i \ o) \ o" (binder "\" 10) + Ex :: "(i \ o) \ o" (binder "\" 10) + +axioms + allI [intro]: "(\x. P(x)) \ \x. P(x)" + allD [dest]: "\x. P(x) \ P(a)" + + exI [intro]: "P(a) \ \x. P(x)" + exE [elim]: "\x. P(x) \ (\x. P(x) \ C) \ C" + + +lemma "(\x. P(f(x))) \ (\y. P(y))" +proof + assume "\x. P(f(x))" + thus "\y. P(y)" + proof + fix x assume "P(f(x))" + thus ?thesis .. + qed +qed + +lemma "(\x. \y. R(x, y)) \ (\y. \x. R(x, y))" +proof + assume "\x. \y. R(x, y)" + thus "\y. \x. R(x, y)" + proof + fix x assume a: "\y. R(x, y)" + show ?thesis + proof + fix y from a have "R(x, y)" .. + thus "\x. R(x, y)" .. + qed + qed +qed + +end diff -r 2af9ad81ea56 -r ab207f9c1e1e src/FOL/ex/ROOT.ML --- a/src/FOL/ex/ROOT.ML Wed Dec 05 03:00:39 2001 +0100 +++ b/src/FOL/ex/ROOT.ML Wed Dec 05 03:05:18 2001 +0100 @@ -6,6 +6,7 @@ Examples for First-Order Logic. *) +time_use_thy "First_Order_Logic"; time_use "intro.ML"; time_use_thy "Nat"; time_use_thy "Natural_Numbers";