<<

COMP 1002

Intro to Logic for Computer Scientists

Lecture 13

B 5 2 J Admin stuff

• Assignments schedule? Split a2 and a3 in two (A2,3,4,5) , 5% each. A2 due Feb 17th. • Midterm date? March 2nd.

• No office hour on Feb 9th

Puzzle 11

• Let = } }

𝑆𝑆 𝑥𝑥 ∈ ℕ 𝑥𝑥 𝑖𝑖𝑖𝑖 𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 ∩ 𝑥𝑥 ∈ ℕ 𝑥𝑥 𝑖𝑖𝑖𝑖 𝑜𝑜𝑜𝑜𝑜𝑜 • Prove or disprove:

, 2 ∀𝑥𝑥 ∈ 𝑆𝑆 𝑥𝑥 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑛𝑛𝑛𝑛𝑛𝑛 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑥𝑥 Puzzle 11

• Let = } } – S = • Prove𝑆𝑆 or disprove:𝑥𝑥 ∈ ℕ 𝑥𝑥 𝑖𝑖𝑖𝑖 𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 ∩ 𝑥𝑥 ∈ ℕ 𝑥𝑥 𝑖𝑖𝑖𝑖 𝑜𝑜𝑜𝑜𝑜𝑜 ∅ , – Let P(x)= “ ” 2 – To disprove,∀ can𝑥𝑥 ∈ give𝑆𝑆 a counterexample𝑥𝑥 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑2 𝑛𝑛𝑛𝑛𝑛𝑛 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑥𝑥 • Find an 𝑥𝑥element𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑛𝑛𝑛𝑛in S𝑛𝑛 such𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 that 𝑥𝑥P(x) is true… • But there is no such element in S, because there are no elements in S at all! – To prove, enough to check that it holds for all elements of S. • There is none, so it does hold for every element in S. – Another way: Since S is defined as a of natural numbers, can read as . • Since “ is always false, is true for every – Call a∀ statement𝑥𝑥 ∈ 𝑆𝑆 𝑃𝑃 𝑥𝑥 ∀𝑥𝑥 ∈ ℕ vacuously𝑥𝑥 ∈ 𝑆𝑆 → 𝑃𝑃true.𝑥𝑥 𝑥𝑥 ∈ 𝑆𝑆푆 𝑥𝑥 ∈ 𝑆𝑆 → 𝑃𝑃 𝑥𝑥 𝑥𝑥 ∈ ℕ ∀𝑥𝑥 ∈ ∅ 𝑃𝑃 𝑥𝑥 Universal

• All men are mortal • Socrates is a man • Therefore, Socrates is mortal

• All cats like fish • Molly likes fish • Therefore, Molly is a cat Universal Modus Ponens

Q • , P • ∀𝑥𝑥 𝑃𝑃 𝑥𝑥 → 𝑄𝑄 𝑥𝑥 • ------𝑃𝑃 𝑎𝑎 •

