Vous êtes sur la page 1sur 41

Propositional Logic

Jim Hefferon
http://joshua.smcvt.edu/proofs

Truth tables

Propositions
A proposition is an assertion that has a truth value, either true or false.

Propositions
A proposition is an assertion that has a truth value, either true or false. These are propositions: 2 + 2 = 4 and Two circles in the plane intersect in either zero points, one point, two points, or all of their points.

Propositions
A proposition is an assertion that has a truth value, either true or false. These are propositions: 2 + 2 = 4 and Two circles in the plane intersect in either zero points, one point, two points, or all of their points. These are not propositions: 3 + 5 and x is not prime.

Negation
Prexing a proposition with not inverts its truth value. It is not the case that 3 + 3 = 5 is true. It is not the case that 3 + 3 = 6 is false.

Negation
Prexing a proposition with not inverts its truth value. It is not the case that 3 + 3 = 5 is true. It is not the case that 3 + 3 = 6 is false. So not is truth functional the truth of not P depends only on the truth value of P. Specically, the truth value of not P is the opposite of the truth value of P. We say it is a unary logical operator or a unary boolean function since it takes one input, a truth value, and yields as output a truth value.

Conjunction, disjunction
A proposition consisting of the word and between two sub-propositions is true if the two halves are true. 3 + 1 = 4 and 3 1 = 2 is true 3 + 1 = 4 and 3 1 = 1 is false 3 + 1 = 5 and 3 1 = 2 is false

Conjunction, disjunction
A proposition consisting of the word and between two sub-propositions is true if the two halves are true. 3 + 1 = 4 and 3 1 = 2 is true 3 + 1 = 4 and 3 1 = 1 is false 3 + 1 = 5 and 3 1 = 2 is false A compound proposition constructed with or between two sub-propositions is true if at least one half is true. 2 2 = 4 or 2 2 = 4 is true 2 2 = 3 or 2 2 = 4 is false 2 2 = 4 or 3 + 1 = 4 is true

Conjunction, disjunction
A proposition consisting of the word and between two sub-propositions is true if the two halves are true. 3 + 1 = 4 and 3 1 = 2 is true 3 + 1 = 4 and 3 1 = 1 is false 3 + 1 = 5 and 3 1 = 2 is false A compound proposition constructed with or between two sub-propositions is true if at least one half is true. 2 2 = 4 or 2 2 = 4 is true 2 2 = 3 or 2 2 = 4 is false 2 2 = 4 or 3 + 1 = 4 is true So and and or are binary logical operators.

Truth Tables
Describe the action of operators with truth tables. P F T P T F P F F T T Q F T F T PQ F F F T PQ F T T T

Write P for not P, P Q for P and Q, and P Q for P or Q.

Truth Tables
Describe the action of operators with truth tables. P F T P T F P F F T T Q F T F T PQ F F F T PQ F T T T

Write P for not P, P Q for P and Q, and P Q for P or Q. One advantage of this notation is that it allows formulas of a complexity that would be awkward in an English sentence. For instance, (P Q) (P Q) is hard to express in English.

Sometimes we prefer using 0 for F and 1 for T . One reason for the preference is that on the left side of the tables the rows make the ascending binary numbers. P 0 1 P 1 0 P 0 0 1 1 Q 0 1 0 1 PQ 0 0 0 1 P+Q 0 1 1 1

Sometimes we prefer using 0 for F and 1 for T . One reason for the preference is that on the left side of the tables the rows make the ascending binary numbers. P 0 1 P 1 0 P 0 0 1 1 Q 0 1 0 1 PQ 0 0 0 1 P+Q 0 1 1 1

. Note that P = 1 P. In this context not P is symbolized P The table makes clear why P and Q is symbolized with a multiplication dot P Q. For P or Q the plus sign is the best symbol because or is accumulation of the truth value T .

Other operators: Exclusive Or


Disjunction models sentences meaning and/or. In contrast, Eat your dinner or no dessert, Live free or die, and Let me go or the hostage gets it all mean one or the other, but not both. P F F T T Q F T F T P XOR Q F T T F

Other operators: Implies


