The primary goal of this course is to become familiar with some of the basic mathematical ideas used in programming.
Reading:
Levin, 0.1 and 0.2
Negation rules: (¬A can also be written ~A)
A => B same as ¬A or B
¬(A and B) same as ¬A or ¬B (if it is not true that A is true and B is true, then one of them must be false) (Morgan's Law)
¬(A or B) same as ¬A and ¬B (if it is not true that either A or B is true, then both of them must be false) (Morgan's Law)
Quantifiers: ∀ (for all) and ∃ (there exists)
Negation rules for quantifiers:
¬∃x P(x) same as ∀x ¬P(x) (if there does not exist an x making P(x) true, then P(x) is false for every x)
¬∀x P(x) same as ∃x ¬P(x) (if P(X) is not true for every x, then for some x it is false)
Here are some simple two-person two-move games. In each case, player A chooses a whole number a, and then, seeing A's move, B chooses a whole number b. Based on the choices a and b, we determine which player wins.
In each game above, who has the winning strategy?
Does every 2-move game have a winning strategy?
Player A has a winning strategy if ∃a ∀b (player A wins). If this is false, that mean
¬ ∃a ∀b (player A wins)
same as ∀a ¬∀b (player A wins)
same as ∀a ∃b ¬(player A wins)
same as ∀a ∃b (player B wins)
Negation of quantifiers
From Levin p 15. Are any of the following equivalent? Do any imply any other?
The first is (∃ person p)(∀ time t) CanFool(p,t)
The second is either ∀p∃t(CanFool(p,t)) or else ∃t∀p CanFool(p,t). What is
the difference? Let's go with the first.
The third is ∃p∀t CanFool(p,t), same as the first.
The fourth is ∃t∀p CanFool(p,t)
A predicate is a formula with a free variable. We can bind that variable by sticking a quantifier for it on the front.
A few more examples of quantifier negation:
Not exists
¬∃a ∀b Win1(a,b)
lim f(x) = L as x->a: ∀e ∃d ∀x |x-a| < d => |f(x)-L| < e.
Suppose you are driving down the highway and see a sign:
No passing zones not striped
A hyphen is missing: no-passing zones are not striped, because they just repaved. But what if we take it to mean:
There are not any passing zones that are not striped
What does this mean?
sqrt(2)
start with: n is even if and only if n*n is even.
n is even if ∃k (n=2*k)
Proving ∀n∈N ∃k∈N(n=2k or n=2k+1). Our first Proof by Mathematical Induction.
Two-move games. The moves are a1, b1, a2, b2
A has a winning strategy if ∃a1 ∀b1 ∃a2 ∀b2 (A wins).
A does not have a winning strategy if ~ ∃a1 ∀b1 ∃a2 ∀b2 (A wins)
which is ∀a1 ∃b1 ∀a2 ∃b2 (~ A wins), which is ∀a1 ∃b1 ∀a2 ∃b2 (B wins), which means there is a winning strategy for B.
game 1: B wins if a1<b1<a2<b2. Who has the winning strategy?
game2: B wins if a1/a2 = b1/b2, or a2==b2==0. Who has the winning strategy?
game 3: B wins if exactly one of a1,a2 is between b1 and b2.
game 4: B wins if the line from (a1,b1) to (a2,b2) has positive slope (or a1=a2)
game 5: B wins if the line from (a1,a2) to (b1,b2) has positive slope
game 6: A and B pick points on the plane. B wins if b2 is equidistant from a1, b1, a2.
Sets: Levin 0.3
End here Monday 1/24
Functions: Levin 0.4
Counting: Levin 1.1, on page 57
Counting subsets of {1, 2, ..., N}, Levin 1.2 on page 70
Counting all subsets (including ∅)Homework 1, due Friday Jan 28, on Sakai