Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

66
Top i c 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logi c

Transcript of Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Page 1: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Topic 2:

Logic – CSc 245 v1.1 (McCann) – p. 1

Logic

Page 2: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

What Is Logic?

Logic – CSc 245 v1.1 (McCann) – p. 2

Definition: Philosophical Logic

Definition: Mathematical Logic

Page 3: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

What Is Logic?

Logic – CSc 245 v1.1 (McCann) – p. 2

Definition: Mathematical Logic

Definition: Philosophical Logic

The study of thought and reasoning, including

argu- ments and proof techniques. (This is the

classical no- tion of logic.)

Page 4: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

What Is Logic?

Logic – CSc 245 v1.1 (McCann) – p. 2

Definition: Philosophical Logic

The study of thought and reasoning, including

argu- ments and proof techniques. (This is the

classical no- tion of logic.)

Definition: Mathematical Logic

The use of formal languages and grammars to represent

the syntax and semantics of computation.

Page 5: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

Logic – CSc 245 v1.1 (McCann) – p. 5

A few of the many reasons:

• Logic is the foundation for computer operation.

Page 6: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

Logic – CSc 245 v1.1 (McCann) – p. 5

A few of the many reasons:

• Logic is the foundation for computer operation.

• Logical conditions are common in programs:

Page 7: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

Logic – CSc 245 v1.1 (McCann) – p. 5

A few of the many reasons:

• Logic is the foundation for computer operation.

• Logical conditions are common in programs:

◦ Selection:

if (score <= max) { ... }

Page 8: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

Logic – CSc 245 v1.1 (McCann) – p. 5

A few of the many reasons:

• Logic is the foundation for computer operation.

• Logical conditions are common in programs:

◦ Selection:

if (score <= max) { ... }

◦ Iteration:

while (i<limit && list[i]!=sentinel) ...

Page 9: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

Logic – CSc 245 v1.1 (McCann) – p. 5

A few of the many reasons:

• Logic is the foundation for computer operation.

• Logical conditions are common in programs:

◦ Selection:

if (score <= max) { ... }

◦ Iteration:

while (i<limit && list[i]!=sentinel) ...

• All manner of structures in computing have properties that need to

be proven (and proofs that need to be understood).

◦ Examples: Trees, Graphs, Recursive Algorithms, . . .

Page 10: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

Logic – CSc 245 v1.1 (McCann) – p. 5

A few of the many reasons:

• Logic is the foundation for computer operation.

• Logical conditions are common in programs:

◦ Selection:

if (score <= max) { ... }

◦ Iteration:

while (i<limit && list[i]!=sentinel) ...

• All manner of structures in computing have properties that need to

be proven (and proofs that need to be understood).

◦ Examples: Trees, Graphs, Recursive Algorithms, . . .

• Programs can be proven correct.

Page 11: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Why Are We Studying Logic?

A few of the many reasons:

• Logic is the foundation for computer operation.

• Logical conditions are common in programs:

◦ Selection:

if (score <= max) { ... }

◦ Iteration:

while (i<limit && list[i]!=sentinel) ...

• All manner of structures in computing have properties that need to

be proven (and proofs that need to be understood).

◦ Examples: Trees, Graphs, Recursive Algorithms, . . .

• Programs can be proven correct.

• Computational linguistics must represent and reason about human

language, and language represents thought (and thus also logic).

Page 12: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

So we can relate to Mr. Spock

Page 13: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (1 / 2)

Logic – CSc 245 v1.1 (McCann) – p. 6

Definition: Simple Proposition

Definition: Proposition

A proposition (a.k.a. statement) is a claim that is

either true or false with respect to an associated

context.

Page 14: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (1 / 2)

Logic – CSc 245 v1.1 (McCann) – p. 6

Definition: Proposition

A proposition (a.k.a. statement) is a claim that is

either true or false with respect to an associated

context.

Definition: Simple Proposition

A proposition containing no logical operators.

Page 15: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Logic – CSc 245 v1.1 (McCann) – p. 7

