Discrete Mathematics -- Chapter 2: Fundamentals of Ch t 2 F d t - - PowerPoint PPT Presentation

discrete mathematics
SMART_READER_LITE
LIVE PREVIEW

Discrete Mathematics -- Chapter 2: Fundamentals of Ch t 2 F d t - - PowerPoint PPT Presentation

Discrete Mathematics -- Chapter 2: Fundamentals of Ch t 2 F d t l f Logic Hung-Yu Kao ( ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U Outline Basic Connectives and


slide-1
SLIDE 1

Discrete Mathematics

Ch t 2 F d t l f

  • - Chapter 2: Fundamentals of

Logic

Hung-Yu Kao (高宏宇) Department of Computer Science and Information Engineering, N l Ch K U National Cheng Kung University

slide-2
SLIDE 2

Outline

Basic Connectives and Truth Tables Logical Equivalence: The Law of Logic Logical Equivalence: The Law of Logic Logical Implication: Rule of Inference The Use of Quantifiers Quantifiers Definitions and the Proofs of Quantifiers, Definitions, and the Proofs of

Theorems

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

2

slide-3
SLIDE 3

The Way to Proof

  • 證明”A君是萬能”這句話是錯的

(1) A君可以搬動任何石頭 (1) A君可以搬動任何石頭 (2) A君可以製造出他無法搬動的石頭 (3) (1) (2) 相互矛盾 原命題為假 (3) (1), (2) 相互矛盾, 原命題為假

A logical sequence of st at ement s.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

3

slide-4
SLIDE 4

2.1 Basic Connectives and Truth Tables

S 敘述 (P i i 命題) d l i

Statement 敘述 (Proposition 命題): are declarative

sentences that are either true or false, but not both.

Primitive Statement (原始命題) Primitive Statement (原始命題)

Examples

p: ‘Discrete Mathematics’ is a required course for sophomores. p: Discrete Mathematics is a required course for sophomores. q: Margaret Mitchell wrote ‘Gone with the Wind’. r: 2+3=5. “What a beautiful evening!” (not a statement) ”Get up and do your exercises.” (not a statement)

No way to make them simpler No way to make them simpler

“The number x is an integer.” is a statement ?

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

4

g

slide-5
SLIDE 5

2.1 Basic Connectives and Truth Tables

New statements can be obtained from primitive

statements in two ways statements in two ways

Transform a given statement p into the statement ¬p,

which denotes its negation and is read “Not p” 非p which denotes its negation and is read Not p . 非p (Negation statements)

Combine two or more statements into a compound Combine two or more statements into a compound

statement, using logical connectives. (Compound statements複合敘述) 複合敘述)

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

5

slide-6
SLIDE 6

2.1 Basic Connectives and Truth Tables

Compound Statement (Logical Connectives)

Conjunction: p q (read “p and q”)

j

Disjunction : p v q (read “p or q”) Exclusive or : p v q.

p → q is also called

Exclusive or : p v q. Implication: p → q,

“p implies q”

p → q is also called,

  • If p, then q
  • p is sufficient for q
  • p is a sufficient condition for q

p: hypothesis l i

p implies q .

Biconditional: p ↔ q

“p if and only if q” (若且為若)

  • q is necessary for p
  • q is a necessary condition for p
  • p only if q
  • q whenever p

q: conclusion

  • p if and only if q (若且為若)

“p iff q” “p is necessary and sufficient for q” q whenever p

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

6

  • p is necessary and sufficient for q .
slide-7
SLIDE 7

2.1 Basic Connectives and Truth Tables

The truth and falsity of the compound statements based

  • n the truth values of their components (primitive

statements).

We do not want a true statement to lead us into believing something that is false. p ¬p p q p q p v q p v q p → q p ↔ q 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

7

Truth Tables

slide-8
SLIDE 8

Writing Down Truth Tables

“True, False” is preferred (less ambiguous) than “1, 0”

List the elementary truth values in a consistent way

(from F…F to T…T or from T…T to F…F).

They get long: with n variables, the length is 2n. In the end we want to be able to reason about logic

without having to write down such tables.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

8

slide-9
SLIDE 9

2.1 Basic Connectives and Truth Tables

p→q is equivalent with (¬p ∨ q) It’s not relative about the causal relationship

  • If Discrete Mathematics’ is a required course for sophomores, then
  • If Discrete Mathematics is a required course for sophomores, then

Margaret Mitchell wrote ‘Gone with the Wind’. is true

  • If “2+3=5”, then “4+2=6” is true
  • If “2+3=6”, then “2+4=7” is true

If 2 3 6 , then 2 4 7 is true

“Margaret Mitchell wrote ‘Gone with

the Wind’(q) and 2+3 5 (not r) the

1 2 3

