CSE 311 Foundations of Computing I Spring 2013, Lecture 3 Propositional Logic, Boolean Logic/Boolean Algebra 1.

Slides:



Advertisements
Similar presentations
Propositional Equivalences
Advertisements

L14: Boolean Logic and Basic Gates
Types of Logic Circuits
Foundations of Computing I CSE 311 Fall 2014 Foundations of Computing I Fall 2014.
CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
Chapter 2 Logic Circuits.
ECE 331 – Digital System Design Boolean Algebra (Lecture #3) The slides included herein were taken from the materials accompanying Fundamentals of Logic.
Boolean Algebra and Logic Gate
Microprocessors vs. Custom Digital Circuits
1 Section 10.1 Boolean Functions. 2 Computers & Boolean Algebra Circuits in computers have inputs whose values are either 0 or 1 Mathematician George.
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
Logic Gate Level Combinational Circuits, Part 1. Circuits Circuit: collection of devices physically connected by wires to form a network Net can be: –
1 Boolean Algebra & Logic Design. 2 Developed by George Boole in the 1850s Mathematical theory of logic. Shannon was the first to use Boolean Algebra.
CSE 311 Foundations of Computing I Autumn 2011 Lecture 2 More Propositional Logic Application: Circuits Propositional Equivalence.
Propositional Calculus Math Foundations of Computer Science.
The Logic of Compound Statements
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
Binary Logic and Gates Binary variables take on one of two values.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
CS1502 Formal Methods in Computer Science
Propositional Equivalences
Apr. 3, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 3: Review of Digital Circuits and Logic Design Jeremy R. Johnson Mon. Apr.
CS1Q Computer Systems Lecture 6 Simon Gay. Lecture 6CS1Q Computer Systems - Simon Gay2 Algebraic Notation Writing AND, OR, NOT etc. is long-winded and.
CSE 311 Foundations of Computing I Lecture 5, Boolean Logic and Predicates Autumn 2012 CSE 3111.
Lecture 22: 11/19/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
ECE 301 – Digital Electronics Basic Logic Operations, Boolean Expressions, and Boolean Algebra (Lecture #3)
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
CSE 311 Foundations of Computing I
Figure 2.6. A truth table for the AND and OR operations. 2.3 Truth Tables 1.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
1 CSE370, Lecture 3 Lecture 3: Boolean Algebra u Logistics u Last lecture --- Numbers n Binary numbers n Base conversion n Number systems for negative.
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.
1 Lect # 2 Boolean Algebra and Logic Gates Boolean algebra defines rules for manipulating symbolic binary logic expressions. –a symbolic binary logic expression.
Boolean Algebra and Logic Gates
Symbolic Logic The Following slide were written using materials from the Book: The Following slide were written using materials from the Book: Discrete.
CSE 311 Foundations of Computing I Lecture 4, Boolean Logic Autumn 2011 CSE 3111.
CSE 461. Binary Logic Binary logic consists of binary variables and logical operations. Variables are designated by letters such as A, B, C, x, y, z etc.
ECE 301 – Digital Electronics
Morgan Kaufmann Publishers
Computer Code.
Chapter 11 (Part 1): Boolean Algebra
The Foundations: Logic and Proofs
Digital Technology.
CSE 311 Foundations of Computing I
Boolean Algebra A Boolean algebra is a set B of values together with:
Jeremy R. Johnson Wed. Sept. 29, 1999
Lecture 3: Boolean Algebra
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
CSE 311 Foundations of Computing I
Propositional Calculus: Boolean Algebra and Simplification
Boolean Algebra.
Administrivia Course Web:
Propositional Equivalences
Information Technology Department
CSE 370 – Winter Combinational Logic - 1
CSE 311 Foundations of Computing I
January 19 W’05 Yutao He 4532B Boelter Hall CSM51A/EEM16-Sec.1 W’05
Propositional Equivalences
CSE 311 Foundations of Computing I
Boolean Algebra Introduction CSCI 240
CSE 311 Foundations of Computing I
Logic Circuits I Lecture 3.
Lecture 3: Boolean Algebra
CSE 321 Discrete Structures
Boolean Algebra Rayat Shikshan Sanstha’s
Introductory Concepts
Boolean Algebra Rayat Shikshan Sanstha’s
Lecture 3: Boolean Algebra
BOOLEAN ALGEBRA.
CSE 370 – Winter Number syst.; Logic functions- 1
Presentation transcript:

CSE 311 Foundations of Computing I Spring 2013, Lecture 3 Propositional Logic, Boolean Logic/Boolean Algebra 1

Administrative Course web: –Homework, Lecture slides, Office Hours... Homework: –Due Wednesday at the start of class 2

Announcements Reading assignments –Propositional Logic th Edition th Edition –Boolean Algebra 12.1 – th Edition 11.1 – th Edition 3

So far Propositional/Boolean logic –Basic logical connectives If pigs can whistle, then horses can fly –Basic circuits –Tautologies, equivalences (in progress) 4

Combinational Logic Circuits OR AND Design a 3 input circuit to compute the majority of 3. Output 1 if at least two inputs are 1, output 0 otherwise What about a majority of 5 circuit? 5

Other gates (more later) NAND NOR XOR X  Y XNOR X ↔ Y, X = Y 6 X Y Z XYZ XYZ XYZ XYZ Z X Y X Y Z XYZ XYZ XYZ XYZ Z X Y

Logical equivalence Terminology: A compound proposition is a –Tautology if it is always true –Contradiction if it is always false –Contingency if it can be either true or false p   p p  p (p  q)  p (p  q)  (p   q)  (  p  q)  (  p   q) 7 Review

Logical Equivalence p and q are logically equivalent iff p  q is a tautology –i.e. p and q have the same truth table The notation p  q denotes p and q are logically equivalent Example: p   p p  p p   pp    p 8 Review

De Morgan’s Laws  (p  q)   p   q  (p  q)   p   q What are the negations of: –The Yankees and the Phillies will play in the World Series –It will rain today or it will snow on New Year’s Day 9 Review

De Morgan’s Laws pq  p p  q  q  p   qp  q  p  q)  p  q)  p   q) TT TF FT FF Example:  (p  q)  (  p   q) 10 Review

