37
Logical Form and Logical Equivalence M260 2.1

Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Embed Size (px)

Citation preview

Page 1: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form and Logical Equivalence

M260 2.1

Page 2: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form Example 1

• If the syntax is faultyor execution results in division by zero,then the program will generate an error message.

• Thereforeif the computer does not generate an error messagethen the syntax is correctand the execution does not result in division by zero.

Page 3: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form Example 2

• If x is a Real number such that x<-2 or x>2,then x2>4.

• Thereforeif x24,then x-2 and x2.

Page 4: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form Example 1

• If (the syntax is faulty)or (execution results in division by zero),then (the program will generate an error message).

• Thereforeif (the computer does not generate an error message)then (the syntax is correct)and (the execution does not result in division by zero).

Page 5: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form Example 1

• If (p)or (q),then (r).

• Thereforeif (not r)then (not p)and (not q).

Page 6: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form Example 2

• If (x<-2) or (x>2),then (x2>4).

• Thereforeif (x24),then (x-2) and (x2).

Page 7: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form Example 2

• If (p) or (q),then (r).

• Thereforeif (not r),then (not p) and (not q).

Page 8: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Form vs Content

• Examples 1 and 2 have the same form:If p or q, then r.therefore if not r, then not p and not q.

• These examples have different values for the propositional variables p and q.

Page 9: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Formal Logic Goals

• Avoid Ambiguity

• Obtain Consistency

• Elucidate Proof Mechanisms

Page 10: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Mathematical Vocabulary

• New terms are defined using previously defined terms.

• Initial terms remain undefined.

• Undefined terms in logic: sentence, true, false.

Page 11: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logic Symbols ~

• ~ denotes “not”

• Negation of p is ~p.

Page 12: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logic Symbols ~

denotes “and”

• Conjunction of p and q is p q. denotes “or”

• Disjunction of p and q is p q.

• Precedence: first ~ then and (unordered)

Page 13: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Truth Values

• True

• False

Page 14: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Precedence Examples

• ~p q• ~p ~q

• ~ (p q)

Page 15: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Let p, q and r be 0<x, x<3, and x=3

• Rewrite x 3

• q r• Rewrite 0<x<3

• pq• Rewrite 0<x3

• p(q r)

Page 16: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Negation Truth Table

p ~p

T F

F T

Page 17: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Conjunction Truth Table

p q pq

T T T

T F F

F T F

F F F

Page 18: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Disjunction Truth Table

p q p q

T T T

T F T

F T T

F F F

Page 19: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Statement Form

• Statement variables

• Logical connectives

• Truth table

Page 20: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Exclusive Or

• p or q but not both

• (p q) ~(p q)

• Do a truth table

Page 21: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Exclusive Or Truth Table

p q p q p q ~(p q)(p q) ~(p q)

Page 22: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Exclusive Or Truth Table

p q p q p q ~(p q)(p q) ~(p q)

T T

T F

F T

F F

Page 23: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Exclusive Or Truth Table

p q p q p q ~(p q)(p q) ~(p q)

T T T T F

T F T F T

F T T F T

F F F F T

Page 24: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Exclusive Or Truth Table

p q p q p q ~(p q)(p q) ~(p q)

T T T T F F

T F T F T T

F T T F T T

F F F F T F

Page 25: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Equivalence

• Statement Forms are logically equivalent if, and only if, they have the same truth tables.

• P Q

Page 26: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Equivalence Examples

• 6>2 2<6

• p q q p• p ~(~p)

Page 27: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

De Morgan’s Laws

• ~(p q) ~p ~ q

• ~(p q) ~p ~ q

• Do truth tables

Page 28: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

~(p q) ~p ~ q

p q ~p ~q p q ~(p q) ~p ~q

Page 29: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

~(p q) ~p ~ q

p q ~p ~q p q ~(p q) ~p ~q

T T

T F

F T

F F

Page 30: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

~(p q) ~p ~ q

p q ~p ~q p q ~(p q) ~p ~q

T T F F T F F

T F F T T F F

F T T F T F F

F F T T F T T

Page 31: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Practice Negations

• John is six feet tall and weighs at least 200 pounds.

• John is not six feet tall or he weighs less than 200 pounds.

Page 32: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Practice Negations

• The bus was late or Tom’s watch was slow.

• The bus was not late and Tom’s watch was not slow.

Page 33: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Jim is tall and thin.

Logical And and Or are only allowed between statements.

Page 34: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Tautologies and Contradictions

• A tautology is a statement form that is always true regardless of the values of the statement variables.

• A contradiction is a statement form that is always false regardless of the values of the statement variables

Page 35: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logically Equivalent Forms

• Commutative laws• Associative laws• Distributive laws• Identity laws• Negation laws• Double negative law

• Idempotent laws• De Morgan’s laws• Universal bound laws• Absorption laws• Negations of

tautologies and contradictions

Page 36: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Equivalences• pq _________ pq ________• (pq)r _______ (pq)r _______ • p(qr) ______ p(qr) _______• pt __________pc __________• p~p _________p~p _________• ~(~p) ________• pp __________pp __________• ~(pq ) _______ ~(pq ) _______• pt __________ pc __________• p(pq) ______ p(pq) ______• ~t ___________~c ___________

Page 37: Logical Form and Logical Equivalence M260 2.1. Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program

Logical Equivalences• pq qp pq qp• (pq)r p(qr) (pq)r p(qr)  • p(qr) (pq) (p r)• p(qr) (pq) (p r) • pt p pc p• p~p t p~p c• ~(~p) p• pp p pp p• ~(pq ) ~p~q ~(pq ) ~p~q • pt t pc c• p(pq) p p(pq) p• ~t c~c t