the Wind (q), and 2+3 5 (not r), the ‘Discrete Mathematics’ is a required course for sophomores (p).

) ( p r q → ¬ ∧

  • Discrete Mathematics

Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

9

slide-10
SLIDE 10

Implications examples

p: If it is sunny today then we will go to the beach p: If it is sunny today, then we will go to the beach. q: If today is Friday then 2+3=5 q: If today is Friday, then 2+3=5. r: If today is Friday, then 2+3=6.

r is true every day except Friday, even though 2+3=6 is false.

Th M h i l f i li i i i d d f The Mathematical concept of an implication is independent of a cause-and-effect relationship between hypothesis and conclusion.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

10

slide-11
SLIDE 11

2.1 Basic Connectives and Truth Tables

Ex 2.1: Let s, t, and u denote the primitive statements.

  • s: Phyllis goes out for a walk.
  • t: The moon is out
  • t: The moon is out.
  • u: It is snowing.

English sentences for compound statements.

  • (t ¬u) → s:

If th i t d it i t i th Ph lli t f lk

If the moon is out and it is not snowing, then Phyllis goes out for a walk.

  • t → (¬u → s) :

If the moon is out, then if it is not snowing Phyllis goes out for a walk.

Same?

  • ¬ (s ↔ (u v t)) :

It is not the case that Phyllis goes out for a walk if and only if it is

snowing or the moon is out.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

11

g

slide-12
SLIDE 12

2.1 Basic Connectives and Truth Tables

Let s, t, and u denote the primitive statements.

  • s: Phyllis goes out for a walk.
  • t: The moon is out
  • t: The moon is out.
  • u: It is snowing.

R l i th l i l f f i E li h t

Reversely, examine the logical form for given English sentences.

  • “Phyllis will go out walking if and only if the moon is out.”

s ↔ t

  • If it is snowing and the moon is not out, then Phyllis will not go out for

a walk.”

(u ¬t ) → ¬ s

(u t ) → s

  • It is snowing but Phyllis will still go out for a walk.

u s

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

12

slide-13
SLIDE 13

2.1 Basic Connectives and Truth Tables

Ex 2.3: Decision (selection) structure

( )

In computer science, the if-then and if-then-else decision

structure arise in high-level programming languages such as Java and C++.

E.g., “if p then q else r,” q is executed when p is true and r

i d h i f l is executed when p is false.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

13

slide-14
SLIDE 14

2.1 Basic Connectives and Truth Tables

Tautology, T0: If a compound statement is true for all

truth value assignments for its component statements.

Example: p∨¬p

Contradiction, F0: If a compound statement is false for

all truth value assignments for its component statements.

Example: p∧¬p

Examples

“2 = 3–1” is not a tautology, but “2=1 or 2≠1” is; “1+1=3” is not a contradiction, but “1=1 and 1≠1” is.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

14

slide-15
SLIDE 15

2.1 Basic Connectives and Truth Tables

An argument starts with a list of given

statements called premises (hypothesis) and a statements called premises (hypothesis) and a statement called the conclusion of the argument.

(p p

p ) → q

(p1 p2 ⋯ pn) → q

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

15

slide-16
SLIDE 16

2.2 Logical Equivalence: The Laws of Logic

Logically equivalent, : When the statement s1 is

true (false) if and only if s2 is true (false).

2 1

s s ⇔

q p q p → ⇔ ∨ ¬

q p p q q p ↔ ⇔ → ∧ → ) ( ) (

( ) ( )

q p p q q p ↔ ⇔ → ∧ → ) ( ) (

the same truth tables

p q ¬p ¬ p v q p → q q → p (p → q ) ( q → p) p ↔ q 1 1 1 1 1 1 1 1 1 1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

16

1 1 1 1 1 1 1 1 1

slide-17
SLIDE 17

2.2 Logical Equivalence: The Laws of Logic

Negation, v (exclusive)

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

17

slide-18
SLIDE 18

2.2 Logical Equivalence: The Laws of Logic

Logically equivalent examples

p ⇔ (p∨p) p ⇔ (p∨p)

“1+1=2” ⇔ “1+1=2 or 1+1=2”

¬¬p ⇔ p ¬¬p ⇔ p

“He did not not do it” ⇔ “He did it”

  • (p∧q) ⇔

p∨ q

¬(p∧q) ⇔ ¬p∨¬q “If p then not p” ⇔ “not p”

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

18

slide-19
SLIDE 19

The Laws of Logic (1/2)

i bl f 1) ⎨ ⎧ ¬ ∧ ¬ ⇔ ∨ ¬ ⇔ ¬¬ ) ( : Laws s DeMorgan' ) 2 : Negation Double

  • f

Law 1) q p q p p p ⎧ ∨ ⇔ ∨ ⎩ ⎨ ¬ ∨ ¬ ⇔ ∧ ¬ ) ( : Laws s DeMorgan ) 2 p q q p q p q p ⎧ ⎩ ⎨ ⎧ ∧ ⇔ ∧ ∨ ⇔ ∨ : Laws e Commutativ ) 3 p q q p p q q p ⎩ ⎨ ⎧ ∧ ∧ ⇔ ∧ ∧ ∨ ∨ ⇔ ∨ ∨ ) ( ) ( ) ( ) ( : Laws e Associativ ) 4 r q p r q p r q p r q p ⎩ ⎨ ⎧ ∧ ∨ ∧ ⇔ ∨ ∧ ∨ ∧ ∨ ⇔ ∧ ∨ ) ( ) ( ) ( ) ( ) ( ) ( : Laws ve Distributi ) 5 r p q p r q p r p q p r q p

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

