1 / 38

CPSC 121: Models of Computation 2011 Winter Term 1

CPSC 121: Models of Computation 2011 Winter Term 1. Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville and others. Outline. Learning Goals Problems and Discussion Side note: numbers from Booleans Expressiveness of Propositional Logic Next Lecture Notes.

Download Presentation

CPSC 121: Models of Computation 2011 Winter Term 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPSC 121: Models of Computation2011 Winter Term 1 Propositional Logic, Continued Steve Wolfman, based on notes by Patrice Belleville and others

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

  3. 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). Discuss point of learning goals.

  4. Where We Are inThe Big Stories Theory 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. How do we model computational systems? Now: learning the underpinnings of all our models (formal logical reasoning with Boolean values).

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

  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.

  7. 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? • One • Seven • Ten • Sixteen • None of these

  8. 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. First: what’s the circuit’s job?

  9. Problem: 7-Segment LED Display“Input Symbols” Problem: Design a circuit that displays the numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. • How many different messages must the circuit understand? • One • Seven • Ten • Sixteen • None of these (This is not the intended question when we ask: “how many inputs are there”.)

  10. Problem: 7-Segment LED Display“Input Lines” Problem: Design a circuit that displays the numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. • How many different “parameters” carry those messages? • One • Seven • Ten • Sixteen • None of these Not quite parameter like in CPSC 110…more like an input “channel”.

  11. 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… Of course, as Epp says, we could agree on a different convention.

  12. 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.

  13. 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? • One • Seven • Ten • Sixteen • None of these Is that a good question?

  14. Exercise:Human Circuit Let’s simulate the display with people. If you’re not at the front,pick one person andthink about what theiralgorithm is.

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

  16. Analyzing One Segment What’s the truth table for the lower-left segment? a. b. c. d. e. None of these.

  17. Analyzing One Segment From the truth table, we can make an expression for each true row and OR them together. (??)  (??)  (??)  (??) Let’s try one! See Epp (4th ed) Example 2.4.5! (3rd ed Example 1.4.5)

  18. Analyzing One Segment From the truth table, we can make an expression for each true row and OR them together. • Which logical statement is true only in this row? • ~a  ~b  c  ~d • a  b  c  d • ~a  ~b  c  ~d • a  b  ~c  d • None of these

  19. Analyzing One Segment From the truth table, we can make an expression for each true row and OR them together. (~a ~b  ~c  ~d)  (~a ~b  c  ~d)  (~a b  c  ~d)  ( a ~b  ~c  ~d)

  20. 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!

  21. Designing the Expression with Many Ts We can by negating statement we construct! (Instead of building out, we build ~out and then negate it.) • Which of these correctly models the LED? • ~(~a  b  ~c  d)  ~(~a  b  c  ~d) • ~(a  ~b  c  ~d)  ~(a  ~b  ~c  d) • ~[(~a  b  ~c  d)  (~a  b  c  ~d)] • ~[(a  ~b  c  ~d)  (a  ~b  ~c  d)] • None of these

  22. 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:

  23. 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.

  24. PRACTICE Exercise for Circuit Design Finish the problem!

  25. 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? • More entries in the LED’s column of the truth table that are true (turn some Fs into Ts). • Fewer entries in the LED’s column of the truth table that are true (turn some Ts into Fs). • More legal input symbols (e.g., 0-15 instead of 0-9). • Fewer legal input symbols (e.g., 0-4 instead of 0-9). • All of these could make the problem harder.

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

  27. 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? ?

  28. 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!

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

  30. 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. Discuss point of learning goals.

  31. 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 Discuss point of learning goals.

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

  33. Some Things to Try... (on your own if you have time, not required)

  34. 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. 1 2 3 4 5 6 7 8 9

  35. 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.

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

  37. Problem: Updating the “PC”

  38. Concept Q: Fetch Logic What’s the minimum number of Boolean outputs necessary for this circuit? • 1 • 2 • 3 • 4 • Cannot be determined from the information given.

More Related