Propositional Calculus. Math Foundations of Computer Science

Similar documents
Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus. Math Foundations of Computer Science

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

LECTURE 4. Logic Design

Combinational Circuits Digital Logic (Materials taken primarily from:

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

Computer Organization and Levels of Abstraction

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

Chapter 2. Boolean Expressions:

Systems Architecture I

Computer Organization and Levels of Abstraction

Boolean Logic CS.352.F12

COMP combinational logic 1 Jan. 18, 2016

QUESTION BANK FOR TEST

Experiment 4 Boolean Functions Implementation

LECTURE 2 An Introduction to Boolean Algebra

1. Mark the correct statement(s)

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

2. BOOLEAN ALGEBRA 2.1 INTRODUCTION

IT 201 Digital System Design Module II Notes

Assignment (3-6) Boolean Algebra and Logic Simplification - General Questions

Section 001. Read this before starting!

60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design

CS470: Computer Architecture. AMD Quad Core

Objectives: 1. Design procedure. 2. Fundamental circuits. 1. Design procedure

Chapter 3. Gate-Level Minimization. Outlines

Lecture (04) Boolean Algebra and Logic Gates

Lecture (04) Boolean Algebra and Logic Gates By: Dr. Ahmed ElShafee

Review. EECS Components and Design Techniques for Digital Systems. Lec 05 Boolean Logic 9/4-04. Seq. Circuit Behavior. Outline.

Summary of Course Coverage

Combinational Circuits

Experiment 3: Logic Simplification

Introduction to Boolean logic and Logical Gates

DIGITAL CIRCUIT LOGIC UNIT 7: MULTI-LEVEL GATE CIRCUITS NAND AND NOR GATES

Combinational Circuits

CS8803: Advanced Digital Design for Embedded Hardware

Chapter 3. Boolean Algebra and Digital Logic

Logic Gates and Boolean Algebra ENT263

Incompletely Specified Functions with Don t Cares 2-Level Transformation Review Boolean Cube Karnaugh-Map Representation and Methods Examples

Combinational Logic & Circuits

LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

SAT Solver. CS 680 Formal Methods Jeremy Johnson

6. Combinational Circuits. Building Blocks. Digital Circuits. Wires. Q. What is a digital system? A. Digital: signals are 0 or 1.

Boolean Algebra and Logic Gates

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

BOOLEAN ALGEBRA. Logic circuit: 1. From logic circuit to Boolean expression. Derive the Boolean expression for the following circuits.

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

Gate Level Minimization Map Method

BOOLEAN ALGEBRA AND CIRCUITS

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Combinational Logic Circuits

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Logic Design (Part 2) Combinational Logic Circuits (Chapter 3)

Gate-Level Minimization. BME208 Logic Circuits Yalçın İŞLER

Department of Electrical Engineering McGill University ECSE 221 Introduction to Computer Engineering Assignment 2 Combinational Logic

UNIT 6 CIRCUIT DESIGN

Simplification of Boolean Functions

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 04. Boolean Expression Simplification and Implementation

A Survey of Mathematics with Applications 8 th Edition, 2009

Chapter 2: Combinational Systems

Gate-Level Minimization. section instructor: Ufuk Çelikcan

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

Introduction to Computer Architecture

Chapter Three. Digital Components

DKT 122/3 DIGITAL SYSTEM 1

Simplification of Boolean Functions

UNIT-4 BOOLEAN LOGIC. NOT Operator Operates on single variable. It gives the complement value of variable.

01 Introduction to Digital Logic. ENGR 3410 Computer Architecture Mark L. Chang Fall 2006


Midterm Exam Review. CS 2420 :: Fall 2016 Molly O'Neil

(Refer Slide Time 6:48)

Logic and its Applications

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Lecture #21 March 31, 2004 Introduction to Gates and Circuits

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Invitation to Computer Science, C++ Version, Third Edition

7/25/2016. Example: Addition of Unsigned Bit Patterns. ECE 120: Introduction to Computing. Adding Two Non-Negative Patterns Can Overflow

Slide Set 5. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Lecture (05) Boolean Algebra and Logic Gates

Basic Arithmetic (adding and subtracting)

2008 The McGraw-Hill Companies, Inc. All rights reserved.

Logic Design: Part 2

Objectives: 1- Bolean Algebra. Eng. Ayman Metwali

01 Introduction to Digital Logic. ENGR 3410 Computer Architecture Mark L. Chang Fall 2008

Boolean Analysis of Logic Circuits

VLSI System Design Part II : Logic Synthesis (1) Oct Feb.2007

Boolean Algebra & Digital Logic

Specifying logic functions

Lecture 10: Floating Point, Digital Design

Standard Boolean Forms

Math 55 - Spring 04 - Lecture notes # 1 - Jan 20 (Tuesday)

CS40-S13: Functional Completeness

24 Nov Boolean Operations. Boolean Algebra. Boolean Functions and Expressions. Boolean Functions and Expressions

Chapter 2 Boolean algebra and Logic Gates

CS/COE 0447 Example Problems for Exam 2 Spring 2011

Logic and Computation

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

SWITCHING THEORY AND LOGIC CIRCUITS

Philadelphia University Student Name: Student Number:

Transcription:

Propositional Calculus Math Foundations of Computer Science

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. Math Foundations of Computer Science 2

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

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) ((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 4

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

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

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. x 0 x 1 s Multiplexor function f s x 0 x 1 f 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 There are 2 2n Boolean function of n variables. 7

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

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 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 9

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 DeMorgan s laws: A + (B C) = (A + B) (A + C) The reason for simplifying is to obtain shorter expressions, which we will see leads to simpler logic circuits.

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

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 x y x y 0 0 1 0 0 1 0 1 1 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1 implication equivalence 12

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 x y x y ~x+y 0 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1 13

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

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

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. 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. y=0 y=1 x=0 1 1 x=1 0 1 16

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

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 A B or gate A B inverter (not) A 18

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 x 0 x 1 s 19

Logic Circuits Here is the circuit for the simplified multiplexor expression x 0 x 1 s 20

Nand negation of the conjunction operation: Nand ( or ) A nand gate is an inverted and gate: x y x y 0 0 1 0 1 1 1 0 1 1 1 0 21

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:

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. d 0 b 0 d 1 b 1 d 2 d 3 23

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. d 0 d 1 b 0 d 2 d 3 b 1 24

Multiplexor A multiplexor is a switch which routes n inputs to one output. The input is selected using a decoder. d 0 d 1 d 2 d 3 s 1 s 0 25

XOR One or the other, but not both Notation for circuits: x y x XOR y 0 0 0 0 1 1 1 0 1 0 0 0 x y

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. CarryIn Draw the simplified circuits. a b Sum CarryOut 27

CarryIn a Sum Full Adder CarryIn b CarryOut 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 a b CarryOut b CarryIn + a CarryIn + a b CarryIn a b CarryIn Sum CarryOut 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 a b Sum 28