Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes.

Slides:



Advertisements
Similar presentations
CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
Advertisements

Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Propositional Logic: A First Model of Computation Steve Wolfman, based on notes by Patrice.
Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Revisiting Induction Steve Wolfman, based on work by Patrice Belleville and others 1.
Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Introduction to Induction Steve Wolfman 1.
Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes.
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Propositional Logic: A First Model of Computation Steve Wolfman, based on notes by Patrice.
Snick  snack 1 CPSC 121: Models of Computation 2009 Winter Term 1 Number Representation Steve Wolfman, based on notes by Patrice Belleville and others.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville and.
Logic: From Greeks to philosophers to circuits. COS 116: 3/11/2008 Sanjeev Arora.
Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Sequential Circuits (“Mealy Machines”) Steve Wolfman, based on notes by Patrice Belleville.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Revisiting Induction Steve Wolfman, based on work by Patrice Belleville and others 1.
Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Sequential Circuits (“Mealy Machines”) Steve Wolfman, based on notes by Patrice Belleville.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Functions Steve Wolfman, based on notes by Patrice Belleville and others.
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville.
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic: A First Model of Computation Steve Wolfman, based on notes by.
Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Proof Techniques Steve Wolfman, based on notes by Patrice Belleville and others 1.
Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 DFAs in Depth Benjamin Israel Notes heavily borrowed from Steve Wolfman’s,
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Proof Techniques (Part B) Steve Wolfman, based on notes by Patrice Belleville and others.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Proof (First Visit) Steve Wolfman, based on notes by Patrice Belleville, Meghan Allen.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Propositional Logic: A First Model of Computation Steve Wolfman, based on notes by Patrice.
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes.
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Sets Steve Wolfman, based on notes by Patrice Belleville and others.
Propositional Calculus Math Foundations of Computer Science.
Chapter 12 Digital Logic Circuit Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Logic: From Greeks to philosophers to circuits. COS 116, Spring 2012 Adam Finkelstein.
1 Survey of Computer Science CSCI 110, Spring 2011 Lecture 16 Digital Circuits, binary Numbers.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
Dr. Ahmed El-Bialy, Dr. Sahar Fawzy Combinational Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
CS1Q Computer Systems Lecture 8
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Describing the World with Predicate Logic Steve Wolfman, based on notes by Patrice Belleville.
CSE 311 Foundations of Computing I Spring 2013, Lecture 3 Propositional Logic, Boolean Logic/Boolean Algebra 1.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
CPSC 121: Models of Computation Unit 2 Conditionals and Logical Equivalences Unit 2 - Conditionals 1 Based on slides by Patrice Belleville and Steve Wolfman.
Chapter 1: Digital Computers and Information Illustration at beginning of each Chapter Base 10 Binary Base 2 Octal Base 8 Hex bas
Snick  snack CPSC 121: Models of Computation 2013W2 Propositional Logic: A First Model of Computation Steve Wolfman, based on notes by Patrice Belleville.
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
IT253: Computer Organization Lecture 7: Logic and Gates: Digital Design Tonga Institute of Higher Education.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
CS1Q Computer Systems Lecture 7
Snick  snack CPSC 121: Models of Computation 2012 Summer Term 2 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
Snick  snack CPSC 121: Models of Computation 2013W2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes by Patrice.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
June 11, 2002© Howard Huang1 Boolean algebra Last time we talked about Boolean functions, Boolean expressions, and truth tables. Today we’ll learn.
June 10, 2002© Howard Huang1 Number systems To get started, we’ll discuss one of the fundamental concepts underlying digital computer design:
Computing via boolean logic. COS 116: 3/8/2011 Sanjeev Arora.
Chapter 1: Binary Systems
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
1 Binary Signals Logic gate circuits are designed to input and output only two types of signals: “high” (1) and “low” (0), as represented by a variable.
Snick  snack 1 CPSC 121: Models of Computation 2008/9 Winter Term 2 Number Representation Steve Wolfman, based on notes by Patrice Belleville and others.
CPSC 121: Models of Computation 2008/9 Winter Term 2
CPSC 121: Models of Computation 2016W2
Morgan Kaufmann Publishers
Module 2: Conditionals and Logical Equivalences
CPSC 121: Models of Computation 2008/9 Winter Term 2
Component 1 – 2A, B, C Binary Logic
Propositional Calculus: Boolean Algebra and Simplification
Chapter 2 Introduction to Logic Circuits
Dr. Clincy Professor of CS
ECE 352 Digital System Fundamentals
CPSC 121: Models of Computation
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
CPSC 121: Models of Computation
Presentation transcript:

snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes by Patrice Belleville and others

Lecture Prerequisites Reread Sections 1.1 and 1.4. Read Section 1.2. Solve problems like Exercise Set 1.1, #19- 29, and 39-46; Set 1.2, #5-15, 20, 22, and 38-46; and Set 1.4, # Complete the open-book, untimed quiz on WebCT that was due before class.

Learning Goals: Pre-Class By the start of class, you should be able to: –Translate back and forth between simple natural language statements and proposition logic, now with conditionals and biconditionals. –Evaluate the truth of propositional logical statements that include conditionals and biconditionals using truth tables. –Given a propositional logic statement and an equivalence rule, apply the rule to create an equivalent statement. Example: given (u  s)  s, apply p  q  ~p  q. Note:p maps to (u  s) and q maps to s. Result: ~(u  s)  s

Learning Goals: In-Class By the end of this unit, you should be able to: –Explore alternate forms of propositional logic statements by application of equivalence rules, especially in order to simplify complex statements or massage statements into a desired form. Note: in this learning goal, we are not asking you to memorize the equivalence rules or their names! However, as you become familiar with them, you’ll find that your exploration is easier and more effective.

Learning Goals: Bonus We will also revisit the previous goal: –Evaluate propositional logic as a “model of computation” for combinational circuits, including at least one explicit shortfall (e.g., referencing gate delays, fan-out, transistor count, wire length, instabilities, shared sub- circuits, etc.).

Quiz 2 Notes: Circuits for 7-seg LED What is the question asking? What is logical equivalence? When is a circuit “correct”? When should the light come on? Can an input be “disconnected”? Consider translating into prop logic (our model!). Approaches people tried: Try some values with the circuits and see if they’re correct (and have the same output) Explore equivalences. Find the intended formula and compare. Compare how “easy” or “often” the LED comes on.

RECALL: Problem: 4-Segment LED Display Problem: Build a circuit that displays the numbers 1 through 9 represented by four Boolean values a, b, c, and d on a 4- segment Boolean display

RECALL: Representing Positive Integers This is the convention we (and computers) use for positive integers (up to 9): #abcd 0FFFF 1FFFT 2FFTF 3FFTT 4FTFF 5FTFT 6FTTF 7FTTT #abcd 8TFFF 9TFFT

Problem: Equivalent Circuits Problem: Here are four circuits to drive the top LED in the 4-segment display (assuming our 4-bit input is “abcd”). Which are correct? Which are equivalent to each other? 1.(~a  b)  (a  ~b  ~c) 2.(~a  b)  a 3.a  b 4.a  b

Concept Q: 4-Segment LED How many of the logic statement “circuits” are correct? a.0 b.1 c.2 d.3 e.4

Concept Q: 4-Segment LED How many “equivalence classes” are there? a.0 b.1 c.2 d.3 e.4 An “equivalence class” is a set whose members are all equivalent to each other and not to anything else in the “universe”. In our case, “equivalent” means two circuits’ propositional logic representations are logically equivalent, and “universe” means the four circuits in the problem. If we make it to relations at the end of the term, we’ll talk more about equivalence classes!

Problem: Arbitrary Logic Expression Problem: Aliens hold the Earth hostage, and only you can save it by proving (a  b)  ~(b  a)  ~a  b. Isn’t it amazing how well-motivated all our problems are? Reminder (p. 20 of Epp, 3d ed.): p  q  ~p  q

Concept Q: Alien Threat Which of these leads to a correct solution? a.Take the simpler side and massage it to look like the more complex side. b.Take the more complex side and massage it to look like the simpler side. c.Take both sides and work toward a common statement. d.Write the truth table. e.None of these.

How To Format A Proof Our proofs won’t always be as neat and clean as equivalence proofs, but good habits can help in communicating your intent. So: 1.Start a proof by stating the theorem to be proven: “Theorem: (a  b)  ~(b  a)  ~a  b” 2.Number each step of the proof. 3.In each step, include the “data” for the step (e.g., the statement so far in an equiv proof) and the “justification” (e.g., the rule by which the current data follows from the previous step’s data). 4.End your proof by proving the theorem!

Problem: “Multiplexer” Problem: Devise a simple circuit that, given two normal inputs ( a and b ) and a control signal (c), produces one input when the control signal is 1 and the other when the control is 0. Start from the truth-table- derived formula on the right. (~c  ~b  a)  (~c  b  a)  (c  b  ~a)  (c  b  a) This circuit is called a multiplexer. a b y c 0 1

