Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville.

Slides:



Advertisements
Similar presentations
Constructing a Truth Table
Advertisements

Digital Circuits.
CPSC 121: Models of Computation Unit 6 Rewriting Predicate Logic Statements Based on slides by Patrice Belleville and Steve Wolfman.
Tutorial 1: Logic Peter Poon. Self Introduction You can call me Peter Office: SHB117 Office hour:
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.
Logic ChAPTER 3 1. Truth Tables and Validity of Arguments
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 Rewriting Predicate Logic Statements Steve Wolfman, based on notes by Patrice Belleville.
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 2008/9 Winter Term 2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville and.
Snick  snack CPSC 121: Models of Computation 2011 Winter Term 1 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
Boolean Algebra Computer Science AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is.
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 A Working Computer Slides based on work by Bob Woodham and others.
EE1J2 – Discrete Maths Lecture 5
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.
Propositional Logic Lecture 2: Sep 9. Conditional Statement If p then q p is called the hypothesis; q is called the conclusion “If your GPA is 4.0, then.
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes.
Propositional Equivalence Goal: Show how propositional equivalences are established & introduce the most important such equivalences.
3.2 – Truth Tables and Equivalent Statements
TRUTH TABLES. Introduction Statements have truth values They are either true or false but not both Statements may be simple or compound Compound statements.
Propositional Logic.
Intro to Discrete Structures
Chapter 1 Section 1.4 More on Conditionals. There are three statements that are related to a conditional statement. They are called the converse, inverse.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
LDK R Logics for Data and Knowledge Representation Exercise 2: PL, ClassL, Ground ClassL.
1 Fundamentals of Computer Science Propositional Logic (Boolean Algebra)
Chapter 1 The Logic of Compound Statements. Section 1.1 Logical Form and Logical Equivalence.
1 The Chinese University of Hong Kong Faculty of Education Diploma in Education (Part-Time) Winter 1997 Educational Communications and Technology Assignment.
Fall 2002CMSC Discrete Structures1 Let’s get started with... Logic !
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
CPSC 121: Models of Computation Unit 2 Conditionals and Logical Equivalences Unit 2 - Conditionals 1 Based on slides by Patrice Belleville and Steve Wolfman.
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.
HAWKES LEARNING Students Count. Success Matters. Copyright © 2015 by Hawkes Learning/Quant Systems, Inc. All rights reserved. Section 3.2 Truth Tables.
Boolean Algebra. Logical Statements A proposition that may or may not be true:  Today is Monday  Today is Sunday  It is raining.
Snick  snack CPSC 121: Models of Computation 2012 Summer Term 2 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
LOGIC Lesson 2.1. What is an on-the-spot Quiz  This quiz is defined by me.  While I’m having my lectures, you have to be alert.  Because there are.
Chapter 7 Logic, Sets, and Counting
Snick  snack CPSC 121: Models of Computation 2013W2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes by Patrice.
CS1022 Computer Programming & Principles Lecture 1 Logic and Proof.
How do I show that two compound propositions are logically equivalent?
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
Boolean Algebra Monday/Wednesday 7th Week. Logical Statements Today is Friday AND it is sunny. Today is Friday AND it is rainy. Today is Monday OR it.
Introductory Logic PHI 120 Presentation: "Truth Tables – Validity vs. Soundness" This PowerPoint Presentation contains a large number of slides, a good.
Lesson 20 INTERPRETING TRUTH TABLES. Review Conditional Statements (Less. 17) Original If p, then q. Converse If q, then p. Inverse If ~p, then ~q. Contrapositive.
Logics for Data and Knowledge Representation
CEC 220 Digital Circuit Design Boolean Algebra I Wed, Sept 2 CEC 220 Digital Circuit Design Slide 1 of 13.
Spring 2003CMSC Discrete Structures1 Let’s get started with... Logic !
3/6/20161 Let’s get started with... Logic !. 3/6/20162 Logic Crucial for mathematical reasoningCrucial for mathematical reasoning Used for designing electronic.
CS 106 Logic and Conditionals (Boolean Expressions)
Assign Yourself and Do Now Thursday, January 10, 2013.
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.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Introduction to Software Testing Chapter 8.2
CPSC 121: Models of Computation 2016W2
Module 2: Conditionals and Logical Equivalences
Propositional Equivalence
CPSC 121: Models of Computation
Karnaugh Maps (K-Maps)
CPSC 121: Models of Computation
CPSC 121: Models of Computation
Presentation transcript:

snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville and others 1

Outline Learning Goals Problems and Discussion –Side note: numbers from Booleans Expressiveness of Propositional Logic Next Lecture Notes 2

Learning Goals: In-Class By the end of this unit, you should be able to: –Build combinational computational systems using propositional logic expressions and equivalent digital logic circuits that solve real problems, e.g., our 7- or 4-segment LED displays (using a “DNF” or any other successful approach). 3

Where We Are in The Big Stories Theory How do we model computational systems? Now: learning the underpinnings of all our models (formal logical reasoning with Boolean values). Hardware How do we build devices to compute? Now: establishing our baseline tool (gates), briefly justifying these as baselines, and designing complex functions from gates. 4

Outline Learning Goals Problems and Discussion –Side note: numbers from Booleans Expressiveness of Propositional Logic Next Lecture Notes 5

Problem: 7-Segment LED Display Problem: Design a circuit that displays the numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. 6

Problem: 7-Segment LED Display Problem: Design a circuit that displays the numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. Understanding the story: How many inputs are there? a.Zero b.One c.Seven d.Ten e.None of these 7

Side Note: Truth Tables and Numbers If we agree on a convention for the rows of a truth table, we can assign a number to each row… #abc 0TTT 1TTF 2TFT 3TFF 4FTT 5FTF 6FFT 7FFF Of course, as Epp says, we could agree on a different convention. 8

Representing Positive Integers This is the convention we use for the positive integers 0-9, which requires (at least) 4 variables: Notice the order: Fs first. #abcd 0FFFF 1FFFT 2FFTF 3FFTT 4FTFF 5FTFT 6FTTF 7FTTT 8TFFF 9TFFT... 9

Problem: 7-Segment LED Display Problem: Design a circuit that displays the numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. Understanding the story: How many outputs are there? a.Zero b.One c.Seven d.Ten e.None of these 10

Exercise: Human Circuit Let’s simulate the display with people. If you’re not at the front, pick one person and think about what their algorithm is. 11

Exercise: Human Circuit Which other people’s algorithms does your person need to know about? a.No one else’s b.Only their neighbours’ c.Everyone else’s d.Some other group 12

Analyzing One Segment What’s the truth table for the lower-left segment? #abcd 0FFFF 1FFFT 2FFTF 3FFTT 4FTFF 5FTFT 6FTTF 7FTTT 8TFFF 9TFFT out F T F T F T F T F T a.b.c.d.e. None of these. out T F T F F F T F T F F T F T T T F T F T 13

Analyzing One Segment From the truth table, we can make an expression for each true row and OR them together. #abcdout 0FFFFT 1FFFTF 2FFTFT 3FFTTF 4FTFFF 5FTFTF 6FTTFT 7FTTTF 8TFFFT 9TFFTF 14 (~a  ~b  ~c  ~d)  (~a  ~b  c  ~d)  (~a  b  c  ~d)  ( a  ~b  ~c  ~d) See Epp Example 1.4.5! (4 th ed number coming soon!)

Designing the Expression with Many Ts Let’s try another LED: the upper-right. With eight Ts, we’d need eight expressions! Too bad we can’t model Fs rather than Ts! #abcdout 0FFFFT 1FFFTT 2FFTFT 3FFTTT 4FTFFT 5FTFTF 6FTTFF 7FTTTT 8TFFFT 9TFFTT 15

