24
Lattice and Boolean Algebra

Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Embed Size (px)

Citation preview

Page 1: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and

Boolean Algebra

Page 2: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 2

Algebra

• An algebraic system is defined by the tuple A,o1, …, ok; R1, …, Rm; c1, … ck, where, A is a non-empty set, oi is a function Api A, pi is a positive integer, Rj is a relation on A, and ci is an element of A.

Page 3: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 3

Lattice

• The lattice is an algebraic system A, , , given a,b,c in A, the following axioms are satisfied:1. Idempotent laws: a a = a, a a = a;

2. Commutative laws: a b = b a, a b = b a

3. Associative laws: a (b c) = (a b) c, a (b c) = (a b) c

4. Absorption laws: a (a b) = a, a (a b) = a

Page 4: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 4

Lattice - Example

• Let A={1,2,3,6}.• Let a b be the least common multiple• Let a b be the greatest common divisor • Then, the algebraic system A, , satisfies

the axioms of the lattice.

Page 5: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 5

Distributive Lattice

• The lattice A, , satisfying the following axiom is a distributive lattice5. Distributive laws: a (b c) = (a b) (a c),

a (b c) = (a b) (a c)

Page 6: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 6

Examplesdistributive non-distributive

a ⋅(b∨c) ≠ a ⋅b∨a ⋅c

Page 7: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 7

Complemented Lattice

• Let a lattice A, , have a maximum element 1 and a minimum element 0. For any element a in A, if there exists an element xa such that a xa = 1 and a xa = 0, then the lattice is a complemented lattice.

• Find complements in the previous example

Page 8: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 8

Boolean Algebra• Let B be a set with at least two elements 0 and 1.

Let two binary operations and , and a unary operation are defined on B. The algebraic system

B, , , , 0,1 is a Boolean algebra, if the following postulates are satisfied:

1. Idempotent laws: a a = a, a a = a;

2. Commutative laws: a b = b a, a b = b a

3. Associative laws: a (b c) = (a b) c, a (b c) = (a b) c

4. Absorption laws: a (a b) = a, a (a b) = a

5. Distributive laws: a (b c) = (a b) (a c), a (b c) = (a b) (a c)

Page 9: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 9

Boolean Algebra

6. Involution:

7. Complements: a a = 1, a a = 0;

8. Identities: a 0 = a, a 1 = a;

9. a 1 = 1, a 0 = 0;

10.De Morgan’s laws:€

a = a

a∨b = a ⋅b

a ⋅b = a∨b

Page 10: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 10

Huntington’s Postulates

• To verify whether a given algebra is a Boolean algebra we only need to check 4 postulates:1. Identities

2. Commutative laws

3. Distributive laws

4. Complements

Page 11: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 11

Example

• prove the idempotent laws given Huntington’s postulates:a = a 0 = a aa

= (a a) (a a)

= (a a) 1

= a a

Page 12: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 12

Models of Boolean Algebra• Boolean Algebra over {0,1}

B={0,1}. B, , , , 0,1

• Boolean Algebra over Boolean VectorsBn = {(a1, a2, … , an) | ai {0,1}}

Let a=(a1, a2, … , an) and b = (b1, b2, … , bn) Bn

define

a b = (a1 b1, a2 b2, … , an bn)

a b = (a1 b1, a2 b2, … , an bn)

a=(a1, a2, … , an)

then Bn, , , , 0,1 is a Boolean algebra, where, 0 = (0,0, …, 0) and 1 = (1,1, …, 1)

• Boolean Algebra over Power Set

Page 13: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 13

Examples

B3 P({a,b,c}) {n | n|30}

Page 14: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 14

Isomorphic Boolean Algebra

• Two Boolean algebras A, , , , 0A,1A and B, , , , 0B,1B are isomorphic iff there is a mapping f:AB, such that

• for arbitrary a,b A, f(ab) = f(a)f(b), f(a b) = f(a) f(b), and f(a) = f(a)

• f(0A ) = 0B and f(1A ) = 1B

An arbitrary finite Boolean algebra is isomorphic to the Boolean algebra Bn, , , , 0,1

Question: define the mappings for the previous slide.

