CSE 2315 - Discrete Structures Homework 2- Fall 2010 Due Date: Oct. 7 2010, 3:30 pm Proofs using Predicate Logic For all your predicate logic proofs you can use only the rules given in the following tables. In addition you are allowed to apply the deduction method and to use the method of temporary hypotheses. All other rules have to be proven first. Equivalence Rules Rule Name Expression Equivalent Expression Commutativity (comm) P Q Q P P Q Q P Associativity (ass) (P Q) R P (Q R) (P Q) R P (Q R) Distributivity (dis) (P Q) R (P R) (Q R) (P Q) R (P R) (Q R) De Morgan s Laws (De Morgan) (P Q) P Q (P Q) P Q Implication (imp) P Q P Q Double negation (dn) (P ) P Self-reference (self) P P P Negation (neg) ( x)p (x) ( x)p (x) 2010 Manfred Huber Page 1
Inference Rules Rule Name From Can Derive Conjunction (con) P, Q P Q Simplification (sim) P Q P, Q Modus ponens (mp) P, P Q Q Modus tollens (mt) P Q, Q P Addition (add) P P Q Universal instantiation (ui) ( x)p (x) P (y) (Be careful with the rule s restrictions) ( x)p (x) P (a) Existential Instantiation (ei) ( x)p (x) P (y) (Be careful with the rule s restrictions) ( x)p (x) P (a) Universal generalization (ug) P (x) ( x)p (x) (Be careful with the rule s restrictions) Existential generalization (eg) P (x) ( x)p (x) (Be careful with the rule s restrictions) P (a) ( x)p (x) For all proofs the steps have to be annotated such as to indicate the rule and which elements of the proof sequence it was applied to. 1. For each instantiation and generalization step in the following proof sequences indicate if it is legal. You have to justify your decision (a short justification is sufficient). a) 1. ( x)r(x) hyp 2. ( x)( y)(r(y) P (x, y, z)) hyp 3. ( y)(r(y) P (z, y, z)) 2 ui 4. R(z) P (z, a, z) 3 ui 5. R(z) 1 ui b) 1. ( z)q(x, z) hyp 2. ( x)( y)(q(x, y) P (x)) hyp 3. ( y)(q(x, y) P (x)) 2 ui 4. Q(x, z) 1 ei 5. Q(x, z) P (x) 3 ui 2010 Manfred Huber Page 2
c) 1. ( x)( y)p (x, y) hyp 2. ( x)(p (x, a) S(a)) hyp 3. ( y)p (x, y) 1 ui 4. P (x, a) 3 ei 5. P (x, a) S(a)) 2 ui 6. S(a) 4, 5 mp d) 1. ( x)p (x) hyp 2. ( y)(p (y) Q(y, z)) hyp 3. P (z) 1 ei 4. P (z) Q(z, z) 2 ui 5. Q(z, z) 4, 3 mp 6. ( z)q(z, z) 5 eg e) 1. ( x)(r(x) ( y)q(x, y)) hyp 2. ( z)( y)q(z, y) hyp 3. R(z) ( y)q(z, y) 1 ui 4. ( y)q(z, y) 2 ui 5. R(z) 4, 3 mt 6. ( x)r(x) 4 eg f) 1. ( x)p (x) hyp 2. ( x)(( y)p (y) Q(x, y)) hyp 3. P (y) 1 ei 4. ( y)p (y) Q(x, y) 2 ui 5. ( y)p (y) 3 eg 6. Q(x, y) 5, 4 mp 7. ( x)q(x, y) 6 ug 8. ( y)( x)q(x, y) 7 ug g) 1. ( x)r(x) hyp 2. ( y)(r(y) Q(y)) hyp 3. R(z) Q(z) 2 ei 4. R(z) 1 ui 5. Q(z) 3, 4 mp 6. ( z)q(z) 5 ug 2010 Manfred Huber Page 3
2. Use predicate logic to prove the following arguments: a) ( x)(p (x) ( y)q(x, y)) ( x)q(x, a) (P (b) R(a)) R(a) b) Q(x) ( x)(p (x) (( y)(q(y) R(x, y)))) ( y)r(y, x) P (b) c) ( x)(p (x) Q(x, a)) Q(b, a) Q(a, a) ( x)( y)(q(x, y) P (x) Q(y, a)) P (b) d) P (a) ( x)(( y)q(y, a) R(x, a)) ( x)( y)(p (x) Q(y, x)) ( z)r(z, a) e) ( x)( y)(p (x, y) R(y, x) ( x)( y)(p (x, y) Q(y) ( x)( y)(r(x, y) Q(y)) f) P (a) ( x)(p (x) Q(x, x)) ( y)(p (y) Q(y, y)) ( x)p (x) ( y)p (y) Proof Techniques 3. For each of the following informal proofs indicate which proof technique was used (exhaustive proof, direct proof, proof by contraposition, or proof by contradiction). a) Conjecture: All odd numbers between 3 and 25 are either prime numbers or the product of exactly 2 prime numbers. Proof: 3, 5, 7, 11, 13, 17, 19, and 23 are all prime numbers and 9 = 3 3, 15 = 3 5, 21 = 3 7, and 25 = 5 5 are the product of exactly two prime numbers, therefore all odd numbers between 3 and 25 are either prime or the product of exactly 2 prime numbers. b) Conjecture: If the product of two non-zero integers is an even number then at least one of them has to be an even number. Proof: Suppose that none of the numbers is even, i.e. x = 2 k + 1 and y = 2 l + 1 but their product is even, i.e. x y = 2 m. Then, x y = (2 k + 1)(2 l + 1) = 4 k l + 2 k + 2 l + 1 = 2 (2 k l + k + l) + 1 would have to be equal to 2 m and therefore 2 m = 2 (n) + 1. Since this is not possible for integers, at least one of the two non-zero integers has to be even. c) Conjecture: The sum of two non-zero integers is even if and only if either both integers are even or if both are odd. Proof:Assume both integers are even, i.e. x = 2 k and y = 2 l. Then x + y = 2 k + 2 l = 2 (k + l) which is even. Assuming both integers are odd, i.e. x = 2 k + 1 and y = 2 l + 1. Then x + y = 2 k + 1 + 2 l + 1 = 2 (k + l) + 2 which is even. Assuming that one is even and one is odd, i.e. x = 2 k + 1 and y = 2 l. Then x + y = 2 k + 1 + 2 l = 2 (k + l) + 1 which is odd. Since there is no other possibility for two non-zero integers, the sum of two non-zero integers is even if and only if either both integers are even or if both are odd. d) Conjecture: if an integer is even then its square is even. Proof: Assume the integer is even with x = 2 k. Then its square is x 2 = x x = 2 k 2 k = 2 (2 k k) which is even. Therefore the square of an even integer is even. 2010 Manfred Huber Page 4
e) Conjecture: If the product of two integers is odd, then both of them are odd. Proof: Assume that one of the integers is even, i.e. x = 2 k. Then the product is x y = 2 k y = 2 (k y) which is even. Therefore, if the product of two integers is odd, then both of them are odd. 4. Prove or disprove the following conjectures. You can use an informal proof (the proof has to have enough detail for everyone to understand it). a) The sum of four consecutive integers is even. b) If the sum of two integers is 0 then either both of them are 0 or one is negative and one is positive. c) The square of a natural number is always larger than the sum of all the numbers between 1 and the number. d) If the afternoon trains from Fort Worth to San Antonio and from San Antonio to Fort Worth run on the same track at the same time, they will collide. But since both trains arrived, they did not run on the same track. e) The result of dividing a rational number by a rational number is a rational number. f) Any odd integer greater than 2 can be written as the sum of an odd and an even number. Induction 5. Use mathematical induction to prove the following statements for positive integers. Also state if you are using the first or the second principle of induction. a) No palindrome of even length contains any symbol an odd number of times. b) For any positive integer, n, greater than 2 the product of all even, positive integers smaller than it is less than n n/2. c) n + m n (m + 1) for all n, m 1 d) Any even positive integer that is a square number can be written as the product of 4 and a set of odd prime numbers. e) The sum of all integers between 1 and n is equal to n 1+n 2. f) Any string constructed by concatenating an arbitrary number of strings of even length has to be of even length. Recursion 6. Give a recursive definition of the following sequences. a) P (n) = {x x is a power of 3} b) P (n) is the number of all possible ways to select 2 cards from a set of n distinct cards. 2010 Manfred Huber Page 5
c) P (n) = 2 n + 7 n + 1 for all positive integers n. d) P (n) is an alternating bit sequence of length n. e) P (n) is the number of possible ways to obtain the positive integer n by summing exactly two positive integers smaller than n. 7. Prove that the correctness of the following properties of the given recursive sequences. a) Given the sequence P (1) = 1, P (n + 1) = P (n) + 2 (n + 1) 1 for all positive integers, prove that P (n) = n 2 b) Given the sequence P (1) = 1, P (2) = 1, P (3) = 1, P (n) = P (n 3) + 2 P (n 2) for all n 3, prove that for all positive integers n P (n) + P (n + 1) = 0. 2010 Manfred Huber Page 6