Foundations of Computing I CSE 311 Fall 2014 Foundations of Computing I Fall 2014.

Slides:



Advertisements
Similar presentations
Propositional Equivalences
Advertisements

Programming for GCSE Topic 9.1: Logic Circuits T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary.
Types of Logic Circuits
CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
1 Combinational Logic Design&Analysis. 2 Introduction We have learned all the prerequisite material: – Truth tables and Boolean expressions describe functions.
Microprocessors vs. Custom Digital Circuits
Logic: From Greeks to philosophers to circuits. COS 116: 3/11/2008 Sanjeev Arora.
Discrete Mathematics Math 6A Instructor: M. Welling.
CSE 311 Foundations of Computing I Autumn 2011 Lecture 2 More Propositional Logic Application: Circuits Propositional Equivalence.
Propositional Calculus Math Foundations of Computer Science.
Logic: From Greeks to philosophers to circuits. COS 116, Spring 2012 Adam Finkelstein.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
XOR and XNOR Logic Gates. XOR Function Output Y is TRUE if input A OR input B are TRUE Exclusively, else it is FALSE. Logic Symbol  Description  Truth.
Chapter 1 The Logic of Compound Statements. Section 1.1 Logical Form and Logical Equivalence.
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.
CSE 311 Foundations of Computing I Spring 2013, Lecture 3 Propositional Logic, Boolean Logic/Boolean Algebra 1.
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.
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
Boolean Algebra and Computer Logic Mathematical Structures for Computer Science Chapter 7.1 – 7.2 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Boolean.
Module Code MA1032N: Logic Lecture for Week Autumn.
Linear Algebra. Circuits The circuits in computers and other input devices have inputs, each of which is either a 0 or 1, the output is also 0s and 1s.
MATH 224 – Discrete Mathematics
Boolean Algebra. Logical Statements A proposition that may or may not be true:  Today is Monday  Today is Sunday  It is raining.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
CSE 311 Foundations of Computing I
Lecture 9 Conditional Statements CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
Chapter 1: The Foundations: Logic and Proofs
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.
Propositional Equivalence A needed step towards proofs Copyright © 2014 Curt Hill.
Introduction to Predicates and Quantified Statements I Lecture 9 Section 2.1 Wed, Jan 31, 2007.
Binary Logic Derrington KCL CPD/SKE Binary We’ve seen how data of all different sorts and kinds can be represented as binary bits… 0s and 1s 1 is.
Lecture 1 Gunjeet kaur Dronacharya group of institutions.
Module Code MA0003NI: Computing mathematics Lecture for Week Autumn.
The Foundations: Logic and Proofs
Working with DIGITAL Information
DISCRETE MATHEMATICS CHAPTER I.
CSE 311 Foundations of Computing I
Logic Gates.
COT 3100, Spr Applications of Discrete Structures
TN 221: DIGITAL ELECTRONICS 1
Jeremy R. Johnson Wed. Sept. 29, 1999
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
CSE 311 Foundations of Computing I
Propositional Calculus: Boolean Algebra and Simplification
Administrivia Course Web:
1.2 Propositional Equivalences
Propositional Equivalences
Information Technology Department
Agenda – 2/12/18 Questions? Readings: CSI 4, P
CSE 370 – Winter Combinational Logic - 1
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Logic Gates.
Propositional Equivalences
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Chapter 2 Introduction to Logic Circuits
Negations of quantifiers
Combinational Circuits
CSE 321 Discrete Structures
1.2 Propositional Equivalences
Truth tables Mrs. Palmer.
1.2 Propositional Equivalences
Introductory Concepts
Boolean Algebra By: Asst Lec. Besma Nazar Nadhem
The Foundations: Logic and Proofs
Presentation transcript:

Foundations of Computing I CSE 311 Fall 2014 Foundations of Computing I Fall 2014

More Gates! X Y Z XYZ XYZ XYZ XYZ Z X Y X Y Z XYZ XYZ XYZ XYZ Z X Y

Review: 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) Tautology! Contradiction! Contingency (note: in morning lecture the and was an or)! Tautology!

Review: Logical Equivalence A and B are logically equivalent if and only if A  B is a tautology i.e. A and B have the same truth table The notation A  B denotes A and B are logically equivalent Example:p   p p pp  pp   p TFTT FTFT

Review: De Morgan’s laws  (p  q)   p   q  (p  q)   p   q if (!(front != null && value > front.data)) front = new ListNode(value, front); else { ListNode current = front; while (current.next == null && current.next.data < value)) current = current.next; current.next = new ListNode(value, current.next); } This code inserts value into a sorted linked list. The first if runs when…front is null or value is smaller than the first item. The while loop stops when…we’ve reached the end of the list or the next value is bigger.

Review: Law of Implication pq p  q  p p  p  q (p  q)  (  p  q) T TTFTT T FFFFT F TTTTT F FTTTT (p  q)  (  p  q)

CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra

Computing Equivalence Describe an algorithm for computing if two logical expressions/circuits are equivalent. What is the run time of the algorithm? Compute the entire truth table for both of them! There are 2 n entries in the column for n variables.

Some Familiar Properties of Arithmetic

Properties of Logical Connectives We will always give you this list!

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

Some Equivalences Related to Implication p  q   p  q p  q   q   p p  q  (p  q)  (q  p) p  q   p   q

Some Equivalences Related to Implication p  q   p  q p  q   q   p p  q  (p  q)  (q  p) p  q   p   q

Logical Proofs To show P is equivalent to Q – Apply a series of logical equivalences to sub- expressions to convert P to Q To show P is a tautology – Apply a series of logical equivalences to sub- expressions to convert P to T

Prove this is a Tautology (p  q)  (p  q)

Prove this is a Tautology (p  (p  q))  q

Prove these are not equivalent (p  q)  r p  (q  r)

Boolean Logic Combinational Logic – output = F(input) Sequential Logic – output t = F(output t-1, input t ) output dependent on history concept of a time step (clock, t) Boolean Algebra consisting of… – a set of elements B = {0, 1} – binary operations { +, } (OR, AND) – and a unary operation { ’ } (NOT )

A Combinational Logic Example Sessions of Class: We would like to compute the number of lectures or quiz sections remaining at the start of a given day of the week. – Inputs: Day of the Week, Lecture/Section flag – Output: Number of sessions left Examples: Input: (Wednesday, Lecture) Output: 2 Input: (Monday, Section) Output: 1

Implementation in Software public int classesLeft (weekday, lecture_flag) { switch (day) { case SUNDAY: case MONDAY: return lecture_flag ? 3 : 1; case TUESDAY: case WEDNESDAY: return lecture_flag ? 2 : 1; case THURSDAY: return lecture_flag ? 1 : 1; case FRIDAY: return lecture_flag ? 1 : 0; case SATURDAY: return lecture_flag ? 0 : 0; } 20

Implementation with Combinational Logic Encoding: – How many bits for each input/output? – Binary number for weekday – One bit for each possible output Lecture? Weekday 0 123

Defining Our Inputs! public int classesLeft (weekday, lecture_flag) { switch (day) { case SUNDAY: case MONDAY: return lecture_flag ? 3 : 1; case TUESDAY: case WEDNESDAY: return lecture_flag ? 2 : 1; case THURSDAY: return lecture_flag ? 1 : 1; case FRIDAY: return lecture_flag ? 1 : 0; case SATURDAY: return lecture_flag ? 0 : 0; } WeekdayNumberBinary Sunday0(000) 2 Monday1(001) 2 Tuesday2(010) 2 Wednesday3(011) 2 Thursday4(100) 2 Friday5(101) 2 Saturday6(110) 2

Converting to a Truth Table! WeekdayNumberBinary Sunday0(000) 2 Monday1(001) 2 Tuesday2(010) 2 Wednesday3(011) 2 Thursday4(100) 2 Friday5(101) 2 Saturday6(110) 2 WeekdayLecture?c0c1c2c

Truth Table to Logic (Part 1) c3 = (DAY == SUN and LEC) or (DAY == MON and LEC) c3 = (d2 == 0 && d1 == 0 && d0 == 0 && L == 1) || (d2 == 0 && d1 == 0 && d0 == 1 && L == 1) c3 = d2’d1’d0’L + d2’d1’d0L DAY d2d1d0d2d1d0Lc0c0c1c1c2c2c3c3 SunS SunL MonS MonL TueS TueL WedS WedL Thu FriS FriL Sat

Truth Table to Logic (Part 2) DAY d2d1d0d2d1d0Lc0c0c1c1c2c2c3c3 SunS SunL MonS MonL TueS TueL WedS WedL Thu FriS FriL Sat c3 = d2’d1’d0’L + d2’d1’d0L c2 = (DAY == TUE and LEC) or (DAY == WED and LEC) c2 = d2’d1d0’L + d2’d1d0L

Truth Table to Logic (Part 3) DAY d2d1d0d2d1d0Lc0c0c1c1c2c2c3c3 SunS SunL MonS MonL TueS TueL WedS WedL Thu FriS FriL Sat c3 = d2’d1’d0’L + d2’d1’d0L c2 = d2’d1 d0’L + d2’d1 d0L c1 = On your homework for next week! c0 = d2d1’ d0 L’ + d2d1 d0’

Logic to Gates c3 = d2’d1’d0’L + d2’d1’d0L d2 d1 d0 L NOT OR AND DAY d2d1d0d2d1d0Lc0c0c1c1c2c2c3c3 SunS SunL MonS MonL TueS TueL WedS WedL Thu FriS FriL Sat Multi-input AND gates

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