Propositional Calculus Math Foundations of Computer Science.

Slides:



Advertisements
Similar presentations
Boolean Algebra and Logic Gates
Advertisements

Digital Circuits.
CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result.
From Chapter 4 Formal Specification using Z David Lightfoot
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
Lecture 3. Boolean Algebra, Logic Gates
Propositional Equivalence Goal: Show how propositional equivalences are established & introduce the most important such equivalences.
Propositional Calculus Math Foundations of Computer Science.
Propositional Calculus CS 680: Formal Methods in Verification Computer Systems Jeremy Johnson.
11.1 Boolean Functions. Boolean Algebra An algebra is a set with one or more operations defined on it. A boolean algebra has three main operations, and,
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Today’s Topics Digital Logic Design Digital Logic Design Boolean Logic Boolean Logic Digital Logic Circuits Digital Logic Circuits.
Lecture 3. Boolean Algebra, Logic Gates Prof. Sin-Min Lee Department of Computer Science 2x.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
1 Fundamentals of Computer Science Propositional Logic (Boolean Algebra)
Boolean Algebra – the ‘Lingua Franca’ of the Digital World The goal of developing an automata is based on the following (loosely described) ‘ideal’: if.
Chapter 3.5 Logic Circuits. How does Boolean algebra relate to computer circuits? Data is stored and manipulated in a computer as a binary number. Individual.
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Lecture 7 Topics –Boolean Algebra 1. Logic and Bits Operation Computers represent information by bit A bit has two possible values, namely zero and one.
1 The Chinese University of Hong Kong Faculty of Education Diploma in Education (Part-Time) Winter 1997 Educational Communications and Technology Assignment.
Apr. 3, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 3: Review of Digital Circuits and Logic Design Jeremy R. Johnson Mon. Apr.
Boolean Algebra and Computer Logic Mathematical Structures for Computer Science Chapter 7.1 – 7.2 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Boolean.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Logic Gates Shashidhara H S Dept. of ISE MSRIT. Basic Logic Design and Boolean Algebra GATES = basic digital building blocks which correspond to and perform.
Lecture 22: 11/19/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Chapter 3: Digital Logic Dr Mohamed Menacer Taibah University
IT253: Computer Organization Lecture 7: Logic and Gates: Digital Design Tonga Institute of Higher Education.
Digital Logic. 2 Abstractions in CS (gates) Basic Gate: Inverter IO IO GNDI O Vcc Resister (limits conductivity) Truth Table.
Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Chapter 2 Two- Level Combinational Logic. Chapter Overview Logic Functions and Switches Not, AND, OR, NAND, NOR, XOR, XNOR Gate Logic Laws and Theorems.
LOGIC GATES & BOOLEAN ALGEBRA
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Computer Systems 1 Fundamentals of Computing Simplifying Boolean Expressions.
Lecture 4 Boolean Algebra. Logical Statements °A proposition that may or may not be true: Today is Monday Today is Sunday It is raining °Compound Statements.
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 9 Boolean Algebras and Combinatorial Circuits.
Apr. 3, 2000Systems Architecture I1 Introduction to VHDL (CS 570) Jeremy R. Johnson Wed. Nov. 8, 2000.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
Chapter 3 Digital Logic Structures
K-maps and Decoders Prof. Sin-Min Lee Department of Computer Science.
Mu.com.lec 9. Overview Gates, latches, memories and other logic components are used to design computer systems and their subsystems Good understanding.
CHAPTER 2 Boolean algebra and Logic gates
Chapter 12. Chapter Summary Boolean Functions Representing Boolean Functions Logic Gates Minimization of Circuits (not currently included in overheads)
Computer Architecture & Operations I
Boolean Algebra & Logic Gates
Digital Logic.
Morgan Kaufmann Publishers
Department of Preparatory Year, Umm Al Qura University
CS 270: Mathematical Foundations of Computer Science
Systems Architecture Lab: Introduction to VHDL
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
Unit 2 Boolean Algebra.
Propositional Calculus: Boolean Functions and Expressions
Lesson Objectives Aims Be able to define problems using Boolean logic
CHAPTER 2 Boolean Algebra
Boolean Algebra A Boolean algebra is a set B of values together with:
Jeremy R. Johnson Wed. Sept. 29, 1999
Propositional Calculus: Boolean Functions and Expressions
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
CSE 311 Foundations of Computing I
Propositional Calculus: Boolean Algebra and Simplification
Digital Circuits.
Digital Logic.
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Logic Gates.
Digital Logic.
Laws & Rules of Boolean Algebra
Presentation transcript:

Propositional Calculus Math Foundations of Computer Science

2 Propositional Calculus  Objective: To provide students with the concepts and techniques from propositional calculus so that they can use it to codify logical statements and to reason about these statements. To illustrate how a computer can be used to carry out formal proofs and to provide a framework for logical deduction.

Propositional Calculus  Topics  Boolean functions and expressions  Rules of Boolean Algebra  Logic Minimization  Tautologies and automatic verification of tautologies  Application to Circuit Design

4 Programming Example  Boolean expressions arise in conditional statements. It is possible to abstract the relations with boolean variables (propositions that are either true or false). Using this abstraction one can reason and simplify conditional statements.  if ((a = b) && (c == d)) then { … } else { … }  Let p denote the relation (a<b) and q denote the relation (c == d). The above expression is then equal to p || !p && q

5 Programming Example (cont)  The previous expression is equivalent (two expressions are equivalent if they are true for the same values of the variables occurring in the expressions) to a simpler expression  (p || !p && q)  p || q  We can see this since if p is true both expressions are true, and if p is false, then !p is true and (!p && q) is true exactly when q is true.