Designing the Expression with Many Ts We can by negating statement we construct! (Instead of building out, we build ~out and then negate it.) #abcdout 0FFFFT 1FFFTT 2FFTFT 3FFTTT 4FTFFT 5FTFTF 6FTTFF 7FTTTT 8TFFFT 9TFFTT Which of these correctly models the LED? a. ~(~a  b  ~c  d)  ~(~a  b  c  ~d) b. ~(a  ~b  c  ~d)  ~(a  ~b  ~c  d) c.~[(~a  b  ~c  d)  (~a  b  c  ~d)] d.~[(a  ~b  c  ~d)  (a  ~b  ~c  d)] e.None of these 16

Problem: 7-Segment LED Display Problem: Design the seven LED display circuit. Approach: Solve each of the seven outputs separately and put the whole thing together. Here’s the two LEDs we’ve solved, simplified: 17

PRACTICE Exercise for Logical Equivalences Prove that our solution for the upper-right LED is logically equivalent to the corresponding circuit on the previous slide. Prove that our solution for the lower-left LED is not logically equivalent to the corresponding circuit on the previous slide, and explain why not. Note: to disprove a logical equivalence, you must give truth values for the inputs that yield different outputs. 18

PRACTICE Exercise for Circuit Design Finish the problem! 19

Concept Q: 7-Segment LED Imagine we were solving for one LED in a display for “Brahmi” numerals. Which of these would never make our problem harder? a.More entries in the LED’s column of the truth table that are true (turn some Fs into Ts). b.Fewer entries in the LED’s column of the truth table that are true (turn some Ts into Fs). c.More legal input values (e.g., 0-15 instead of 0-9). d.Fewer legal input values (e.g., 0-4 instead of 0-9). e.All of these could make the problem harder. 20

Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Side note: numbers from Booleans Expressiveness of Propositional Logic Next Lecture Notes 21

Homework Problem: Expressiveness of Propositional Logic Problem: Is propositional logic (and combinational circuits) universal for Boolean functions—able to implement a truth table with any number of columns and list of T and F in the output? abcdout FFFFF FFFTT FFTFT FFTTF FTFFT... FTTFF FTTTF TFFFF TFFTF ? 22

Homework Problem: Expressiveness of Propositional Logic Problem: Is propositional logic universal for Boolean functions? You’ll prove this with an algorithm to turn any truth table into a corresponding propositional logic statement. Universality is a pretty cool result for our very first model! 23

Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Side note: numbers from Booleans Expressiveness of Propositional Logic Next Lecture Notes 24

Learning Goals: In-Class By the end of this unit, you should be able to: –Build combinational computational systems using propositional logic expressions and equivalent digital logic circuits that solve real problems, e.g., our 7- or 4-segment LED displays. 25

Next Lecture Learning Goals: Pre-Class By the start of class, you should be able to: –Translate back and forth between simple natural language statements and propositional 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 26

Next Lecture Prerequisites Reread Sections 1.1 and 1.4 (3 rd ed) or 2.1 and 2.4 (4 th ed). Read Section 1.2 (3 rd ed) or 2.2 (4 th ed). Complete the open-book, untimed quiz on Vista that’s due before the next class. 27

snick  snack Some Things to Try... (on your own if you have time, not required) 28

Problem: 4-Segment LED Display Problem: build a circuit that displays the numbers 1 through 9 represented by four Boolean values p, q, r, and s on a 4- segment Boolean display

Problem: One-Bit Addition Problem: build a circuit that takes three one-bit numbers as input and outputs their sum as a two-bit number. 30

Problem: Updating the “PC” Problem: Create logic that calculates the amount to increase the PC by, given the values NeedValC and NeedRegIDs. 31

Problem: Updating the “PC” 32

Concept Q: Fetch Logic What’s the minimum number of Boolean outputs necessary for this circuit? a.1 b.2 c.3 d.4 e.Cannot be determined from the information given. 33