19

⎩ ∧ ∨ ∧ ⇔ ∨ ∧ ) ( ) ( ) ( r p q p r q p

slide-20
SLIDE 20

The Laws of Logic (2/2)

⎧ ⇔ ∨ p p p ⎧ ⎩ ⎨ ⎧ ⇔ ∧ ⇔ ∨ p p p p p p : Laws Idempotent ) 6 ⎩ ⎨ ⎧ ⇔ ∧ ⇔ ∨ p T p p F p : Laws Identity 7) ⎩ ⎨ ⎧ ⇔ ¬ ∧ ⇔ ¬ ∨ F p p T p p : Laws Inverse 8) ⎩ ⎨ ⎧ ⇔ ⇔ ∨ ⎩ ⇔ ¬ ∧ F F T T p F p p : Laws Domination ) 9 ⎨ ⎧ ⇔ ∧ ∨ ⎩ ⇔ ∧ p q p p F F p ) ( : Laws Absorption ) 10

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

20

⎩ ⎨ ⇔ ∨ ∧ p q p p ) ( : Laws Absorption ) 10

slide-21
SLIDE 21

2.2 Logical Equivalence: The Laws of Logic

DeMorgan’s Laws:

q p q p q p q p ¬ ∧ ¬ ⇔ ∨ ¬ ¬ ∨ ¬ ⇔ ∧ ¬ ) ( ) ( q p q p ¬ ∧ ¬ ⇔ ∨ ¬ ) (

p q p q ¬(p q) ¬p ¬q ¬ p ∨ ¬ q p ∨ q ¬(p ∨ q) ¬p ¬ q 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

21

1 1 1 1

slide-22
SLIDE 22

The Principle of Duality

Definition 2.3: Let s be a statement. Dual of s, denoted sd, is the

statement obtained from s by replacing each occurrence of ∧ and b d ti l d h f T d F b ∨ by ∨ and ∧, respectively, and each occurrence of T0 and F0 by F0 and T0, respectively.

  • E.g.

) ( ) ( : T r q p s ∧ ∨ ∧

g

) ( ) ( : ) ( ) ( : F r q p s T r q p s

d

∨ ∧ ¬ ∨ ∧ ∨ ¬ ∧

Keep negation!

The Principle of Duality: Let s and t be statements that contain

no logical connectives other than ∧ and ∨. If t th

d

td If s ⇔ t , then sd ⇔ td.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

22

slide-23
SLIDE 23

Substitution Rules

Rule 1: Suppose that the compound statement P is a tautology.

  • If p is a primitive statement that appears in P and we replace each

f b th t t t th th lti

  • ccurrence of p by the same statement q, then the resulting

compound statement P1.is also a tautology.

Rule 2: Let P be a compound statement where p is an arbitrary

p p y statement that appears in P, and let q be a statement such that q ⇔ p.

S h i l f b

  • Suppose that in P we replace one or more occurrences of p by q.

Then this replacement yields the compound statement P1. Under these circumstances P1 ⇔ P.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

23

slide-24
SLIDE 24

Simplification of Compound Statements

Ex 2.10: From the first of DeMorgan’s Laws

P: ¬ (p ∨ q) ↔(¬p ∧¬q) is a tautology

from the first substitution rule

P1: ¬ [(r ∧ s) ∨ q] ↔ [¬(r ∧ s) ∧ ¬q] is also a tautology

replace each occurrence of q by t →u

P2: ¬ [(r ∧ s) ∨ (t →u)] ↔[¬ (r ∧ s) ∧ ¬ (t →u)]

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

24

slide-25
SLIDE 25

Simplification of Compound Statements

Ex 2.11: P: (p → q) →r, and because (p → q) ⇔ ¬p ∨ q from the second substitution rule

if P1: (¬p ∨ q ) →r, then P1 ⇔ P

Check 2.11 (b) for another example using the second rule

p →(p ∨ q), ¬ ¬ p ⇔ p

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

25

slide-26
SLIDE 26

Simplification of Compound Statements

  • Ex 2.12:
  • Negate and simplify the compound statement (p ∨ q) → r

1.

(p ∨ q) → r ⇔ ¬(p ∨ q) ∨ r (First substitution rule)

2.

¬[(p ∨ q) → r] ⇔ ¬[¬(p ∨ q) ∨ r] (Negating)

3

¬[¬(p ∨ q) ∨ r] ⇔ ¬¬(p ∨ q) ∧ ¬r (DeMorgan’s Laws)

3.

¬[¬(p ∨ q) ∨ r] ⇔ ¬¬(p ∨ q) ∧ ¬r (DeMorgan s Laws)

4.

¬¬(p ∨ q) ∧ ¬r ⇔ (p ∨ q) ∧ ¬r (Law of double Negation)

5.

¬[(p ∨ q) → r] ⇔ (p ∨ q) ∧ ¬r [(p q) ] (p q)

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

26

slide-27
SLIDE 27

Simplification of Compound Statements

Ex 2.13:

p: Joan goes to Lake George q: Mary pays for Joan’s shopping spree. p → q: If Joan goes to Lake George, then Mary will pay for

Joan’s shopping spree. Joan s shopping spree.

The negation of p → q :

  • One way: ¬ (p → q). It is not the case that if Joan goes to Lake

G th M ill f J ’ h i George, then Mary will pay for Joan’s shopping spree.

  • Another way: p ∧ ¬ q. Joan goes to Lake George, but Mary does not

pay for Joan’s shopping spree.

q p → ) ( q p q p q p ¬ ∧ ¬¬ ⇔ ∨ ¬ ¬ ⇔ → ¬ ) ( ) (

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

27

q p q p ¬ ∧ ⇔

slide-28
SLIDE 28

Relevant Statements to Implication p Statement

p q p → q ¬ q → ¬ p q → p ¬ p → ¬ q

  • Ex 2.15:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

p → q ⇔ (¬ q → ¬ p)

→ ⇔ ( → )

1 1 1 1 1 1

q → p ⇔ (¬ p → ¬ q) Contrapositive of p → q : ¬ q → ¬ p Converse of p → q : q → p Converse of p → q : q → p Inverse of p → q : ¬ p → ¬ q

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

28

slide-29
SLIDE 29

Simplification of Compound Statements

Ex 2.16: How to simply express the compound

statement (p ∨ q) ∧ ¬(¬p ∧ q)?

Reasons ) ( ) ( q p q p ∧ ¬ ¬ ∧ ∨ Negation) Double

  • f