Page 15: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 15

De Morgan’s Theorem

• De Morgan’s Laws hold

• These equations can be generalized

a∨b = a ⋅b

a ⋅b = a∨b

x1∨x2∨K ∨xn = x1 ⋅x2 ⋅K ⋅xn

x1 ⋅x2 ⋅K ⋅xn = x1∨x2∨K ∨xn

Page 16: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 16

Definition

• Let Bn, , , , 0,1 be a Boolean algebra. The variable that takes arbitrary values in the set B is a Boolean variable. The expression that is obtained from the Boolean variables and constants by combining with the operators , , and parenthesis is a Boolean expression. If a mapping f:Bn B is represented by a Boolean expression, then f is a Boolean function. However, not all mappings f:Bn B are Boolean functions.

Page 17: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 17

Theorem

• Let F(x1, x2, …, xn) be a Boolean expression. Then the complement of the complement of the Boolean expression F(x1, x2, …, xn) is obtained from F as follows• Add parenthesis according to the order of

operations• Interchange with

• Interchange xi with xi

• Interchange 0 with 1

Example

x∨(y ⋅z) = x ⋅(y∨z )

Page 18: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 18

Principle of Duality

• In the axioms of Boolean algebra, in an equation that contains , , 0, or 1, if we interchange with , and/or 0 with 1, then the other equation holds.

Page 19: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 19

Dual Boolean Expressions• Let A be a Boolean expression. The dual AD

is defined recursively as follows:1. 0D = 12. 1D = 0

3. if xi is a variable, then xiD = xi

4. if A, B, and C are Boolean expressions, and A = B C, then AD = BD CD

5. if A, B, and C are Boolean expressions, and A = B C, then AD = BD CD

6. if A and B are Boolean expressions, and A = B, then

AD = (BD )

Page 20: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 20

Examples

1. Given xy yz = xy yz xz

the dual (x y)(y z) = (x y)(y z)(x z)

2. Consider the Boolean algebra B={0,1,a,a} check if f is a Boolean function.

f(x) = xf(0) xf(1)

f(x) = x a x 1

f(a) = a a a 1 = a

x f(x)

0 a

1 1

a a

a 1

Page 21: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 21

Logic Functions• Let B = {0,1}. A mapping Bn B is always represented

by a Boolean expression–a two-valued logic function.

f g = h f(x1,x2,…,xn) g(x1,x2,…,xn) = h(x1,x2,…,xn)

f = g f(x1,x2,…,xn) = g(x1,x2,…,xn)

x y f g fg fg f g

0 0 0 0 0 0 1 1

0 1 1 0 1 0 0 1

1 0 1 0 1 0 0 1

1 1 0 1 1 0 1 0

Example

Page 22: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 22

Logical Expressions

1. Constants 0 and 1 are logical expressions

2. Variables x1,x2,…,xn are logical expressions

3. If E is a logical expression, then E is one

4. If E1 and E2 are logical expressions, then (E1 E2) and (E1 E2) are also logical expressions

5. The logical expressions are obtained by finite application of 1 - 4

Page 23: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 23

Evaluation of logical Expressions

• An assignment mapping :{xi} {0,1} (i = 1, … , n)

• The valuation mapping |F| of a logical expression is obtained:

1. |0| = 0 and |1| = 1

2. If xi is a variable, then | xi | = (xi)

3. If F is a logical expression, then |F| = 1 |F| = 0

4. If F and G are logical expressions, then |F G| = 1 (|F| = 1 or |G| = 1)

5. If F and G are logical expressions, then |F G| = 1 (|F| = 1 and |G| = 1)

Example: F:x y z

(x) = 0, (y) = 0, (z) = 1

Page 24: Lattice and Boolean Algebra. Slide 2 Algebra An algebraic system is defined by the tuple  A,o 1, …, o k ; R 1, …, R m ; c 1, … c k , where, A is a non-empty

Lattice and Boolean Algebra Slide 24

Equivalence of Logic Expressions

• Let F and G be logical expressions. If |F| = |G| hold for every assignment , then F and G are equivalent ==> F G

• Logical expressions can be classified into 22n

equivalence classes by the equivalence relation ()