Mohamed G. Gouda CS 311 Fall 2013 Midterm 1 1) Pigeon Hole Principle: Let m be a non-negative integer and n be a positive integer. Prove by contradiction that in any distribution of m pigeons into n holes there exist a hole that has at least m/n pigeons. Sol. not (In any distribution of m piogeons into n holes, Exist a hole that has at least m/n pigeons) => {De Morgan's} (Exist a distribution of m pigeons into n holes where All holes have fewer than m/n pigeons each) => {compute number of pigeons} number of pigeons < (m/n)*n = m => {number of pigeons = m and m < m is false} F 2) Show that the "->" Boolean operator is not associative. Sol. We need to exhibit a combination of x, y, and z where the formula (x -> (y -> z)) is not equivalent to ((x -> y) -> z). Consider the combination x=F, y=T, and z=F. In this case, we have (x -> (y -> z)) = (F -> (T -> F)) = (F -> F) = T ((x -> y) -> z) = ((F -> T) -> F) = (T -> F) = F. 3) Show that the formula f(x,y) = ((x or y) -> (x and y)) is not equivalent to formula T and not equivalent to formula F. Sol. We exhibit a combination of x and y that makes f(x,y) false and another combination of x and y that makes f(x,y) true. f(T,F) = ((T or F) -> (T and F)) = (T -> F) = F f(T,T) = ((T or T) -> (T and T)) = (T -> T) = T 4) Let Dx be the set of all integers. Use case analysis to prove that (All x in Dx, x^2 != 8). Sol. Case 1: (x >= -2 and x =< 2): in this case, x^2 =< 4 != 8. Case 2: (x < -2 or x > 2): in this case, x^2 >= 9 != 8. 5) Let k, m, and n be positive integers. Let (k is multiple of m) denote that k = m*x for some positive integer x. Use direct inference to prove (All k, m, n, ((k is multiple of m) and (m is multiple of n)) => (k is multiple of n)). Sol. (k is multiple of m) and (m is multiple of n) => {definition of multiple} (k = m*x for some positive integer x) and (m = n*y for some positive integer y) => {arithmetics} (k = n*y*x for some positive integers x and y) => {y*x is a positive integer say z} (k = n*z for some positive integer z) => {definition of multiple} (k is multiple of n)