University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. February 9, :30 pm Duration: 1:50 hs. Closed book, no calculators

Similar documents
University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. March 1, :00 pm Duration: 1:15 hs

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Formal Logic: Quantifiers, Predicates, and Validity. CS 130 Discrete Structures

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Logic Overview, I. and T T T T F F F T F F F F

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Do not start until you are given the green signal

CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 Solutions

Intro to Logic and Proofs

2. Use quantifiers to express the associative law for multiplication of real numbers.

Discrete Mathematics Logics and Proofs. Liangfeng Zhang School of Information Science and Technology ShanghaiTech University

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

Mathacle. PSet ---- Algebra, Logic. Level Number Name: Date: I. BASICS OF PROPOSITIONAL LOGIC

Math 3336: Discrete Mathematics Practice Problems for Exam I

Predicate Logic. Andreas Klappenecker

1 Predicates and Quantifiers

UNIVERSITY OF VICTORIA DECEMBER EXAMINATIONS MATH 122: Logic and Foundations

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

At least one of us is a knave. What are A and B?

Proving Arguments Valid in Predicate Calculus

Discrete Structures for Computer Science

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Logic and Proof. Aiichiro Nakano

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes:

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Mat 243 Exam 1 Review

CSI 4105 MIDTERM SOLUTION

Section Summary. Section 1.5 9/9/2014

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Solutions to Exercises (Sections )

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

CSCE 222 Discrete Structures for Computing. Predicate Logic. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

MACM 101 Discrete Mathematics I. Exercises on Predicates and Quantifiers. Due: Tuesday, October 13th (at the beginning of the class)

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

Example ( x.(p(x) Q(x))) ( x.p(x) x.q(x)) premise. 2. ( x.(p(x) Q(x))) -elim, 1 3. ( x.p(x) x.q(x)) -elim, x. P(x) x.

Review. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions

5. Use a truth table to determine whether the two statements are equivalent. Let t be a tautology and c be a contradiction.

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

MAT 243 Test 1 SOLUTIONS, FORM A

Math.3336: Discrete Mathematics. Nested Quantifiers/Rules of Inference

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

(Refer Slide Time: 02:20)

CS 220: Discrete Structures and their Applications. Predicate Logic Section in zybooks

CS 250/251 Discrete Structures I and II Section 005 Fall/Winter Professor York

Math Fundamentals of Higher Math

Section 1.1 Propositions

Readings: Conjecture. Theorem. Rosen Section 1.5

Math 13, Spring 2013, Lecture B: Midterm

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

Chapter 2: The Logic of Quantified Statements

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics. Introductory Notes in Discrete Mathematics Solution Guide

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Propositional Logic Not Enough

Chapter 3. The Logic of Quantified Statements

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

DISCRETE MATH: FINAL REVIEW

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

MAT2345 Discrete Math

Mathematical Reasoning Rules of Inference & Mathematical Induction. 1. Assign propositional variables to the component propositional argument.

The Foundations: Logic and Proofs. Chapter 1, Part III: Proofs

Chapter 1 Elementary Logic

For all For every For each For any There exists at least one There exists There is Some

Before you get started, make sure you ve read Chapter 1, which sets the tone for the work we will begin doing here.

CSE 20 DISCRETE MATH. Fall

Proofs. Introduction II. Notes. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

Review: Potential stumbling blocks

Denote John by j and Smith by s, is a bachelor by predicate letter B. The statements (1) and (2) may be written as B(j) and B(s).

Basic Logic and Proof Techniques

Rules of Inference. Arguments and Validity

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Proofs. Example of an axiom in this system: Given two distinct points, there is exactly one line that contains them.

9/5/17. Fermat s last theorem. CS 220: Discrete Structures and their Applications. Proofs sections in zybooks. Proofs.

Mathematics for Computer Science Exercises for Week 10

1 The Foundation: Logic and Proofs

Your quiz in recitation on Tuesday will cover 3.1: Arguments and inference. Your also have an online quiz, covering 3.1, due by 11:59 p.m., Tuesday.

Ch 3.2: Direct proofs

Boolean Algebra and Proof. Notes. Proving Propositions. Propositional Equivalences. Notes. Notes. Notes. Notes. March 5, 2012

Discrete Mathematics Fall 2018 Midterm Exam Prof. Callahan. Section: NetID: Multiple Choice Question (30 questions in total, 4 points each)

Logic. Facts (with proofs) CHAPTER 1. Definitions

Math 230 Final Exam, Spring 2009

CSE 20 DISCRETE MATH. Winter

CSE Discrete Structures

2k n. k=0. 3x 2 7 (mod 11) 5 4x 1 (mod 9) 2 r r +1 = r (2 r )

Argument. whenever all the assumptions are true, then the conclusion is true. If today is Wednesday, then yesterday is Tuesday. Today is Wednesday.

MATH 135 Fall 2006 Proofs, Part IV

Practice Midterm Exam Solutions

Test 1 Solutions(COT3100) (1) Prove that the following Absorption Law is correct. I.e, prove this is a tautology:

Proofs: A General How To II. Rules of Inference. Rules of Inference Modus Ponens. Rules of Inference Addition. Rules of Inference Conjunction

Math 55 Homework 2 solutions

2-4: The Use of Quantifiers

MATH 215 Final. M4. For all a, b in Z, a b = b a.

MATH FINAL EXAM REVIEW HINTS

1 The Foundation: Logic and Proofs

CSI30. Chapter 1. The Foundations: Logic and Proofs Nested Quantifiers

1. From Lewis Carroll: extract a pair of premises and finish the conclusion.

Full file at

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

Transcription:

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura February 9, 2010 11:30 pm Duration: 1:50 hs Closed book, no calculators Last name: First name: Student number: There are 5 questions and 100 marks total. This exam paper should have 12 pages, including this cover page. 1 Propositional logic / 10 2 Predicate logic / 24 3 Inference rules / 20 4 Proof Methods / 20 5 Number Theory / 26 Total / 100

CSI 2101 Midterm Test, February 9, 2010 Page 2 of 12 1 Propositional logic 10 points Part A 5 points Show that the compound proposition below is a contradiction: (p q) ( p q) (p q) ( p q) Via truth tables: p q p q p q p q p q result T T T T T F F T F T F T T F F T T T F T F F F F T T T F Via equivalences: (p q) ( p q) (p q) ( p q) ((p p) q) ((p p) q) (F q) (F q) q q F

CSI 2101 Midterm Test, February 9, 2010 Page 3 of 12 Part B 5 points You go to your digital circuit lab to implement a boolean function represented by the following compound proposition: (p q) ( q p) (r p) (q r). However, you realise that you only have 2 AND-gates (binary) and 2 OR-gates (binary) in your knapsack. Give a circuit that implements the boolean function and uses only the gates available in your knapsack. Indeed, you will get a bonus 2 points if you use only 2 gates in total. (p q) ( q p) (r p) (q r) (p (q q)) (r p) (q r) (p T ) (r p) (q r) p (r p) (q r) The above solution is acceptable, but for bonus marks, can be simplified further to: p (r p) (q r) (p T ) (p r) (q r) (p (r T )) (q r) (p T ) (q r) p (q r) Note that the drawing of the circuit is not included here but was expected in your solution.

