16
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Embed Size (px)

Citation preview

Page 1: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Logical Form and Logical Equivalence

Lecture 1

Section 1.1

Wed, Jan 12, 2005

Page 2: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Statements

A statement is a sentence that is either true or false, but not both.

Statements:It is raining.I am carrying an umbrella.

Not statementsHello.Are you there?Go away!

Page 3: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Logical Operators

Binary operators Conjunction – “and”. Disjunction – “or”.

Unary operator Negation – “not”.

Other operators XOR – “exclusive or” NAND – “not both” NOR – “neither”

Page 4: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Logical Symbols

Statements are represented by letters: p, q, r, etc.

means “and”. means “or”. means “not”.

Page 5: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Examples

Basic statements p = “It is raining.” q = “I am carrying an umbrella.”

Compound statements p q = “It is raining and I am carrying an umbrella.” p q = “ It is raining or I am carrying an umbrella.” p = “It is not raining.”

Page 6: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

False Negations

StatementEveryone likes me.

False negationEveryone does not like me.

True negationSomeone does not like me.

Page 7: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

False Negations

StatementSomeone likes me.

False negationSomeone does not like me.

True negationNo one likes me.

Page 8: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Truth Table of an Expression

Make a column for every variable. List every possible combination of truth

values of the variables. Make one more column for the expression. Write the truth value of the expression for

each combination of truth values of the variables.

Page 9: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Truth Table for “and”

p q p q

T T T

T F F

F T F

F F F

p q is true if p is true and q is true. p q is false if p is false or q is false.

Page 10: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Truth Table for “or”

p q is true if p is true or q is true. p q is false if p is false and q is false.

p q p qT T T

T F T

F T T

F F F

Page 11: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Truth Table for “not”

p is true if p is false. p is false if p is true.

p p

T F

F T

Page 12: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Example: Truth Table

Truth table for the statement (p) (q r).

p q r (p) (q r )

T T T T

T T F F

T F T F

T F F F

F T T T

F T F T

F F T T

F F F T

Page 13: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Logical Equivalence

Two statements are logically equivalent if they have the same truth values for all combinations of truth values of their variables.

Page 14: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Example: Logical Equivalence

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

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

T T T T

T F F F

F T F F

F F T T

Page 15: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

DeMorgan’s Laws

(p q) (p) (q) (p q) (p) (q) (C++) If it is not true that

i < size && value != array[i]

then it is true thati >= size || value == array[i]

If it is not true that x 5 or x 10, then it is true that x > 5 and x < 10.

Page 16: Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005

Tautologies and Contradictions

A tautology is a statement that is logically equivalent to T.

A contradiction is a statement that is logically equivalent to F.

Some tautologies: p p p q (p q)

Some contradictions: p p p q (p q)