Today Propositional logic. Connecting Propositions with Boolean Operators A proposition is a statement that is true or false. Propositions? 3 = 4 − 1 ? Proposition! 3 = 5 ? Proposition! A ∧ B , A ∨ B , ¬ A , A = ⇒ B . 3 ? Not a proposition! Propositional Expressions and Logical Equivalence n = 3 ? Not a proposition...but a predicate. ( A = ⇒ B ) ≡ ( ¬ A ∨ B ) Predicate: Statement with free variable(s). Review for Midterm. ¬ ( A ∨ B ) ≡ ( ¬ A ∧¬ B ) Example: x = 3 Given a value for x , becomes a proposition. Predicate? Proofs: truth table or manipulation of known formulas. n > 3 ? Predicate: P ( n ) ! Boolean simplification rules - De Morgan’s law, commutativity, x = y ? Predicate: P ( x , y ) ! associativity, etc. x + y ? No. An expression, not a proposition. ( ∀ x )( P ( x ) ∧ Q ( x )) ≡ ( ∀ x ) P ( x ) ∧ ( ∀ x ) Q ( x ) Quantifiers: ( ∀ x ) P ( x ) . For every x , P ( x ) is true. ( ∃ x ) P ( x ) . There exists an x , where P ( x ) is true. When all variables are quantified, the statement turns into a proposition. ( ∀ n ∈ N ) , n 2 ≥ n . ( ∀ x ∈ R )( ∃ y ∈ R ) y > x . Proofs! Induction. Stable Marriage: a study in definitions and WOP . Direct: P = ⇒ Q ⇒ a 2 is even. Example: a is even = P ( 0 ) ∧ (( ∀ n )( P ( n ) = ⇒ P ( n + 1 ) ≡ ( ∀ n ∈ N ) P ( n ) . n -men, n -women. Approach: What is even? a = 2 k Thm: For all n ≥ 1, 8 | 3 2 n − 1. a 2 = 4 k 2 . Each person has completely ordered preference list contains every person of opposite gender. What is even? Induction on n . a 2 = 2 ( 2 k 2 ) Base: 8 | 3 2 − 1. Pairing. Integers closed under multiplication! Set of pairs ( m i , w j ) containing all people exactly once. a 2 is even. Induction Hypothesis: True for some n . How many pairs? n . (3 2 n − 1 = 8 d ) People in pair are partners in pairing. Contrapositive: P = ⇒ Q or ¬ Q = ⇒ ¬ P . Example: a 2 is odd = ⇒ a is odd. Induction Step: Rogue Couple in a pairing. ⇒ a 2 is even. Contrapositive: a is even = 3 2 n + 2 − 1 = 9 ( 3 2 n ) − 1 (by induction hypothesis) A m j and w k who like each other more than their current partners Contradiction: P = 9 ( 8 d + 1 ) − 1 Stable Pairing. ¬ P = ⇒ false = 72 d + 8 Pairing with no rogue couples. ¬ P = ⇒ R ∧¬ R = 8 ( 9 d + 1 ) Does stable pairing exist? Useful for prove something does not exist: √ Divisible by 8. Example: rational representation of 2 does not exist. No, for roommates problem. Example: finite set of primes does not exist. Example: rogue couple does not exist.
Stable Marriage Algorithm (SMA). Optimality/Pessimal Graph Theory! (Also called Traditional Marriage Algorithm) Each Day: G = ( V , E ) Every man proposes to favorite woman who has not yet rejected V - set of vertices. him. E ⊆ V × V - set of edges. Every woman rejects all but best of the men who propose. Optimal partner if best partner in any stable pairing. Focus on simple graphs (at most one edge from a vertex to another) Not necessarily first in list. Useful Definitions: Undirected: no ordering to edge. Directed: ordered pair of vertices. Possibly no stable pairing with that partner. Man crosses off woman who rejected him. Adjacent, Incident, Degree. Woman’s current proposer is “on string.” Man-optimal pairing is pairing where every man gets optimal partner. In-degree, Out-degree. “Propose and Reject.” : Either men propose or women. But not both. Thm: SMA produces male optimal pairing, S . Thm: Sum of degrees is 2 | E | . Traditional propose and reject where men propose. Man optimal = ⇒ Woman pessimal. Pair of Vertices are Connected: Key Property: Improvement Lemma: Woman optimal = ⇒ Man pessimal. If there is a (simple) path between them. Every day, if man on string for woman, any future man on string is Related notions: cycle, walk, tour better. Connected Component: maximal set of connected vertices. Stability: No rogue couple. Connected Graph: one connected component. suppose rogue couple (M,W) = ⇒ M proposed to W = ⇒ W ended up with someone she liked better than M . Not rogue couple! Graph Algorithm: Eulerian Tour Graph Types: Complete Graph. Trees. Thm: Every connected graph where every vertex has even degree has an Eulerian Tour; a tour which visits every edge exactly once. Definitions: Algorithm: A connected graph without a cycle. Take a walk. A connected graph with | V |− 1 edges. Property: return to starting point. K n , | V | = n A connected graph where any edge removal disconnects it. Proof Idea: Even degree. A connected acyclic graph where any edge addition creates a every edge present. Recurse on connected components. cycle. degree of vertex? | V |− 1. Put together. To tree or not to tree! Property: walk visits every component. Very connected. Proof Idea: Original graph connected. Lots of edges: n ( n − 1 ) / 2. Minimally connected, minimum number of edges to connect.
Hypercube Recursive Definition. Hypercube:properties A 0-dimensional hypercube is a node labelled with the empty string of Hypercubes. Really connected. | V | log | V | edges! bits. Also represents bit-strings nicely. An n -dimensional hypercube consists of a 0-subcube (1-subcube) G = ( V , E ) Hamiltonian (Rudrata) Cycle: cycle that visits every node. which is a n − 1-dimensional hypercube with nodes labelled 0 x (1 x ) | V | = { 0 , 1 } n , Eulerian? If n is even. with the additional edges ( 0 x , 1 x ) . | E | = { ( x , y ) | x and y differ in one bit position. } Large Cuts: Cutting off k nodes needs ≥ k edges. 101 111 “Best” cut? Cut apart subcubes: cuts off 2 n nodes with 2 n − 1 edges. 01 11 001 011 0 1 110 100 00 10 000 010 ...Modular Arithmetic... Midterm format Arithmetic modulo m . Elements of equivalence classes of integers. Time: 120 minutes. { 0 ,..., m − 1 } and integer i ≡ a ( mod m ) Many short answers. if i = a + km for integer k . Get at ideas that we study. or if the remainder of i divided by m is a . Know material well: fast, correct. Know material medium: slower, less correct. Can do calculations by taking remainders Know material not so well: Uh oh. at the beginning, in the middle Some longer questions. or at the end. Proofs, think about algorithms, properties, etc. 58 + 32 = 90 = 6 ( mod 7 ) Not so much calculation. 58 + 32 = 2 + 4 = 6 ( mod 7 ) Good Luck!!! 58 + 32 = 2 + − 3 = − 1 = 6 ( mod 7 ) Negative numbers work the way you are used to. − 3 = 0 − 3 = 7 − 3 = 4 ( mod 7 )
Recommend
More recommend