CPSC 121 Midterm 1 Friday February 5th, 2016

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

CPSC 121 Midterm 1 Tuesday, October 11th, 2011

Definition 2. Conjunction of p and q

Logic, Sets, and Proofs

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Chapter 1: The Logic of Compound Statements. January 7, 2008

DISCRETE MATH: FINAL REVIEW

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

Logic and Proofs. (A brief summary)

Discrete Structures & Algorithms. Propositional Logic EECE 320 // UBC

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

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

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

CSE 20: Discrete Mathematics

Packet #1: Logic & Proofs. Applied Discrete Mathematics

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

CPSC 121 Sample Final Examination December 2013

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

CSC Discrete Math I, Spring Propositional Logic

Propositional Logic: Equivalence

Logic and Proofs. (A brief summary)

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

A. Propositional Logic

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Do not start until you are given the green signal

Chapter 4, Logic using Propositional Calculus Handout

The Logic of Compound Statements cont.

Digital Logic (2) Boolean Algebra

ANS: If you are in Kwangju then you are in South Korea but not in Seoul.

CSC 125 :: Final Exam December 14, 2011

CPSC 121: Models of Computation

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

Introduction to Sets and Logic (MATH 1190)

Math 3336: Discrete Mathematics Practice Problems for Exam I

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8

Propositional Logic. Spring Propositional Logic Spring / 32

1.1 Language and Logic

1) Let h = John is healthy, w = John is wealthy and s = John is wise Write the following statement is symbolic form

CSCI Homework Set 1 Due: September 11, 2018 at the beginning of class

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

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

MATH 2001 MIDTERM EXAM 1 SOLUTION

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)

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

software design & management Gachon University Chulyun Kim

1.1 Language and Logic

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

Introduction to Decision Sciences Lecture 2

CPSC 121: Models of Computation

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9

A Quick Lesson on Negation

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

CSE 20 DISCRETE MATH. Winter

Compound Propositions

Quiz 2 Room 10 Evans Hall, 2:10pm Tuesday April 2 (Open Katz only, Calculators OK, 1hr 20mins)

Logical Representations. LING 7800/CSCI 7000 Martha Palmer 9/30/2014

DISCRETE MATH: LECTURE 6

EECS 1028 M: Discrete Mathematics for Engineers

Predicate Logic. Andreas Klappenecker

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

1.1 Statements and Compound Statements

Tautologies, Contradictions, and Contingencies

PROPOSITIONAL CALCULUS

DISCRETE MATHEMATICS BA202

EECS 1028 M: Discrete Mathematics for Engineers

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

CSE 20 DISCRETE MATH. Fall

Show Your Work! Point values are in square brackets. There are 35 points possible. Tables of tautologies and contradictions are on the last page.

HANDOUT AND SET THEORY. Ariyadi Wijaya

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

Review for Midterm 1. Andreas Klappenecker

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

It rains now. (true) The followings are not propositions.

THE LOGIC OF COMPOUND STATEMENTS

Discrete Structures CRN Test 3 Version 1 CMSC 2123 Autumn 2013

Propositional Calculus. Problems. Propositional Calculus 3&4. 1&2 Propositional Calculus. Johnson will leave the cabinet, and we ll lose the election.

CPSC 121 Sample Midterm Examination October 2007

MCS-236: Graph Theory Handout #A4 San Skulrattanakulchai Gustavus Adolphus College Sep 15, Methods of Proof

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

Valid Reasoning. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing February, Outline Truth and Validity Valid Reasoning

CSE 20 Discrete Math. Algebraic Rules for Propositional Formulas. Summer, July 11 (Day 2) Number Systems/Computer Arithmetic Predicate Logic

Intro to Logic and Proofs

Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.

Discrete Mathematics Exam File Spring Exam #1

What is the decimal (base 10) representation of the binary number ? Show your work and place your final answer in the box.

Midterm Examination # 1 Wednesday, February 25, Duration of examination: 75 minutes

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Logic and Proof. Aiichiro Nakano

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

Homework assignment 1: Solutions

Section 1.1 Propositions

CSE 20 DISCRETE MATH. Fall

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

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Discrete Structures of Computer Science Propositional Logic III Rules of Inference

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

1.3 Propositional Equivalences

Transcription:

CPSC 121 Midterm 1 Friday February 5th, 2016 [3] 1. Is the following statement a tautology, a contradiction or neither? Justify your answer using a truth table: (p q) (p q) This statement is a tautology: p q p q q p q (p q) (p q) F F T T T T F T F F F T T F F T F T T T T F T T [6] 2. Using a sequence of logical equivalences, prove that ( p q) ( (r q) p) p ( q r) Write the name of the law you applied at each step. The left-hand side (LHS) is ( p q) ( (r q) p). Hence LHS ( p q) ( (r q) p) by the definition of implication ( p q) ((r q) p) by the double negative law ( p q) ( (r q) p) by the de Morgan s law ( p q) ( p (r q)) by the commutative law p ( q (r q)) by the distributive law p ( q ( r q)) by the de Morgan s law p (( q q) r) by the commutative and associative laws p ( q r) by the idempotent law [9] 3. Consider the following digital circuit:

page 2 [3] a. Write a propositional logic expression which is the direct translation of this circuit to propositional logic. Do not simplify your expression. ( ( p r) q) r [4] b. Simplify your answer from part (a) using a sequence of logical equivalences. Write the name of the law you applied at each step. ( ( p r) q) r (( p r) q) r by the de Morgan s law ((p r) q) r by the double negative law ((p q) (r q)) r by the distributive law (p q) ((r q) r) by the associative law (p q) r by the absorption law [2] c. Draw the simplified circuit corresponding to your answer for part (b). Hint: you should only need 3 gates. [11] 4. Assume that we use 6 bits to represent signed binary integers (using two s complement). [3] a. What is the 6-bit binary representation of the signed decimal value 15? What is the corresponding hexadecimal representation using 2 digits? The binary representation of 15 is 001111; hence the binary representation of 15 is 110000 + 1 = 110001. In hexadecimal, this is 31. [3] b. What is the 6-bit binary representation of the hexadecimal value 2E? What is the corresponding signed decimal value? The binary representation is 101110. This number is negative, and its inverse is 010001 + 1 = 010010 = 2 4 + 2 = 18. Hence 2E is 18. [1] c. With 6 bits, what is the smallest (most negative) signed binary integer that you can represent? 2 5 = 32

page 3 [2] d. What is the sum of the two 6-bit signed binary integers from parts (a) and (b)? What is the corresponding decimal value? 110001 + 101110 = 011111, which is 16 + 8 + 4 + 2 + 1 = 31. [2] e. Why is your decimal answer from part (d) positive? It is positive because 15 + 18 = 33, and 33 is outside the range of values that can be represented using 6-bit signed integers. [12] 5. Three mafiosi (Don Cortizone, Don Maledictione and Don Sanconvictione) went to the horse races. Inspector Montalbano, who is watching them, learns that If Don Sanconvictione bet on Gallant Fox in the third race, then Don Maledictione paid Secretariat s jockey to lose. If Don Cortizone provided EPO to Whirlaway, then Don Sanconvictione and Don Maledictione bet on Count Fleet in the seventh race. Either Don Maledictione did not win any of his bets, or Don Sanconvictione was responsible for War Admiral s sickness (or both). If Don Sanconvictione and Don Maledictione bet on Count Fleet in the seventh race and Don Sanconvictione was responsible for War Admiral s sickness, then Don Maledictione did not pay Secretariat s jockey to lose. After the races were over, Detective Catarella brought him proof that not only Don Cortizone provided EPO to Whirlaway, but also that Don Maledictione won all five of his bets. [3] (a) Rewrite each of these statements using propositional logic. Make sure to define the propositions you are using by underlining part of the sentence above (for instance Don Sanconvictione bet on Gallant Fox in the third race ) and putting the letter (for instance, g ) next to it. Let gf: Don Sanconvictione bet on Gallant Fox in the third race. s: Don Maledictione paid Secretariat s jockey to lose. w: Don Cortizone provided EPO to Whirlaway. cf: Don Sanconvictione and Don Maledictione bet on Count Fleet in the seventh race. b: Don Maledictione won some of his bets. wa: Don Sanconvictione was responsible for War Admiral s sickness. Then the statements can be written as:

page 4 1. gf s 2. w cf 3. b wa 4. (cf wa) s 5. w b [9] (b) Using your answer from part (a), known logical equivalences and the rules of inference, prove that Don Sanconvictione did not bet on Gallant Fox in the third race. Write the name of the equivalence law or the inference rule you applied at each step. We are trying to prove gf. Here is one possible proof (there may be others). 6. w Specialization from (5). 7. cf Modus ponens from (2) and (6). 8. b Specialization from (5). 9. wa Elimination from (3) and (8). 10. cf wa Addition from (7) and (9). 11. s Modus ponens from (4) and (10). 12. gf Modus tollens from (1) and (11). [6] 6. Consider the following definitions: C: the set of all colors. S: the set of all shoppers. I: the set of all items (dress, shoes, pants, hats, gloves, shirts, etc). Knows(x, y): shopper x knows shopper y. Bought(x, y, z): shopper x bought item y in color z. translate each of the following English statements into predicate logic. For instance, Mrs. Nelly bought a colored skirt would be translated as x C, Bought(Mrs. Nelly, skirt, x). [3] a. A shopper who knows Cédric bought a blue shirt. x S, Knows(x, Cédric) Bought(x, shirt, blue). [3] b. Every shopper who bought green gloves knows a shopper who bought a red hat. x S, Bought(x, gloves, green) y S, Knows(x, y) Bought(y, hat, red). [6] 7. Using the same definitions as for the previous question, translate each of the following predicate logic statements into English. [3] a. x I, y C, Bought(Nicolas, x, y) Bought(Chen, x, y). Chen bought every item that Nicolas bought, in the same color.

page 5 [3] b. x S, y S, Bought(y, dress, pink) Knows(x, y). Someone knows every shopper who bought a pink dress. [7] 8. A triangular number (or triangle number) counts the objects that can form an equilateral triangle, as in the diagram below. The n th triangular number is the sum of the first n integers, as shown in the following figure illustrating the first four triangular numbers (what is the fifth one?): Design a circuit that takes a 4-bit unsigned binary integer x 3 x 2 x 1 x 0 as input, and outputs True if this integer is a triangular number, and False otherwise. You may assume that 0 is not a triangular number. The only four-bit triangular numbers x 3 x 2 x 1 x 0 are 1 (0001), 3 (0011), 6 (0110), 10 (1010) and 15 (1111). We thus need a proposition (and a circuit) that matches exactly these five bit patterns, and no other one. Here are a couple of observation about these bit patterns: The first two have x 3 = x 2 = 0 and x 0 = 1. The next two have exactly one of x 3, x 2 equal to 1, and end with 10 (x 1 = 1 and x 2 = 0). So the proposition x 3 x 2 x 0 matches the first two patterns, the proposition (x 3 x 2 ) x 1 x 0 matches the next two, and x 3 x 2 x 1 x 0 matches the last one. This leads us to the following circuit, where each input to the final OR gate corresponds to one of the three propositions: