Today First there was logic... Connecting Statements A statement is a true or false. A ∧ B , A ∨ B , ¬ A , A = ⇒ B . Don’t worry about G¨ odel. Statements? Propositional Expressions and Logical Equivalence 3 = 4 − 1 ? Statement! ( A = ⇒ B ) ≡ ( ¬ A ∨ B ) 3 = 5 ? Statement! ¬ ( A ∨ B ) ≡ ( ¬ A ∧¬ B ) 3 ? Not a statement! n = 3 ? Not a statement...but a predicate. Proofs: truth table or manipulation of known formulas. Predicate: Statement with free variable(s). Review for Midterm. ( ∀ x ∈ R )( P ( x ) ∧ Q ( x )) ≡ ( ∀ x ∈ R ) P ( x ) ∧ ( ∀ x ∈ R ) Q ( x ) Example: x = 3 Given a value for x , becomes a statement. If you think it’s true: Predicate? Step 1: Show that when the thing on the left is true, the thing on n > 3 ? Predicate: P ( n ) ! the right is true. No matter what P and Q are! x = y ? Predicate: P ( x , y ) ! Step 2: Show that when the thing on the right is true, the thing on x + y ? No. An expression, not a statement. the left is true. No matter what P and Q are! Quantifiers: Or manipulate the formulas. ( ∀ x ) P ( x ) . For every x , P ( x ) is true. If you think it’s not true: ( ∃ x ) P ( x ) . There exists an x , where P ( x ) is true. Find an example of P ( x ) and Q ( x ) such that one of the above ( ∀ n ∈ N ) , n 2 ≥ n : Any free variables? No. So it’s a statement. steps fails. ( ∀ x ∈ R )( ∃ y ∈ R ) y > x . ...and then proofs... ...jumping forward.. ...and then induction... Direct : P = ⇒ Q P ( 0 ) ∧ (( ∀ n )( P ( n ) = ⇒ P ( n + 1 ) ≡ ( ∀ n ∈ N ) P ( n ) . ⇒ a 2 is even. Example: a is even = Thm: For all n ≥ 1, 8 | 3 2 n − 1. Approach: What is even? a = 2 k a 2 = 4 k 2 = 2 ( 2 k 2 ) Induction on n . Contradiction in induction: Integers closed under multiplication! So 2 k 2 is even. Base: 8 | 3 2 − 1. Find a place where induction step doesn’t hold. a 2 is even. Something something Well ordering principle... Induction Hypothesis: Assume P ( n ) : True for some n . Contrapositive : P = ⇒ Q or ¬ Q = ⇒ ¬ P . (3 2 n − 1 = 8 d ) Contradiction in Stable Marriage: Example: a 2 is odd = ⇒ a is odd. First day where no woman improves. Does not exist. ⇒ a 2 is even. Induction Step: Prove P ( n + 1 ) Contrapositive: a is even = Contradiction in Countability: 3 2 n + 2 − 1 = 9 ( 3 2 n ) − 1 (by induction hypothesis) Contradiction : P Assume there is a list with all the real numbers. Impossible. = 9 ( 8 d + 1 ) − 1 ¬ P = ⇒ false = 72 d + 8 Useful to prove something does not exist: √ = 8 ( 9 d + 1 ) Example: rational representation of 2 does not exist. Example: finite set of primes does not exist. Divisible by 8. Example: rogue couple does not exist.
...Graphs... Graph Algorithm: Eulerian Tour Graph Coloring. G = ( V , E ) V - set of vertices. Thm: Every connected graph where every vertex has even degree Given G = ( V , E ) , a coloring of a G assigns colors to vertices V E ⊆ V × V - set of edges. has an Eulerian Tour; a tour which visits every edge exactly once. where for each edge the endpoints have different colors. Directed: ordered pair of vertices. Algorithm: Take a walk using each edge at most once. Adjacent, Incident, Degree. Property: return to starting point. In-degree, Out-degree. Why? Even degree. Always have an option Thm: Sum of degrees is 2 | E | . Remove the walk from the graph Edge is incident to 2 vertices. Recurse on connected components. Degree of vertices is total incidences. Put together. Notice that the last one, has one three colors. Pair of Vertices are Connected: Property: walk visits every component. Fewer colors than number of vertices. If there is a path between them. Proof Idea: Original graph connected. Fewer colors than max degree node. Connected Component: maximal set of connected vertices. Connected Graph: one connected component. Planar graphs and maps. Six color theorem. Five color theorem Theorem: Every planar graph can be colored with six colors. Planar graph coloring ≡ map coloring. Proof: Recall: e ≤ 3 v − 6 for any planar graph. From Euler’s Formula: v + f = e + 2. 3 f ≤ 2 e Theorem: Every planar graph can be colored with five colors. Total degree: 2 e Proof: Not Today! Average degree: ≤ 2 e v ≤ 2 ( 3 v − 6 ) ≤ 6 − 12 v . v There exists a vertex with degree < 6 or at most 5. Remove vertex v of degree at most 5. Inductively color remaining graph. Color is available for v since only five neighbors... Four color theorem is about planar graphs! and only five colors are used.
Four Color Theorem Graph Types: Complete Graph. Trees. Definitions: A connected graph without a cycle. Theorem: Any planar graph can be colored with four colors. A connected graph with | V |− 1 edges. A connected graph where any edge removal disconnects it. Proof: Not Today! K n , | V | = n An acyclic graph where any edge addition creates a cycle. every edge present. To tree or not to tree! degree of vertex? | V |− 1. Very connected. Lots of edges: n ( n − 1 ) / 2. Wow. Minimally connected, minimum number of edges to connect. Property: Can remove a single node and break into components of size at most | V | / 2. Hypercube Recursive Definition. Hypercube:properties A 0-dimensional hypercube is a node labelled with the empty string of Hypercubes. Really connected. O ( | V | log | V | ) edges! Wait what? I thought it was n 2 n − 1 . Oh... 2 n = | V | ... bits. Dense cuts: Cutting off k nodes needs ≥ k edges. Also represents bit-strings nicely. An n -dimensional hypercube consists of a 0-subcube (1-subcube) FYI: Also cuts represent boolean functions. One side of the cut which is a n − 1-dimensional hypercube with nodes labelled 0 x (1 x ) G = ( V , E ) takes value 0. The other side takes value 1. | V | = { 0 , 1 } n , with the additional edges ( 0 x , 1 x ) . Nice Paths between nodes. | E | = { ( x , y ) | x and y differ in exactly one bit position. } Get from 000100 to 101000. 101 111 01 11 000100 → 100100 → 101100 → 101000 001 011 Correct bits in string, moves along path in hypercube! 0 1 Good communication network! 110 000 100 00 10 010
Bipartite graphs Stable Marriage: a study in definitions and WOP . TMA. U Traditional Marriage Algorithm: n -men, n -women. V Each Day: Each person has completely ordered preference list Every man proposes to his favorite woman from the ones that 1 contains every person of opposite gender. haven’t already rejected him. 6 Pairing/Marching. Every woman rejects all but best man who proposes. Set of pairs ( m i , w j ) containing all people exactly once. 2 Useful Algorithmic Definitions: How many pairs? n . 7 Man crosses off woman who rejected him. People in pair are partners in pairing. Woman’s current proposer is “on string.” 3 Rogue Couple in a pairing. 8 Key Property: Improvement Lemma: A m j and w k who like each other more than their partners Every day, if man on string for woman, 4 Stable Pairing. = ⇒ any future man on string is better. (proof by contradiction) 9 Pairing with no rogue couples. Stability: No rogue couple. 5 Does stable pairing exist? rogue couple (M,W) = ⇒ M proposed to W Yes for matching. = ⇒ W ended up with someone she liked better than M . No, for roommates problem. Not rogue couple! There is a cut with all the edges. Cycles have length 4 or more edges. Optimality/Pessimal And then countability HALTING Optimal partner if best partner in any stable pairing. Not necessarily first in list. Possibly no stable pairing with that partner. Man-optimal pairing is pairing where every man gets optimal partner. The HALT problem: Is there a program that can tell you if another More than one infinities (generic) program halts on an input? Thm: TMA produces male optimal pairing, S . Proof by contradiction: Some things are countable , like the natural numbers , or the NO! rationals... Let M be the first man to propose to someone worse than optimal Why? Self reference! Why? There is a list!! partner W . TMA: M asked W . And then got replaced by M ′ ! Some things are not countable , like the reals , or the set of all Who cares? Using the same trick I can show that a bunch of W prefers M ′ . subsets of the naturals... problems are undecidable! How much doesn M ′ like W ? Why? Diagonalization: Well, assume there is a list. Can construct Like: Will this program P even print ”Hello World”? Better than his match in optimal pairing? Impossible. a diagonal element x . x is not in the list! Contradiction. Or ”Is there an input for this program P that will give an attacker Worse than his match in the optimal pairing? admin access? Then M wasn’t the first!! Thm: woman pessimal. Man optimal = ⇒ Woman pessimal. Woman optimal = ⇒ Man pessimal.
Recommend
More recommend