• Keine Ergebnisse gefunden

Limits of the truth-table method

N/A
N/A
Protected

Academic year: 2022

Aktie "Limits of the truth-table method"

Copied!
53
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Formale Methoden der Softwaretechnik Formal methods of software engineering

Till Mossakowski, Christoph L¨uth

SoSe 2011

(2)

Propositional Logic

at the core of many logics, formalisms, programming languages

used as kind of assembly language for coding problems available tools:

Boole — learning about truth tables Tarski’s world — Henkin-Hintikka game Fitch — natural deduction proofs SPASS — resolution proofs Jitpro — tableau proofs

minisat, zChaff — SAT solvers using DPLL

Hets — friendly interface to SAT solvers and SPASS

(3)

Logical consequence

Q is a logical consequence ofP1, . . . ,Pn, if all worlds that

makeP1, . . . ,Pn true also makeQ true.

Q is a tautological consequenceofP1, . . . ,Pn, if all valuations of atomic formulas with truth values that make P1, . . . ,Pn true also make Q true.

Q is a TW-logical consequence ofP1, . . . ,Pn, if all worlds from Tarski’s world that makeP1, . . . ,Pn true also makeQ true.

(4)

Proofs

With proofs, we try to show (tauto)logical consequence Truth-table method can lead to very large tables, proofs are often shorter

Proofs are also available for consequence in full first-order logic, not only for tautological consequence

(5)

Limits of the truth-table method

1 truth-table method leads to exponentially growingtables 20 atomic sentencesmore than 1.000.000 rows

2 truth-table method cannot be extended to first-order logic model checkingcan overcome the first limitation (up to 1.000.000 atomic sentences)

proofscan overcome both limitations

(6)

Limits of the truth-table method

1 truth-table method leads to exponentially growingtables 20 atomic sentencesmore than 1.000.000 rows

2 truth-table method cannot be extended to first-order logic model checkingcan overcome the first limitation (up to 1.000.000 atomic sentences)

proofscan overcome both limitations

(7)

Limits of the truth-table method

1 truth-table method leads to exponentially growingtables 20 atomic sentencesmore than 1.000.000 rows

2 truth-table method cannot be extended to first-order logic model checkingcan overcome the first limitation (up to 1.000.000 atomic sentences)

proofscan overcome both limitations

(8)

Limits of the truth-table method

1 truth-table method leads to exponentially growingtables 20 atomic sentencesmore than 1.000.000 rows

2 truth-table method cannot be extended to first-order logic model checkingcan overcome the first limitation (up to 1.000.000 atomic sentences)

proofscan overcome both limitations

(9)

Limits of the truth-table method

1 truth-table method leads to exponentially growingtables 20 atomic sentencesmore than 1.000.000 rows

2 truth-table method cannot be extended to first-order logic model checkingcan overcome the first limitation (up to 1.000.000 atomic sentences)

proofscan overcome both limitations

(10)

Proofs

A proof consists of a sequence ofproof steps Each proof step is known to be valid and should

be significant but easily understood, ininformalproofs, follow someproof rule, in formalproofs.

Some valid patterns of inference that generally go unmentioned in informal (but not in formal) proofs:

FromPQ, inferP.

FromPandQ, inferPQ.

FromP, inferPQ.

(11)

Proofs

A proof consists of a sequence ofproof steps Each proof step is known to be valid and should

be significant but easily understood, ininformalproofs, follow someproof rule, in formalproofs.

Some valid patterns of inference that generally go unmentioned in informal (but not in formal) proofs:

FromPQ, inferP.

FromPandQ, inferPQ.

FromP, inferPQ.

(12)

Proofs

A proof consists of a sequence ofproof steps Each proof step is known to be valid and should

be significant but easily understood, ininformalproofs, follow someproof rule, in formalproofs.

Some valid patterns of inference that generally go unmentioned in informal (but not in formal) proofs:

FromPQ, inferP.

FromPandQ, inferPQ.

FromP, inferPQ.

(13)

Proofs