Law of Implication pq p  q  p p  p  q(p  q)  (  p  q) Example: (p  q)  (  p  q) 11

Understanding connectives Reflect basic rules of reasoning and logic Allow manipulation of logical formulas –Simplification –Testing for equivalence Applications –Query optimization –Search optimization and caching –Artificial Intelligence –Program verification 12

Properties of logical connectives Identity Domination Idempotent Commutative Associative Distributive Absorption Negation DeMorgan’s Laws Double Negation 13 Textbook, th Edition/1.2 6 th Edition, Table 6

Equivalences relating to implication p  q   p  q p  q   q   p p  q   p  q p  q   (p   q) p  q  (p  q)  (q  p) p  q   p   q p  q  (p  q)  (  p   q)  (p  q)  p   q 14

Logical Proofs To show P is equivalent to Q –Apply a series of logical equivalences to subexpressions to convert P to Q To show P is a tautology –Apply a series of logical equivalences to subexpressions to convert P to T 15

Show (p  q)  (p  q) is a tautology 16

Show (p  q)  r and r  (q  p) are not equivalent 17

Boolean Logic Applications of Propositional Logic for Circuits 18

Boolean logic Combinational logic –output t = F(input t ) Sequential logic –output t = F(output t-1, input t ) output dependent on history concept of a time step (clock) An algebraic structure consists of –a set of elements B = {0, 1} –binary operations { +, } (OR, AND) –and a unary operation { ’ } (NOT ) 19

A quick combinational logic example Calendar subsystem: number of days in a month (to control watch display) –used in controlling the display of a wrist-watch LCD screen –inputs: month, leap year flag –outputs: number of days 20

Implementation in software integer number_of_days ( month, leap_year_flag) { switch (month) { case 1: return (31); case 2: if (leap_year_flag == 1) then return (29) else return (28); case 3: return (31);... case 12: return (31); default: return (0); } 21

Implementation as a combinational digital system Encoding: –how many bits for each input/output? –binary number for month –four wires for 28, 29, 30, and 31 leap month d28d29d30d31 monthleapd28d29d30d ––––– 0001– – – – – – – – – – – ––––– 1110––––– 1111––––– 22

Combinational example (cont.) Truth-table to logic to switches to gates –d28 = “1 when month=0010 and leap=0” –d28 = m8'm4'm2m1'leap' –d31 = “1 when month=0001 or month=0011 or... month=1100” –d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) +... (m8m4m2'm1') –d31 = can we simplify more? monthleapd28d29d30d ––––– 0001– – – – ––––– 111–––––– 23