(Law ) ( ) ( Law) s (DeMorgan' ) ( ) ( q p q p q p q p ¬ ∨ ∧ ∨ ⇔ ¬ ∨ ¬¬ ∧ ∨ ⇔ Law) (Inverse )

  • ver
  • f

Law ive (Distribut ) ( g ) ( ) ( ) ( F p q q p q p q p ∨ ⇔ ∧ ∨ ¬ ∧ ∨ ⇔ Law) (Identity Law) (Inverse p F p ⇔ ∨ ⇔

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

29

slide-30
SLIDE 30

Simplification of Compound Statements

Ex 2 18: A switching network is made up of wires and Ex 2.18: A switching network is made up of wires and

switches connecting two terminals T1 and T2

p p p q t ¬t

  • p
  • r

¬q r q t t

T1 T2

r

T1 T2

t ¬q

)] ( [ ) ( ) ( ) ( t t t ⇔

P i !

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

30

)] ( [ ) ( ) ( ) ( q t r p r t p q t p r q p ¬ ∨ ∧ ∨ ⇔ ∨ ¬ ∨ ∧ ¬ ∨ ∨ ∧ ∨ ∨

Practice!

slide-31
SLIDE 31

Simplification of Compound Statements (p ∨ q ∨ r) ∧ (p ∨ t ∨ ¬q) ∧ (p ∨ ¬t ∨ r)

⇔ p ∨ [(q ∨ r) ∧ (t ∨ ¬q) ∧ (¬t ∨ r)] ⇔ p ∨ [(q ∨ r) ∧ (t ∨ ¬q) ∧ (¬t ∨ r)] ⇔ p ∨ [((q ∧ ¬t ) ∨ r) ∧ (t ∨ ¬q)] ⇔ p ∨ [((q ∧ ¬t ) ∨ r) ∧ ¬(¬t ∧ q)] ⇔ p ∨ [((q ∧ ¬t ) ∧ ¬(¬t ∧ q)) ∨ (¬(¬t ∧ q) ∧ r)] ⇔ p ∨ [((q ∧

t ) ∧ ( t ∧ q)) ∨ ( ( t ∧ q) ∧ r)]

⇔ p ∨ [F0 ∨ (¬(¬t ∧ q) ∧ r)]

p

⇔ p ∨ [r ∧ (t ∨ ¬q)]

  • T1
  • T2

t

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

31

r ¬q

slide-32
SLIDE 32

2.3 Logic Implication: Rules of Inference

  • Argument:

Premiss: p1, p2,…, pn Conclusion: q

q p p p

n → ∧ ⋅ ⋅ ⋅ ∧ ∧

) (

2 1

q

  • Ex 2.19:
  • p: Roger studies
  • p: Roger studies.
  • q: Roger plays racketball.
  • r: Roger passes discrete mathematics.
  • p1: Roger studies, then he will pass discrete mathematics.
  • p2: If Roger don’t play racketball then he’ll study

p q p r p p → ¬ → : :

2 1

  • p2: If Roger don t play racketball, then he ll study.
  • p3: Roger failed discrete mathematics.
  • Determine whether the argument is valid.

r p ¬ :

3

q p p p →

∧ ∧

) (

3 2 1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

32

slide-33
SLIDE 33

Logic Implication: Rules of Inference

Examine the truth table for the implication

p

p1 p2 p3 (p1 p2p3) → q

q r p q r p → ¬ ∧ → ¬ ∧ → ] ) ( ) [(

r p p → :

1

p1 p2 p3 (p1 p2 p3) q p q r p → r ¬q → p ¬r [(p → r ) (¬q → p) ¬r] → q 1 1 1

r p p q p ¬ → ¬ : :

3 2

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

  • is a valid argument

q p p p → ) (

1 1 1 1 1 1 1 1 1 1 1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

33

  • is a valid argument.

q p p p →

∧ ∧

) (

3 2 1

slide-34
SLIDE 34

Logic Implication: Rules of Inference

Definition 2.4: p logically implies q, p ⇒ q.

  • If p, q are arbitrary statements such that p → q is a tautology.

Rules of inference

Using these techniques will enable us to consider only the

Use instead of constructing the huge truth table

cases wherein all the premises are true.

Development of a step-by-step validation of how the

concl sion logicall follo s from the premises conclusion q logically follows from the premises p1, p2,…, pn in an implication of the form

→ ) ( q p p p

n → ∧ ⋅ ⋅ ⋅ ∧ ∧

) (

2 1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

34

slide-35
SLIDE 35

Logic Implication: Rules of Inference

Rule of Detachment (分離)

  • Modus Ponens: the method of affirming

→ → )] ( [

Example:

p q p → q p (p → q) [p (p → q)] → q

q q p p → → ∧ )] ( [

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

  • Tabular form:

q p p →

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

35

q q p ∴

therefore

slide-36
SLIDE 36

Logic Implication: Rules of Inference

Law of the Syllogism (演繹推理)

Tabular form:

q p → r p r q q p → ∴ →

Modus Tollens: Method of Denying

r p → ∴

Tabular form:

q p → p q ¬ ∴ ¬

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

36

p

slide-37
SLIDE 37

Rules of Inference

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

37

slide-38
SLIDE 38

Logic Implication: Rules of Inference

Ex 2.30:

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

38

slide-39
SLIDE 39

Logic Implication: Rules of Inference

  • Ex 2.31:

If the band could not play rock music or the refreshments were

not delivered on time, then the New Year’s party would have been cancelled and Alicia would have been angry. been cancelled and Alicia would have been angry.

If the party were cancelled, then refunds would have had to be

made.

No refunds were made. Therefore the band could play rock music.

p: The band could play rock music. q: The refreshments were delivered

  • n time

) ( ) ( t r s r q p → ∧ → ¬ ∨ ¬

  • n time

r: The New Year’s party was cancelled . s: Alicia was angry. t: Refunds had to be made

p t ∴ ¬

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

39

t: Refunds had to be made.

slide-40
SLIDE 40

Logic Implication: Rules of Inference

) ( ) ( s r q p ∧ → ¬ ∨ ¬

Premise (1) t r → Reasons Steps

p t t r ∴ ¬ →

i A lifi Di j i f R l d (3) ) 4 ( Denying

  • f

Method and (2), and (1) (3) Premise ) 2 ( r t ¬ ¬

p ∴

Premise ) ( ) ( ) 6 ( Laws s DeMorgan' and (4) ) ( ) 5 ( ion Amplificat e Disjunctiv

  • f

Rule and (3) ) 4 ( s r q p s r s r ∧ → ¬ ∨ ¬ ∧ ¬ ¬ ∨ ¬ Negation Double

  • f

Law and Laws, s DeMorgan' , (7) ) 8 ( Denying

  • f

Method and (5), and (6) ) ( (7) Premise ) ( ) ( ) 6 ( q p q p s r q p ∧ ¬ ∨ ¬ ¬ ∧ → ¬ ∨ ¬ tion Simplifica e Conjunctiv

  • f

Rule and (8) ) 9 ( p ∴

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

40

slide-41
SLIDE 41

Proof by Contradiction

  • Ex 2.35:
  • Ex 2.35:

Is the right argument valid or invalid? Let conclusion ¬p be false (the argument invalid)

⇒ p is true ⇒ q is true ⇒ q is true ⇒ s is true ⇒ r is false i t ( i t ) ⇒ r is true (¬p∨r, now p is true) ⇒ contradiction ⇒ argument is valid

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

41

slide-42
SLIDE 42

Interesting examples

A

. 考前猜題

習題A

  • 1A
  • 2

兩題中必出一題 但不會兩題都

習題A1

, A2 兩題中必出 題, 但不會兩題都 出

習題A

  • 2

和A

  • 3

兩題要嘛都出 要嘛都不出

習題A2

和A3 兩題要嘛都出, 要嘛都不出

如果不出A

  • 1

, 也不會出A

  • 3

請問哪 題會出哪 題不會出?

請問哪一題會出哪一題不會出?

A

  • 1

出, A

  • 2

不出, A

  • 3

不出

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

42

slide-43
SLIDE 43

Interesting examples

B

. 誰是兇手

角頭老大A

死了 警方請來他幫派裡兩位二哥

角頭老大A

死了, 警方請來他幫派裡兩位二哥 級人物B 和C 來協助瞭解死因。

B

說: 如果A 被謀殺, 那肯定是C 幹的

B

說: 如果A 被謀殺, 那肯定是C 幹的

C

說: 如果A 不是自殺, 那就是被謀殺

警方不知B

C 供詞真偽 但可以確定的是

警方不知B

, C 供詞真偽, 但可以確定的是

A

死因只有三種: 意外, 自殺和謀殺

如果B

和C 都沒有說謊 那A 就死於一場意外

如果B

和C 都沒有說謊, 那A 就死於 場意外

如果B

和C 兩人中有一人說謊, 那麼A 就不是死於 意外

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

請問A

的死因為何?

43

A n s : 謀殺, B 說謊

slide-44
SLIDE 44

2.4 The Use of Quantifiers

Definition 2.5: A declarative sentence is an open statement if Definition 2.5: A declarative sentence is an open statement if

  • it contains one or more variables, and
  • it is not a statement, but
  • it becomes a statement when the variables in it are replaced by
  • it becomes a statement when the variables in it are replaced by

certain allowable choices.

  • E.g.,

p(x): The number x+2 is an even integer p(x): The number x+2 is an even integer. q(x, y): The number y+2, x - y, and x+2y are even integers. For some x, p(x). For some x, y, q(x, y). For some x

p(x) For some x y q(x y)

For some x, ¬p(x). For some x, y, ¬q(x, y).

Existential quantifier: , “for some x”, “for at least one x” or

“th i t h th t”

x ∃

“there exists an x such that”

Universal quantifier: , “for all x”, “for any x” “for every x” or

“for each x such that”

x ∀

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

44

slide-45
SLIDE 45

The Use of Quantifiers

  • Ex 2.36:

Given the open statements

3 : ) ( 4 3 : ) ( : ) ( , : ) (

2 2 2

> = ≥ ≥ x x s x x x r x x q x x p

The statement is true

For every real number x, if x ≥ 0, then x2 ≥ 0.

)] ( ) ( [ x q x p x → ∀

3 : ) ( , 4 3 : ) ( > − = − − x x s x x x r For every real number x, if x ≥ 0, then x ≥ 0.

Every nonnegative real number has a nonnegative square. The square of any nonnegative real number is a nonnegative

l b real number.

All nonnegative real numbers have nonnegative squares.

The statement is true. The statement is false.

)] ( ) ( [ x r x p x ∧ ∃

)] ( ) ( [ x s x q x → ∀

Counterexample!

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

45

slide-46
SLIDE 46

Summarization

¬∃x: P(x) v.s. ∃x: ¬P(x)

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

46

x: (x) v.s. x: (x) ¬∀x: P(x) v.s. ∀x: ¬P(x)

slide-47
SLIDE 47

The Use of Quantifiers

For open statements p(x), q(x), the universally

quantified statement ∀x[p(x) → q(x)], we define

Contrapositive: ∀x[¬q(x) → ¬p(x)] Converse: ∀x[q(x) → p(x)] Inverse: ∀x[¬p(x) → ¬q(x)]

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

47

slide-48
SLIDE 48

Logical Equivalence and Implication for g q p Quantified Statements

)] ( ) ( [ )] ( ) ( [ ∃ ∃ ∃ )] ( ) ( [ )] ( ) ( [ )] ( ) ( [ )] ( ) ( [ x q x x p x x q x p x x q x x p x x q x p x ∃ ∨ ∃ ⇔ ∨ ∃ ∃ ∧ ∃ ⇒ ∧ ∃ )] ( ) ( [ )] ( ) ( [ )] ( ) ( [ )] ( ) ( [ x q x x p x x q x p x x q x x p x x q x p x ∀ ∧ ∀ ⇔ ∧ ∀ ∃ ∨ ∃ ⇔ ∨ ∃ )] ( ) ( [ )] ( ) ( [ )] ( ) ( [ )] ( ) ( [ x q x p x x q x x p x q p q p ∨ ∀ ⇒ ∀ ∨ ∀

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

48

slide-49
SLIDE 49

The Use of Quantifiers

Rules for negating statements with one quantifier

) ( )] ( [ x p x x p x ¬ ∃ ⇔ ∀ ¬ ) ( ) ( )] ( [ ) ( )] ( [ x p x x p x x p x x p x x p x ∃ ⇔ ∃ ⇔ ∀ ¬ ∀ ⇔ ∃ ¬ ) ( ) ( )] ( [ ) ( ) ( )] ( [ x p x x p x x p x x p x x p x x p x ∀ ⇔ ¬¬ ∀ ⇔ ¬ ∃ ¬ ∃ ⇔ ¬¬ ∃ ⇔ ¬ ∀ ¬

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

49

slide-50
SLIDE 50

Commuting Quantifiers

Identical quantifiers commute: Identical quantifiers commute: ∃x∃y: P(x,y) ⇔ ∃y∃x: P(x,y) and ∀x∀y: P(x y) ⇔ ∀y∀x: P(x y) ∀x∀y: P(x,y) ⇔ ∀y∀x: P(x,y) But non-identical ones do not, see: ∃x∀y: x=y v.s. ∀y∃x: x=y y y y y

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

50

slide-51
SLIDE 51

The Use of Quantifiers

  • Ex 2.49:

What is the negation of the following statement?

)] , ( )) , ( ) , ( [( y y x r y x q y x p x → ∧ ∃ ∀

)]] , ( )) , ( ) , ( [( y [ y x r y x q y x p x → ∧ ∃ ∀ ¬ )] , ( )) , ( ) , ( [( y )]] , ( )) , ( ) , ( [( y [ y x r y x q y x p x y x r y x q y x p x → ∧ ¬ ∀ ∃ ⇔ → ∧ ¬∃ ∃ ⇔ )] ( )] ( ) ( [ [ )] , ( )] , ( ) , ( [ [ y )] , ( )) , ( ) , ( [( y y x r y x q y x p x y x y x q y x p x ∀ ∃ ∨ ∧ ¬ ¬ ∀ ∃ ⇔ → ⇔ )] , ( )] , ( ) , ( y[ )] , ( )] , ( ) , ( [ y[ y x r y x q y x p x y x r y x q y x p x ¬ ∧ ∧ ∀ ∃ ⇔ ¬ ∧ ∧ ¬ ¬ ∀ ∃ ⇔

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

51

slide-52
SLIDE 52

2.5 Quantifiers, Definitions, and the , , Proofs of Theorems

  • Ex 2.52:

show that for all n, n=2, 4, 6,…,24, 26, we can write n as the

f h f sum of at most three perfect squares.

Exhaustion method

2=1+1 4 4 10=9+1 12 4 4 4 20=16+4 22 9 9 4 4=4 6=4+1+1 8=4+4 12=4+4++4 14=9+4+1 16=16 22=9+9+4 24=16+4+4 26=25+1 8 4+4 16 16 18=16+1+1 26 25+1

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

52

slide-53
SLIDE 53

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems

Th R l f U i l S ifi ti If

The Rule of Universal Specification: If an open statement

becomes true for all replacements by the members in a given universe, then that open statement is true for each specific individual member in that universe.

  • E g

universe. in the each for true is ) ( then true, is (x) a x p p x if ∀

  • E.g.

) ( ) ( )] ( ) ( [ a c a m x c x m x ∴ → ∀ ) (a c ∴

Premise )] ( ) ( [ (1) → ∀ x c x m x Reasons Steps Detachment

  • f

Rule the and (3) and (2) c(a) ) 4 ( ion Specificat Universal

  • f

rule the and (1) c(a) (a) (3) Premise (a) ) 2 ( ∴ → m m

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

53

( ) ( ) ( ) ) (

slide-54
SLIDE 54

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems

Th R l f U i l G li ti If ( )

The Rule of Universal Generalization: If an open statement p(x)

is proved to be true when x is replaced by any arbitrarily chosen element c from our universe, then the universally quantified statement is true. Furthermore, the rule extends beyond a single variable.

  • Ex 2.56:

) ( x p x ∀ )] ( ) ( [ x q x p x ∨ ∀ ))] ( ) ( ( ) ( [ x q x p x r ∧ ¬ ¬ → ¬ )] ( ) ( [ )] ( )) ( ) ( [( )] ( ) ( [ x p x r x x r x q x p x x q x p x → ¬ ∀ ∴ → ∧ ¬ ∀ ))] ( ) ( ) ( [ x q x p x r ¬ ∨ → ¬ )] ( ) ( [ p

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

54

slide-55
SLIDE 55

Quantifiers, Definitions, and the Proofs of Theorems

)] ( )) ( ) ( [( )] ( ) ( [ x r x q x p x x q x p x → ∧ ¬ ∀ ∨ ∀

Ex 2.56:

)] ( ) ( [ x p x r x → ¬ ∀ ∴

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

55

slide-56
SLIDE 56

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems
  • Argument

) ( ) ( )] ( )) ( ) ( [( m s m p x p x s x j x ∴ ¬ → ∨ ∀

  • No junior or senior is enrolled in

a physical education class. Mary is enrolled in a physical

  • Establish the validity of this argument

) (m s ¬ ∴

Reasons Steps

  • Mary is enrolled in a physical

education class.

  • Thus Mary is not a senior.

Premise ) ( ) 2 Premise )] ( ) ( ) ( [ 1) m p x p x s x j x ¬ → ∨ ∀ Reasons Steps Negation Double

  • f

Law and ) ( ) ( (3), )) ( ) ( ( ) ( ) 4 ion Specificat Universal

  • f

Rule and (1) ) ( ) ( ) ( 3) q t t q m s m j m p m p m s m j ¬ → ¬ ⇔ → ∨ ¬ → ¬ → ∨ Detachment

  • f

