cse 311 foundations of computing announcements
play

CSE 311: Foundations of Computing announcements Fall 2013 Reading - PowerPoint PPT Presentation

CSE 311: Foundations of Computing announcements Fall 2013 Reading assignment Lecture 5: Canonical forms, predicate Logic Predicates and Quantifiers 1.4, 1.5 7 th Edition 1.3, 1.4 6 th Edition 2 review: boolean algebra review: mapping


  1. CSE 311: Foundations of Computing announcements Fall 2013 • Reading assignment Lecture 5: Canonical forms, predicate Logic – Predicates and Quantifiers 1.4, 1.5 7 th Edition 1.3, 1.4 6 th Edition 2 review: boolean algebra review: mapping truth tables to logic gates • Boolean algebra to circuit design Given a truth table: A B C F 0 0 0 0 1. Write the Boolean expression 0 0 1 0 • Boolean algebra 2. Minimize the Boolean expression 0 1 0 1 – a set of elements B containing {0, 1} 3. Draw as gates 0 1 1 1 – binary operations { + , • } 4. Map to available gates 1 0 0 0 – and a unary operation { ’ } 1 1 0 1 1 1 1 0 0 – such that the following axioms hold: F = A’BC’+A’BC+AB’C+ABC 1 1 1 1 = A’B(C’+C)+AC(B’+B) 2 = A’B+AC 1. the set B contains at least two elements: a, b 2. closure: a + b is in B a • b is in B 3. commutativity: a + b = b + a a • b = b • a 3 4. associativity: a + (b + c) = (a + b) + c a • (b • c) = (a • b) • c notA notA 4 5. identity: a + 0 = a a • 1 = a B B 6. distributivity: a + (b • c) = (a + b) • (a + c) a • (b + c) = (a • b) + (a • c) F F 7. complementarity: a + a’ = 1 a • a’ = 0 A A C C

  2. review: canonical forms sum-of-products canonical form • also known as Disjunctive Normal Form (DNF) • Truth table is the unique signature of a Boolean function • also known as minterm expansion • The same truth table can have many gate realizations F = 001 011 101 110 111 – we’ve seen this already F = + A’BC + AB’C + ABC’ + ABC A’B’C – depends on how good we are at Boolean simplification A B C F F’ 0 0 0 0 1 • Canonical forms 0 0 1 1 0 0 1 0 0 1 – standard forms for a Boolean expression 0 1 1 1 0 – we all come up with the same expression 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 sum-of-products canonical form product-of-sums canonical form • also known as Conjunctive Normal Form (CNF) Product term (or minterm) – AND-ed product of literals – input combination for which output is • also known as maxterm expansion true – each variable appears exactly once, true or inverted (but not both) F = 000 010 100 A B C minterms F = (A + B + C) (A + B’ + C) (A’ + B + C) F in canonical form: 0 0 0 A’B’C’ m0 F(A, B, C) = Σ m(1,3,5,6,7) 0 0 1 A’B’C m1 A B C F F’ = m1 + m3 + m5 + m6 + m7 0 1 0 A’BC’ m2 0 0 0 0 1 = A’B’C + A’BC + AB’C + ABC’ + ABC 0 0 1 1 0 0 1 1 A’BC m3 0 1 0 0 1 1 0 0 AB’C’ m4 0 1 1 1 0 canonical form ≠ minimal form 1 0 1 AB’C m5 1 0 0 0 1 F(A, B, C) = A’B’C + A’BC + AB’C + ABC + ABC’ 1 0 1 1 0 1 1 0 ABC’ m6 = (A’B’ + A’B + AB’ + AB)C + ABC’ 1 1 0 1 0 1 1 1 ABC m7 1 1 1 1 0 = ((A’ + A)(B’ + B))C + ABC’ = C + ABC’ = ABC’ + C short-hand notation for = AB + C minterms of 3 variables

  3. s-o-p, p-o-s, and de Morgan’s theorem product-of-sums canonical form Sum term (or maxterm) Complement of function in sum-of-products form: – OR-ed sum of literals – input combination for which output is false – F’ = A’B’C’ + A’BC’ + AB’C’ – each variable appears exactly once, true or inverted (but not both) A B C maxterms F in canonical form: Complement again and apply de Morgan’s and 0 0 0 A+B+C M0 F(A, B, C) = Π M(0,2,4) 0 0 1 A+B+C’ M1 get the product-of-sums form: = M0 • M2 • M4 0 1 0 A+B’+C M2 = (A + B + C) (A + B’ + C) (A’ + B + C) – (F’)’ = (A’B’C’ + A’BC’ + AB’C’)’ 0 1 1 A+B’+C’ M3 1 0 0 A’+B+C M4 canonical form ≠ minimal form – F = (A + B + C) (A + B’ + C) (A’ + B + C) 1 0 1 A’+B+C’ M5 F(A, B, C) = (A + B + C) (A + B’ + C) (A’ + B + C) 1 1 0 A’+B’+C M6 = (A + B + C) (A + B’ + C) 1 1 1 A’+B’+C’ M7 (A + B + C) (A’ + B + C) = (A + C) (B + C) short-hand notation for maxterms of 3 variables predicate logic predicate logic predicate or propositional function • propositional logic – a function that returns a truth value, e.g., – allows us to analyze complex propositions in terms of their simpler constituent parts joined “ x is a cat” by connectives “ x is prime” “student x has taken course y ” • predicate logic “ x > y ” – lets us analyze them at a deeper level… “ x + y = z ” or Sum(x, y, z) Predicates will have variables or constants as arguments.

  4. quantifiers statements with quantifiers Domain: ∀ x P(x) • ∃ x Even(x) Positive Integers P(x) is true for every x in the domain Even( x ) • ∀ x Odd(x) Odd( x ) read as “for all x, P of x” Prime( x ) Greater( x , y ) • ∀ x (Even(x) ∨ Odd(x)) Equal( x , y ) ∃ x P(x) There is an x in the domain for which P(x) is true • ∃ x (Even(x) ∧ Odd(x)) read as “there exists x, P of x” • ∀ x Greater(x+1, x) ∃ x (Even(x) ∧ Prime(x)) • statements with quantifiers statements with quantifiers Domain: • “There is an odd prime” Domain: Even(x) • ∀ x ∃ y Greater (y, x) Positive Integers Positive Integers Odd(x) Prime(x) Even( x ) Greater(x,y) Odd( x ) Sum(x,y,z) • ∀ x ∃ y Greater (x, y) Prime( x ) • “If x is greater than two, x is not an even prime” Greater( x , y ) Equal( x , y ) Sum(x,y,z) • ∀ x ∃ y (Greater(y, x) ∧ Prime(y)) • ∀ x ∀ y ∀ z ((Sum(x, y, z) ∧ Odd(x) ∧ Odd(y)) → Even(z)) • ∀ x (Prime(x) → (Equal(x, 2) ∨ Odd(x)) • “There exists an odd integer that is the sum of two primes” • ∃ x ∃ y(Sum(x, 2, y) ∧ Prime(x) ∧ Prime(y))

  5. english to predicate logic goldbach’s conjecture “Every even integer greater than two can be • “Red cats like tofu” expressed as the sum of two primes” Even(x) Odd(x) Prime(x) Greater(x,y) Equal(x,y) Cat(x) Red(x) Domain: LikesTofu(x) Positive Integers scope of quantifiers scope of quantifiers vs. example: ∃ x (P(x) ∧ ∧ Q(x)) ∃ x P(x) ∧ ∧ ∃ x Q(x) Notlargest(x) ≡ ∃ y Greater (y, x) ∧ ∧ ∧ ∧ ≡ ∃ z Greater (z, x) truth value: doesn’t depend on y or z “bound variables” does depend on x “free variable” quantifiers only act on free variables of the formula they quantify ∀ x ( ∃ y (P(x,y) → ∀ x Q(y, x)))

  6. nested quantifiers quantification with two variables expression when true when false • bound variable names don’t matter ∀ x ∃ y P(x, y) ≡ ∀ a ∃ b P(a, b) ∀ x ∀ y P(x, y) • positions of quantifiers can sometimes change ∃ x ∃ y P(x, y) ∀ x (Q(x) ∧ ∃ y P(x, y)) ≡ ∀ x ∃ y (Q(x) ∧ P(x, y)) • but: order is important... ∀ x ∃ y P(x, y) ∃ y ∀ x P(x, y) negations of quantifiers de morgan’s laws for quantifiers • not every positive integer is prime ¬∀ x P(x) ≡ ∃ x ¬ P(x) ¬ ∃ x P(x) ≡ ∀ x ¬ P(x) • some positive integer is not prime • prime numbers do not exist • every positive integer is not prime

  7. de morgan’s laws for quantifiers ¬∀ x P(x) ≡ ∃ x ¬ P(x) ¬ ∃ x P(x) ≡ ∀ x ¬ P(x) “ There is no largest integer ” ¬ ∃ x ∀ y ( x ≥ y) ≡∀ x ¬ ∀ y ( x ≥ y) ≡∀ x ∃ y ¬ ( x ≥ y) ≡∀ x ∃ y (y > x) “ For every integer there is a larger integer ”

Recommend


More recommend