6 Limitations of Propositional Calculus  Propositions hide the information in the predicates they abstract.  Sometimes properties of the hidden information is required to make further deductions.  E.G. for integers a,b, and c, (a < b) && (b < c) implies that a < c; however, this can not be deduced without using the order properties of the integers.  The predicate calculus allows the use of predicates to encode this additional information.  E.G. we can introduce a parameterized predicate lt(a,b) to encode the predicate a < b. Properties such as lt(a,b) && lt(b,c)  lt(a,c) can be asserted. This type of notation and deduction is discussed in chapter 14.

7 Boolean Functions  A Boolean variable has two possible values (true/false) (1/0).  A Boolean function has a number of Boolean input variables and has a Boolean valued output.  A Boolean function can be described using a truth table.  There are 2 2 n Boolean function of n variables. s x 0 x 1 f f x0x0 x1x1 s Multiplexor function

8 Boolean Expressions  An expression built up from variables, and, or, and not. x y x  y x y x + y x and or not

9 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written as a Boolean expression  Disjunctive normal form (sums of products)  For each row in the truth table where the output is true, write a product such that the corresponding input is the only input combination that is true  Not unique  E.G. (multiplexor function) s x 0 x 1 f

Boolean Logic  Boolean expressions can be simplified using rules of Boolean logic  Identity law: A + 0 = A and A ● 1 = A.  Zero and One laws: A + 1 = 1 and A ● 0 = 0  Inverse laws:  Commutative laws: A + B = B + A and A ● B = B ● A.  Associative laws: A + (B + C) = (A + B) + C and A ● (B ● C) = (A ● B) ● C.  Distributive laws: A ● (B + C) = (A ● B) + (A ● C) and A + (B ● C) = (A + B) ● (A + C)  DeMorgan’s laws:  The reason for simplifying is to obtain shorter expressions, which we will see leads to simpler logic circuits.

11 Simplification of Boolean Expressions  Simplifying multiplexor expression using Boolean algebra  Verify that the boolean function corresponding to this expression as the same truth table as the original function.

12 Additional Notation  Several additional Boolean functions of two variables have special meaning and are given special notation. By our previous results we know that all boolean functions can be expressed with not, and, and or; so the additional notation is simply a convenience. x y x  y implication x y x  y equivalence

13 Tautologies  A tautology is a boolean expression that is always true, independent of the values of the variables occurring in the expression. The properties of Boolean Algebra are examples of tautologies.  Tautologies can be verified using truth tables. The truth table below shows that xy xyxy~x  y

14 Exercise  Derive the tautology from the sum of products expression obtained from the truth table for x  y. You will need to use properties of Boolean algebra to simplify the sum of products expression to obtain the desired equivalence.

15 Tautology Checker  A program can be written to check to see if a Boolean expression is a tautology.  Simply generate all possible truth assignments for the variables occurring in the expression and evaluate the expression with its variables set to each of these assignments. If the evaluated expressions are always true, then the given Boolean expression is a tautology.  A similar program can be written to check if any two Boolean expressions E1 and E2 are equivalent, i.e. if E1  E2. Such a program has been provided.

16 Karnaugh Map  A Karnaugh map is a two dimensional version of a truth table. It can be used to simplify Boolean expressions expressed as sums of products. y=0y=1 x=011 x=101  This example shows the Karnaugh table for the truth table defining implication. There is a 1 in each box corresponding to each value of p and q where x  y is true and a 0 where it is false.

17 Logic Minimization  We want a sum of products that is true for all of the boxes with 1’s (a cover). One such cover is obtained using a product for each individual box. A simpler expression can be obtained using the literals !x and y which cover the first row and the second column respectively.  This shows that  This can be generalized to more the one variable (Sec. 12.5)

18 Logic Circuits  A single line labeled x is a logic circuit. One end is the input and the other is the output. If A and B are logic circuits so are:  and gate  or gate  inverter (not) A B A A B

19 Logic Circuits  Given a boolean expression it is easy to write down the corresponding logic circuit  Here is the circuit for the original multiplexor expression x0x0 x1x1 s

20 Logic Circuits  Here is the circuit for the simplified multiplexor expression x0x0 x1x1 s

21 Nand ( | or  )  Nand – negation of the conjunction operation:  A nand gate is an inverted and gate: x y x | y

Nand is functionally complete  All boolean functions can be implemented using nand gates (and, or and not can be implemented using nand)  not:  and:  or:

23 Decoder  A decoder is a logic circuit that has n inputs (think of this as a binary number) and 2 n outputs. The output corresponding to the binary input is set to 1 and all other outputs are set to 0. d0d0 d1d1 d2d2 d3d3 b0b0 b1b1

24 Encoder  An encoder is the opposite of a decoder. It is a logic circuit that has 2 n inputs and n outputs. The output equal to the input line (in binary) that is set to 1 is set to 1. d0d0 d1d1 d2d2 d3d3 b0b0 b1b1

25 Multiplexor  A multiplexor is a switch which routes n inputs to one output. The input is selected using a decoder. d0d0 d1d1 d2d2 d3d3 s0s0 s1s1

XOR  “One or the other, but not both” xyx XOR y  Notation for circuits: x y

27 Exercise  Derive a truth table for the output bits (Sum and CarryOut) of a full adder.  Using the truth table derive a sum of products expression for Sum and CarryOut. Draw a circuit for these expressions.  Using properties of Boolean algebra and Karnaugh Maps to simplify your expressions. Draw the simplified circuits.

28 Full Adder  Sum = parity(a,b,CarryIn)  a xor b xor c + a  b  c  a xor b xor c  CarryOut = majority(a,b,CarryIn)  b  CarryIn + a  CarryIn + a  b + a  b  CarryIn   b  CarryIn + a  CarryIn + a  b b a CarryIn Sum