SLIDE 1 CSC165
Larry Zhang, September 23, 2014
SLIDE 2 Tutorial classrooms
T0101, Tuesday 9:10am~10:30am: BA3102 A-F (Jason/Jason) BA3116 G-L (Eleni/Eleni) BA2185 M-T (Madina/Madina) BA2175 V-Z (Siamak/Siamak) T0201: Monday 7:10~8:30pm BA2175* A-D (Ekaterina/Ekaterina) BA1240* E-Li (Gal/Gal) BA2185* Liang-S (Yana/Adam) BA3116 T-Z (Christina/Nadira) T5101: Thursday 7:10~8:30pm BA3116 A-F (Christine/Christine) BA2135 G-Li (Elias/Elias) BA1200* Lin-U (Yiyan/Yiyan) GB244* V-Z (Natalie/Natalie)
SLIDE 3 slogURL.txt
➔ 393 / 447 submitted ➔ can still submit on MarkUS if you haven’t. ➔ can still fix it if you did it wrong
◆ a plain TXT file: slogURL.txt
- NOT slogURL.pdf, slogURL.doc, slogURL.txt.pdf, slogURL.txt.
doc, or PDF/DOC renamed to TXT ◆ Submit individually
- If you formed a group with more than one person, email
Danny and me with both of your URLs.
SLIDE 4 Assignment 1 is out
http://www.cdf.toronto.edu/~heap/165/F14/Assignments/a1.pdf
➔ Due on October 3rd, 10:00pm. ➔ May work in groups of up to 3 people. ➔ Submit on MarkUs: a1.pdf ➔ Prefer to use LaTeX, try the following tools
◆ www.writelatex.com ◆ www.sharelatex.com
SLIDE 5
Today’s agenda
➔ More elements of the language of Math
◆ Conjunctions ◆ Disjunctions ◆ Negations ◆ Truth tables ◆ Manipulation laws
SLIDE 6
Lecture 3.1 Conjunctions, Disjunctions
Course Notes: Chapter 2
SLIDE 7
Conjunction (AND, ∧)
noun “the action or an instance of two or more events or things occurring at the same point in time or space.” Synonyms: co-occurrence, coexistence, simultaneity.
SLIDE 8
Conjunction (AND, ∧)
Combine two statements by claiming they are both true. R(x): Car x is red. F(x): Car x is a Ferrari. R(x) and F(x): Car x is red and a Ferrari. R(x) ∧ F(x)
predicates!
SLIDE 9
Which ones are R(x) ∧ F(x)
SLIDE 10
Conjunction (AND, ∧)
As sets (instead of predicates): R: the set of red cars F: the set of Ferrari cars Intersection
SLIDE 11
What are R, F, R ∩ F
SLIDE 12
➔ Using predicates: R(x) ∧ F(x) ➔ Using sets: R ∩ F
SLIDE 13
Be careful with English “and”
There is a pen, and a telephone. O: the set of all objects P(x): x is a pen. T(x): x is a telephone.
There is a pen-phone!
SLIDE 14
Be careful with English “and”
There is a pen, and a telephone. O: the set of all objects P(x): x is a pen. T(x): x is a telephone.
SLIDE 15
Be careful, even in math
The solutions are x < 20 and x > 10.
A B
A ∩ B
The solutions are x > 20 and x < 10.
A ∪ B
A B
SLIDE 16
Disjunction
SLIDE 17
Disjunction (OR, ∨)
Combine two statements by claiming that at least one of them is true. R(x): Car x is red. F(x): Car x is a Ferrari. R(x) or F(x): Car x is red or a Ferrari. R(x) ∨ F(x)
SLIDE 18
Which ones are R(x) ∨ F(x)
SLIDE 19
Disjunction (OR, ∨)
As sets (instead of predicates): R: the set of red cars F: the set of Ferrari cars Union
SLIDE 20
What are R, F, R ∪ F
SLIDE 21
➔ Using predicates: R(x) ∨ F(x) ➔ Using sets: R ∪ F
SLIDE 22
Be careful with English “or”
Either we play the game my way, or I’m taking my ball and going home.
“exclusive or”, not “or”!
SLIDE 23
Summary
➔ Conjunction: AND, ∧, ∩ ➔ Disjunction: OR, ∨, ∪
SLIDE 24 Quick test
A logician’s wife is having a baby. The doctor immediately hands the newborn to the dad. His wife asks impatiently: “So, is it a boy or a girl?” The logician replies: “Yes.”
Source: “21 jokes for super smart people.”
http://www.buzzfeed.com/tabathaleggett/jokes-youll-only-get-if-youre-really-smart#1ml5j1x
SLIDE 25
Lecture 3.2 Negations
Course Notes: Chapter 2
SLIDE 26
Negation (NOT, ¬)
All red cars are Ferrari. Not all red cars are Ferrari. C: set of all cars negation
SLIDE 27
Negation (NOT, ¬)
Not all red cars are Ferrari. There exists a car that is red and not Ferrari. equivalent
SLIDE 28
Exercise: Negate-it!
SLIDE 29
Exercise: Negate-it!
Rule: the negation sign should apply to the smallest possible part of the expression.
NO GOOD! GOOD!
SLIDE 30
Exercise: Negate-it!
All cars are red.
NEG
Not all cars are red. There exists a car that is not red.
SLIDE 31
Exercise: Negate-it!
There exists a car that is red.
NEG
There does not exists a car that is red. All cars are not red.
SLIDE 32
Exercise: Negate-it!
Every red car is a Ferrari.
NEG
Not every red car is a Ferrari. There is a car that is red and not a Ferrari.
SLIDE 33
Exercise: Negate-it!
There exists a car that is red and Ferrari.
NEG There does not exists a car that is red and Ferrari. For all cars, if it is red, then it is not Ferrari.
SLIDE 34
Exercise: Negate-it!
There exists a car that is red and Ferrari.
NEG There does not exists a car that is red and Ferrari. For all cars, it is red, then it is not Ferrari. For all cars, it is Ferrari, then it is not red.
SLIDE 35
Some tips
➔ The negation of a universal quantification is an existential quantification (“not all...” means “there is one that is not...”). ➔ The negation of a existential quantification is an universal quantification (“there does not exist...” means “all...are not...”) ➔ Push the negation sign inside layer by layer (like peeling an onion).
SLIDE 36
Exercise: Negate-it!
NEG
SLIDE 37
Scope
SLIDE 38
Parentheses are important!
NO GOOD! GOOD! GOOD!
SLIDE 39
Scope inside parentheses
Everything happens in parentheses stays in parentheses.
is the same as
SLIDE 40
Summary
➔ Negations
◆ understand them in human language ◆ practice is the key!
➔ Parentheses
◆ use them properly to avoid ambiguity
SLIDE 41
Lecture 3.3 Truth tables, and some laws
Course Notes: Chapter 2
SLIDE 42
About visualization...
P Q
Venn diagram works pretty well… ... for TWO predicates.
SLIDE 43
What if we have 3 predicates?
P Q R
SLIDE 44
What if we have 4 predicates?
SLIDE 45
What if we have 5 predicates?
SLIDE 46
What if we have 20 predicates?
There must be a better way!
SLIDE 47
It’s called the truth table
SLIDE 48 Truth table with 2 predicates
Enumerate the outputs over all possible combinations of input values of P and Q.
2² = 4
INPUTS OUTPUTS
How many rows are there?
SLIDE 49
Truth table with 3 predicates
How many rows are there?
2³ = 8
SLIDE 50
Truth table with 20 predicates
2²⁰ rows It’s not a mess, it just a larger table, which computers can process easily!
SLIDE 51
What can truth tables be used for?
SLIDE 52
for evaluating expressions
SLIDE 53
P Q P ∧ Q P ∧ ¬P P ∨ ¬P T T T F F T F F satisfiable unsatisfiable (contradiction) T F F F F F F F
for determining satisfiability
tautology (universal truth) T T T T It’s a boy and it’s not a boy. It’s a boy or it’s not a boy.
SLIDE 54
P Q ¬P ∨ Q P => Q T T T F F T F F T F T T T F T T
for proving equivalence
SLIDE 55
P Q ¬ (P ∨ Q) ¬P ∧ ¬Q T T T F F T F F F F F T F F F T
for proving equivalence
We just proved De Morgan’s Law!
SLIDE 56
De Morgan’s Law
SLIDE 57
Augustus De Morgan (1806-1871) ➔ De Morgan’s Law ➔ Mathematical Induction
SLIDE 58
there are more laws...
SLIDE 59
Other laws
Commutative laws
SLIDE 60
Other laws
Associative laws
SLIDE 61
Other laws
Distributive laws
SLIDE 62
Other laws
Identity laws
always true always false
SLIDE 63
Other laws
Idempotent laws
SLIDE 64
Other laws
For a full list of laws to be used in CSC165, read Chapter 2.17 of Course Notes.
SLIDE 65
About these laws...
➔ Similar to those for arithmetics. ➔ Only use when you are sure. ➔ Understand them, be able to verify them, rather than memorizing them. ➔ Practice is the key!
SLIDE 66
Summary for today
➔ Conjunctions ➔ Disjunctions ➔ Negations ➔ Truth tables ➔ Manipulation laws ➔ We are almost done with learning the language of math.
SLIDE 67
Next week
➔ finish learning the language ➔ start learning proofs