33
Chapter 2 Symbolic Logic

Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Embed Size (px)

Citation preview

Page 1: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Chapter 2

Symbolic Logic

Page 2: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Section 2-1

Truth, Equivalence and Implication

Page 3: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

More on Implication

Universal Implication: A statement p implies a statement q, if q is true in every situation that makes p true. pq

EX: (x>2) (x>1)

Page 4: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

More on Implication

Ex:

Show that p ^ q implies p V (¬p ^ q)

Page 5: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Def.

A universally true statement is true for each element of the universe.

Ex:

Universe: Flipping 2 coins.

p: if there is one tail then there is one head.

- p is a universally true statement.

Page 6: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Tautology

A tautologically true statement is a statement that is always true ( it can be written as a symbolic statement whose truth table has only Trues in the final column).

Ex: “The result has 2 H’s or the result doesn’t have 2 H’s” ( p V ¬p)

The statement is always true (tautology).

Page 7: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Contradiction

A statement that is always false.

Ex: p ^ ¬ p is always false ( a contradiction).

Page 8: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Example

p is the statement: x<=0 q is the statement: x>=10

Show that ¬(p V q) and ¬p ^ ¬q are equivalent.

Page 9: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Section 2.3

Predicate Logic

Page 10: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Propositional Logic

In propositional logic we used symbols to represent simple statements ( p, q, r, s)

we also used symbols and logical connectives ( V, ^, , , ¬ ) to represent ⊕compound statements.

Page 11: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic

A predicate is a function that always evaluates to either true or false.

A predicate has the form: Predicate-name( List of Arguments).Ex: x is a positive numberPredicate: positive number (x)Positive number (5)= TruePositive number (-5)= False

Page 12: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic

Ex:

“ 5 is greater than 2”

We define the predicate greater than as:

Greater than( x, y): x>y

P (x, y): x>y

P(2,5)= False

P(5,2)= True

Page 13: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic

1- Uses predicates to represent simple statements.

2- Uses Logical connectives ( V, ^, , , ¬ ) ⊕3- Quantifiers:

Universal quantifier: Existential quantifier: 4- Variables: x, y, z….. .

Page 14: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic

Ex: Consider the statement “ x is greater than 14”.

Predicate: p( x, y): x>y

P( x,14): x>14- There is a value greater than 14 is represented

as .........- All values are greater than 14 is represented as

……….- All values are less than 14 as……………..

Page 15: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic

Ex:

Element x belongs to set A.

B (x, A): Element x belongs to set A.

- Every element in A belongs also to B is represented as: x [ b( x, A) b( x, B)]

Page 16: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Free and Bound variables

The variable x is said to be bound by x or by x if x lies in the scope of the quantifier.

A variable that is not bound by a quantifier is said to be free.

Page 17: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Free and Bound Variables

Ex: Below, describe the scope of each quantifier, and describe which variables are bound and which are free.

x ( p (x) ^ y (t( x, y) ^ r(x)))No free variables.- ¬ x (p(x) ^ y (t(x,y)) V r(z))Z is free.- ¬ x (p(x) ^ y (t(x,y)) V r(y)).Y in t(x,y) is bound but the y in r(y) is free.

Page 18: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Free and Bound Variables

Ex: x [ b( x, A)] b( x, B)

Means: If A is the universe, x belongs to B.

What is the scope of the quantifier? x [ b( x, A)] x [b( x, B)]

It means: If A is the universe then B is the universe.

Page 19: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic

Ex:Assume b(x,y) represents the statement “x belongs to y”. Represent each of the following in predicate logic:- 2 belongs to S.- 1 belongs to A and 2 belongs to B.- All elements in A are positive.- There is an element in A that is not in B.- There is an element in A that is greater then any element in B.- A is a subset in B.

Page 20: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic ( quantifiers)

The statement x s(x) is true iff s is true for every element in the universe.

The statement x s(x) is true iff s is true for at least one element in the universe.

Page 21: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Predicate Logic (quantifiers)

Ex: Suppose Universe: the set of +ve integers s(x) represents “x is an even integer” p(x) represents “x is a prime integer” r(x) represents “ x>2”

Which of the following are true and which are false? x p(x) …. True( try x=2) x p(x) …. False (try x=4) x (p(x) ^ s(x)) … true ( x=2) x (p(x) ^ s(x) ^ r(x)) …false x (s(x) p(x))…false ( try x=4) x (p(x) s(x))…false (try x=3) x (p(x) s(x))… true (x=2) x [(r(x)^s(x))p(x)] …. true(x=2)

Page 22: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Equivalence

Two statements p and q in predicate logic are equivalent if for any universe and for any statements about the universe we substitute for p,q the resulting statements about the universe are equivalent.

Ex:

x(¬ s (x)) is equivalent to ¬ x (s (x))

Page 23: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Equivalence Rules

The following quantified statements are equivalent. x(¬ s (x)) ↔ ¬ x (s (x))- (x s(x)) ^t ↔ x (s(x) ^t)- (x s(x)) ^t ↔ x (s(x) ^t)- (x s(x)) v t ↔ x (s(x) vt)- (x s(x)) v t ↔ x (s(x) v t)- [x p(x)] ^ [x q(x)] ↔ x [p(x) ^ q(x)] - [x p(x)] v [z q(z)] ↔ x [p(x) v q(x)]

Page 24: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Equivalence

Ex:

- [w p(w)] ^ [w q(w)]

- w [p(w) ^ q(w)]

Are they equivalent? Why?

Page 25: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Equivalence

Ex:

- y [x p(x,y)] x [y p(x,y)]

Are they equivalent? Why?

Page 26: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Section 2.2

Proof Methods:- Direct proof- Indirect proofs:

a- Contra positive inference

b- Proof by contradiction

Page 27: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Converses

The statement qp is the converse of the statement pq.

If pq is true, it does not mean that qp is true.

-Ex:-If n is a positive even integer, then n>1. (pq)- 5>1, then 5 is a positive even integer

(qp)....false

Page 28: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Counter-example

To show that a statement is theorem we give a proof.

To show that a statement is false (not theorem), we give a counter-example.

Ex:

“ If n is a positive integer, then n >5”

Counter-example: n=4 (positive and <5)

Page 29: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Direct proof or principle of direct inference (also called modes ponens)

If we know that r is true, and rs is true, we conclude that s is true. A direct proof has the form:

Statement1Statement 2...Statement n

Where statement n is the one we want to prove and each other statement is:

a- a hypothesisb- an accepted mathematical factc- the result of applying direct inference to earlier statements

Page 30: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Direct proof

Ex:

Prove that if the integers n and m are each multiple of 3, then m+n is a multiple of 3.

Note: The word assume precedes the hypothesis and the words ( therefore, then) precedes the inference.

Page 31: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Contra positive Inference

To show that pq, we show that ¬q¬p

Ex:

Prove that for each number n of the universe of positive integers, if n2 >100 then n>10.

Page 32: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Proof by Contradiction

From p and p^¬q¬p we conclude q. If assuming that ¬p leads to contradiction,

the p is true.

Ex:

Prove that if x2 +x-2 =0 then x ≠ 0

Also, see example 15 page 74

Page 33: Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication

Example

Show that if the following statements are true

p

pq

qr

rs

Then s is also true.

(Prove it by both direct and contradiction).