Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Similar documents
Digital Logic (2) Boolean Algebra

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Boolean Algebra. Philipp Koehn. 9 September 2016

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

211: Computer Architecture Summer 2016

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Review for Test 1 : Ch1 5

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Logic and Boolean algebra

CSC Discrete Math I, Spring Propositional Logic

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8

Sample Test Paper - I

Digital Logic Appendix A

1.1 Statements and Compound Statements

Propositional Logic. Spring Propositional Logic Spring / 32

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

CSE20: Discrete Mathematics for Computer Science. Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication

2.2: Logical Equivalence: The Laws of Logic

Possible logic functions of two variables

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Chapter 7 Logic Circuits

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms

Boolean Algebra, Gates and Circuits

Review: Additional Boolean operations

Fundamentals of Digital Design

Chapter 5. Digital systems. 5.1 Boolean algebra Negation, conjunction and disjunction

LOGIC GATES. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

II. COMBINATIONAL LOGIC DESIGN. - algebra defined on a set of 2 elements, {0, 1}, with binary operators multiply (AND), add (OR), and invert (NOT):

Systems I: Computer Organization and Architecture

CS/COE0447: Computer Organization and Assembly Language

Definition 2. Conjunction of p and q

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture)

Why digital? Overview. Number Systems. Binary to Decimal conversion

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Z = F(X) Combinational circuit. A combinational circuit can be specified either by a truth table. Truth Table

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3


COMBINATIONAL LOGIC FUNCTIONS

Lecture A: Logic Design and Gates

Combinational Logic. By : Ali Mustafa

Packet #1: Logic & Proofs. Applied Discrete Mathematics

EECS 1028 M: Discrete Mathematics for Engineers

Lecture 22 Chapters 3 Logic Circuits Part 1

Language of Propositional Logic

DIGITAL LOGIC CIRCUITS

Latches. October 13, 2003 Latches 1

DIGITAL LOGIC CIRCUITS

Sequential Logic Circuits

Advanced Topics in LP and FP

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Deductive Systems. Lecture - 3

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Week-I. Combinational Logic & Circuits

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

PROPOSITIONAL CALCULUS

Tautologies, Contradictions, and Contingencies

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents

Section 1.2: Propositional Logic

02 Propositional Logic

Simplifying Logic Circuits with Karnaugh Maps

ENG2410 Digital Design Combinational Logic Circuits

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Computer Science Final Examination Friday December 14 th 2001

Inference in Propositional Logic

Combinational Logic. Review of Combinational Logic 1

CHAPTER1: Digital Logic Circuits Combination Circuits

CS61c: Representations of Combinational Logic Circuits

software design & management Gachon University Chulyun Kim

DIGITAL LOGIC CIRCUITS

Chapter 2 Combinational logic

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Lecture 7: Logic design. Combinational logic circuits

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

UNIT 8A Computer Circuitry: Layers of Abstraction. Boolean Logic & Truth Tables

Logic Overview, I. and T T T T F F F T F F F F

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS

Digital Electronics Circuits 2017

Combinational Logic (mostly review!)

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Logic, Sets, and Proofs

Propositional Logic: Equivalence

Topic 1: Propositional logic

Logic Simplification. Boolean Simplification Example. Applying Boolean Identities F = A B C + A B C + A BC + ABC. Karnaugh Maps 2/10/2009 COMP370 1

This form sometimes used in logic circuit, example:

Chapter 4. Sequential Logic Circuits

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) State any two Boolean laws. (Any 2 laws 1 mark each)

Transcription:

