propositional logic review computability and logic

62
Propositional Logic Review Computability and Logic

Upload: madison-copeland

Post on 24-Dec-2015

228 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Propositional Logic Review Computability and Logic

Propositional Logic Review

Computability and Logic

Page 2: Propositional Logic Review Computability and Logic

Boolean Connectives

Page 3: Propositional Logic Review Computability and Logic

Truth-Functional Connectives and Boolean Connectives

• Connectives are usually called truth-functional connectives:– This is because the truth value of a complex claim

that has been constructed using a truth-functional connective is considered to be a function of the truth values of the claims that are being connected by that connective.

– This is also why propositional logic is also called truth-functional logic.

• For now, we will focus on three connectives: and, or, not; these are called the Boolean connectives.

Page 4: Propositional Logic Review Computability and Logic

Truth-Table for Negation

P P

TTF

F

Page 5: Propositional Logic Review Computability and Logic

Truth-Table for Conjunction

P P Q

T

TF

F

Q

T

FF

F

FFTT

Page 6: Propositional Logic Review Computability and Logic

Truth-Table for Disjunction

P P Q

T

TF

T

Q

T

FF

T

FFTT

Page 7: Propositional Logic Review Computability and Logic

Combining Complex Claims: Parentheses

• Using the truth-functional connectives, we can combine complex claims to make even more complex claims.

• We are going to use parentheses to indicate the exact order in which claims are being combined.

• Example: (P Q) (R S) is a conjunction of two disjunctions.

Page 8: Propositional Logic Review Computability and Logic

Parentheses and Ambiguity

• An ambiguous statements is a statement whose meaning is not clear due to its syntax. Example : ”P or Q and R”

• In formal systems, an expression like P Q R is simply not allowed and considered unsyntactical.

• Claims in our formal language are therefore never ambiguous.

• One important application of the use of formal languages is exactly this: to avoid ambiguities!

Page 9: Propositional Logic Review Computability and Logic

Exclusive Disjunction vs Inclusive Disjunction

• Notice that the disjunction as defined by ‘’ is considered to be true if both disjuncts are true. This is called an inclusive disjunction.

• However, when I say “a natural number is either even or odd”, I mean to make a claim that would be considered false if a number turned out to be both even and odd. Thus, I am trying to express an exclusive disjunction.

Page 10: Propositional Logic Review Computability and Logic

How to express Exclusive Disjunctions

• We could define a separate symbol for exclusive disjunctions, but we are not going to do that.

• Fortunately, exclusive disjunctions can be expressed using the symbols we already have: (PQ) (PQ)

P (P Q) (PQ)

T

TF

T

Q

T

FF

T

FFTT

F

T

F

FT

F

T

TT

F

F

T

!

Page 11: Propositional Logic Review Computability and Logic

Conditionals

Page 12: Propositional Logic Review Computability and Logic

The Material Conditional

• Let us define the binary truth-functional connective ‘’ according to the truth-table below.

• The expression P Q is called a conditional. In here, P is the antecedent, and Q the consequent.

P P Q

T

TF

T

Q

T

TF

F

FFTT

Page 13: Propositional Logic Review Computability and Logic

‘If … then …’ Statements

• The conditional is used to capture ‘if … then …’ statements.• However, the match isn’t perfect. • For example, we don’t want to say that the claim “If grass is

green then elephants are big” is true just because grass is green and elephants are big, nor that any ‘if … then’ statement is automatically true once the ‘if’ part is false or the ‘then part true.

• The problem is that most English ‘if…then’ expressions aren’t meant to make a claim that is truth-functional in nature.

• Still, any ‘if … then …’ statement will be false if the ‘if’ part is true, but the ‘then’ part false, and the conditional captures at least this important truth-functional aspect of any ‘if … then …’ statement.

• So, while we will from now on refer to the conditional as an ‘if … then’ statement, we must be careful about the use of this, just as care must be taken when applying Newtonian physics to some situation.

Page 14: Propositional Logic Review Computability and Logic

Case in point: The Infamous ‘King-Ace’ problem

• The psychologist of reasoning gave the following logic problem to Princeton undergraduates:– Consider the following statement: “If there is a king in