Some non-propositions:

Page 16: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Isotope 52Fe is radioactive

Logic – CSc 245 v1.1 (McCann) – p. 7

True

Some non-propositions:

Page 17: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Logic – CSc 245 v1.1 (McCann) – p. 7

Isotope 52Fe is radioactive

Toronto is the capital of

Canada.

True

False (Ottawa)

Some non-propositions:

Page 18: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Logic – CSc 245 v1.1 (McCann) – p. 7

Isotope 52Fe is radioactive

Toronto is the capital of

Canada.

5 ∗(1 + 4) = 5 ∗4 + 5

∗1

True

False (Ottawa)

True

(Distributivity)

Some non-propositions:

Page 19: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Logic – CSc 245 v1.1 (McCann) – p. 7

Isotope 52Fe is radioactive

Toronto is the capital of

Canada.

5 ∗(1 + 4) = 5 ∗4 + 5

∗199.44 is irrational.

True

False (Ottawa)

True

(Distributivity)

False (rational)Some non-propositions:

Page 20: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Logic – CSc 245 v1.1 (McCann) – p. 7

Isotope 52Fe is radioactive

Toronto is the capital of

Canada.

5 ∗(1 + 4) = 5 ∗4 + 5

∗199.44 is irrational.

True

False (Ottawa)

True

(Distributivity)

False (rational)Some non-propositions:

log2x = 4 (what is x?)

Page 21: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Logic – CSc 245 v1.1 (McCann) – p. 7

Isotope 52Fe is radioactive

Toronto is the capital of

Canada.

5 ∗(1 + 4) = 5 ∗4 + 5

∗199.44 is irrational.

True

False (Ottawa)

True

(Distributivity)

False (rational)Some non-propositions:

log2x = 4

Is your name Ferb?

(what is x?)

(questions are not claims)

Page 22: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Simple Propositions (2 / 2)

Example(s):

Some propositions:

Isotope 52Fe is radioactive

Toronto is the capital of

Canada.

5 ∗(1 + 4) = 5 ∗4 + 5

∗199.44 is irrational.

True

False (Ottawa)

True

(Distributivity)

False (rational)Some non-propositions:

log2x = 4

Is your name Ferb?

Listen to me!

(what is x?)

(questions are not claims)

(a command, not a claim)

Logic – CSc 245 v1.1 (McCann) – p. 7

Page 23: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Proposition Labels

To save writing, it is traditional to label propositions with

lower-case letters called proposition labels or statement

letters.

Example(s):

Logic – CSc 245 v1.1 (McCann) – p. 8

Page 24: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Proposition Labels

To save writing, it is traditional to label propositions with

lower-case letters called proposition labels or statement

letters.

Example(s):

t: Toronto is the capital of Canada.

Logic – CSc 245 v1.1 (McCann) – p. 8

Page 25: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Proposition Labels

To save writing, it is traditional to label propositions with

lower-case letters called proposition labels or statement

letters. (also called propositional or statement variable)

Example(s):

t: Toronto is the capital of Canada.

Either:

• Select meaningful letters (like ‘t’, above), or

• Use letters in sequence starting with ‘p’

Note: Labeled propositions are still True or False.

Logic – CSc 245 v1.1 (McCann) – p. 8

Page 26: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

In Other Words

A propositional or statement variable is just a variable that takes on the values of True or False.

A computer scientist might call them a Boolean variable or even a bit.

Page 27: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Compound Propositions

And with what do we combine them?

Logic – CSc 245 v1.1 (McCann) – p. 9

Definition: Compound Proposition

A statement that is a logical combination of multiple sim-

ple propositions.

Page 28: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conjunctions

Conjunctions are:

• compound propositions formed in English with the word “and”,

• formed in logic with the caret symbol (“ ∧ ”), and

• true only when both participating propositions are true.

Example(s):

Logic – CSc 245 v1.1 (McCann) – p. 11

Page 29: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conjunctions

Conjunctions are:

• compound propositions formed in English with the word “and”,

• formed in logic with the caret symbol (“ ∧ ”), and

• true only when both participating propositions are true.

Example(s):

Logic – CSc 245 v1.1 (McCann) – p. 11

I bought gas.p:

q:I got a haircut.

Page 30: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conjunctions

Conjunctions are:

• compound propositions formed in English with the word “and”,

• formed in logic with the caret symbol (“ ∧ ”), and

• true only when both participating propositions are true.

Example(s):

Logic – CSc 245 v1.1 (McCann) – p. 11

I bought gas.

I got a haircut.

p:

q:

p ∧ q:

I bought gas and I got a haircut.

Page 31: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

More Examples

My name is Eric and I am 6’10’ tall.

Is this a true or false proposition?What are the simple propositions that make it up?Are they true or false?

Page 32: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Disjunctions (1 / 3)

Logic – CSc 245 v1.1 (McCann) – p. 12

When two propositions p, q are joined by a disjunction, the compound proposition is true if at least one of them is true:

Page 33: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Disjunctions (1 / 3)

Logic – CSc 245 v1.1 (McCann) – p. 12

When two propositions p, q are joined by a disjunction, the compound proposition is true if at least one of them is true:

Example

n: My name is Erict: I’m 6’10” tall

n t: My name is Eric or I’m 6’10” tall.

Proposition is true.

Page 34: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Problems with English

While in mathematics, formal logic, and computer science “or” means disjunction (the prop is true if one or both of the joined props is true), in spoken English the meaning is not so clear.

Page 35: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Problems with English

While in mathematics, formal logic, and computer science “or” means disjunction (the prop is true if one or both of the joined props is true), in spoken English the meaning is not so clear.

For Example: If you drink the potion in the cup, you will live or you will die.

The speaker doesn’t mean you can both live and die. One or the other will happen. In other words, EXACTLY one has to be true. We call this an exclusive or.

Page 36: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Exclusive or

p

True if p is true or q is true but not both are true.

is always called exclusive or

is sometimes called inclusive or to emphasize the difference

Page 37: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Negation

Negating a proposition simply flips its value.

Symbols representing negation include:

¬x x

Example(s):

Logic – CSc 245 v1.1 (McCann) – p. 15

Page 38: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Negation

Negating a proposition simply flips its value.

Symbols representing negation include:

x ′

¬x x∼ x

Example(s):

We will not use these forms.

Logic – CSc 245 v1.1 (McCann) – p. 15

Page 39: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Negation

Negating a proposition simply flips its value.

Symbols representing negation include:

¬x x

Example(s):

Logic – CSc 245 v1.1 (McCann) – p. 15

h: Homework 1 is easy

Page 40: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Negation

Negating a proposition simply flips its value.

Symbols representing negation include:

¬x x

Example(s):

h: Homework 1 is easy

h: Homework 1 is not easy

Logic – CSc 245 v1.1 (McCann) – p. 15

Page 41: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (1 / 3)

Logic – CSc 245 v1.1 (McCann) – p. 29

Definition: Conditional Proposition

A proposition expressible in the form “if p, then q” (p →

q, read “p implies q”), where p and q are propo- sitions, is

a conditional proposition.

Example:

Page 42: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (1 / 3)

Logic – CSc 245 v1.1 (McCann) – p. 29

Definition: Conditional Proposition

A proposition expressible in the form “if p, then q” (p →

q, read “p implies q”), where p and q are propo- sitions, is

a conditional proposition.

Example:

If Sauron gets the ring, then all Middle-earth will be destroyed.

Page 43: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (2 / 3)

In “if p, then q”, p and qare known by various names:

Common forms of “if p, then q” (Rosen 7/e, p. 6):

—p q

Logic – CSc 245 v1.1 (McCann) – p. 30

Page 44: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (2 / 3)

In “if p, then q”, p and qare known by various names:

Common forms of “if p, then q” (Rosen 7/e, p. 6):

—p q