CSI 2101 Midterm Test, February 9, 2010 Page 4 of 12 2 Predicate logic 24 points Part A 12 points Circle true or false 1. x y(x 2 = y), where the domain is the set of real numbers. [true] [false] 2. x y((y 0) (xy = 1), where the domain is the set of real numbers. [true] [false] 3. The following are logically equivalent: (p q) and (p q) [true] [false] 4. The following are logically equivalent: x Q(x) and x Q(x) [true] [false] 5. xp (x) x Q(x) logically implies x(p (x) Q(x)) [true] [false] 6. Consider the domain of discourse to be the set {1, 2, 3}, and Q(x, y) = y x, and R(y) = y is odd. Then y(( xq(x, y)) R(y)) is true. [true] [false] Justification not required, but given here for your understanding: 1. x, take y = x 2. 2. Obviously wrong. For example, if y = 2, then the only x satisfying xy = 1 is x = 1. If 2 y = 3, however, the only x satisfying xy = 1 is x = 1. Thus, there is no one x for all y. 3 3. (p q) ( p q) (p q). 4. x Q(x) Q(x) xq(x) x Q(x). 5. xp (x) x Q(x) implies xp (x), which implies x(p (x) Q(x)). 6. xq(x, y) is only satisfied for y = 3, and R(3) is true, so the predicate holds.

CSI 2101 Midterm Test, February 9, 2010 Page 5 of 12 Part B 12 points Consider the following statements: B(x): x is a baby L(x): x is logical M(x) x is able to manage a crocodile D(x): x is despised Suppose the domain consists of all people. B1 Express each of the following statements using quantifiers, logical connectives and the propositional functions given above. phrase in English logical statement 1. Babies are illogical. x(b(x) L(x)) 2. Nobody despised who can manage a crocodile. x(d(x) M(x)) x(d(x) M(x)) 3. Illogical persons are despised. x( L(x) D(x)) 4. Babies cannot manage crocodiles. x(b(x) M(x)) B2 Does 4. follows from 1., 2., 3.? If yes, justify your argument. If no, explain why it doesn t. Using 1, 2, 3 by universal instantiation, for an arbitrary a: 1. B(a) L(a) 2. D(a) M(a) 3. L(a) D(a) Applying the transitivity of on 1 and 3, we get B(a) D(a). Applying transitivity again on this and 2, we get B(a) M(a). Since the choice of a was arbitrary, we have that: x(b(x) M(x)).

CSI 2101 Midterm Test, February 9, 2010 Page 6 of 12 3 Inference rules 20 points Part A 10 points Using inference rules, show that the hypotheses: If a student likes chocolate then he/she answers the questions. If a student doesn t like chocolate then he/she is not motivated to go to class. If a student is not motivated to go to class then he/she fails the course. lead to the conclusion: If a student doesn t like chocolate then he/she fails the course. Define the following: l : a : m : f : student likes chocolate student answers the question student is motivated to go to class student fails the course We translate the hypotheses and conclusion into propositions as follows: 1. l a 2. l m 3. m f 4. l f Formal argument: 1. l m hypothesis 2. m f hypothesis 3. l f hypothetical syllogism of 1, 2

CSI 2101 Midterm Test, February 9, 2010 Page 7 of 12 Part B 10 points Justify the rule of universal transitivity, which states that if x(p (x) Q(x)) and x(q(x) R(x)) are true then x(p (x) R(x)) is true, where the domain of all quantifiers is the same. Step Justification 1. x(p (x) Q(x)) hypothesis 2. P (a) Q(a) universal instantiation for arbitrary a 3. x(q(x) R(x)) hypothesis 4. Q(a) R(a) universal instantiation for arbitrary a 5. P (a) R(a) hypothetical syllogism for 2, 4 6. x(p (x) R(x)) universal generalization

CSI 2101 Midterm Test, February 9, 2010 Page 8 of 12 4 Proof Methods 20 points For this question you will need the definitions of odd and even, seen in class. DEFINITION: An integer n is even if there exists an integer k such that n = 2k. An integer n is odd if there exists an integer k such that n = 2k + 1. Part A 10 points Prove that if m + n and n + p are even numbers, then m + p is even. Let m, n, p be integers such that m + n is even and n + p is even. By definition of odd, there exist k and k such that m + n = 2k and n + p = 2k. Thus, m = 2k n and p = 2k n. This gives: m + p = (2k n) + (2k n) = 2k n + 2k n = 2(k + k n) Therefore m + p is even.

CSI 2101 Midterm Test, February 9, 2010 Page 9 of 12 Part B 10 points Prove the following: For any integer number n, if n 2 + 5 is odd then n is even. using B1 (5 points) a proof by contraposition. B2 (5 points) a proof by contradiction. B1. Assume n is odd, and show n 2 + 5 is even. Let n be an even number. Thus, n = 2k + 1 for some integer k. Then: Thus, n 2 + 5 is even. n 2 + 5 = (2k + 1) 2 + 5 = 4k 2 + 4k + 1 + 5 = 4k 2 + 4k + 6 = 2(2k 2 + 2k + 3) B2. Assume n 2 + 5 is odd and n is odd and reach a contradiction. Let n be an odd number such that n 2 + 5 is odd. Thus, there exist k, k such that n = 2k + 1 and n 2 + 5 = 2k + 1. Thus, n 2 + 5 = (2k + 1) 2 + 5 = 2k + 1, so 4k 2 + 4k + 6 = 2k + 1, i.e. 5 = 2k 4k 2 4k = 2(k 4k 2 4k). This implies that 5 is an even number, which is a contradiction.

CSI 2101 Midterm Test, February 9, 2010 Page 10 of 12 5 Number Theory 26 points Find counterexamples to each of these statements about congru- Part A 6 points ences: A1 Let a, b, c, and m be integers with m 2. If ac bc (mod m), then a b (mod m). Counterexample: Take a = 1, b = 2, c = 0, m = 3. Then: ac bc (mod m) : 1 0 2 0 (mod 3) a b (mod m) : 1 2 (mod 3) A2 Let a, b, c, d and m be integers with c and d positive and m 2. If a b (mod m) and c d (mod m), then a c b d (mod m). Counterexample: Take a = 2, b = 5, c = 4, d = 1, m = 3. Then: a b (mod m) : 2 5 (mod 3) c d (mod m) : 4 1 (mod 3) a c b d (mod m) : 2 4 = 16 5 1 = 5 (mod 3)

CSI 2101 Midterm Test, February 9, 2010 Page 11 of 12 Part B 5 points What is the greatest common divisor and the least common multiple of: 3 7 5 3 7 3 and 2 11 3 5 5 2. gcd(3 7 5 3 7 3, 2 11 3 5 5 2 ) = 3 5 5 2 lcm(3 7 5 3 7 3, 2 11 3 5 5 2 ) = 2 11 3 7 5 3 7 3 Part C 5 points Use the Euclidean algorithm to calculate gcd(100, 270). Show each step. 100 = 0 270 + 100 270 = 2 100 + 70 100 = 1 70 + 30 70 = 2 30 + 10 30 = 3 10 + 0 Thus, gcd(135, 50) = 10.

CSI 2101 Midterm Test, February 9, 2010 Page 12 of 12 Part D 10 points Prove the following result. Let a, b and m be integers with m 2. If a b (mod m) then gcd(a, m) = gcd(b, m). Let a, b, m be integers with m 2. Assume a b (mod m). So m a b, or in other words, a b = km for some integer k. We will show that the common divisors of a and m are the same as the common divisors of b and m. ( ) Let d be a common divisor of a and m. Since d a and d m, we conclude that d a km = b. Thus, d is a common divisor of b and m. ( ) Let d be a common divisor of b and m. Since d b and d m, we conclude that d b+km = a. Thus, d is a common divisor of a and m. So we have shown that a and m, b and m have the same common divisors, so their greatest common divisor is the same. Thus, gcd(a, m) = gcd(b, m).... End Of Midterm Test