𝑄𝑄 𝑎𝑎 • All men are mortal ( , ) ( ) • Socrates is a man Mortals • Therefore, Socrates is∀ 𝑥𝑥mortal𝑀𝑀𝑀𝑀𝑀𝑀 (𝑥𝑥 → 𝑀𝑀(𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 𝑥𝑥 ) 𝑀𝑀𝑀𝑀𝑀𝑀 𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 • All numbers are either odd or even𝑀𝑀𝑀𝑀𝑀𝑀 𝑀𝑀𝑀𝑀 𝑀𝑀 𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 • 2 is a number • Therefore, 2 is either odd or even. Men

• All trees drop leaves • Pine does not drop leaves • Therefore, pine is not a tree Universal Modus Ponens

• All men are mortal Mortal

• Socrates is a man Men

• Therefore, Socrates is mortal

Like fish • All cats like fish cats • Molly likes fish • Therefore, Molly is a cat Instantiation/generalization

• In general, if is true for some formula , if you take any specific element , then ∀ 𝑥𝑥 ∈ must𝑆𝑆 𝐹𝐹 be𝑥𝑥 true. – This is called𝐹𝐹 𝑥𝑥 the rule. 𝑎𝑎 ∈•𝑆𝑆 𝐹𝐹>𝑎𝑎 1 • 5 > 1 ∀𝑥𝑥 ∈ ℕ 𝑥𝑥 − • If you∴ prove− without any assumptions about other than , then , – This is called𝐹𝐹 universal𝑎𝑎 generalization. 𝑎𝑎 𝑎𝑎 ∈ 𝑆𝑆 ∀𝑥𝑥 ∈ 𝑆𝑆 𝐹𝐹 𝑥𝑥 Instantiation/generalization

• If you can find an element such that , then , – This is called existential generalization𝑎𝑎 ∈ 𝑆𝑆 . 𝐹𝐹 𝑎𝑎 ∃𝑥𝑥 ∈ 𝑆𝑆 𝐹𝐹 𝑥𝑥 • Alternatively, if is true, then you can give that element of for which is true a name, as long∃ as𝑥𝑥 that∈ 𝑆𝑆 name𝐹𝐹 𝑥𝑥 has not been used elsewhere. 𝑆𝑆 𝐹𝐹 𝑥𝑥 – This is called the existential instantiation rule. • 5 = 0 • = 0 + 5 ∃𝑥𝑥 ∈ ℕ 𝑥𝑥 −

∴ 𝑘𝑘

Existential instantiation

• If is true, then you can give that element of for which is true a name, as long∃ 𝑥𝑥 as∈ that𝑆𝑆 𝐹𝐹 name𝑥𝑥 has not been used elsewhere. – “Let n be an𝑆𝑆 even number.𝐹𝐹 𝑥𝑥Then n=2k for some k”. • = 2 – Important to have a new name! ∀𝑥𝑥 ∈ ℕ 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 𝑥𝑥 → ∃ 𝑦𝑦 ∈ ℕ 𝑥𝑥 ∗ 𝑦𝑦 • “Let n and m be two even numbers. Then n=2k and m=2k” is wrong! • , , = 2 = 2 ∀𝑥𝑥1 𝑥𝑥2 ∈ ℕ 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 𝑥𝑥1 ∧ 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 𝑥𝑥2 → • “Let n and m be two1 even2 numbers.1 Then1 n=2k2 and 2 m=2 ” ∃ 𝑦𝑦 𝑦𝑦 ∈ ℕ 𝑥𝑥 ∗ 𝑦𝑦 ∧ 𝑥𝑥 ∗ 𝑦𝑦

ℓ Other inference rules

• Combining universal instantiation with tautologies, get other types of arguments:

• For any x, if > 3 , then > 2 q • For any x, if > 2, then 1 𝑝𝑝 → 𝑞𝑞 ∀𝑥𝑥 𝑃𝑃 𝑥𝑥 → 𝑄𝑄 𝑥𝑥 𝑥𝑥 𝑥𝑥 ______∀𝑥𝑥 𝑄𝑄 𝑥𝑥 → 𝑅𝑅 𝑥𝑥 → 𝑟𝑟 For any x,𝑥𝑥 if > 3 , then𝑥𝑥 ≠ 1

∴ ∴ 𝑥𝑥 𝑥𝑥 ≠ ∴ 𝑝𝑝• →(This𝑟𝑟 particular∀𝑥𝑥 𝑃𝑃 𝑥𝑥 → rule𝑅𝑅 𝑥𝑥 is called “transitivity”)

Types of proofs

• Direct proof of – Show that holds for arbitrary x, then use . • Often, ∀ is𝑥𝑥 of𝐹𝐹 the𝑥𝑥 form ( ) – Example: A𝐹𝐹 sum𝑥𝑥 of two even numbers is even. 𝐹𝐹 𝑥𝑥 𝐺𝐺 𝑥𝑥 → 𝐻𝐻 𝑥𝑥 • Proof by cases – If can write as ( ) ( ), prove ( ) ( ( )) – Example: triangle∀𝑥𝑥 𝐹𝐹 𝑥𝑥inequality∀𝑥𝑥 𝐺𝐺 (1 𝑥𝑥+∨ 𝐺𝐺2 𝑥𝑥 ∨+⋯ ∨)𝐺𝐺 𝑘𝑘 𝑥𝑥 → 𝐻𝐻 𝑥𝑥 1 2 𝑘𝑘 • Proof by contraposition𝐺𝐺 𝑥𝑥 → 𝐻𝐻 𝑥𝑥 ∧ 𝐺𝐺 𝑥𝑥 → 𝐻𝐻 𝑥𝑥 ∧ ⋯ ∧ 𝐺𝐺 𝑥𝑥 → 𝐻𝐻 𝑥𝑥 – To prove ( ), prove𝑥𝑥 𝑦𝑦 ¬≤ 𝑥𝑥 𝑦𝑦¬ ( ) – Example: If square of an integer is even, then this integer is even. • Proof by contradiction∀𝑥𝑥 𝐺𝐺 𝑥𝑥 → 𝐻𝐻 𝑥𝑥 ∀𝑥𝑥 𝐻𝐻 𝑥𝑥 → 𝐺𝐺 𝑥𝑥 – To prove , prove ¬ – Example: 2 is not a rational number. – Example:∀ There𝑥𝑥 𝐹𝐹 𝑥𝑥 are infinitely∀𝑥𝑥 many𝐹𝐹 𝑥𝑥 primes.→ 𝐹𝐹𝐹𝐹𝐹𝐹 𝐹𝐹𝐹𝐹

Puzzle: better than nothing

• Nothing is better than eternal bliss • A burger is better than nothing ------• Therefore, a burger is better than eternal bliss.

≤ ≤

Is there anything wrong with this argument?