cpsc 121 models of computation 2018s
play

CPSC 121: Models of Computation 2018S Propositional Logic: A First - PowerPoint PPT Presentation

CPSC 121: Models of Computation 2018S Propositional Logic: A First Model of Computation Meghan Allen, based on notes by Steve Wolfman, Patrice Belleville and others 1 This work is licensed under a Creative Commons Attribution 3.0 Unported


  1. CPSC 121: Models of Computation 2018S Propositional Logic: A First Model of Computation Meghan Allen, based on notes by Steve Wolfman, Patrice Belleville and others 1 This work is licensed under a Creative Commons Attribution 3.0 Unported License.

  2. Reminder • join Piazza! The access code is models 2

  3. Outline • Prereqs, Learning Goals, and Quiz Notes • True, False, and Gates. Why Start Here? • Problems and Discussion – Side note: numbers from Booleans • Expressiveness of Propositional Logic • Next Unit Notes 3

  4. 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. – Evaluate the truth of propositional logic statements using truth tables. – Translate back and forth between propositional logic statements and circuits that assess the truth of those statements. How should you achieve pre-class goals? Use the quiz to guide your readings! 4

  5. 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). 5

  6. Quiz 1 Notes Approaches… • Try to understand the “story”: “no matter with switch is flipped, the result will always result in the light turning on” [not quite what we intended] • Formalize the problem: “Let a,b,c represent 3 switches from left to right” • Solve in propositional logic: “(x ^ y ^ z) v (x ^ ~y ^ ~z) v (~x ^ y ^ ~z) v (~x ^ ~y ^ z)” • Try a simpler problem: “I decided to just focus on two parts [switches] of the circuit” • Test your answer: “The light switches cannot both be on at the same, but they can both be off. By working out the truth table, it proofs to be correct.” 6

  7. Quiz 1 Notes “Marked for Completeness”? Compare these two responses I'm not sure I understand I understand this question the question...how does a but i dont know how to logic circuit diagram write it in terms of this connect to an electrical circuit and logic stuff circuit? Somewhere between these is the “marked for completeness line”. (The left one gets credit; the right does not.) At minimum: give the question a shot or ask a meaningful question in return! 7

  8. Quiz 1 Notes Popular sources of help (especially on the open‐ended light‐bulb problem): • Epp (the textbook) • Friends • Wikipedia (especially its page of logic gate symbols) • Lecture notes • Online videos related to logic and circuits But… follow the quiz collaboration guidelines. Closed-ended part: work alone (but open book). Open-ended part: work with anyone (but acknowledge). 8

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

  10. Outline • Prereqs, Learning Goals, and Quiz Notes • True, False, and Gates. Why Start Here? • Problems and Discussion – Side note: numbers from Booleans • Expressiveness of Propositional Logic • Next Unit notes 10

  11. Logic for Reasoning about Truth: Where Should We Start? I will suppose that ... some malicious demon of the utmost power and cunning has employed all his energies in order to deceive me. I shall think that the sky, the air, the earth, colours, shapes, sounds and all external things are merely the delusions of dreams which he has devised to ensnare my judgement. I shall consider myself as not having hands or eyes, or flesh, or blood or senses, but as falsely believing that I have all these things. ‐ René Descartes 11

  12. Logic as Model for Physical Computations http://alumni.media.mit.edu/~paulo/courses /howmake/mlfabfinalproject.htm Input a Input b a  b 5V a ~a 0V 12

  13. “OR” operator and gate Propositional logic model: Physical System a  b means “ a OR b ” a b Circuit diagram model: the “OR” gate “Truth Table” model output a  b We think of “flowing water” a b as true and “no water” as T T T false, and the physical world T F T becomes an effective F T T representation for our ideas ! F F F

  14. Outline • Prereqs, Learning Goals, and Quiz Notes • True, False, and Gates. Why Start Here? • Problems and Discussion – Side note: numbers from Booleans • Expressiveness of Propositional Logic • Next Unit notes 14

  15. Problem : Light Switch Problem : Design a circuit to control a light so that the light changes state any time its switch is flipped. ? The problem gives the story we have to implement. Be sure you understand the story and always keep it in mind! 15

  16. Problem : ? Light Switch Problem : Design a circuit to control a light so that the light changes state any time its switch is flipped. Identifying inputs/outputs: consider Which are most useful for these possible inputs and outputs: this problem? Input : the switch flipped or a. flipped and shining the switch is up b. flipped and changed c. up and shining Output : the light is shining or d. up and changed the light changed states e. None of these 16

  17. Problem : ? Light Switch Problem : Design a circuit to control a light so that the light changes state any time its switch is flipped. Consider these possible Which of these solves the solutions: problem? a. Only #1 b. Only #2 c. Only #3 d. #1 and #2 e. Some other combination 17

  18. Problem : Two‐Switch Problem : Design a circuit to control a light so that the light changes state any time either of the two switches that control it is flipped. ? 18

  19. Problem : ? Two‐Switch Problem : Design a circuit to control a light so that the light changes state any time either of the two switches that control it is flipped. Getting the Story Right: Is the light on or off when both switches are up? a. On, in every correct solution. b. Off, in every correct solution. c. It depends, but a correct solution should always do the same thing given the same settings for the switches. d. It depends, and a correct solution might do different things at different times with the same switch settings. e. Neither on nor off. 19

  20. Problem : ? Two‐Switch Problem : Design a circuit to control a light so that the light changes state any time either of the two switches that control it is flipped. Which of these circuits solves the problem? a. Only #1 b. Only #2 c. #1 and #2 d. #1 and #3 e. All three 20

  21. Problem : Three‐Switch Problem : Design a circuit to control a light so that the light changes state any time any of the three switches that control it is flipped. ? 21

  22. Problem : ? Three‐Switch Problem : Design a circuit to control a light so that the light changes state any time any of the three switches that control it is flipped. Fill in the circuit’s truth table: a. b. c. d. e. None s 1 s 2 s 3 out out out out of T T T T F F T these T T F F T T F T F T F T F T T F F T F T F F T T F T F T F T F T F T F F F T T F F T F F F F T T F 22

  23. Problem : ? Three‐Switch Problem : Design a circuit to control a light so that the light changes state any time any of the three switches that control it is flipped. Getting the Story Right: Which of these is enough alone to always know whether the light is on or off? a. Whether an odd number of switches is on. b. Whether the majority (two or more) of switches are on. c. Whether all the switches are on. d. Whether a switch has been flipped recently. e. None of these. 23

  24. Problem : ? Three‐Switch Problem : Design a circuit to control a light so that the light changes state any time any of the three switches that control it is flipped. Modelling the Circuit: Which of these describes an incorrect solution? (s 1  s 2  s 3 )  (s 1  ~s 2  ~s 3 )  a. (~s 1  s 2  ~s 3 )  (~s 1  ~s 2  s 3 ) s 1  s 2  s 3  (s 1  s 2  s 3 ) b. s 1  (s 2  s 3 ) c. (s 1  ~(s 2  s 3 ))  (~s 1  (s 2  s 3 )) d. e. None of these is incorrect. 24

  25. Problem : n ‐Switch Problem : Describe an algorithm for designing a circuit to control a light so that the light changes state any time any of its n switches is flipped. ... ? 25

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

  27. 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 to our circuit are there? a. One b. Seven c. Ten d. Sixteen e. None of these 27

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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend