Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Logik f¨ ur Informatiker Logic for computer scientists
Till Mossakowski
Wintersemester 2014/15
Till Mossakowski Logik 1/ 39
Korrektheit und Vollst¨andigkeit
Formale Beweise und Boolesche Logik
Till Mossakowski Logik 2/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Formale Beweise in Fitch
Wir haben eine wohldefinierte Menge formaler Beweisregeln.
Formale Beweise in Fitch k¨onnenmechanisch gepr¨uft werden.
F¨ur jeden Junktor gibt es
eineEinf¨uhrungsregel, z. B. “vonP schließe aufP∨Q”, eineBeseitigungsregel, z. B. “vonP∧Q schließe aufP”.
Till Mossakowski Logik 3/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Konjunktions-Einf¨ uhrung
Summary of Rules
Propositional rules ( F
T)
Conjunction Introduction (∧ Intro)
P1
⇓ Pn
...
. P1∧. . .∧Pn
Conjunction Elimination (∧ Elim)
P1∧. . . ∧Pi∧. . .∧Pn ...
. Pi
Disjunction Introduction (∨ Intro)
Pi ...
. P1∨. . .∨Pi∨. . .∨Pn
Disjunction Elimination (∨ Elim)
P1∨. . . ∨Pn ...
P1 ... S
⇓ Pn
... S ...
. S
557
Till Mossakowski Logik 4/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Konjunktions-Beseitigung
Summary of Rules
Propositional rules ( F
T)
Conjunction Introduction (∧ Intro)
P1
⇓ Pn
...
. P1∧. . .∧Pn
Conjunction Elimination (∧ Elim)
P1∧. . . ∧Pi∧. . .∧Pn
... . Pi
Disjunction Introduction (∨ Intro)
Pi
...
. P1∨. . .∨Pi∨. . .∨Pn
Disjunction Elimination (∨ Elim)
P1∨. . . ∨Pn
... P1
... S
⇓ Pn
... S ...
. S
557
Till Mossakowski Logik 5/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Disjunktions-Einf¨ uhrung
Summary of Rules
Propositional rules ( F
T)
Conjunction Introduction (∧Intro)
P1
⇓ Pn
...
. P1∧. . .∧Pn
Conjunction Elimination (∧ Elim)
P1∧. . . ∧Pi∧. . .∧Pn ...
. Pi
Disjunction Introduction (∨Intro)
Pi ...
. P1∨. . .∨Pi∨. . .∨Pn
Disjunction Elimination (∨ Elim)
P1∨. . . ∨Pn ...
P1 ... S
⇓ Pn
... S ...
. S
557
Till Mossakowski Logik 6/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Disjunktions-Beseitigung
Summary of Rules
Propositional rules ( F
T)
Conjunction Introduction (∧Intro)
P1
⇓ Pn
...
. P1∧. . .∧Pn
Conjunction Elimination (∧Elim)
P1∧. . .∧Pi∧. . .∧Pn
...
. Pi
Disjunction Introduction (∨Intro)
Pi
...
. P1∨. . .∨Pi∨. . .∨Pn
Disjunction Elimination (∨Elim)
P1∨. . .∨Pn
... P1
... S
⇓ Pn
... S ...
. S
557
Till Mossakowski Logik 7/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
⊥ -Einf¨ uhrung
Negation Introduction (¬ Intro)
P ...
⊥
. ¬P
Negation Elimination (¬ Elim)
¬¬P ...
. P
⊥Introduction (⊥ Intro)
P...
¬P ...
. ⊥
⊥Elimination (⊥Elim)
⊥...
. P
Conditional Introduction (→ Intro)
P ... Q
. P→Q
Conditional Elimination (→Elim)
P→Q ... P...
. Q
Summary of Rules
Till Mossakowski Logik 8/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
⊥ -Beseitigung
558 /Summary of Rules
Negation Introduction (¬Intro)
P ...
⊥
. ¬P
Negation Elimination (¬ Elim)
¬¬P ...
. P
⊥Introduction (⊥Intro)
P...
¬P ...
. ⊥
⊥Elimination (⊥ Elim)
⊥...
. P
Conditional Introduction (→Intro)
P ... Q
. P→Q
Conditional Elimination (→ Elim)
P→Q ... P...
. Q
Summary of Rules
Till Mossakowski Logik 9/ 39
Korrektheit und Vollst¨andigkeit
Negations-Einf¨ uhrung
558 /Summary of Rules
Negation Introduction (¬Intro)
P ...
⊥
. ¬P
Negation Elimination (¬ Elim)
¬¬P ...
. P
⊥Introduction (⊥Intro)
P...
¬P ...
. ⊥
⊥Elimination (⊥ Elim)
⊥...
. P
Conditional Introduction (→ Intro)
P ... Q
. P→Q
Conditional Elimination (→ Elim)
P→Q ... P...
. Q
Summary of Rules
Till Mossakowski Logik 10/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Negations-Beseitigung
558 /Summary of Rules
Negation Introduction (¬Intro)
P ...
⊥
. ¬P
Negation Elimination (¬ Elim)
¬¬P ...
. P
⊥Introduction (⊥Intro)
P...
¬P ...
. ⊥
⊥Elimination (⊥ Elim)
⊥...
. P
Conditional Introduction (→ Intro)
P ... Q
. P→Q
Conditional Elimination (→ Elim)
P→Q ... P...
. Q
Summary of Rules
Till Mossakowski Logik 11/ 39
Korrektheit und Vollst¨andigkeit
Strategie und Taktik in Fitch
1 Machen Sie sich klar, was die S¨atze besagen.
2 Uberlegen¨ Sie, ob die Konklusion aus den Pr¨amissen folgt.
3 Wenn Sie meinen, dass die Konklusion nicht folgt oder sich nicht sicher sind, versuchen Sie, einGegenbeispielzu finden.
4 Wenn Sie meinen, dass die Konklusion folgt, versuchen Sie, einen informellen Beweis zu f¨uhren.
5 Falls einformaler Beweis gefordert ist, lassen Sie sich bei der Auffindung dessen vom informellen Beweisleiten.
6 Vergessen Sie nicht die Taktik des R¨uckw¨arts-Arbeitens, falls Sie formal oder informell nachweisen, dass ein Satz aus anderen folgt.
7 Wenn Sie r¨uckw¨arts arbeiten, ¨ubrepr¨ufen Sie stets, ob die
Beweisziele Ihrer Zwischenschritteaus den gegebenen Informationen folgen.
Till Mossakowski Logik 12/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Strategie und Taktik in Fitch (Fortsetzung)
Versuchen Sie stets, die Situation in Ihrem Beweis mit den Beweisregeln zu vergleichen(im Anhang des Buches gibt es die komplette Liste der verf¨ugbaren Regeln, ebenso im internen Bereich auf der Webseite der Vorlesung).
Orientieren Sie sich am Hauptjunktor einer Pr¨amisseund wenden die entsprechende Beseitigungsregel an (vorw¨arts), oder Sie orientieren sich am Hauptjunktor der Konklusion und wenden die entsprechende Einf¨uhrungsregel an (r¨uckw¨arts).
Till Mossakowski Logik 13/ 39
Korrektheit und Vollst¨andigkeit
Konditionale
Till Mossakowski Logik 14/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Konditionale 178 /
Conditionalsdo, however, make it much easier to say and prove certain things, and so are valuable additions to the language.
Section 7.1
Material conditional symbol: →
The symbol → is used to combine two sentences P and Q to form a new sentence P → Q, called a material conditional. The sentence P is called the antecedent of the conditional, and Q is called the consequent of the conditional.
We will discuss the English counterparts of this symbol after we explain its meaning.
Semantics and the game rule for the conditional
The sentence P → Q is true if and only if either P is false or Q is true (or both). This can be summarized by the following truth table.
P Q P → Q
t t
Tt f
Ff t
Tf f
Ttruth table for →
A second’s thought shows that P → Q is really just another way of saying
¬ P ∨ Q. Tarski’s World in fact treats the former as an abbreviation of the latter. In particular, in playing the game, Tarski’s World simply replaces a
game rule for →statement of the form P → Q by its equivalent ¬ P ∨ Q.
Remember
1. If P and Q are sentences of fol, then so is P → Q.
2. The sentence P → Q is false in only one case: if the antecedent P is true and the consequent Q is false. Otherwise, it is true.
English forms of the material conditional
We can come fairly close to an adequate English rendering of the material conditional P → Q with the sentence If P then Q. At any rate, it is clear that
if . . . thenChapter 7
Spielregel:P →Q wird durch ¬P∨Q ersetzt.
Till Mossakowski Logik 15/ 39
Korrektheit und Vollst¨andigkeit
Formalisierung von Konditionals¨ atzen
Die folgenden deutschen Ausdr¨ucke werden alle alsP →Q
¨ubersetzt:
WennP,dannQ.
Q wennP.
P nur dann, wennQ.
Gegeben dassP,dann Q.
P impliziertQ.
Die folgenden S¨atze werden als ¬P →Q ¨ubersetzt:
Sofern nichtP,Q.
Q,es sei denn dass P.
Till Mossakowski Logik 16/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Logische Folgerung und Konditionale
Theorem
Ein Satz Q ist einelogische Folgerung aus P1, . . . ,Pn, genau dann wenn
(P1∧ · · · ∧Pn)→Q eine logische Wahrheit ist.
Till Mossakowski Logik 17/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Konditional-Beseitigung
Negation Introduction (¬Intro)
P ...
⊥
. ¬P
Negation Elimination (¬ Elim)
¬¬P ...
. P
⊥Introduction (⊥Intro)
P...
¬P ...
. ⊥
⊥ Elimination (⊥Elim)
⊥...
. P
Conditional Introduction (→Intro)
P ... Q
. P→Q
Conditional Elimination (→ Elim)
P→Q ... P...
. Q
Summary of Rules
Till Mossakowski Logik 18/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Konditional-Einf¨ uhrung
558 /Summary of Rules
Negation Introduction (¬Intro)
P ...
⊥
. ¬P
Negation Elimination (¬ Elim)
¬¬P ...
. P
⊥Introduction (⊥Intro)
P...
¬P ...
. ⊥
⊥Elimination (⊥ Elim)
⊥...
. P
Conditional Introduction (→ Intro)
P ... Q
. P→Q
Conditional Elimination (→ Elim)
P→Q ... P...
. Q
Summary of Rules
Till Mossakowski Logik 19/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Bikonditionale
means of the biconditional: P ↔ Q. A sentence of the form P ↔ Q is true if and only if P and Q have the same truth value, that is, either they are both true or both false. In English this is commonly expressed using the expression if and only if. So, for example, the sentence Max is home if and only if Claire
if and only ifis at the library would be translated as:
Home(max) ↔ Library(claire)
Mathematicians and logicians often write “iff” as an abbreviation for “if
iffand only if.” Upon encountering this, students and typesetters generally con- clude it’s a spelling mistake, to the consternation of the authors. But in fact it is shorthand for the biconditional. Mathematicians also use “just in case” as a
just in caseway of expressing the biconditional. Thus the mathematical claims n is even iff n
2is even, and n is even just in case n
2is even, would both be translated as:
Even(n) ↔ Even(n
2)
This use of “just in case” is, we admit, one of the more bizarre quirks of mathematicians, having nothing much to do with the ordinary meaning of this phrase. In this book, we use the phrase in the mathematician’s sense, just in case you were wondering.
An important fact about the biconditional symbol is that two sentences P and Q are logically equivalent if and only if the biconditional formed from them, P ↔ Q, is a logical truth. Another way of putting this is to say that P ⇔ Q is true if and only if the fol sentence P ↔ Q is logically necessary.
So, for example, we can express one of the DeMorgan laws by saying that the following sentence is a logical truth:
¬ (P ∨ Q) ↔ ( ¬ P ∧ ¬ Q)
This observation makes it tempting to confuse the symbols ↔ and ⇔ . This
↔ vs. ⇔
temptation must be resisted. The former is a truth-functional connective of fol, while the latter is an abbreviation of “is logically equivalent to.” It is not a truth-functional connective and is not an expression of fol.
Semantics and the game rule for ↔
The semantics for the biconditional is given by the following truth table.
P Q P ↔ Q
t t
Tt f
Ff t
Ff f
Ttruth table for ↔
Chapter 7
Spielregel:P ↔Q wird durch (P →Q)∧(Q →P) ersetzt.
Till Mossakowski Logik 20/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Bikonditionale und logische ¨ Aquivalenzen
Theorem
P und Q sindlogisch ¨aquivalent(P⇔Q) genau dann, wenn
der Satz P↔Q einelogische Wahrheit ist.
Bemerkung:
P ⇔Q ist kein Satz in PL1, sondern eine Meta-Aussage.
“↔” istJunktor, Operationin der Menge der PL1-S¨atze,
“⇔” ist eineRelation in der Menge der PL1-S¨atze.
Till Mossakowski Logik 21/ 39
Korrektheit und Vollst¨andigkeit
Konversationale Implikatur
“Max ist zu Hause, es sei denn, Claire ist in der Bibliothek.” kann formalisiert werden als
¬Library(claire)→Home(max) aber manchmal wird der Satz formalisiert als
¬Library(claire)↔Home(max) Die zus¨atzliche Behauptung
¬Library(claire)←Home(max)
heißtkonversationale Implikatur. Sie ist m¨oglich aber nicht notwendig gem¨aß des urspr¨unglichen deutschen Satzes.
Folgende Fortsetzunghebtdie Implikatur auf:
“Wenn Claire allerdings in der Bibliothek ist, dann weiß ich nicht, wo Max sein k¨onnte.”
Till Mossakowski Logik 22/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Wahrheitsfunktionale Vollst¨ andigkeit
Definition
Ein logischer Junktor heißtwahrheitsfunktional, wenn der
Wahrheitswert eines komplexen Satzes, der mittels dieses Junktors gebildet wird, nur von den Wahrheitswerten der einfacheren S¨atze, aus denen er aufgebaut ist, abh¨angt.
Wahrheitsfunktionale Junktoren:∧,∨,¬,←,↔
Nicht wahrheitsfunktional: da, nachdem, notwendigerweise Definition
Eine Menge von Junktoren heißtwahrheitsfunktional vollst¨andig, wenn sich mit ihr jede Wahrheitsfunktion ausdr¨ucken l¨asst.
Theorem
Die Menge{∧,∨,¬} ist wahrheitsfunktional vollst¨andig.
Till Mossakowski Logik 23/ 39
Korrektheit und Vollst¨andigkeit
Beispiel: ein zweistelliger wahrheitsfunktionaler Junktor
P Q WederP nochQ
T T F
T F F
F T F
F F T ¬P ∧ ¬Q
“WederP nochQ” kann durch¬P∧ ¬Q ausgedr¨uckt werden.
Till Mossakowski Logik 24/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Beispiel: ein dreistelliger wahrheitsfunktionaler Junktor
P Q R ♣(P,Q,R)
T T T T P∧Q∧R
T T F T P∧Q∧ ¬R
T F T F
T F F F
F T T T ¬P∧Q∧R
F T F F
F F T T ¬P∧ ¬Q∧R
F F F F
♣(P,Q,R) kann ausgedr¨uckt werden durch
(P∧Q∧R)∨(P ∧Q∧ ¬R)∨(¬P ∧Q∧R)∨(¬P∧ ¬Q∧R).
Till Mossakowski Logik 25/ 39
Korrektheit und Vollst¨andigkeit
Logische ¨ Aquivalenzen des Konditionals und Bikonditionals
P →Q ⇔ ¬Q → ¬P P →Q ⇔ ¬P ∨Q
¬(P →Q) ⇔ P ∧ ¬Q
P ↔Q ⇔ (P →Q)∧(Q →P) P ↔Q ⇔ (¬P∨Q)∧(P∨ ¬Q) P ↔Q ⇔ (P∧Q)∨(¬P∧ ¬Q)
Till Mossakowski Logik 26/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Bikonditional-Beseitigung
First-order rules (F)/ 559
Biconditional Introduction (↔ Intro)
P ... Q Q ... P
. P↔Q
Biconditional Elimination (↔ Elim)
P↔Q(or Q↔P) ...
P...
. Q
Reiteration (Reit)
P...
. P
First-order rules ( F )
Identity Introduction (=Intro)
. n=n
Identity Elimination (= Elim)
P(n)... n=m
...
. P(m)
First-order rules (F)
Till Mossakowski Logik 27/ 39
Korrektheit und Vollst¨andigkeit
Bikonditional-Einf¨ uhrung
First-order rules (F)/ 559Biconditional Introduction (↔ Intro)
P ... Q Q ... P
. P↔Q
Biconditional Elimination (↔ Elim)
P↔Q(orQ↔P) ...
P...
. Q
Reiteration (Reit)
P...
. P
First-order rules ( F )
Identity Introduction (=Intro)
. n=n
Identity Elimination (=Elim)
P(n)... n=m
...
. P(m)
First-order rules (F)
Till Mossakowski Logik 28/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Korrektheit und Vollst¨ andigkeit
Till Mossakowski Logik 29/ 39
Korrektheit und Vollst¨andigkeit
Objekt- und Metatheorie
Objekttheorie = Beweiseinnerhalb eines formalen Beweissystems (z. B. Fitch)
Metatheorie = Beweise¨uberein formales Beweissystem
Till Mossakowski Logik 30/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Tautologische Folgerungen
S ist einetautologische Folgerung aus einer Menge T von S¨atzen, geschrieben als
T |=T S,
genau dann, wenn f¨ur alle Belegungen der atomaren Formeln mit Wahrheitswerten, die alle S¨atze vonT wahr machen, auch S wahr ist.
Till Mossakowski Logik 31/ 39
Korrektheit und Vollst¨andigkeit
Aussagenlogische Beweise
Ein SatzS istFT-beweisbar vonT, in Zeichen T `T S,
wenn f¨urS ein formaler Beweis mit Pr¨amissen aus T existiert, der allein die Beseitigungs- und Einf¨uhrungsregeln f¨ur∨,∧,¬,→,↔ sowie⊥ benutzt.
Wir bemerken erneut, dassT auch unendlich sein kann.
Till Mossakowski Logik 32/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Korrektheit
Theorem
Das BeweissystemFT ist korrekt, d. h., wenn T `T S
gilt, dann auch
T |=T S. Beweis.
Im Buch als Widerspruchsbeweis, unter Ausnutzung des ersten ung¨ultigen Schrittes.
Hier durch vollst¨andige Induktion ¨uber die L¨ange des Beweises (siehe Lemma).
Till Mossakowski Logik 33/ 39
Korrektheit und Vollst¨andigkeit
Korrektheit
Das Theorem folgt aus folgendem Lemma:
Lemma
F¨ur m≥1 sei Tm die Menge der Pr¨amissen, die in Beweisschritt m in Kraft sind. Dann folgt die Formel in Zeile m logisch ausTm. Beweis.
Induktionsanfang: die erste Zeile ist immer eine Pr¨amisse, und damit sogar Element vonT1.
Induktionsschritt: Das Lemma gelte f¨ur die erstenm Zeilen eines Beweises. Wir betrachten die Formel in derm+ 1-ten Zeile. Falls sie eine Pr¨amisse ist, ist sie sogar Element vonTm+1. Falls nicht, wurde eine Regel angewandt. Wir machen eine Fallunterscheidung nach der angewandten Regel.
Till Mossakowski Logik 34/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Beweis-Fall: Disjunktions-Einf¨ uhrung
Summary of Rules
Propositional rules ( F
T)
Conjunction Introduction (∧Intro)
P1
⇓ Pn
...
. P1∧. . .∧Pn
Conjunction Elimination (∧ Elim)
P1∧. . . ∧Pi∧. . .∧Pn
... . Pi
Disjunction Introduction (∨Intro)
Pi
...
. P1∨. . .∨Pi∨. . .∨Pn
Disjunction Elimination (∨ Elim)
P1∨. . . ∨Pn
... P1
... S
⇓ Pn
... S ...
. S
557 Seik die Zeile des Support-Steps Pi. Nach
Induktionsvoraussetzung folgt Pi logisch aus Tk ⊆ Tm+1. Damit folgt auch P1∨ · · · ∨Pn ausTm+1
Till Mossakowski Logik 35/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Beweis-Fall: Disjunktions-Beseitigung
Propositional rules (FT)
Conjunction Introduction (∧Intro)
P1
⇓ Pn
...
. P1∧. . .∧Pn
Conjunction Elimination (∧Elim)
P1∧. . .∧Pi∧. . .∧Pn
...
. Pi
Disjunction Introduction (∨Intro)
Pi
...
. P1∨. . .∨Pi∨. . .∨Pn
Disjunction Elimination (∨Elim)
P1∨. . .∨Pn
... P1
... S
⇓ Pn
... S ...
. S
557
Zur Vereinfachung nehmen wir an, dassn = 2. Seien k1,s1,k2,s2 die Zeilen f¨ur P1, das erste S, P2 und das zweite S. Nach
Induktionsvoraussetzung ist f¨ur i = 1,2 S eine logische Folgerung aus Tki =Tm+1∪ {Pi}, und P1∨P2 eine logische Folgerung aus Tm+1. Eine Belegung, die Tm+1 wahr macht, muss daher P1∨P2 wahr machen, und somit auch eines der Pi. Damit ist Tki
wahr, und somit auch S.
Till Mossakowski Logik 36/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Korrektheit
Till Mossakowski Logik 37/ 39
Korrektheit und Vollst¨andigkeit
Vollst¨ andigkeit
Theorem 2(Bernays, Post). Das BeweissystemFT ist vollst¨andig, d. h., wenn
T |=T S gilt, dann auch
T `T S.
Der Beweis erfolgt sp¨ater in dieser Lehrveranstaltung.
Till Mossakowski Logik 38/ 39
Formale Beweise und Boolesche Logik Konditionale Korrektheit und Vollst¨andigkeit
Vollst¨ andigkeit
Till Mossakowski Logik 39/ 39