A proof consists of a sequence ofproof steps Each proof step is known to be valid and should

be significant but easily understood, ininformalproofs, follow someproof rule, in formalproofs.

Some valid patterns of inference that generally go unmentioned in informal (but not in formal) proofs:

FromPQ, inferP.

FromPandQ, inferPQ.

FromP, inferPQ.

(14)

Proofs

A proof consists of a sequence ofproof steps Each proof step is known to be valid and should

be significant but easily understood, ininformalproofs, follow someproof rule, in formalproofs.

Some valid patterns of inference that generally go unmentioned in informal (but not in formal) proofs:

FromPQ, inferP.

FromPandQ, inferPQ.

FromP, inferPQ.

(15)

Proofs

A proof consists of a sequence ofproof steps Each proof step is known to be valid and should

be significant but easily understood, ininformalproofs, follow someproof rule, in formalproofs.

Some valid patterns of inference that generally go unmentioned in informal (but not in formal) proofs:

FromPQ, inferP.

FromPandQ, inferPQ.

FromP, inferPQ.

(16)

Formal proofs in Fitch

Well-defined set offormal proof rules

Formal proofs in Fitch can be mechanically checked For each connective, there is

anintroduction rule, e.g. “fromP, inferPQ”.

anelimination rule, e.g. “fromPQ, inferP”.

(17)

Formal proofs in Fitch

Well-defined set offormal proof rules

Formal proofs in Fitch can be mechanically checked For each connective, there is

anintroduction rule, e.g. “fromP, inferPQ”.

anelimination rule, e.g. “fromPQ, inferP”.

(18)

Formal proofs in Fitch

Well-defined set offormal proof rules

Formal proofs in Fitch can be mechanically checked For each connective, there is

anintroduction rule, e.g. “fromP, inferPQ”.

anelimination rule, e.g. “fromPQ, inferP”.

(19)

Formal proofs in Fitch

Well-defined set offormal proof rules

Formal proofs in Fitch can be mechanically checked For each connective, there is

anintroduction rule, e.g. “fromP, inferPQ”.

anelimination rule, e.g. “fromPQ, inferP”.

(20)

Formal proofs in Fitch

Well-defined set offormal proof rules

Formal proofs in Fitch can be mechanically checked For each connective, there is

anintroduction rule, e.g. “fromP, inferPQ”.

anelimination rule, e.g. “fromPQ, inferP”.

(21)

Formal proofs in Fitch

P Q R

S1 Justification 1

. . . . . .

Sn Justification n

S Justification n+1

(22)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

Fitch rule: Reiteration

Identity Elimination (= Elim):

P(n)...

n=m ...

. P(m)

When we apply this rule, it does not matter which ofP(n) andn=moccurs first in the proof, as long as they both appear beforeP(m), the inferred step.

In justifying the step, we cite the name of the rule, followed by the steps in whichP(n) andn=moccur, in that order.

We could also introduce rules justified by the meanings of other predicates besides = into the systemF. For example, we could introduce a formal rule of the following sort:

Bidirectionality of Between:

Between(a,b,c) ...

. Between(a,c,b)

We don’t do this because there are just too many such rules. We could state them for a few predicates, but certainly not all of the predicates you will encounter in first-order languages.

There is one rule that is not technically necessary, but which will make Reiteration

some proofs look more natural. This rule is called Reiteration, and simply allows you to repeat an earlier step, if you so desire.

Reiteration (Reit):

P...

. P

To use the Reiteration rule, just repeat the sentence in question and, on the right, write “Reit:x,” wherexis the number of the earlier occurrence of the sentence.

(23)

Formal Proofs in Fitch The rule system of Fitch (natural deduction)

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

Till Mossakowski, Christoph L¨uth FMSE

(24)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

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

Till Mossakowski, Christoph L¨uth FMSE

(25)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

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

Till Mossakowski, Christoph L¨uth FMSE

(26)

Proof by cases (disjunction elimination)

To proveS fromP1∨. . .∨Pn, proveS from each of P1, . . . ,Pn. Claim: there are irrational numbers b andc such thatbc is rational.