Combinational example (cont.) d28 = m8'm4'm2m1'leap’ d29 = m8'm4'm2m1'leap d30 = (m8'm4m2'm1') + (m8'm4m2m1') + (m8m4'm2'm1) + (m8m4'm2m1) = (m8'm4m1') + (m8m4'm1) d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) + (m8'm4m2'm1) + (m8'm4m2m1) + (m8m4'm2'm1') + (m8m4'm2m1') + (m8m4m2'm1') CSE 31124

Combinational logic Switches Basic logic and truth tables Logic functions Boolean algebra Proofs by re-writing and by truth table 25

Switches: basic element of physical implementations Implementing a simple circuit (arrow shows action if wire changes to “1”): close switch (if A is “1” or asserted) and turn on light bulb (Z) AZ open switch (if A is “0” or unasserted) and turn off light bulb (Z) Z  A A Z 26

Switches (cont.) Compose switches into more complex ones (Boolean functions): AND OR Z  A and B Z  A or B A B A B 27

Transistor networks Modern digital systems are designed in CMOS technology –MOS stands for Metal-Oxide on Semiconductor –C is for complementary because there are both normally-open and normally-closed switches MOS transistors act as voltage-controlled switches –similar, though easier to work with than relays. 28

Multi-input logic gates CMOS logic gates are inverting –Easy to implement NAND, NOR, NOT while AND, OR, and Buffer are harder XYZ XYZ Z X 1.8V 0V Y 1.8V XY X Z 0V Y 1.8V XY X Y Z Claude Shannon –

Possible logic functions of two variables There are 16 possible functions of 2 input variables: –in general, there are 2**(2**n) functions of n inputs XY16 possible functions (F 0 –F 15 ) X and Y X Y X or Y not Y not X 1 X Y F X xor Y X nor Y not (X or Y) X = Y X nand Y not (X and Y) 30

Boolean algebra An algebraic structure consisting of –a set of elements B –binary operations { +, } –and a unary operation { ’ } –such that the following axioms hold: 1. the set B contains at least two elements: a, b 2. closure:a + b is in Ba b is in B 3. commutativity:a + b = b + aa b = b a 4. associativity:a + (b + c) = (a + b) + ca (b c) = (a b) c 5. identity:a + 0 = aa 1 = a 6. distributivity:a + (b c) = (a + b) (a + c)a (b + c) = (a b) + (a c) 7. complementarity:a + a’ = 1a a’ = 0 George Boole –

Logic functions and Boolean algebra Any logic function that can be expressed as a truth table can be written as an expression in Boolean algebra using the operators: ’, +, and X, Y are Boolean algebra variables XYX Y XYX’Y’X YX’ Y’( X Y ) + ( X’ Y’ ) ( X Y ) + ( X’ Y’ )  X = Y XYX’X’ Y Boolean expression that is true when the variables X and Y have the same value and false, otherwise 32

Axioms and theorems of Boolean algebra identity 1. X + 0 = X1D. X 1 = X null 2. X + 1 = 12D. X 0 = 0 idempotency: 3. X + X = X3D. X X = X involution: 4. (X’)’ = X complementarity: 5. X + X’ = 15D. X X’ = 0 commutatively: 6. X + Y = Y + X6D. X Y = Y X associativity: 7. (X + Y) + Z = X + (Y + Z)7D. (X Y) Z = X (Y Z) distributivity: 8. X (Y + Z) = (X Y) + (X Z)8D. X + (Y Z) = (X + Y) (X + Z) 33

Axioms and theorems of Boolean algebra (cont.) uniting: 9. X Y + X Y’ = X9D. (X + Y) (X + Y’) = X absorption: 10. X + X Y = X10D. X (X + Y) = X 11. (X + Y’) Y = X Y11D. (X Y’) + Y = X + Y factoring: 12. (X + Y) (X’ + Z) =12D. X Y + X’ Z = X Z + X’ Y (X + Z) (X’ + Y) consensus: 13. (X Y) + (Y Z) + (X’ Z) =13D. (X + Y) (Y + Z) (X’ + Z) = X Y + X’ Z (X + Y) (X’ + Z) de Morgan’s: 14. (X + Y +...)’ = X’ Y’...14D. (X Y...)’ = X’ + Y’

Proving theorems (rewriting) Using the laws of Boolean algebra: – e.g., prove the theorem: X Y + X Y’ = X e.g., prove the theorem: X + X Y = X distributivity (8) complementarity (5) identity (1D) distributivity (8) identity (2) identity (1D) X Y + X Y’ = X (Y + Y’) = X (1) = X X + X Y = X 1 + X Y = X (1 + Y) = X (1) = X 35

Proving theorems (truth table) Using complete truth table: –e.g., de Morgan’s: (X + Y)’ = X’ Y’ NOR is equivalent to AND with inputs complemented (X Y)’ = X’ + Y’ NAND is equivalent to OR with inputs complemented XYX’Y’(X + Y)’X’ Y’ XYX’Y’(X Y)’X’ + Y’