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.

Slides:



Advertisements
Similar presentations
Sahar Mosleh PageCalifornia State University San Marcos 1 Introductory Concepts This section of the course introduces the concept of digital circuits and.
Advertisements

CPSC 121: Models of Computation Unit 6 Rewriting Predicate Logic Statements Based on slides by Patrice Belleville and Steve Wolfman.
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.
CPSC 121: Models of Computation
Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
Snick  snack CPSC 121: Models of Computation 2010 Winter Term 2 Introduction to Induction Steve Wolfman 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 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.
Module 7 Hardware. Introduction Switches are the basic blocks of computer hardware. We build increasingly complex hardware from these simple switches.
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 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 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 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.
Chapter 4 Logic Gates and Boolean Algebra. Introduction Logic gates are the actual physical implementations of the logical operators. These gates form.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
Information Technology Systems EN230-1 Justin Champion C208 –
Boolean Algebra and Truth Table The mathematics associated with binary number system (or logic) is call Boolean: –“0” and “1”, or “False” and “True” –Calculation.
Snick  snack CPSC 121: Models of Computation 2010/11 Winter Term 2 Propositional Logic: Conditionals and Logical Equivalence Steve Wolfman, based on notes.
Propositional Logic 7/16/ Propositional Logic A proposition is a statement that is either true or false. We give propositions names such as p, q,
In this module you will learn: What the various logic gates do. How to represent logic gates on a circuit diagram. The truth tables for the logic gates.
3. DIGITAL ELECTRONICS..
Intro to Discrete Structures
Think about the following expression If the number entered is greater than 15 but less than 25 or the number is 100 and the letter chosen is after p but.
BUILDING COMPUTER CIRCUITS prepared by Burak Galip ASLAN September, 2006 BOOLEAN LOGIC AND GATES CONTROL CIRCUITS.
Foundations of Computing I CSE 311 Fall CSE 311: Foundations of Computing I Fall 2014 Lecture 1: Propositional Logic.
Copyright © Curt Hill Using Propositional Logic Several applications.
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 24.
Math 240: Transition to Advanced Math Deductive reasoning: logic is used to draw conclusions based on statements accepted as true. Thus conclusions are.
CPSC 121: Models of Computation Unit 2 Conditionals and Logical Equivalences Unit 2 - Conditionals 1 Based on slides by Patrice Belleville and Steve Wolfman.
CSCI N201 Programming Concepts and Database 3 – Essence of Computing Lingma Acheson Department of Computer and Information Science, IUPUI.
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.
LOGIC GATES.
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.
How do I show that two compound propositions are logically equivalent?
Logic and Boolean Algebra. Logic statements  Real life statements  “I use public transportation when the car is broken and I have to go to work”  “All.
CEC 220 Digital Circuit Design Boolean Algebra I Wed, Sept 2 CEC 220 Digital Circuit Design Slide 1 of 13.
CEC 220 Digital Circuit Design Boolean Algebra Friday, January 17 CEC 220 Digital Circuit Design Slide 1 of 22.
Digital Logic Circuits. Overview Objectives Background Materials Procedure Report/Presentation Closing.
Fundamental Logic Gates And, Or, Not. Logic Gates: The Basics Regulate the flow of electricity within circuits to perform desired functionalities Each.
Snick  snack CPSC 121: Models of Computation 2008/9 Winter Term 2 Introduction & Motivation Steve Wolfman, based on notes by Patrice Belleville and others.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Minute Paper 4/4/04 Z=50+j86.7=100
5-1-2 Synchronous counters. Learning Objectives: At the end of this topic you will be able to: draw a block diagram showing how D-type flip-flops can.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
CPSC 121: Models of Computation 2016W2
CPSC 121: Models of Computation 2016W2
Hume’s Fork A priori/ A posteriori Empiricism/ Rationalism
Logic Gates and Boolean Algebra
Module 2: Conditionals and Logical Equivalences
CPSC 121: Models of Computation 2012 Summer Term 2
CPSC 121: Models of Computation
Lesson 9: "if-else-if" and Conditional Logic
Boolean logic Taken from notes by Dr. Neil Moore
3.4 Computer systems Boolean logic Lesson 2.
Descartes Scepticism.
Boolean Logic Boolean Logic is considered to be the basic of digital electronics. We know that a computer’s most basic operation is based on digital electronics.
Truth tables Mrs. Palmer.
CPSC 121: Models of Computation
CPSC 121: Models of Computation
Presentation transcript:

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 Belleville and others 1