Proof: √ 2

2 is either rational or irrational.

Case 1: If √ 2

2 is rational: takeb=c =√ 2.

Case 2: If √ 2

2 is irrational: takeb =√ 2

2 andc =√ 2.

Then bc= (√ 2

2)

2=√ 2(

2) =√

22 = 2.

(27)

Proof by cases (disjunction elimination)

To proveS fromP1∨. . .∨Pn, proveS from each of P1, . . . ,Pn. Claim: there are irrational numbers b andc such thatbc is rational.

Proof: √ 2

2 is either rational or irrational.

Case 1: If √ 2

2 is rational: takeb=c =√ 2.

Case 2: If √ 2

2 is irrational: takeb =√ 2

2 andc =√ 2.

Then bc= (√ 2

2)

2=√ 2(

2) =√

22 = 2.

(28)

Proof by cases (disjunction elimination)

To proveS fromP1∨. . .∨Pn, proveS from each of P1, . . . ,Pn. Claim: there are irrational numbers b andc such thatbc is rational.

Proof: √ 2

2 is either rational or irrational.

Case 1: If √ 2

2 is rational: takeb=c =√ 2.

Case 2: If √ 2

2 is irrational: takeb =√ 2

2 andc =√ 2.

Then bc= (√ 2

2)

2=√ 2(

2) =√

22 = 2.

(29)

Proof by cases (disjunction elimination)

To proveS fromP1∨. . .∨Pn, proveS from each of P1, . . . ,Pn. Claim: there are irrational numbers b andc such thatbc is rational.

Proof: √ 2

2 is either rational or irrational.

Case 1: If √ 2

2 is rational: takeb=c =√ 2.

Case 2: If √ 2

2 is irrational: takeb =√ 2

2 andc =√ 2.

Then bc= (√ 2

2)

2=√ 2(

2) =√

22 = 2.

(30)

Proof by cases (disjunction elimination)

To proveS fromP1∨. . .∨Pn, proveS from each of P1, . . . ,Pn. Claim: there are irrational numbers b andc such thatbc is rational.

Proof: √ 2

2 is either rational or irrational.

Case 1: If √ 2

2 is rational: takeb=c =√ 2.

Case 2: If √ 2

2 is irrational: takeb =√ 2

2 andc =√ 2.

Then bc= (√ 2

2)

2=√ 2(

2) =√

22 = 2.

(31)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

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

(32)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

The proper use of subproofs

In the following two exercises, determine whether the sentences are consistent. If they are, use Tarski’s World to build a world where the sentences are both true. If they are inconsistent, use Fitch to give a proof that they are inconsistent (that is, derivefrom them). You may useAna Con in your proof, but only applied to literals (that is, atomic sentences or negations of atomic sentences).

6.15

¬(Larger(a,b)Larger(b,a))

¬SameSize(a,b)

6.16

Smaller(a,b)Smaller(b,a) SameSize(a,b)

Section 6.4

The proper use of subproofs

Subproofs are the characteristic feature of Fitch-style deductive systems. It is important that you understand how to use them properly, since if you are not careful, you may “prove” things that don’t follow from your premises. For example, the following formal proof looks like it is constructed according to our rules, but it purports to prove thatABfollows from (BA)(AC), which is clearly not right.

1. (BA)(AC) 2.BA

3.B Elim: 2

4.A Elim: 2

5.AC

6.A Elim: 5

7.A Elim: 1, 2–4, 5–6

8.AB Intro: 7, 3

The problem with this proof is step 8. In this step we have used step 3, a step that occurs within an earlier subproof. But it turns out that this sort of justification—one that reaches back inside a subproof that has already ended—is not legitimate. To understand why it’s not legitimate, we need to think about what function subproofs play in a piece of reasoning.

A subproof typically looks something like this:Till Mossakowski, Christoph L¨uth FMSE

(33)

The proper use of subproofs (cont’d)

In justifying a step of a subproof, you may cite any earlier step contained in the main proof, or in any subproof whose

assumption is still in force. You may never cite individual steps inside a subproof that has already ended.

Fitch enforces this automatically by not permitting the citation of individual steps inside subproofs that have ended.

(34)

The proper use of subproofs (cont’d)

In justifying a step of a subproof, you may cite any earlier step contained in the main proof, or in any subproof whose

assumption is still in force. You may never cite individual steps inside a subproof that has already ended.

Fitch enforces this automatically by not permitting the citation of individual steps inside subproofs that have ended.

(35)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

Negation Introduction (¬ Intro)

P ...

. ¬P

Negation Elimination (¬ Elim)

¬¬P ...

. P

Introduction ( Intro)

P...

¬P ...

.

Elimination (Elim)

...

. P

Conditional Introduction ( Intro)

P ... Q

. PQ

Conditional Elimination (Elim)

PQ ... P...

. Q

Till Mossakowski, Christoph L¨uth FMSE

(36)

Proof by contradiction

To prove¬S, assume S and prove a contradiction ⊥.

(⊥may be infered from P and¬P.) AssumeCube(c)∨Dodec(c) andTet(b).

Claim: ¬(b=c).

Proof: Let us assumeb =c.

Case 1: If Cube(c), then by b=c, also Cube(b), which contradictsTet(b).

Case 2: Dodec(c) similarly contradictsTet(b).

In both case, we arrive at a contradiction. Hence, our assumption b=c cannot be true, thus¬(b=c).

(37)

Proof by contradiction

To prove¬S, assume S and prove a contradiction ⊥.

(⊥may be infered from P and¬P.) AssumeCube(c)∨Dodec(c) andTet(b).

Claim: ¬(b=c).

Proof: Let us assumeb =c.

Case 1: If Cube(c), then by b=c, also Cube(b), which contradictsTet(b).

Case 2: Dodec(c) similarly contradictsTet(b).

In both case, we arrive at a contradiction. Hence, our assumption b=c cannot be true, thus¬(b=c).

(38)

Proof by contradiction

To prove¬S, assume S and prove a contradiction ⊥.

(⊥may be infered from P and¬P.) AssumeCube(c)∨Dodec(c) andTet(b).

Claim: ¬(b=c).

Proof: Let us assumeb =c.

Case 1: If Cube(c), then by b=c, also Cube(b), which contradictsTet(b).

Case 2: Dodec(c) similarly contradictsTet(b).

In both case, we arrive at a contradiction. Hence, our assumption b=c cannot be true, thus¬(b=c).

(39)

Proof by contradiction

To prove¬S, assume S and prove a contradiction ⊥.

(⊥may be infered from P and¬P.) AssumeCube(c)∨Dodec(c) andTet(b).

Claim: ¬(b=c).

Proof: Let us assumeb =c.

Case 1: If Cube(c), then by b=c, also Cube(b), which contradictsTet(b).

Case 2: Dodec(c) similarly contradictsTet(b).

In both case, we arrive at a contradiction. Hence, our assumption b=c cannot be true, thus¬(b=c).

(40)

Proof by contradiction

To prove¬S, assume S and prove a contradiction ⊥.

(⊥may be infered from P and¬P.) AssumeCube(c)∨Dodec(c) andTet(b).

Claim: ¬(b=c).

Proof: Let us assumeb =c.

Case 1: If Cube(c), then by b=c, also Cube(b), which contradictsTet(b).

Case 2: Dodec(c) similarly contradictsTet(b).

In both case, we arrive at a contradiction. Hence, our assumption b=c cannot be true, thus¬(b=c).

(41)

Proof by contradiction

To prove¬S, assume S and prove a contradiction ⊥.

(⊥may be infered from P and¬P.) AssumeCube(c)∨Dodec(c) andTet(b).

Claim: ¬(b=c).

Proof: Let us assumeb =c.

Case 1: If Cube(c), then by b=c, also Cube(b), which contradictsTet(b).

Case 2: Dodec(c) similarly contradictsTet(b).

