170 likes | 315 Vues
This document explores the concept of equal Boolean functions, emphasizing that two functions F and G of degree n are equal if they produce the same output for all inputs. It provides examples, such as F(x,y,z) = x(y+z) and G(x,y,z) = xy + xz, illustrating the equivalence of Boolean expressions. It also covers essential Boolean identities, such as the distributive and absorption laws, and discusses the construction of Boolean expressions based on their truth tables, along with concepts like Disjunctive Normal Form (DNF) and Conjunctive Normal Form (CNF).
E N D
Discrete Mathematics CS 2610 February 17
Equal Boolean Functions • Two Boolean functions F and G of degree n are equal iff for all (x1,..xn) Bn, F(x1,..xn) = G(x1,..xn) • Example: F(x,y,z) = x(y+z), G(x,y,z) = xy + xz, and F=G (recall the “truth” table from an earlier slide) • Also, note the distributive property: x(y+z) = xy + xz via the distributive law
x1 x2 x3 F(x1,x2,x3) 0 0 0 1 F(x1,x2,x3) = x1(x2+x3)+x1x2x3 0 0 1 0 F(x1,x2,x3) = x1x2+x1x3+x1x2x3 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 Boolean Functions • Two Boolean expressions e1and e2 that represent the exact same function F are called equivalent
Boolean Functions • More equivalent Boolean expressions: (x + y)z = xyz + xyz + xyz (x + y)z = xz + yz distributive = x1z + 1yz identity = x(y + y)z + (x + x)yz unit = xyz + xyz + xyz + xyz distributive = xyz + xyz + xyz idempotent We’ve expanded the initial expression into its sum of products form.
Boolean Functions • More equivalent Boolean expressions: xy + z = ?? = xy1 + 11z identity = xy(z + z) + (x + x)1z unit = xyz + xyz + x1z + x1z distributive = xyz + xyz + x(y + y)z + x(y + y)z unit = xyz + xyz + xyz + xyz + xyz + xyz distributive = xyz + xyz + xyz + xyz + xyz idempotent
x y z 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 Representing Boolean Functions • How to construct a Boolean expression that represents a Boolean Function ? F F(x, y, z) = 1 if and only if: (-x)(y)(-z) + (-x)yz + x(-y)z + xyz
x y z 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 Representing Boolean Functions • How to construct a Boolean expression that represents a Boolean Function ? F F(x, y, z) = x·y·z + x·y·z + x·y·z + x·y·z
Boolean Identities • Double complement: x = x • Idempotent laws: x + x = x, x · x = x • Identity laws: x + 0 = x, x · 1 = x • Domination laws: x + 1 = 1, x · 0 = 0 • Commutative laws: x + y = y + x, x · y = y · x • Associative laws: x + (y + z) = (x + y) + z x· (y · z) = (x· y) · z • Distributive laws: x + y ·z = (x + y)·(x + z) x · (y + z) = x ·y + x ·z • De Morgan’s laws: (x · y) = x + y, (x + y) = x · y • Absorption laws: x + x ·y = x, x · (x + y) = x the Unit Property: x + x = 1 and Zero Property: x·x =0
Boolean Identities • Absorption law: • Show that x ·(x + y)=x • x ·(x + y)= (x + 0) ·(x + y) identity • = x + 0 ·y distributive • = x + y · 0 commutative • = x + 0 domination • = x identity
Dual Expression (related to identity pairs) • The dualed of a Boolean expression e is obtained by exchanging + with , and 0 with 1 in e. Example: e = xy + zw e = x + y + 0 ed=(x + y)(z + w) ed= x · y · 1 Duality principle:e1e2iffe1de2d x (x + y) = x iff x + xy = x (absorption)
Dual Function • The dual of a Boolean function F represented by a Boolean expression is the function represented by the dual of this expression. • The dual function of F is denoted by Fd • The dual function, denoted by Fd, does not dependon the particular Boolean expression used to represent F.
Recall: Boolean Identities • Double complement: x = x • Idempotent laws: x + x = x, x · x = x • Identity laws: x + 0 = x, x · 1 = x • Domination laws: x + 1 = 1, x · 0 = 0 • Commutative laws: x + y = y + x, x · y = y · x • Associative laws: x + (y + z) = (x + y) + z x· (y · z) = (x· y) · z • Distributive laws: x + y ·z = (x + y)·(x + z) x · (y + z) = x ·y + x ·z • De Morgan’s laws: (x · y) = x + y, (x + y) = x · y • Absorption laws: x + x ·y = x, x · (x + y) = x the Unit Property: x + x = 1 and Zero Property: x·x =0
Boolean Expressions Sets Propositions • Identity Laws x 0 = x, x 1 = x +, • Complement Laws x x = 1, x x = 0 ¬ • Associative Laws (x y) z = x (y z) (x y) z = x (y z) • Commutative Laws xy = yx, xy = yx • Distributive Laws x(yz) = (x y) (x z) x(yz) = (x y) (x z) Propositional logic has operations ,, and elements T and F such that the above properties hold for all x, y, and z.
minterms x y z + x y z + x y z DNF: Disjunctive Normal Form • A literal is a Boolean variable or its complement. • A minterm of Boolean variables x1,…,xn is a Boolean product of n literals y1…yn, where yi is either the literal xior its complement xi. Example: Disjunctive Normal Form: sum of products We have seen how to develop a DNF expression for a function if we’re given the function’s “truth” table.
maxterms (x + y + z) (x + y +z) (x +y + z) CNF: Conjunctive Normal Form • A literal is a Boolean variable or its complement. • A maxterm of Boolean variables x1,…,xn is a Boolean sum of n literals y1…yn, where yi is either the literal xior its complement xi. Example: Conjuctive Normal Form: product of sums
F x y z F F = x·y·z + x·y·z + x·y·z + x·y·z 0 0 0 1 0 F = (x·y·z) · (x·y·z) · (x·y·z) · (x·y·z) 0 0 1 0 1 = (x+y+z) · (x+y+z) · (x+y+z) · (x+y+z) 0 1 0 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 Conjunctive Normal Form • To find the CNF representation of a Boolean function F • Find the DNF representation of its complement F • Then complement both sides and apply DeMorgan’s laws to get F: How do you build the CNF directly from the table ?
xy = (x+y) Functional Completeness • Since every Boolean function can be expressed in terms of ,+,¯, we say that the set of operators {,+,¯} is functionally complete. • {+, ¯} is functionally complete (no way!) • {, ¯} is functionally complete (note: x + y = xy) • NAND | and NOR ↓ are also functionally complete, each by itself (as a singleton set). • Recall x NAND y is true iff x or y (or both) are false and x NOR y is true iff both x and y are false.