Propositional Logic CSC 17 Propositional logic mathematical model (or algebra) for reasoning about the truth of logical expressions (propositions) Logical expressions propositional variables or logical expressions connected with logical operators (not, and, or) Uses design of digital circuits Composition of logical expressions in programs Automatic reasoning systems Model of computation (programming language Prolog) Logical Expressions Propositional variables (whose value is TRUE or FALSE) and the propositional constants TRUE and FALSE are logical expressions If LE1 and LE are logical expressions, then LE1 AND LE is a logical expression, whose value is TRUE if both LE1 and LE have the value TRUE, and is FALSE otherwise If LE1 and LE are logical expressions, then LE1 OR LE is a logical expression, whose value is TRUE if either LE1 or LE have the value TRUE, and is FALSE otherwise If LE1 is a logical expression, then NOT LE1 is a logical expression, whose value is TRUE if LE1 has the value FALSE, and is FALSE otherwise Algebraic Laws for Logical Expressions AND and OR are commutative AND and OR are associative AND is distributive over OR; OR is distributive over AND TRUE is the identity for AND; FALSE is the identity for OR FALSE annihilates AND; TRUE annihilates OR AND and OR are idempotent (p AND p p OR p p) Subsumption (p OR (p AND q)) (p AND (p OR q)) p DeMorgan s Laws: NOT(p AND q) (NOT p) OR (NOT q) NOT(p OR q) (NOT p) AND (NOT q) Logic Minimization Essence of simplification Repeatedly find two-element sub-sets of true values in which only one variable changes its value while the other variables do not Apply the Unifying Theorem to eliminate the single varying variable _ FUNC = A.B + A.B FUNC = A. (B+B) apply the Distributive law of Boolean Algebra F = A apply the Inverse law of Boolean Algebra CNF and DNF Disjunctive normal form (DNF) sum of products Conjunctive normal form (CNF) product of sums Construct logical expressions from truth tables using either DNF or CNF 1

Karnaugh Maps A graphical representation of the truth table boolean cube in n- dimensional space where n is the number of input variables Entry for each combination of input variables specifying the value of the output function Uses Gray code encoding advancing from 1 index to the next changes the value of only a single input variable/bit Multi-dimensional table with logical adjacency along a dimension And two adjacent elements (horizontal or vertical) are distance one apart Adjacencies provide clues about whether uniting theorem can be applied Goal: fina a minimum cover of the 1 a using rectangles or squares containing a power of number of 1 s p AND q Completeness of NAND ((p NAND q) NAND TRUE) p OR q ((p NAND TRUE) NAND (q NAND TRUE)) (NOT p) NAND (NOT q) (NOT p) (p NAND TRUE) (p NAND p) In essence, a mechanical method to find the don t cares in the truth table Laws of Implication Laws of implication Reasoning with Propositional logic Deductive proofs Take as given a set of premises (or hypotheses) that are known to be try and attempt to prove a conclusion valid by a sequence of steps, termed inferences Each inference follows from the premises or a previous inference by application of an inference rule p q NOT p OR q (p q) AND (q p) (p q) (p q) (p q) (p1 AND p AND pn q) (NOT p1 OR NOT p OR NOT pn OR q) (p q) (NOT q NOT p) (contrapositive law) ((p q) AND (NOT p q)) q Reasoning with Propositional Logic Given premises (or inferences) P1 Pn, we can infer expression E if P1 AND P AND Pn E is a tautology Whenever E is a tautology, P1 AND P AND Pn E is a tautology Given two premises P1 and P1, we can infer P1 AND P If P1 and (P1 P) are given or inferred, then we can infer P by the rule of modus ponens ((p AND (p q)) q) If NOT P and (P1 P) are given or inferred, then we can infer NOT P1 by the rule of modus tollens If P1 and (P1 P) are given or inferred, we can infer P Techniques Prove tautologies using inference Deductive proof Proof with Resolution Resolution tautology - If we know p OR q and p r then we can deduce q OR r (p OR q) AND (NOT p OR r) q OR r In order to apply resolution in a proof: Express hypotheses and conclusion as a product of sums (conjunctive normal form), such as those that appear above Each maxterm in the CNF of the hypothesis becomes a clause of the proof Apply the resolution tautology to pairs of clauses, producing new clauses Prove by producing all clauses of the conclusion OR prove by contradiction using resolution

Circuit Design Gate: Basic electronic device. Computes a Boolean function. NOT AND NAND OR AND, OR, NOT, NAND: Easy to implement Conceptually any number of inputs Used in practice NOR Circuit Design Circuit: A combination of gates Output of some gates are the input of others. Has one or more inputs: These are inputs to the gates in the circuit. May have one or more outputs. -input NAND: Two -input AND. One Inverter. Combinational & Sequential Circuits Combinational: Output is a Boolean function of input values. Are Acyclic: No cycles between inputs of a gate and its outputs. No memory: Cannot remember previous inputs or outputs. Example of use: Decode instructions and perform arithmetic. Combinational & Sequential Circuits () Sequential: Output depends on the current input values and the previous sequence of input values. Are Cyclic: Output of a gate feeds its input at some future time. Memory: Remember results of previous operations Use them as inputs. Example of use: Build registers and memory units. Combinational Circuit: Encoder for a 7-Segment Display Goal: Design a circuit With 1 inputs: i, i 1, i,, i. Each one corresponds to the decimal digits (-). Lights up the display segments A, B, C,, G. As needed to display the digit specified by the input. Total: 7 outputs. F E A G D B C Number : Input i ==1. i, i 1, i,, i ==. Outputs: A=B=D=E=G=1 C=F= Encoder for a 7-Segment Display () Boolean expression for the outputs: A = i B = i E = i C = i F = i D = i G = i 1 1 7 7 7 Build the circuit with 7 OR gates: One for each segment of the display F E A G D B C

i i 1 i i i i i i 7 i Encoder for a 7-Segment Display () and so on A B Constraints on Circuit Design Numerous constraints impact: The speed and cost of a circuit. Speed: Every gate in a circuit introduces a small delay. Circuit delay depends on the number of gates between inputs and outputs Depends on fan-in and fan-out of a gate i Constraints on Circuit Design Divide and Conquer Adder Size limitations: More gates lead to larger circuits. Large circuits are more expensive Higher failure rate. And slower. Signals must propagate from one end to the other. Fan-in and Fan-out: Number of inputs and outputs of a gate. Large fan-in makes a gate slower. Already seen Ripple-Carry adder Need: Adder with a smaller delay for larger words. Solution: Use a divide and conquer strategy. Use two N/-bit adders and combine results. Left and right halves added in parallel. Divide and Conquer Adder () x 1 y 1 x n/ y n/ carry x n/+1 y n/+1 x n y n z 1 z n/ z n/+1 z n Carry: Not known in advance: How can the adders operate in parallel? Compute to sums for the upper half. One assuming there is a carry. One assuming there is NO carry. Use additional circuit to select the correct sum. Design of an N-adder Assume two N-bit operands: x 1 x N & y 1 y N. Design N-adder that computes: Sum without carry-in: s 1 s N. Sum with carry-in: t 1 t N. The carry-propagate bit, p: It is 1 if there is a carry-out assuming there is carry-in. The carry-generate bit, g: It is 1 if there is a carry-out even if there is NO carry-in. NOTE: if g is one then p will be one too (g implies p). First, build an 1-bit adder.

A 1-bit Adder A -bit Adder from 1-bit Adders Boolean Functions x y s t p g 1 1 1 1 1 1 1 1 1 1 1 1 Logical Expressions s = x y + x y t = x y + xy p = x + y g = xy x y x 1 y 1 High Order 1-bit Adder s H t H g H p H p g FIX t s Low Order 1-bit Adder p L g L t L s L t 1 s 1 ``FIX Circuit Carry-propagate bit: p= p H p L +g H If there is a carry-in p is 1 if: Both the low and high order part propagate a carry (p H p L ). Or: The high order part generates a carry (g H ). Carry-generate bit: g= g H + g L p H If there is NO carry-in g is 1 if: If the high order part generates a carry (g H ). Or if there is a carry from the low part and the high part propagate that carry (g L p H ). ``FIX Circuit () High order sum, NO carry-in: It is: s = s g + t g H L H L s H if there is no carry from low order part (~g L ). t H if there is carry from low order part (g L ). High order sum, with carry-in: It is: t = s p + t p H L H L t H if there is a carry from the low order part. s H otherwise. Sequential Circuits for Memory Elements. Memory element: A collection of gates capable of producing its last input as output. They are sequential circuits. Their behavior depends on current and past inputs. Flip-flop: A 1-bit memory element. Typical flip-flop: Takes two inputs (load and data-in). Produces one output (data-out). Flip-Flops Load==: The circuit produces the stored value as output. Load==1: The circuit stores the value data-in and Produces it as output.

Flip-Flop Circuit load A1 data-out data-in A Load=1A1= data-out=a=data-in. Load= A= data-out=a1 Which is the previously stored value.