In both case, we arrive at a contradiction. Hence, our assumption b=c cannot be true, thus¬(b=c).

(42)

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

. PQ

Conditional Elimination ( Elim)

PQ ... P...

. Q

Till Mossakowski, Christoph L¨uth FMSE

(43)

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

. PQ

Conditional Elimination ( Elim)

PQ ... P...

. Q

Till Mossakowski, Christoph L¨uth FMSE

(44)

Arguments with inconsistent premises

A proof of a contradiction⊥from premisesP1, . . . ,Pn (without additional assumptions) shows that the premises areinconsistent.

An argument with inconsistent premises is alwaysvalid, but more importantly, alwaysunsound.

Home(max)∨Home(claire)

¬Home(max)

¬Home(claire)

Home(max)∧Happy(carl)

(45)

Propositional Logic Formal Proofs in Fitch The rule system of Fitch (natural deduction)

Negation Introduction (¬Intro)

P ...

. ¬P

Negation Elimination (¬ Elim)

¬¬P ...

. P

Introduction (Intro)

P...

¬P ...

.

Elimination ( Elim)

...

. P

Conditional Introduction (Intro)

P ... Q

. PQ

Conditional Elimination ( Elim)

PQ ... P...

. Q

Till Mossakowski, Christoph L¨uth FMSE

(46)

Example proof in fitch

(47)

Arguments without premises

A proof without any premises shows that its conclusion is alogical truth.

Example: ¬(P ∧ ¬P).

(48)

The Con rules in Fitch

Taut Conproves all tautological consequences.

FO Con proves all first-order consequences (like a=c follows froma=b∧b =c).

Ana Con proves (almost) all Tarski’s world consequences.

(49)

The Con rules in Fitch

Taut Conproves all tautological consequences.

FO Con proves all first-order consequences (like a=c follows froma=b∧b =c).

Ana Con proves (almost) all Tarski’s world consequences.

(50)

The Con rules in Fitch

Taut Conproves all tautological consequences.

FO Con proves all first-order consequences (like a=c follows froma=b∧b =c).

Ana Con proves (almost) all Tarski’s world consequences.

(51)

Consistency

A set of sentencesT is called formally inconsistent, if T `T ⊥.

Example: {A∨B,¬A,¬B}.

Otherwise,T is called formally consistent.

Example: {A∨B,A,¬B}

(52)

Soundness

Theorem 1. The proof calculusFT is sound, i.e. if T `T S,

then

T |=T S.

Proof: by induction on the length of the proof.

(53)

Completeness

Theorem 2(Bernays, Post). The proof calculusFT is complete, i.e. if

T |=T S, then

T `T S. Theorem 2 follows from:

Theorem 3. Every formally consistent set of sentences is tt-satisfiable.

Lemma 4. T ∪ {¬S} `T ⊥if and only if T `T S.

Referenzen

ÄHNLICHE DOKUMENTE

In the presence of equality, we can show the undecidability of satisfiability of GFU (and hence of TGF ) by a reduction from the tiling problem for an infinite grid [7]..

We first point out that if g has no pair of exchangeable literals, then FOL(∃, ∧, ¬ a )-E NTAILMENT has the same complexity as in the positive fragment (indeed it can be computed by

Semantics for Logic Programs via Circumscription and Projection Based on the representation of a logic program as a clausal first-order sentence with raw rule clauses, three

These develop into a conversation that engages South Asian scholars working at the forefront of critical social science, history and theory with a foundational text of

2 truth-table method cannot be extended to first-order logic model checking can overcome the first limitation (up to 1.000.000 atomic sentences).. proofs can overcome

TW-necessary, if it is true in all worlds of Tarski’s world, a tautology, if it is true in all valuations of the atomic sentences with { TRUE, FALSE }... Logic, Boolean logic

Despite of the failed studies, inconsistent and inconclusive results of the list experiment and the critical view of the RRT, it is not longer justifiable to use

For random Young’s modulus and geometry however, the robust topology optimization using first-order second-moment approach provides robust designs at very little computational