antecedent — consequent

Logic – CSc 245 v1.1 (McCann) – p. 30

Page 45: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (2 / 3)

In “if p, then q”, p and qare known by various names:

Common forms of “if p, then q” (Rosen 7/e, p. 6):

—p q

antecedent

hypothesis

— consequent— conclusion

Logic – CSc 245 v1.1 (McCann) – p. 30

Page 46: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (2 / 3)

In “if p, then q”, p and qare known by various names:

Common forms of “if p, then q” (Rosen 7/e, p. 6):

—p q

antecedent

hypothesis

sufficient

— consequent— conclusion— necessary

Logic – CSc 245 v1.1 (McCann) – p. 30

Page 47: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (2 / 3)

In “if p, then q”, p and qare known by various names:

Common forms of “if p, then q” (Rosen 7/e, p. 6):

—p q

antecedent

hypothesis

sufficient

— consequent— conclusion— necessary

Logic – CSc 245 v1.1 (McCann) – p. 30

⊲ if p, then q ⊲ q if p⊲ if p, q ⊲ q when p⊲ p implies q ⊲ q whenever p⊲ p only if q ⊲ q follows from p⊲ p is sufficient for q ⊲ q is necessary for p⊲⊲

a necessary condition for p is q

q unless ¬p

⊲⊲

a sufficient condition for q is pand I’m sure you could find more!

Page 48: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Conditional Propositions (3 / 3)

Example(s):

You will get a citation if you part in the loading zone.

≡ If you park in the loading zone, then you will get a citation.

Logic – CSc 245 v1.1 (McCann) – p. 31

The crops will grow well only if they are adequately fertilized.

≡ If the crops grow well, then they are adequately fertilized.

[Switching p and q gives an incorrect statement; crops need more than

just fertilizer.]

Page 49: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Inverse, Converse, and Contrapositive

Logic – CSc 245 v1.1 (McCann) – p. 34

Definition: Inverse

Definition: Converse

Definition: Contrapositive

Page 50: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

r s

T T

T F

F T

F F

(Inverse)

¬r → ¬s

(Converse)

s → r

Thus, Original ≡ Contrapositive Inverse ≡ Converse

(Orig.)(Contrapos.)

¬r ¬s r → s ¬s → ¬r

F F

F T

T F

T T

Logic – CSc 245 v1.1 (McCann) – p. 35

Inverse, Converse, and Contrapositive

Page 51: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

(Original) (Contrapos.)

If UA is in session, beer sales increase.If beer sales don't increase, UA isn't in session.

(Converse) (Inverse)

If beer sales increase, UA is in session.If UA isn't in session, beer sales do not increase.

Inverse, Converse, and Contrapositive

Logic – CSc 245 v1.1 (McCann) – p. 35

(Orig.) (Contrapos.) (Inverse) (Converse)

r s ¬r ¬s r → s ¬s →

¬r

¬r → ¬s s → r

T T F F T T T T

T F F T F F T T

F T T F T T F F

F F T T T T T T

Page 52: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Contraposition

Logic – CSc 245 v1.1 (McCann) – p. 35

An implication p→q gives you interesting information in two scenarios:

- If p is TRUE, then q must be TRUE- If q is FALSE, then p must be FALSE

.

Page 53: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (1 / 2)

Logic – CSc 245 v1.1 (McCann) – p. 41

What is the meaning of:

A triangle is equilateral if and only if all three angles are equal.

Page 54: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (1 / 2)What is the meaning of:

A triangle is equilateral if and only if all three angles are equal.

t: A triangle is equilateral a : All three angles are equal

IF AND ONLY IF

Logic – CSc 245 v1.1 (McCann) – p. 41

Page 55: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (1 / 2)What is the meaning of:

A triangle is equilateral if and only if all three angles are equal.

t: A triangle is equilateral a : All three angles are equal

IF AND ONLY IF

Logic – CSc 245 v1.1 (McCann) – p. 41

Page 56: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (1 / 2)What is the meaning of:

A triangle is equilateral if and only if all three angles are equal.

t: A triangle is equilateral a : All three angles are equal

IF AND ONLY IF

Logic – CSc 245 v1.1 (McCann) – p. 41

t if a

if a , then t

( a →

t) ∧

Page 57: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (1 / 2)What is the meaning of:

A triangle is equilateral if and only if all three angles are equal.

t: A triangle is equilateral a : All three angles are equal

IF AND ONLY IF

Logic – CSc 245 v1.1 (McCann) – p. 41

t if a

if a , then t

t only if a

if t, then a

( a →

t) ∧ ( t →

a )

Page 58: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (2 / 2)Definition: Biconditional Proposition

The expression “p if and only if q” (“p iff q”) is called

the biconditional proposition (a.k.a. biimplication)

and is represented by the symbol ↔ (as in: p ↔ q).

Logic – CSc 245 v1.1 (McCann) – p. 42

Page 59: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (2 / 2)

r s

T T

T F

F T

F F

Definition: Biconditional Proposition

The expression “p if and only if q” (“p iff q”) is called

the biconditional proposition (a.k.a. biimplication)

and is represented by the symbol ↔ (as in: p ↔ q).

r → s s → r ( r → s) ∧ ( s → r )

r ↔ s

Logic – CSc 245 v1.1 (McCann) – p. 42

Page 60: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Biconditional Propositions and if (2 / 2)Definition: Biconditional Proposition

The expression “p if and only if q” (“p iff q”) is called

the biconditional proposition (a.k.a. biimplication)

and is represented by the symbol ↔ (as in: p ↔ q).

Logic – CSc 245 v1.1 (McCann) – p. 42

r s r → s s → r (r→ s) ∧ (s → r )

r— s

T T T T T T

T F F T F F

F T T F F F

F F T T T T

Page 61: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Precedence of Logical Operators

Logic – CSc 245 v1.1 (McCann) – p. 18

Total agreement is hard to come by:

Page 62: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Precedence of Logical Operators

Total agreement is hard to come by:

Rosen 7/ePrecedence p. 11

Highest

Lowest

¬

(Note: We’ll cover → and ↔ soon.)

Logic – CSc 245 v1.1 (McCann) – p. 18

Page 63: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Precedence of Logical Operators

Total agreement is hard to come by:

(Note: We’ll cover → and ↔ soon.)

Logic – CSc 245 v1.1 (McCann) – p. 18

Precedence

Rosen 7/e

p. 11

Gersting 5/e

p. 6

Highest ¬

∧,∨

∨ →

Lowest

Page 64: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Precedence of Logical Operators

Total agreement is hard to come by:

(Note: We’ll cover → and ↔ soon.)

Logic – CSc 245 v1.1 (McCann) – p. 18

Precedence

Rosen 7/e

p. 11

Gersting 5/e

p. 6

Hein 2/e

p. 351

Highest ¬

∧,∨

¬

∨ → ∨

Lowest

↔ →

Page 65: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Precedence of Logical Operators

Total agreement is hard to come by:

(Note: We’ll cover → and ↔ soon.)

Logic – CSc 245 v1.1 (McCann) – p. 18

Precedence

Rosen 7/e

p. 11

Gersting 5/e

p. 6

Hein 2/e

p. 351

Epp 1/e

p. 24

Highest ¬

∧,∨

¬

∧,∨

Lowest

→ ,↔

Page 66: Topic 2: Logic – CSc 245 v1.1 (McCann) – p. 1 Logic.

Precedence of Logical Operators

Total agreement is hard to come by:

(Note: We’ll cover → and ↔ soon.)

In this class: Use parentheses to avoid confusion.

Logic – CSc 245 v1.1 (McCann) – p. 18

Precedence

Rosen 7/e

p. 11

Gersting 5/e

p. 6

Hein 2/e

p. 351

Epp 1/e

p. 24

Highest ¬

∧,∨

¬

∧,∨

Lowest

→ ,↔