the hand, then there is an ace in the hand, or else if there is not a king in the hand, then there is an ace in the hand”. What follows from this statement?

• Almost all students responded that it can be inferred that there is an ace in the hand.

• Johnson-Laird, however, said that what can be concluded is that there is not an ace in the hand, and that this is evidence that people can easily make logical reasoning mistakes! …. Really?

Page 15: Propositional Logic Review Computability and Logic

‘If and only if’ and the Material Biconditional

• A statement of the form ‘P if and only if Q’ (or ‘P iff Q’) is short for ‘P if Q, and P only if Q’. Hence, we could translate this as (P Q) (Q P). However, since this is a common expression, we define a new connective ‘’:

P P Q

T

TF

F

Q

T

TF

F

FFTT

Page 16: Propositional Logic Review Computability and Logic

Logical Properties

Page 17: Propositional Logic Review Computability and Logic

Truth Tables

• Truth-tables can be used for:– defining the truth-conditions of truth-functional

connectives – evaluating the truth-conditions of any complex

statement

Page 18: Propositional Logic Review Computability and Logic

Tautologies

• A tautology is a statement that is necessarily true.

• Example: P P

P PTF

P

TT T

TF

FF

T

Page 19: Propositional Logic Review Computability and Logic

Contradictions

• A contradiction is a statement that is necessarily false.

• Example: P P

P PTF

P

FF T

TF

FF

T

Page 20: Propositional Logic Review Computability and Logic

Contingencies

• A contingency is a statement that can be true as well as false

• Example: P

P

TF

P

TF

Page 21: Propositional Logic Review Computability and Logic

Equivalences

• Two statements are equivalent if they have the exact same truth-conditions.

• Example: P and P

P

TF

P

TT

FF

FT

PTF

Page 22: Propositional Logic Review Computability and Logic

Contradictories

• Two statements are contradictories if one of them is false whenever the other one is true and vice versa.

• Example: P and P

P

TF

P

TT

FF

FT

P

Page 23: Propositional Logic Review Computability and Logic

Implication

• One statement implies a second statement if it is impossible for the second statement to be false whenever the first statement is true.

• Example: P implies P Q

P P Q

T

TF

F

Q

T

FF

T

FFTT

P

FTTT

Page 24: Propositional Logic Review Computability and Logic

Consistency

• A set of statements is consistent if it is possible for all of them to be true at the same time.

• Example: {P, P Q, Q}

P P Q

T

TF

F

Q

T

FF

T

FFTT

P

FTTT

Q

TFTF

Page 25: Propositional Logic Review Computability and Logic

Consequence

• A statement is a consequence of a set of statements if it is impossible for the statement to be false while each statement in the set of statements is true.

• Example: P is a consequence of {PQ, Q}

P P Q

T

TF

F

Q

T

FF

T

FFTT

P

FTTT

Q

TFTF

Page 26: Propositional Logic Review Computability and Logic

Validity

• An argument is valid if it is impossible for the conclusion to be false whenever all of its premises are true.

• Example: P Q, Q P

P P Q

T

TF

F

Q

T

FF

T

FFTT

P

FTTT

Q

TFTF

Page 27: Propositional Logic Review Computability and Logic

Implication, Consequence, Validity

• The notions of implication, consequence, and validity are very closely related:

• A statement implies a statement if and only if is a consequence of the set of statements {}

• For implication and consequence we use the symbol ‘’: – If statement implies statement we write – If statement is a consequence of a set of statements

{1, …, n}, we write {1, …, n} • An argument consisting of premises 1, …, n and

conclusion is valid iff {1, …, n} • The terms implication, consequence and validity

can therefore be used interchangeably.

Page 28: Propositional Logic Review Computability and Logic

Boolean Algebra:Rewriting Statements

Page 29: Propositional Logic Review Computability and Logic

Logically Equivalent Statements

• To express that two statements P and Q are logically equivalent, we will write: PQ

• ‘’ is not a symbol of (the language of) propositional logic!!

• Rather, it is a symbol used to say something about (statements expressed in the language of) propositional logic.