We model if P then Q this way. P F F T T Q F T F T PQ T T F T

Here P is the antecedent while Q is the consequent.

Other operators: Bi-implication


Model P if and only if Q with this. P F F T T Q F T F T PQ T F F T

This is also called logical equivalence. Mathematicians sometimes write i.

All binary operators


We can lists all of the binary logical operators.
P F F T T Q F T F T P 0 Q F F F F P F F T T Q F T F T P 1 Q F F F T P F F T T Q F T F T P 15 Q T T T T

...

All binary operators


We can lists all of the binary logical operators.
P F F T T Q F T F T P 0 Q F F F F P F F T T Q F T F T P 1 Q F F F T P F F T T Q F T F T P 15 Q T T T T

...

These are the unary ones.


P F T 0 P F F P F T 1 P F T P F T 2 P T F P F T 3 P T T

All binary operators


We can lists all of the binary logical operators.
P F F T T Q F T F T P 0 Q F F F F P F F T T Q F T F T P 1 Q F F F T P F F T T Q F T F T P 15 Q T T T T

...

These are the unary ones.


P F T 0 P F F P F T 1 P F T P F T 2 P T F P F T 3 P T T

A zero-ary function is constant so the zero-ary boolean functions are: T and F.

Evaluating complex statements


We can calculate how the output results depend on the values of the input variables.

Evaluating complex statements


We can calculate how the output results depend on the values of the input variables. Here is the input-output relationship for (P Q) (P R). P F F F F T T T T Q F F T T F F T T R F T F T F T F T PQ T T T T F F T T PR T T T T F T F T (P Q) (P R) T T T T F F F T

Tautology, Satisability, Equivalence


A formula is a tautology if it evaluates to T for every value of the variables. A formula is satisable if it evaluates to T for at least one value of the variables.

Tautology, Satisability, Equivalence


A formula is a tautology if it evaluates to T for every value of the variables. A formula is satisable if it evaluates to T for at least one value of the variables. Two propositional expressions are logically equivalent if they give the same input-output relationship. Check that the expressions E0 and E1 are equivalent by using truth tables to verify that E0 E1 is a tautology. For instance, P Q and Q P are equivalent. Another example is that P Q and Q P are equivalent.

Note on the denition of implication


P F F T T Q F T F T PQ T T F T

Consider if Babe Ruth was president then life exists on other planets or if Mallory reached the summit of Everest then life exists on earth. Our denition of implies takes both of these statements to be true, the rst because its antecedent is false and the second because its consequent is true. Some people say that this violates their intuition and ask why we adopt the denition.

Note on the denition of implication


P F F T T Q F T F T PQ T T F T

Consider if Babe Ruth was president then life exists on other planets or if Mallory reached the summit of Everest then life exists on earth. Our denition of implies takes both of these statements to be true, the rst because its antecedent is false and the second because its consequent is true. Some people say that this violates their intuition and ask why we adopt the denition. Standard mathematical practice denes implication so as to have if n is a perfect square then n is not prime be true for all n N. Take x = 6 to get that F T must evaluate to T . Take x = 3 to get that F F should yield T . For T T take x = 4.

Points about implication


P F F T T Q F T F T PQ T T F T

The antecedent P need not be materially connected to the consequent Q; we saw that on the prior slide.

Points about implication


P F F T T Q F T F T PQ T T F T

The antecedent P need not be materially connected to the consequent Q; we saw that on the prior slide. If the antecedent P is false then the statement as a whole is true.

Points about implication


P F F T T Q F T F T PQ T T F T

The antecedent P need not be materially connected to the consequent Q; we saw that on the prior slide. If the antecedent P is false then the statement as a whole is true. If the antecedent P is true then the statement as a whole has the same truth value as the consequent.

Points about implication


P F F T T Q F T F T PQ T T F T

The antecedent P need not be materially connected to the consequent Q; we saw that on the prior slide. If the antecedent P is false then the statement as a whole is true. If the antecedent P is true then the statement as a whole has the same truth value as the consequent. If the consequent Q is true then the statement as a whole is true.

Points about implication


P F F T T Q F T F T PQ T T F T

The antecedent P need not be materially connected to the consequent Q; we saw that on the prior slide. If the antecedent P is false then the statement as a whole is true. If the antecedent P is true then the statement as a whole has the same truth value as the consequent. If the consequent Q is true then the statement as a whole is true. Truth tables show that P Q is equivalent to (P Q), to P Q, and also equivalent to the contrapositive Q P.

Points about implication


P F F T T Q F T F T PQ T T F T

The antecedent P need not be materially connected to the consequent Q; we saw that on the prior slide. If the antecedent P is false then the statement as a whole is true. If the antecedent P is true then the statement as a whole has the same truth value as the consequent. If the consequent Q is true then the statement as a whole is true. Truth tables show that P Q is equivalent to (P Q), to P Q, and also equivalent to the contrapositive Q P. On a table in front of you are four cards, marked A, B, 0, and 1. You must verify the truth of the implication, if a card has a vowel on the one side then it has an even number on the other. How to do it, turning over the fewest cards?

Predicates, Quantiers
Consider the mathematical statement if n is odd then n is a perfect square.

Predicates, Quantiers
Consider the mathematical statement if n is odd then n is a perfect square. It involves two clauses, n is odd and n is square, for each of which the truth value depend on the variable. A predicate is a truth-valued function. An example is the function Odd that takes an integer as input and yields either T or F, as in Odd(5) = T . Another example is Square, as in Square(5) = F.

Predicates, Quantiers
Consider the mathematical statement if n is odd then n is a perfect square. It involves two clauses, n is odd and n is square, for each of which the truth value depend on the variable. A predicate is a truth-valued function. An example is the function Odd that takes an integer as input and yields either T or F, as in Odd(5) = T . Another example is Square, as in Square(5) = F. A mathematician who made that statement would mean that it holds for all n. To make this explicit we need a quantier describing for how many values of the variable the implication must hold in order for the statement as a whole to be true. We denote for all by . The other main quantier is there exists, denoted . With these, the statement is n N Odd(n) Square(n) .

Examples of statements written with explicit quantiers. Every number is divisible by 1. n N 1 | n

Examples of statements written with explicit quantiers. Every number is divisible by 1. n N 1 | n There are ve dierent powers n where the equation 2n 7 = a2 has a solution. n0 , . . . , n4 N (n0 = n1 ) (n0 = n2 ) (n3 = n4 )
n4 a0 N(2n0 7 = a2 7 = a2 0 ) a4 N(2 4)

Examples of statements written with explicit quantiers. Every number is divisible by 1. n N 1 | n There are ve dierent powers n where the equation 2n 7 = a2 has a solution. n0 , . . . , n4 N (n0 = n1 ) (n0 = n2 ) (n3 = n4 )
n4 a0 N(2n0 7 = a2 7 = a2 0 ) a4 N(2 4)

Any two integers have a common multiple. n0 , n1 N m N (n0 | m) (n1 | m)

Examples of statements written with explicit quantiers. Every number is divisible by 1. n N 1 | n There are ve dierent powers n where the equation 2n 7 = a2 has a solution. n0 , . . . , n4 N (n0 = n1 ) (n0 = n2 ) (n3 = n4 )
n4 a0 N(2n0 7 = a2 7 = a2 0 ) a4 N(2 4)

Any two integers have a common multiple. n0 , n1 N m N (n0 | m) (n1 | m) The function f : R R is continuous at a R. > 0 > 0 x R (|x a| < ) (|f(x) f(a)| < )

Observe that the negation of a statement is a statement. For instance, the negation of every odd number is a perfect square n N Odd(n) Square(n) is n N Odd(n) Square(n) which is equivalent to this. n N Odd(n) Square(n) Thus a person could show every odd number is a perfect square is false by nding a number that is both odd and not a square.

Observe that the negation of a statement is a statement. For instance, the negation of every odd number is a perfect square n N Odd(n) Square(n) is n N Odd(n) Square(n) which is equivalent to this. n N Odd(n) Square(n) Thus a person could show every odd number is a perfect square is false by nding a number that is both odd and not a square. Simililarly the negation of a statement is a .

Vous aimerez peut-être aussi