180 likes | 321 Views
Discrete Mathematics CS 2610. February 12, 2009. Agenda. Previously Finished functions Began Boolean algebras And now Continue with Boolean algebras. But First. p q r, is NOT true when only one of p, q, or r is true. Why not? It is true for (p Λ ¬q Λ ¬r)
E N D
Discrete Mathematics CS 2610 February 12, 2009
Agenda • Previously • Finished functions • Began Boolean algebras • And now • Continue with Boolean algebras
But First • p q r, is NOT true when only one of p, q, or r is true. Why not? • It is true for (p Λ ¬q Λ ¬r) • It is true for (¬p Λ q Λ ¬r) • It is true for (¬p Λ ¬q Λ r) • So what’s wrong? Raise your hand when you know.
Injective Functions (one-to-one) • If function f : A B is 1-to-1 then every b B has 0 or 1 pre-image. • Proof (bwoc): Say f is 1-to-1 and b B has 2 or more pre-images. • Then a1, a2 st a1 A and a2 A, and a1 ≠ a2. • So f(a1) = b and f(a2) = b, meaning f(a1) = f(a2). • This contradicts the definition of an injection since when a1 ≠ a2 we know f(a1) ≠ f(a2).
Boolean Algebras (Chapter 11) • Boolean algebra provides the operations and the rules for working with the set {0, 1}. • These are the rules that underlie electronic and optical circuits, and the methods we will discuss are fundamental to VLSI design.
Boolean Algebra • The minimal Boolean algebra is the algebra formed over the set of truth values {0, 1} by using the operations functions +, ·, - (sum, product, complement). • The minimal Boolean algebra is equivalent to propositional logic where • Ocorresponds to False • 1 corresponds to True • corresponds logical operator AND • + corresponds logical operator OR • - corresponds logical operator NOT
x 0 0 1 1 y 0 1 0 1 x + y 0 1 1 1 x 0 1 x 1 0 xy 0 0 0 1 Boolean Algebra Tables x,y are Boolean variables – they assume values 0 or 1
Boolean n-Tuples • Let B = {0, 1}, the set of Boolean values. • LetBn = { (x1,x2,…xn) | xi B, i=1,..,n} . B1= { (x1) | x1 B,} B2= { (x1, x2), | xi B, i=1,2} Bn= { ((x1,x2,…xn) | xi B, i=1,..,n,} • For all nZ+, any function f:Bn→B is called a Boolean function of degree n.
Example Boolean Function F(x,y,z) =B3B z 0 1 0 1 0 1 0 1 x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 F(x,y,z)=x(y+z) 0 0 0 0 1 B3 has 8 triplets 1 0 1
Number of Boolean Functions • How many different Boolean functions of degree 1 are there? • How many different Boolean functions of degree 2 are there? • How many different functions of degree n are there ? • There are 22ⁿ distinct Boolean functions of degree n.
Combining Boolean Functions • Let Fand G be two Booleans functions of degree n. • Complement ofF: F (x1,..xn) = F (x1,..xn) • Boolean Sum : (F + G)(x1,..xn) = F (x1,..xn) + G (x1,..xn) • Boolean Product: (F·G)(x1,..xn) = F(x1,..xn)·G(x1,..xn)
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 + zx
Boolean Expressions • Let x1, …, xn be n different Boolean variables. • A Boolean expression is a string of one of the following forms (recursive definition): • 0, 1, x1, …, or xn. are Boolean Expressions • If E1 and E2are Boolean expressions then -E1, (E1E2), or (E1+E2)are Boolean expressions. Example: E1 = x E2 = y E3 = z E4 = E1 + E2= x + y E5 = E1E2= x y E6 = -E3 = -z E7 = E6 + E4 = -z + x + y E8 = E6 E4 = -z ( x + y) Note: equivalent notation: -E = E for complement
x1 x2 x3 F(x1,x2,x3) 0 0 0 1 F(x1,x2,x3) = x1(x2+x3)+x1x2x3 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 Functions and Expressions • A Boolean expression represents a Boolean function. • Furthermore, every Boolean function (of a given degree) can be represented by a Boolean expression with n variables.
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
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 What about a 2-input multiplexer?
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