Rule and (5) and (2) ) ( ) ( ) 6 Law s DeMorgan' and (4) )) ( ) ( ( ) ( ) 5 Negation Double

  • f

Law m s m j m s m j m p ¬ ∧ ¬ ¬ ∧ ¬ →

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

56

tion Simplifica e Conjunctiv

  • f

Rule and (6) ) ( ) 7 m s ¬ ∴

slide-57
SLIDE 57

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems

D fi iti 2 8

  • Definition 2.8:
  • Let n be an integer. We call n even if n is divisible by 2, that is, if

there exists an integer r so that n = 2r. If n is not even, then we call n odd and find for this case that there exists an integer s where n = n odd and find for this case that there exists an integer s where n = 2s +1.

  • Theorem 2 2: For all integers k and l if k and l are both odd then
  • Theorem 2.2: For all integers k and l, if k and l are both odd, then

k + l is even.

  • Proof

Si k d l dd i k 2 1 d l 2b 1 f

1.

Since k and l are odd, we may write k = 2a+1 and l = 2b+1, for some integers a, b. (the Rule of Universal Specification)

2.

Then k + l = (2a+1)+(2b+1) = 2(a+b+1), which hold for integers. (apply Commutative Associative and Distributive Laws) (apply Commutative, Associative, and Distributive Laws)