Introductions, again Steven Wolfman ICICS 239; office hours listed on the website I also have an open door policy: If my door is open, come in and talk! Also, I will usually be available after class. And, you can make appointments with me Additionally, you can use TA office hours 2

Outline Prereqs, Learning Goals, and Quiz Notes True, False, and Gates. Why Start Here? Problems and Discussion Next Lecture Notes: Unit Continues... 3

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

Quiz 1 Notes (1) How should we solve the box in red (which 1 in 6 students missed)?

Quiz 1 Notes (2) What logic statement does this directly implement? a. a v b b. ~(a ^ b) c. ~(a v b) d. ~a v ~b e. None of these

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

Quiz 1 Notes (3) 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.” 8

Quiz 1 Notes (4) “Marked for Completeness”? Compare these two responses I'm not sure I understand the question...how does a logic circuit diagram connect to an electrical circuit? I understand this question but i dont know how to write it in terms of this circuit and logic stuff 9 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!

Quiz 1 Notes (5) Popular sources of help (especially on the open-ended light-bulb problem): Epp Friends and family members Wikipedia (especially its page of logic gate symbols) Lecture notes Random websites: But… should you be getting help? The collaboration T/F question.

Where We Are in The Big Stories Theory How do we model computational systems? Now: learning the underpinning 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. 11

Outline Prereqs, Learning Goals, and Quiz Notes True, False, and Gates. Why Start Here? Problems and Discussion Next Lecture Notes: Unit Continues... 12

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 13

Logic as Model for Physical Computations Input a Input b a  b ~aa 5V 0V /howmake/mlfabfinalproject.htm 14

Outline Prereqs, Learning Goals, and Quiz Notes True, False, and Gates. Why Start Here? Problems and Discussion Next Lecture Notes: Unit Continues... 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! 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 these possible inputs and outputs: Input 1 : the switch flipped Input 2 : the switch is on Output 1 : the light is on Output 2 : the light changed states Which are most useful for this problem? a.Input 1 and Output 1 b.Input 1 and Output 2 c.Input 2 and Output 1 d.Input 2 and Output 2 e.None of these 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 solutions: Which of these solves the problem? a.Only #1 b.Only #2 c.Only #3 d.#1 and #2 e.Some other combination 18

Problem: Two-Way 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. ? ? 19

Problem: Two-Way 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. 20

Problem: Two-Way 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 ? ? 21

Problem: Three-Way 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. ? ? 22

Problem: Three-Way 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: s1s1 s2s2 s3s3 TTT TTF TFT TFF FTT FTF FFT FFF a.b.c.d.e. out T F F T F T T F F T T F T F F T F T F T F T F T T F T F T F T F None of these 23

Problem: Three-Way 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 indicates whether the light is on or off in a particular correct solution? 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. 24

Problem: Three-Way 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? 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  (s 1  s 2  s 3 ) c.s 1  (s 2  s 3 ) d.(s 1  ~(s 2  s 3 ))  (~s 1  (s 2  s 3 )) e.None of these is incorrect. 25

Problem: n-Way 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. ? ?... 26

Outline Prereqs, Learning Goals, and Quiz Notes True, False, and Gates. Why Start Here? Problems and Discussion Next Lecture Notes: Unit Continues... 27

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

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

Problem: Logicians and Hats Problem: Three logicians are each wearing a black hat or a white hat, but not all white. Nobody can see their own hat. However, A can see the hats of B and C, and B can see the hats of A and C. C is blind. You go and ask them one by one in the order A, B, C, whether they know the color of their own hat. A answers “No”. B answers “No”. Then C answers “Yes”. Explain how this is possible. 30

Problem: Criminals and Hats Problem: A warden plans to line up 100 prisoners in order tomorrow. The warden will place a white or black hat on each prisoner’s head so that no prisoner can see the hat on his or her own head, but they can see the hats of the prisoners in front of them. From the back of the line, the warden will ask each prisoner “Is your hat black?” If the prisoner answers correctly, he or she is set free. Incorrect answers lead to immediate and noisy beheading. If they answer anything other than “yes” or “no”, all prisoners are beheaded. They get one hour as a group to plan their strategy. How many prisoners can be saved? The three-way light switch might give you a hint. 31