Homework 1 Due Date: Wednesday 11/26/07 - at the beginning of the lecture Problems marked with a [*] are a littlebit harder and count as extra credit. Note 1. For any of the given problems make sure that you justify your answers. You must show how you obtained your solution or argue that your solution is correct. If you fail to so, you will receive little or no credit for your solution! Problem 1. (10+5 pts) Consider the logical operator nand denoted by (the Sheffer stroke). It is defined as follows. p q p q T T F T F T F T T F F T (a) (2 pts) Show that p p p holds for any proposition p. (b) (4 pts) Find a propositions just involving p, q and which is equivalent to p q. (c) (4 pts) Find a propositions just involving p, q and which is equivalent to p q. Try to find one that uses only the operator three times. (d) [*] (5 pts) We mentioned in class that just the operators and are not strong enough to express every possible proposition, because we cannot express the negation. We did not give a proof for this statement in class. explains why and cannot express. Try to find an argument that
Problem 2. (16+7 pts) For all subproblems consider the proposition [ (p q) r] [r (p q)]. (a) (6 pts) Use the truth table method to compute an equivalent proposition in DNF (Disjunctive Normal Form). Do not simplify. (b) (5 pts) Find a DNF for the given proposition using logical equivalences. For each step mentioned the equivalence used. (c) (5 pts) Try to simplify the DNF you found in Part (b), to get a DNF using only three logical operators. Use logical equivalences to show that your answer is correct. In case you need to use equivalences that we did not mention during class, you will have to prove them first. Just as we can express any compound proposition in DNF as an or of ands of literals ( a disjunction of conjunctions of literals), i.e. (l 1 l 2... l i )... (l j... l n ), it is possible to express it as an and of ors of literals (a conjunction of disjunctions of literals): (l 1 l 2... l i )... (l j... l n ). This is called the conjunctive normal form (CNF). Note that a compound proposition in CNF is true if at least one literal in each disjunction is true. (d) [*] (4 pts) Find a method using a truth table for computing the CNF of a compound proposition. Describe your method in English and explain why it works. (e) [*] (3 pts) Use your method from Part (d) to compute the CNF of the given proposition [ (p q) r] [r (p q)].
Problem 3. (16 pts) Let us define two new quatifiers: the unique existentential quantification and almost universal quantification. We shall use the notation! x P (x) to express the proposition: There exists a unique value for x such that P (x) is true. We shall use the notation! x P (x) to express the proposition: P (x) is true for all possible values of x except one. Use definition to solve the following problems. (a) (4 pts) Let the universe of discourse be the set of all positive and negative integers. For each of the following propositions decide whether they are true or false and give a brief justification. (i)! x [x 4 = 1] (ii)! x [x + 2 = 2x] (iii)! x [x 2 + 2 = 2x] (iv)! x [x < 1] (v)! x [x < 1] (vi)! x [x 2 x] (vii)! x [x 2 4] (viii)! x [2x 4x] (b) (4 pts) Use English to describe the meaning of! x P (x) (Don t just say: There is not a unique x... ). Translate your description into predicate logic using only the quatifiers and, logic operators and the predicates P (x) and S(x, y) where S(x, y) means x and y are the same. (c) (4 pts) Are the two propositions! x P (x)! x Q(x) and! x [P (x) Q(x)] equivalent? Justify your answer. (d) (4 pts) We know that xp (x) x P (x). Does this also hold for! xp (x) and! x P (x)? If not, can you find some equivalence involving!,! P (x) and P (x)? Justify your answer.
Problem 4. (18 pts) Suppose the variable x represents students and y represents courses. Consider the following predicates. U(y) = y is an upper-level course C(y) = y is a computer science course F (x) = x is a freshman P (x) = x is a part-time student Q(x) = x is a full-time student T (x, y) = student x is taking y Write each of the following statements using the above predicates and any needed quantifiers and logical operators. (a) (1 pts) Bob is a freshman. (b) (1 pts) Charlie is not taking any classes. (c) (1 pts) Every freshman is a taking a non-computer science course. (d) (1 pts) No part-time student is taking an upper level course. (e) (1 pts) Every students is taking at least one course. (f) (1 pts) Every full-time student is taking a computer science course. (g) (2 pts) There is and upper-level computer science that cannot be taken by freshmen. Write each of the following in good English without using variables in your answers. (h) (1 pts) T (Alice, CS205) (i) (1 pts) xf (x) (j) (1 pts) x P (x) F (x) (k) (1 pts) x y T (x, y) (l) (1 pts) y x T (x, y) (m) (1 pts) x y [ P (x) (C(y) T (x, y)) ] (n) (2 pts) x y [ Q(x) ( F (x) (U(y) T (x, y)) ) ] (o) (2 pts) x y [ F (x) ( (U(y) T (x, y)) C(y) ) ]
Problem 5. (10+6 pts) Let f(x, y, z) be the Boolean function that returns 1 is at least two of its arguments are 1 and 0 otherwise. For all parts of this problem, assume that we are only working with logic gates that have fan-in 2. That is each AND and OR gate have exactly two input wires. (a) (2 pts) Compute f(0, 1, 1), f(0, 1, 0), f(1, 1, 1) and f(0, 0, 0). (b) (6 pts) Express how f(x, y, z) can be computed from the Boolean operations +,, and x. (c) (2 pts) Draw a circuit that computes f. (d) [*] (+6 pts) Let maj n (x 1,..., x n ) the Boolean function that takes n Boolean variables and inputs, and that returns 1 if at least half (i.e., n 2 ) of the inputs are 1. Describe the structures of a circuit that would compute maj n. What is the depth of such a circuit? (I.e., what the maximum number of gates that one would have to pass to get from an input to the output?)