Mohamed G. Gouda CS 313K Fall 2012 Midterm 4 1. Let A and B be arbitrary sets, and let "v" denote the set union operator, "^" denote the set intersection operator, and "not" denote the set complement operator. Show, by two-sided inference, that not(A ^ B) = not(A) v not(B) Sol: x in not(A ^ B) <=> {Definition of "not"} not(x in (A ^ B)) <=> {Definition of "^"} not((x in A) and (x in B)) <=> {De-Morgan's} not(x in A) or not(x in B) <=> {Definition of "not"} (x in not(A)) or (x in not(B)) <=> {Definition of "v"} x in (not(A) v not(B)) 2. Let f:A->B and g:B->C be two functions. Show, by guessing values for A, B, C, f, and g, that the following inference does not hold: (g.f is surjective) => (f is surjective) Sol: A={1}, B={2,3}, C={4} f(1)=2, g(2)=4, g(3)=4, g.f(1)=g(2)=4 Thus, g.f is surjective but f is not surjective 3. Let f:A->B be a function, and let A1 and A2 be two non-empty subsets of A. Show, by two-sided inference, that f(A1) v f(A2) = f(A1 v A2) Sol: y in (f(A1) v f(A2)) <=> {Definition of v} (y in f(A1)) or (y in f(A2)) <=> {Definitions of f(A1) and f(A2)} (Exist x in A1, f(x) = y) or (Exist x in A2, f(x) = y) <=> {Definition of v} (Exist x in A1 v A2, f(x) = y) <=> {Definition of f(A1 v A2)} y in f(A1 v A2) 4. Let f:A->B and g:B->A be two functions that have inverses f' and g', respectively. Show, by direct inference, that function g.f has an inverse f'.g'. Sol: T => {Definition of (f'.g')} (f'.g')(g.f(x)) = f'(g'(g.f(x))) => {Definition of (g.f)} (f'.g')(g.f(x)) = f'(g'(g(f(x)))) => {g'(g(f(x))) = f(x)} (f'.g')(g.f(x)) = f'(f(x)) => {f'(f(x)) = x} (f'.g')(g.f(x)) = x 5. Let R be the set of all real numbers, let f:R->R and g:R->R be two functions where two functions g and g.f are defined as follows: g(x) = 2x+1 g.f(x) = 2x+11 Use direct inference to derive the definition of function f. Sol: T => {g(x) = 2x+1} g(x) = 2x+1 => {Definition of g.f(x)} g.f(x) = g(f(x)) = 2*f(x)+1 => {g.f(x) = 2x+11} 2x+11 = 2f(x)+1 => {Arithmetics} f(x) = x+5