Concept Q: Multiplexer Which of these equivalence rules is the lynchpin of your simplification? a.p  ~~p (Double Negation) b.p  p  p; p  p  p (Idempotent) c.p  (p  q)  p; p  (p  q)  p (Absorption) d.~(p  q)  ~p  ~q; ~(p  q)  ~p  ~q (De Morgan’s) e.None of these

Problem: Glitch in MUX Design Problem: Consider this solution for the multiplexer (MUX) circuit. Imagine the circuit is in steady-state with a, b, and c all 1 (true). Trace how changes flow when we change c to 0, if each gate takes 10ns to operate.

Concept Q: First MUX Circuit Assume the output starts at 1. We want it to end up at 1. How long does it take before it’s stable? (Choose the best answer.) a.0 ns (it never varies from 1) b.10 ns (it varies before 10ns, but not after) c.20 ns d.30 ns e.40 ns

Other Glitches in MUX? The mux has a glitch because the information from c travels down two paths to the output that have different delays. So, while waiting for the longer path to “catch up” the circuit can be incorrect. Can changing a (while holding b and c constant) cause a glitch? What about b ? If a and b are held constant and one of them is 0, can changing c cause a glitch?

A Glitchless MUX Our only glitch (when one input is changed at a time) is when c changes while a and b are both 1. What is the intended output if both a and b are one? Is this question answerable, or do you need more information?

Problem: Logical Correctness of the Glitchless MUX This circuit takes advantage of what we’ve discovered. Problem: Prove that it’s logically equivalent to the original MUX. Hint: break a  b up into two cases, where c is true and where c is false: a  b  c and a  b  ~c.

Concept Q: Second MUX Circuit Which of these equivalence rules is the lynchpin of your simplification? a.p  ~~p (Double Negation) b.p  p  p; p  p  p (Idempotent) c.p  (p  q)  p; p  (p  q)  p (Absorption) d.~(p  q)  ~p  ~q; ~(p  q)  ~p  ~q (De Morgan’s) e.None of these Problem: prove that (~c  a)  (c  b)  (a  b)  (~c  a)  (c  b)

Learning Goals: In-Class By the end of this unit, you should be able to: –Explore alternate forms of propositional logic statements by application of equivalence rules, especially in order to simplify complex statements or massage statements into a desired form. Note: in this learning goal, we are not asking you to memorize the equivalence rules or their names! However, as you become familiar with them, you’ll find that your exploration is easier and more effective.

Learning Goals: Bonus We will also revisit the previous goal: –Evaluate propositional logic as a “model of computation” for combinational circuits, including at least one explicit shortfall (e.g., referencing gate delays, fan-out, transistor count, wire length, instabilities, shared sub- circuits, etc.).

Next Lecture Learning Goals: Pre-Class By the start of class, you should be able to: –Convert positive numbers from decimal to binary and back. –Convert positive numbers from hexadecimal to binary and back. –Take the two’s complement of a binary number. –Convert signed (either positive or negative) numbers to binary and back. –Add binary numbers.

Next Lecture Prerequisites Read Section 1.5. Solve problems like Exercise Set 1.5, #1-16, 27-36, and NOTE: the binary numbers in problems are signed (that is, they use the two’s complement representation scheme). Complete the open-book, untimed quiz on WebCT that’s due before the next class.

snick  snack More problems to solve... (on your own or if we have time)

Problem: String equals Consider the following from the Java 6 API documentation for the String class’s equals method:...The [method returns] true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. Let n1 mean “this string is null”, n2 mean “the argument is null”, r mean “the method returns true”, and s mean “the two strings are objects that represent the same sequence of characters”. Presumably any two null strings are equal to each other. Then, equality would become something like “the method returns true if and only if the two strings both null or are objects that represent the same sequence of characters”. Problem: Is that logically equivalent to the statement from the API? Why or why not?

Problem: Decisions in Code Consider the following code, part of a “binary bounds search”: if target equals value then if lean-left-mode is true call the go-left routine otherwise call the go-right routine otherwise if target is less than value then call the go-left routine otherwise call the go-right routine

Problem: Decisions in Code Let gl mean “the go-left routine is called” Problem: complete the logical expression gl  _____________________ Problem: Use your logic to simplify the pseudocode so it requires just one “if/otherwise”.