------------------------------------------------------------------------------ Mohamed G. Gouda CS 311 Fall 2015 Homework 1 ------------------------------------------------------------------------------ 1. Use equivalence laws to prove that the following two formulas are equivalent: f(x) = not(f(x)) F ------------------------------------------------------------------------------- 2. Let Dx be the set {1,2} and Dy be the set {1,2,3}. Define the parametrized predicate P(x,y) such that the following predicate is T: (All x, Exist y, P(x,y)) and (not(Exist y, All x, P(x,y))) Explain your answer. ------------------------------------------------------------------------------ 3. A positive integer x is said to be divisble by a positive integer m, denoted x|m, iff there is a positive integer k such that x = (m*k) where * denotes the integer multiplication operator. Let Dx, Dy, and Dm be the set of all positive integers. Use direct inference to prove the following predicate is T: (All x, y, m, (x|m and y|m) => ((x+y)|m)) ------------------------------------------------------------------------------ 4. Give a by-contradiction proof of the predicate: (7 is even) => (7*3 is even)) ----------------------------------------------------------------------------- Solutions ------------------------------------------------------------------------------ 1. f(x) = not(f(x)) => {definition of the Bolean operator "="} (f(x) and not(f(x))) or (not(f(x)) and (not(not(f(x))))) => {idempotence} (f(x) and not(f(x))) or (not(f(x)) and (f(x))) => {symmetry of "and"} (f(x) and not(f(x))) or ((f(x)) and (not(f(x)))) => {idempotence} f(x) and not(f(x)) => {elementary} F ------------------------------------------------------------------------------ 2. Define P(x,y) as follows: P(1,1) = T P(1,2) = F P(1,3) = F P(2,1) = F P(2,2) = T P(2,3) = F In this case, we have (All x, Exist y, P(x,y)) = T (Exist y, All x, P(x,y)) = F ----------------------------------------------------------------------------- 3. (x|m and y|m) => {definition of "|"} x = (m*k) for some positive integer k and y = (m*r) for some positive integer r => {adding x plus y} x+y = m*(k+r) for some positive integers k and r => {(k+r) is a positive integer s} x+y = m*s for some positive integer s => {definition of "|"} ((x+y)|m)) ---------------------------------------------------------------------------- 4. ((7 is even) and not(7*3 is even)) => {7 is not even} ((7 is even) and not(7*3 is even)) and not(7 is even) => {symmetry and associativity of and} ((7 is even) and not(7 is even)) and not(7*3 is even) => {idempotence} (F and not(7*3 is even)) => {elementary} F -----------------------------------------------------------------------------