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

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

Propositional Calculus. Math Foundations of Computer Science

Propositional Calculus. Math Foundations of Computer Science

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

SAT Solver. CS 680 Formal Methods Jeremy Johnson

CS February 17

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

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

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

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

Logic Design: Part 2

Summary of Course Coverage

Menu. Algebraic Simplification - Boolean Algebra EEL3701 EEL3701. MSOP, MPOS, Simplification

Computer Organization and Levels of Abstraction

Computer Organization and Levels of Abstraction

Circuit analysis summary

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

TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009

IT 201 Digital System Design Module II Notes

Combinational Logic & Circuits

Experiment 4 Boolean Functions Implementation

BOOLEAN ALGEBRA AND CIRCUITS

NP-Completeness. Algorithms

Introduction to Boolean logic and Logical Gates

Chapter 2. Boolean Expressions:

ENGIN 112. Intro to Electrical and Computer Engineering

Variable, Complement, and Literal are terms used in Boolean Algebra.

COMP combinational logic 1 Jan. 18, 2016

Combinational Circuits Digital Logic (Materials taken primarily from:

2. BOOLEAN ALGEBRA 2.1 INTRODUCTION

Introduction to Boolean Algebra

Introduction to Boolean Algebra

DSAS Laboratory no 4. Laboratory 4. Logic forms

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Lecture (04) Boolean Algebra and Logic Gates

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

CSC Discrete Math I, Spring Sets

Introduction to Computer Architecture

QUESTION BANK FOR TEST

Boolean Representations and Combinatorial Equivalence

Boolean algebra. June 17, Howard Huang 1

What's the difference between the entailment symbol with the equals vs the entailment symbol with one line? Single turnstile meaning

Standard Forms of Expression. Minterms and Maxterms

Combinational Logic Circuits

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

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

LOGIC AND DISCRETE MATHEMATICS

Boolean Logic CS.352.F12

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

Boolean Algebra and Logic Gates

UNIT 2 BOOLEAN ALGEBRA

Computer Engineering Chapter 3 Boolean Algebra

Systems Architecture I

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

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

PROPOSITIONAL LOGIC (2)

Propositional Calculus

CSE 20 DISCRETE MATH. Fall

8.1 Polynomial-Time Reductions

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

Boolean Algebra A B A AND B = A*B A B A OR B = A+B

CSE 20 DISCRETE MATH. Winter

Unit-IV Boolean Algebra

CS8803: Advanced Digital Design for Embedded Hardware

LECTURE 2 An Introduction to Boolean Algebra

Summary. Boolean Addition

Chapter 10 Part 1: Reduction

2.1 Binary Logic and Gates

Combinational Devices and Boolean Algebra

CS40-S13: Functional Completeness

Implementation of a Sudoku Solver Using Reduction to SAT

Chapter 2: Universal Building Blocks. CS105: Great Insights in Computer Science

LECTURE 4. Logic Design

1.4 Normal Forms. We define conjunctions of formulas as follows: and analogously disjunctions: Literals and Clauses

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

Sets. Mukulika Ghosh. Fall Based on slides by Dr. Hyunyoung Lee

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

CS470: Computer Architecture. AMD Quad Core

Read this before starting!

Simplification of Boolean Functions

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

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

Identity. p ^ T p p _ F p. Idempotency. p _ p p p ^ p p. Associativity. (p _ q) _ r p _ (q _ r) (p ^ q) ^ r p ^ (q ^ r) Absorption

Chapter 3. Gate-Level Minimization. Outlines

Mixed Integer Linear Programming

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 9 Normal Forms

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Reductions and Satisfiability

NP-Complete Reductions 2

ENGIN 112 Intro to Electrical and Computer Engineering

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

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

NP and computational intractability. Kleinberg and Tardos, chapter 8

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

DKT 122/3 DIGITAL SYSTEM 1

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

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

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

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202)

Lecture 5. Logic I. Statement Logic

Transcription:

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

Propositional Calculus Topics Motivation: Simplifying Conditional Expressions Rules of Boolean Algebra Equational Reasoning Proofs Using Truth Tables Tautologies and Automatic Verification of Tautologies Arguments, Satisfiability and Truth Trees

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 3

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

