380 likes | 579 Views
CSCI 2110 Discrete Mathematics Tutorial 10. Chin. About me. Name: Chin Office: SHB 117 Email: chlee@cse.cuhk.edu.hk Office Hour: Friday 10:00 – 12:00 Outside office hour? Email me first. Proposition. A statement that can be true or false, but not both Examples I hate discrete maths
E N D
About me • Name: Chin • Office: SHB 117 • Email: chlee@cse.cuhk.edu.hk • Office Hour: Friday 10:00 – 12:00 • Outside office hour? Email me first
Proposition • A statement that can be true or false, but not both • Examples • I hate discrete maths • The quizzes are difficult • 1 + 1 = 3 • All primes are odd • No one likes this tutorial
Predicate • A function that maps elements from a domain to {true, false} • A claim with variables • Examples • ocamp(x) := x went to ocamp • attend(y) := y attends 2110 lecture • odd(a, b) := a is odd and b is odd • compare(x, y) := x < y • female(p) := p is female
Domain of a predicate • A set that contains the values a variable can take • attend(y) := y attends 2110 lecture • Domain can be the set of 2110 students • then attend(Chin) is undefined (neither true, nor false) • because Chin is not in the domain • Sometimes, we omit the domain when the context is clear
Quantifiers • for ∀ll, • for any, for every, for each, given any, … • P(x) := x goes to tutorial • ∀x, P(x) • there ∃xists, • (for) some, at least one, (for) one, … • P(x) := x teaches tutorial • ∃x, P(x)
Domain is important • Let P be a predicate from the domain D • P(x) := x loves discrete maths • Is it true that ∀x∈ D, P(x)? • When D is the set of • 2110 tutors, yes • 2110 students, no
Negation • De Morgan’s laws for first order logic: • ¬(∀x, P(x)) is equivalent to ∃x, ¬P(x) • ¬(∃x, P(x)) is equivalent to ∀x, ¬P(x)
De Morgan’s laws • Let P(x) := x is female • ∀x, P(x) means everyone is female • Which one is its negation, i.e. ¬(∀x, P(x)) ? • No one is female, i.e. ¬(∃x, P(x)) • Everyone is not female, i.e. (∀x, ¬P(x)) • Someone is female, i.e. ∃x, P(x) • Someone is not female, i.e. ∃x, ¬P(x)
Express the following using predicates • Every one goes to lectures • Let attend(x) := x goes to lectures • ∀x, attend(x) • What is its negation?
More quantifiers • Every one goes to some lectures • Let attend(x, y) := x attend lecture y • ∀x, ∃y attend(x, y) • What is its negation?
More quantifiers • What is the negation of ∀x, ∃y attend(x, y)? • ¬(∀x, ∃y attend(x, y)) • ∃x, ¬(∃y attend(x, y)) • ∃x, ∀y¬attend(x, y) • Some students don’t attend any lectures
Order of quantifiers are important • Every one goes to some lectures • Let attend(x, y) := x attend lecture y • ∀x, ∃y attend(x, y) • Everyone goes to some lectures • Alice can go to first lecture, Bob can go to the second • ∃y, ∀xattend(x, y) • There exist some lectures that everyone attends • Everyone goes to the same lectures
More quantifiers • Every year, someone goes to every lecture • attend(x, y, z) := x goes to lecture y in year z • ∀z, ∃x, ∀yattend(x, y, z) • What is its negation?
More quantifiers • What is the negation of ∀z, ∃x, ∀y,attend(x, y, z)? • ¬(∀z, ∃x, ∀y,attend(x, y, z)) • ∃z, ¬(∃x, ∀y,attend(x, y, z)) • ∃z, ∀x, ¬(∀y,attend(x, y, z)) • ∃z, ∀x, ∃y,¬attend(x, y, z) • In some years, every student does not go to some lectures.
More and more quantifiers • For everyd, there existsxandy, so that for everyf, f(x) – f(y) < d • Let P(f, x, y, d) := f(x) – f(y) < d • ∀d, ∃x, ∃y, ∀f, P(f, x, y, d) • What is its negation?
More and more quantifiers • What is the negation of • ∀d, ∃x, ∃y, ∀f, P(f, x, y, d) • ¬(∀d, ∃x, ∃y, ∀f, P(f, x, y, d)) • ∃d, ¬(∃x, ∃y, ∀f, P(f, x, y, d)) • ∃d, ∀x, ¬(∃y, ∀f, P(f, x, y, d)) • ∃d, ∀x, ∀y, ¬(∀f, P(f, x, y, d)) • ∃d, ∀x, ∀y, ∃f, ¬P(f, x, y, d)
Statements in First Order Logic • Every odd prime can be written as a sum of the square of two integers • What are the predicates? • Let P(p):= pis an odd prime and can be written as a sum of the square of two integers • ∀p, P(p). Correct, but … • In the quiz and exam, you have to break predicates down whenever it is possible
Mathematical Statements • ∀p, P(p) • P(p) := p is an odd prime and can be written as a sum of the square of two integers • P(p) := oddprime(p)∧ sumoftwo(p) • Can we do more?
Mathematical Statements • P(p) := oddprime(p) ∧ sumoftwo(p) • oddprime(p) := odd(p) ∧ prime(p) • odd(p) := ∃k ∈ ℤ, p = 2k + 1 • prime(p):= (p > 1) ∧ (∀a ∈ ℤ,∀b∈ ℤ, ((a > 1)∧(b > 1) → ab≠ p))
Mathematical Statements • P(p) := oddprime(p) ∧ sumoftwo(p) • sumoftwo(p) := p = x2 + y2 for some integers x, y • sumoftwo(p) := p = x2 + y2 for some integers x, y • sumoftwo(p) := ∃x ∈ ℤ, ∃y∈ ℤ, p= x2 + y2
Mathematical Statements • P(p) := oddprime(p) ∧ sumoftwo(p) • oddprime(p) := odd(p) ∧ prime(p) • odd(p) := ∃k ∈ ℤ, p = 2k + 1 • prime(p) := (p > 1) ∧ (∀a ∈ ℤ,∀b∈ ℤ, ((a > 1)∧(b > 1) → ab ≠ p)) • sumoftwo(p) := ∃x ∈ ℤ, ∃y∈ ℤ, p = x2 + y2 • ∀p, P(p)
Method of proofs • Direct proof • Proof by contradiction • Proof by cases
Direct Proof • Let a be an even number and b be an odd. Show that abis an even number • Write a = 2s, and b = 2t + 1 for some integers s and t • Then ab = 2s(2t + 1) = 4st + 2s = 2(2st + s) • Therefore ab is an even number because 2st+s is an integer. cannot use the same letter
Proof by contradiction • Show that if 2x + 45 < 85, then x < 20 • Suppose x ≥ 20 • 2x ≥ 40 • 2x + 40 ≥ 85 • Contradiction!
Proof by contradiction • Show that 3 is not rational. • How to say 3 is a rational number? • 3 = p/q for some integers p and q √ √ √
Proof by contradiction • 3 = p/q for some integers p and q • We choose p and q so that have no common factors that are greater than 1. • 12/64 → 3/16 • You can always reduce a fraction • If we can show p and q have 3 as their common factor, done. But how? √
Proof by contradiction • 3 = p/q for some integers p and q • Where p and q have no common factors that are > 1 • 3q2 = p2 • If p2 = 3s, p= 3t for some integer t • Prove by contradiction √
Proof by contradiction • If p2 = 3s for some integer s, p= 3t for some integer t • Prove by contradiction • Suppose p ≠ 3t for any t • Case 1: p = 3t + 1 for some t • Case 2: p = 3t + 2 for some t
Proof by contradiction • If p2= 3s for some integer s, p= 3t for some integer t • Suppose p2= 3s for some integer s but p≠ 3t for any t • Case 1: p = 3t + 1, p2 = 9t2 + 6t + 1 = 3(3t2 + 2t) + 1 p2 ≠ 3s for any s • Case 2: p = 3t+ 2, p2 = 9t2+ 12t+ 4 = 3(3t2+ 4t + 1) + 1 p2 ≠ 3s for any s • Contradiction.
Proof by contradiction • 3q2 = p2 • If p2 = 3s for some integer s, p= 3t for some integer t • p = 3t for some integer t • 3q2 = p2 = 9t • q2 = 3t • If p2 = 3tfor some integer t, p= 3ufor some integer u • q = 3u for some integer u
Proof by contradiction • p = 3t for some integer t • q = 3ufor some integer u • So p and q have 3 as their common factor. • Contradiction because we begin with the fact that p and q do not have common factor > 1.
Proof by contradiction • Suppose 100 students took a quiz and the mean is 80 (out of 100). Show that at least 50 students score greater than 60. • What is the negation of at least 50 students score > 60? • At most 49 students score > 60 • (or at least 51 score ≤ 60)
Proof by contradiction • What is the highest mean we can get? • The 49 students who score > 60 get 100 • The rest of the 51 students who score ≤ 60 get 60 • Then the mean is (# people who score 100) × 100 + (# people who score 60) × 60 = (49 × 100 + 51 × 60) / 100 = (4900 + 3060) / 100 = 79.6 < 80 • Contradiction! (total number of students)
Proof by cases • Prove that max(x, y) + min(x, y) = x + y. • If y> x • max(x, y) = y and min(x, y) = x • max(x, y) + min(x, y) = y + x = x + y • If y ≤ x • max(x, y) = x and min(x, y) = y • max(x, y) + min(x, y) = x + y • done, since either x < y or y <= x must be true.
Proof by cases • Suppose x > 0 and y > 0. • Prove that (|x + y| - |x – y|)/2 = min(x, y) • If x> y • min(x, y) = y • |x + y| = x + y, |x – y| = x – y • |x + y| - |x – y| = (x + y) – (x – y) = 2y • (|x + y| - |x – y|)/2 = y = min(x, y)
Proof by cases • Suppose x > 0 and y > 0. • Prove that (|x + y| - |x – y|)/2 = min(x, y) • If x ≤y • min(x, y) = x • |x + y| = x + y, |x – y| = y – x • (because |a| = -a if a≤ 0, and (x – y) ≤ 0) • |x + y| - |x – y| = (x + y) – (y – x) = 2x • (|x + y| - |x – y|)/2 = x = min(x, y)
End • Questions?