3.

Since a, b are integers, a+b+1 = c is an integer; with k + l = 2c, so k + l is even.

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

57

slide-58
SLIDE 58

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems
  • Theorem 2.3: For all integers k and l, if k and l are both
  • dd, then kl is also odd.
  • Proof?

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

58

slide-59
SLIDE 59

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems
  • Theorem 2.4: If m is an even integer, then m + 7 is odd.
  • Proof

1.

Since m is even, we have m = 2a for some integer a. Then m + 7 =

1.

Since m is even, we have m 2a for some integer a. Then m 7 2a + 7 = 2a + 6 +1 = 2(a + 3) + 1. since a+3 is an integer, we know that m + 7 is odd.

2.

Suppose that m + 7 is not odd, hence even. Then m + 7 = 2b for pp some integer b, and m = 2b – 7 = 2b – 8 +1 = 2(b – 4) +1, where b – 4 is an integer. Hence m is odd. (contraposition method)

3.

Assume that m is even and m + 7 is also even. Then m + 7 even i li th t + 7 2 f i t C tl 2 implies that m + 7 = 2c for some integer c. Consequently, m = 2c – 7 = 2c – 8 +1 = 2(c – 4) +1 with c – 4 an integer, so m is odd. Now we have contradiction. So the assumption is false (m + 7 is even), and we have m + 7 odd. (contradiction method) and we have m 7 odd. (contradiction method)

Assumption Result Derived Contraposition ¬q(m) ¬p(m)

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

59

Contradiction p(m) and ¬q(m) F0

slide-60
SLIDE 60

Proof

Prove (p and ¬ q) is false prove (¬p or q) is true Prove (p and ¬ q) is false prove (¬p or q) is true

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

60

slide-61
SLIDE 61

Quantifiers, Definitions, and the Proofs , ,

  • f Theorems
  • Theorem 2.5:
  • For all positive real numbers x and y if the product xy
  • For all positive real numbers x and y, if the product xy

exceeds 25, then x > 5 or y > 5.

  • Proof: (Contrapositive)
  • Suppose that 0 < x ≤ 5 and 0 < y ≤ 5 (¬q(x, y))
  • We find that 0 = 0.0 < x. y ≤ 5.5 = 25 (¬p(x, y))

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

61

slide-62
SLIDE 62

Exercise

2.1: 10 2 2: 16 20 2.2: 16, 20 2.3: 10 2.4: 14 2 5: 16 2.5: 16

Discrete Mathematics Discrete Mathematics – – CH2 CH2 2009 Spring 2009 Spring

62