Boolean Algebra The Boolean operators and are analogous to addition and multiplication with true and false playing the roles of 1 and 0. Complement is used for negation. This provides a compact notation and suggests appropriate algebraic simplification Similar properties hold such as the associative, commutative, and distributive identities.

Sums of Products Disjunctive normal form, using the notation of Boolean Algebra, corresponds to a sum of products 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 6

Properties of Boolean Algebra Boolean expressions can be simplified using rules of Boolean algebra Identity law: A + 0 = A and A 1 = A. Zero and One laws: A + 1 = 1 and A 0 = 0 Inverse laws: Idempotent laws: A + A = A = A A 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) Double Negation: AA = AA DeMorgan s laws:

Simplification of Boolean Expressions Simplifying multiplexor expression using Boolean algebra Equational reasoning: replace subexpressions by equivalent expressions Reflexive, Symmetric, Transitive Verify that the boolean function corresponding to this expression as the same truth table as the original function. 8

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 9

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

Nand is functionally complete Using DeMorgan s Law, and are enough to generate all Boolean functions All boolean functions can be implemented using nand gates (and, or and not can be implemented using nand) not: x y x y and: or: 0 0 1 0 1 1 1 0 1 1 1 0

Conjunctive Normal Form Conjunctive normal form (products of sums) Conjunction of clauses (disjunction of literals) For each row in the truth table where the output is false, write a sum such that the corresponding input not in that row Alternatively use Demorgan s law for the negation of dnf for f (zero rows) Duality (swap and/or true/false) E.G. (multiplexor function) (ss + xx 0 + xx 1 ) (ss + xx 0 + xx 1 ) ( ss + xx 0 + xx 1 ) ( ss + xx 0 + xx 1 ) 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 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 0 0 1 0 1 1 1 0 0 1 1 1 implication x y x y 0 0 1 0 1 0 1 0 0 1 1 1 equivalence x y x y 0 0 0 0 1 1 1 0 1 1 1 0 xor 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 x y x y x y x y x y 0 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1 14

Exercise Derive the tautology x y x y 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

Derive the tautology x y x y Solution x y x y 0 0 1 0 1 1 1 0 0 1 1 1 xx yy ( xx yy) xx yy xx yy ( xx yy) ( xx yy) xx yy xx yy xx ( yy yy) xx xx yy ( xx TT) (TT yy) xx yy 16

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 will be written later in the term. 17

Satisfiability A formula is satisfiable if there is an assignment to the variables that make the formula true A formula is falsifiable if there is an assignment to the variables that make the formula false A formula is contradictory if all assignments to variables eval to false A formula is valid if all assignments to variables eval to true (a valid formula is a tautology) The negation of a valid formula is not satisfiable A formula is invalid if there is an assignment to variables that eval to false (counterexample)

Satisfiability Checking to see if a formula f is satisfiable can be done by searching a truth table for a true entry or truth tree construction Exponential in the number of variables Does not appear to be a polynomial time algorithm (satisfiability is NP-complete) There are efficient satisfiability checkers that work well on many practical problems Checking whether f is invalid can be done by checking if f is satisfiable. An assignment that makes f satisfiable provides a counterexample

Arguments An argument is a list of premises followed by a conclusion ϕ 1,,ϕ n ψ An argument is valid if any assignment that makes the premises true also makes the conclusion true An argument is invalid if there is some assignment that makes the premises true but does not make the conclusion true If we negate the conclusion we can search for counterexamples by looking for an assignment that makes the premises and negated conclusion true

Arguments and Formulas An argument ϕ 1,,ϕ n ψ is valid if and only if the formula (ϕ 1 ϕ n ) ψ is a tautology

Truth Tree Construction ϕ ψ ϕ ψ ϕ ψ (ϕ ψ) ϕ ψ (ϕ ψ) ϕ ψ (ϕ ψ) ϕ ψ

Truth Tree Construction (ϕ ψ) (ϕ ψ) (ϕ ψ) (ϕ ψ) ϕ ψ (ϕ ψ) ϕ ψ (ϕ ψ) ϕ ψ ϕ ϕ ϕ

Example Truth Tree