• It is a meta-logical symbol, expressing a meta-logical claim.

Page 30: Propositional Logic Review Computability and Logic

Some Important Equivalences

• Double Negation: – P P

• DeMorgan:– (P Q) P Q– (P Q) P Q

• Distribution:– P (Q R) (P Q) (P R)– P (Q R) (P Q) (P R)– (Q R) P (Q P) (R P)– (Q R) P (Q P) (R P)

Page 31: Propositional Logic Review Computability and Logic

More Equivalences

• Commutation:– P Q Q P– P Q Q P

• Association:– P (Q R) (P Q) R– P (Q R) (P Q) R

• Idempotence:– P P P– P P P

• Subsumption:– P (P Q) P– P (P Q) P

Page 32: Propositional Logic Review Computability and Logic

Even More Equivalences

• Implication:– P Q P Q– (P Q) P Q

• Transposition:– P Q Q P

• Exportation:– P (Q R) (P Q) R

• Absorption:– P Q P (P Q)

• Equivalence:– P Q (P Q) (Q P)– P Q (P Q) (P Q)

Page 33: Propositional Logic Review Computability and Logic

Simplifying Statements I

• Using the principle of substitution of logical equivalents, and using the logical equivalences that we saw before (Double Negation, Association, Commutation, Idempotence, DeMorgan, Distribution, and Subsumption), we can often simplify statements.

• Example:

(A B) A (Commutation)

(B A) A (Association)

B (A A) (Idempotence)

B A

Page 34: Propositional Logic Review Computability and Logic

Generalized Conjunctions and Generalized Disjunctions

• Recall the Association equivalences: – P (Q R) (P Q) R– P (Q R) (P Q) R

• Because of this, we’ll allow to drop brackets:– P Q R– P Q R

• Thus we can generalize conjunctions and disjunctions– A generalized conjunction (disjunction) can have any

number of conjuncts (disjuncts)

Page 35: Propositional Logic Review Computability and Logic

Simplifying Statements II

• The conjuncts (disjuncts) of a generalized conjunction (disjunction) can be switched around in any way you want. This really helps with simplifying statements. Example:

C (A (B C)) (Distribution)

C (A B) (A C) (Subsumption)

C (A B)

Page 36: Propositional Logic Review Computability and Logic

‘⊤’ and ‘⊥’

• A generalized conjunction is false if it has at least one false conjunct, otherwise it is true. – So, a generalized conjunction with 0

conjuncts cannot have a false conjunct, and hence cannot be false. Therefore, it is a tautology! We will write this as ‘⊤’.

• A generalized disjunction is true if it has at least one true disjunct, otherwise it is false.– Hence, a generalized disjunction with 0

disjuncts can never be true, and is therefore a contradiction! We will write this as ‘⊥’.

Page 37: Propositional Logic Review Computability and Logic

Some equivalences involving ‘⊤’ and ‘⊥’

• ⊥ ⊤• ⊤ ⊥• P ⊥ ⊥ • P ⊤ ⊤ • P ⊤ P • P ⊥ P • P P ⊥ • P P ⊤

Page 38: Propositional Logic Review Computability and Logic

Simplifying Statements III

• Using ‘⊤’ and ‘⊥’, we can simplify statements even more. Example:

(A (B (A B)) (DeMorgan)

A (B (A B)) (Double Neg.)

A B (A B) (Distribution)

(A B A) (A B B) ⊥ ⊥

Page 39: Propositional Logic Review Computability and Logic

Normal Forms and Expressive Completeness

Page 40: Propositional Logic Review Computability and Logic

Negation Normal Form

• Literals: Atomic Sentences or negations thereof.• Negation Normal Form: An expression built up

with ‘’, ‘’, and literals.• Using repeated DeMorgan and Double

Negation, we can transform any truth-functional expression built up with ‘’, ‘’, and ‘’ into an expression that is in Negation Normal Form.

• Example:((A B) C) (DeMorgan)(A B) C (Double Neg, DeM)(A B) C

Page 41: Propositional Logic Review Computability and Logic

Disjunctive Normal Form

• Disjunctive Normal Form: A disjunction of conjunctions of literals.

• Using repeated distribution of over , any statement in Negation Normal Form can be written in Disjunctive Normal Form.

• Example:

(AB) (CD) (Distribution)[(AB)C] [(AB)D] (Distribution (2x))(AC) (BC) (AD) (BD)

Page 42: Propositional Logic Review Computability and Logic

Conjunctive Normal Form

• Conjunctive Normal Form: A conjunction of disjunctions of literals.

• Using repeated distribution of over , any statement in Negation Normal Form can be written in Conjunctive Normal Form.

• Example:

(AB) (CD) (Distribution)[(AB) C] [(AB) D] (Distribution (2x))(AC) (BC) (AD) (BD)

Page 43: Propositional Logic Review Computability and Logic

Truth-Functional Connectives

• So far, we have seen one unary truth-functional connective (‘’), and two binary truth-functional connectives (‘’, ‘’).

• Later, we will see two more binary connectives (‘’, ‘’)

• However, there are many more truth-functional connectives possible:– First of all, a connective can take any number of

arguments: 3 (ternary), 4, 5, etc.– Second, there are unary and binary connectives other

than the ones listed above.

Page 44: Propositional Logic Review Computability and Logic

Unary Connectives

• What other unary connectives are there besides ‘’?

• Thinking about this in terms of truth tables, we see that there are 4 different unary connectives:

P *P

T

F

T

T

P *P

T

F

T

F

P *P

T

F

F

T

P *P

T

F

F

F

Page 45: Propositional Logic Review Computability and Logic

Binary Connectives

• The truth table below shows that there are 24 = 16 binary connectives:

P Q P*Q

T

T

T

T

F

FF

F

T/F

T/F

T/F

T/F

In general:n sentences

22n

different n-ary connectives!

2n truth value combinations(i.e. 2n rows in truth table)

Page 46: Propositional Logic Review Computability and Logic

Expressing other connectives using ‘and’, ‘or’, and ‘not’

• We saw that we can express the exclusive disjunction using ‘and’, ‘or’, and ‘not’.

• Q: Can we express all other connectives as well?

• A: Yes! We can generalize from this example:P Q P*Q

T

T

T

T

F

FF

F

F

T

T

F

PQ

PQ (PQ) (PQ)

Step 1: Step 2:

Page 47: Propositional Logic Review Computability and Logic

Truth-Functional Expressive Completeness

• Since I can express any truth function using ‘’, ‘’, and ‘’, we say that the set of operators {, , } is (truth-functionally) expressively complete.

• DeMorgan Laws:– (P Q) P Q– (P Q) P Q

• Hence, by the principle of substitution of logical equivalents, since {, , } is expressively complete, the sets {, } and {, } are expressively complete as well!

Page 48: Propositional Logic Review Computability and Logic

The NAND

• Let us define the binary truth-functional connective ‘NAND’ according to the truth-table below.

• Obviously, P NAND Q (P Q) (hence the name!)

P P NAND Q

T

TF

T

Q

F

TF

T

FFTT

Page 49: Propositional Logic Review Computability and Logic

Expressive Completeness of the NAND

• The NAND has a very interesting property, in that it can express any truth-functional connective, i.e. {NAND} is expressively complete!

• Proof: We already know that we can express every truth-functional connective using only and . Furthermore:– P NAND P (P P) P– (P NAND P) NAND (Q NAND Q) ((P NAND P) (Q

NAND Q)) (P Q) P Q• In other words, we can build circuitry using only

one kind of logic gate!! Of course, the drawback is that we need many of those gates.

Page 50: Propositional Logic Review Computability and Logic

Truth-Trees

Page 51: Propositional Logic Review Computability and Logic

Logical Possibility

• All logically interesting claims can be reduced to questions about logical possibility:– Logical Consistency: Is it possible for all statements to

be true?– Logical Validity: Is it possible for all premises to be

true and the conclusion false?– Logical Consequence: Is it possible for the implying

statements to be true and the implied statement to be false?

– Logical Equivalence: Is it possible for the two statements to have a different truth value?

– Logical Tautology: Is it possible for the statement to be false?

Page 52: Propositional Logic Review Computability and Logic

Truth Table Method

• The truth table method systematically exhausts all possible truth value combinations of the statements involved.

• In the truth-table we look for a row that reflects a certain possibility, and that will tell us the answer to whatever question we had (e.g. if there is no row where statement is false, then it is not possible for that statement to be false, and hence it is a tautology).

Page 53: Propositional Logic Review Computability and Logic

Drawback and Room for Solution

• A drawback of the truth table method is that the number of rows grows exponentially.

• Fortunately, there is room for a solution to this problem. Since all we are interested in, is the existence of a specific combination of truth values of the statements involved, all we need to find is one example of such a case. Once we have found such a case, there is no need to exhaust all other cases.

Page 54: Propositional Logic Review Computability and Logic

Simple Solution: Stopping Early

• One solution to the problem of big truth tables is therefore to simply stop once you have found a row that represents the combination of truth values you are interested in.

• Thus, rather than working out a truth table column by column, you may want to do it row by row, so that you can stop as soon as you have found a row of the kind you are looking for.

• A big drawback of this approach is that if no row of the kind you are looking for exists, then you have to complete the whole truth table after all.

Page 55: Propositional Logic Review Computability and Logic

A More Focused Search

• Consider the following argument:

P (Q R)

R

R Q

• We are interested in whether all premises can be true and the conclusion false:– In order for the conclusion to be false, R must be false.– In order for the second premise to be true while R is

false, Q must be false.– In order for the first premise to be true while Q and R

are both false, P must be false.

Page 56: Propositional Logic Review Computability and Logic

The Short Truth Table Method

• The Short Truth Table Method assigns truth values to the involved atomic and complex statements in order to try and obtain a certain combination of truth values:

P (Q R) RR QT FT FF T FF FF

/

• The Short Truth Table Method thus tries to generate one row of the truth table that has the combination of truth values you are interested in.

Page 57: Propositional Logic Review Computability and Logic

Short Truth Table Method and Indirect Proof

• As you assign truth values to certain statements, the truth values of other statements can be forced.

• If you are forced to make a statement both true and false, then you know that the combination of truth values you are looking for does not exist:

P (Q P)F FT FT

• The short truth table method is therefore a kind of indirect proof (proof by contradiction), except that you don’t always get a contradiction.

Contradiction, so the statement is a tautology!

Page 58: Propositional Logic Review Computability and Logic

Drawback of the Short Truth Table Method

• A drawback of the short truth table method is that you are not always forced to assign any further truth values:

• At this point, you can choose to assign certain truth values, but if your choice does not lead to the row you are looking for, then you need to try a different option, and the short truth table method has no tools to do go through all of your options in a systematic way.

R (Q P) R P(Q R) PTT T

QTT T

Page 59: Propositional Logic Review Computability and Logic

Truth Trees• The obvious solution to the drawback of the

short truth table method is to incorporate tools to systematically keep track of multiple options.

• One method that does so is the truth tree method:– The truth tree method tests for the consistency of a

set of statements and, as such, can be used to determine validity, tautologies, equivalence, etc.

– Like the short table method, it infers which other statements are forced to be true under this assumption.

– When nothing is forced, then the tree branches into the possible options.

Page 60: Propositional Logic Review Computability and Logic

Truth Tree Example

(((PQ)R) (P(QR)))

((PQ)R)

(P(QR))

(PQ)RP(QR)

P(QR)

Q

R

(PQ) R

P Q× ×

×

PQRPQ

P Q R

Q R××

×

All branches close the originalstatement cannot be false tautology!

Page 61: Propositional Logic Review Computability and Logic

Decomposition Rules for Truth Trees

PQ

PQ PQ

PQ

P

(PQ)

(PQ)

(PQ)

(PQ)

P

PP

P

P P

Q

Q

Q

Q

Q

P

P P P

P

Q QQ

Q

Q

Page 62: Propositional Logic Review Computability and Logic

Truth Trees as Decision Procedures

• The truth tree method can easily be made into a systematic procedure.

• As such, the truth tree method becomes a decision procedure for truth-functional consequence that is, on average, quite a bit more efficient than the truth-table method.