+ All Categories
Home > Documents > Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions:...

Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions:...

Date post: 14-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
26
Transcript
Page 1: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Digitalteknik EIT020

Lecture 6: Boolean Algebra

September 16, 2014

Page 2: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Ring

, Digitalteknik L6:2, Ch 3.3

De�nition

The algebraic structure (R,+, ·) is a ring if the following criterias

are ful�lled:

Addition: a+ b = b + a (commutative)

(a+ b) + c = a+ (b + c) (associative)

a+ 0 = a (0 exists)

a+ (−a) = 0 (−a exists)

Multiplication: (a · b) · c = a · (b · c) (associative)

a · 1 = 1 · a = a (1 exists)

Combination: a · (b + c) = a · b + a · c (distributive)

(b + c) · a = b · a+ c · a

Page 3: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

The football match

Problem

A football manager is forming his squad. 4 players (A,B,C,D)

compete for 2 positions. The manager has reached the following

conclusions:

I Either A or B must play, but not both

I If C does not play, then D must

I B must play together with C, or none of them can play

I If D plays, then C should not play

I If B does not play, then D and C must play

I (There are only 2 positions available)

, Digitalteknik L6:3, Ch 3.3

Page 4: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean rings

De�nition

An element a in a ring (R,+, ·) is idempotent if a2 = a.

De�nition (3.8)

A Boolean ring is a ring where all elements are idempotent.

, Digitalteknik L6:4, Ch 3.3

Page 5: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean rings (example)

Example (3.31)

The ring (Z2,⊕,⊗) with

⊕ 0 1

0 0 1

1 1 0

⊗ 0 1

0 0 0

1 0 1

is a Boolean ring since

0⊗ 0 = 0

1⊗ 1 = 1

, Digitalteknik L6:5, Ch 3.3

Page 6: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean ring (example)

Example 3.32

The ring (Z6,⊕,⊗) is not a Boolean ring.

⊕ 0 1 2 3 4 5

0 0 1 2 3 4 5

1 1 2 3 4 5 0

2 2 3 4 5 0 1

3 3 4 5 0 1 2

4 4 5 0 1 2 3

5 5 0 1 2 3 4

⊗ 0 1 2 3 4 5

0 0 0 0 0 0 0

1 0 1 2 3 4 5

2 0 2 4 0 2 4

3 0 3 0 3 0 3

4 0 4 2 0 4 2

5 0 5 4 3 2 1

Let B be the idempotent elements in Z6, i.e., B = {0, 1, 3, 4}.De�ne addition and multiplication according to

a+ b = a⊕ b ⊕ 4⊗ (a⊗ b)

a · b = a⊗ b

, Digitalteknik L6:6, Ch 3.3

Page 7: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Ex 3.32 (cont'd)

Example 3.32

Then (B,+, ·) with

+ 0 1 3 4

0 0 1 3 4

1 1 0 4 3

3 3 4 0 1

4 4 3 1 0

· 0 1 3 4

0 0 0 0 0

1 0 1 3 4

3 0 3 3 0

4 0 4 0 4

is a Boolean ring.

, Digitalteknik L6:7, Ch 3.3

Page 8: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

a + a = 0

Theorem (3.16)

If (B,+, ·) is a Boolean ring and a ∈ B then

a+ a = 0

That is, all elements have characteristic 2.

All elements are their own additive inverses, −a = a.There is no meaning to use minus in a Boolean ring.

, Digitalteknik L6:8, Ch 3.3

Page 9: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Proof of Thm 3.16

In a Boolean ring

(a+ b)2 = a+ b

But

(a+ b)2 = (a+ b)(a+ b)

= a2 + ab + ba+ b2

= a+ ab + ba+ b

That is

a+ ab + ba+ b = a+ b

Theorem 3.7 (cancellation law) gives

ab + ba = 0

Let b ← aa2 + a2 = a+ a = 0

, Digitalteknik L6:9, Ch 3.3

Page 10: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean rings are commutative

Theorem (3.17)

A Boolean ring (B,+, ·) is a commutative ring. That is, if a, b ∈ Bthen

a · b = b · a

, Digitalteknik L6:10, Ch 3.3

Page 11: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean ring (Summary)

, Digitalteknik L6:11, Ch 3.3

Boolean ring

The ring (R,+, ·) is an algebraic structure where

Addition: a+ b = b + a (commutative)

(a+ b) + c = a+ (b + c) (associative)

a+ 0 = a (0 exists)

a+ (−a) = 0 (−a exists)

Multiplication: (a · b) · c = a · (b · c) (associative)

a · 1 = 1 · a = a (1 exists)

a2 = a (idempotent)

Combination: a · (b + c) = a · b + a · c (distributive)

(b + c) · a = b · a+ c · aTheorem: a+ a = 0 (Characteristic 2)

a · b = b · a Commutative ring

Page 12: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean algebra

De�nition (3.9)

A Boolean algebra (B,∧,∨,′ ) consists of a set B and three

operations AND (∧), OR (∨), and NOT (′) where

a ∧ 1 = a a ∨ 0 = a

a ∧ a′ = 0 a ∨ a′ = 1

a ∧ b = b ∧ a a ∨ b = b ∨ a

a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)

, Digitalteknik L6:12, Ch 3.3

Page 13: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Boolean operations

Theorem

If (B,+, ·) is a Boolean ring, then the Boolean operations AND,

OR, and NOT can be derived as

a ∧ b = a · b AND

a ∨ b = a+ b + a · b OR

a′ = 1+ a NOT

, Digitalteknik L6:13, Ch 3.3

Page 14: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

(Z2,⊕,⊗)→ (Z2,∧,∨,′ )

Example

In the Boolean ring (Z2,⊕,⊗) the Boolean operations are

a ∧ b = a⊗ b AND

a ∨ b = a⊕ b ⊕ a⊗ b OR

a′ = 1⊕ a NOT

Or

∧ 0 1

0 0 0

1 0 1

∨ 0 1

0 0 1

1 1 1

0 1

1 0

, Digitalteknik L6:14, Ch 3.3

Page 15: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Ring operations

Theorem

If (B,∧,∨,′ ) is a Boolean algebra, then the operations + and · canbe derived as

a · b = a ∧ b

a+ b = (a ∧ b′) ∨ (a′ ∧ b)

, Digitalteknik L6:15, Ch 3.3

Page 16: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

(Z2,∧,∨,′ )→ (Z2,⊕,⊗)

Example

In the Boolean algebra (Z2,∧,∨,′ ) the ring operations are

a⊗ b = a ∧ b MULT

a⊕ b = ab′ ∨ a′b ADD

Or

⊗ 0 1

0 0 0

1 0 1

⊕ 0 1

0 0 1

1 1 0

Often ∧ and () are omitted. For example, a ∨ bc is equivalent to

a ∨ (b ∧ c).

, Digitalteknik L6:16, Ch 3.3

Page 17: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

(B ,∧,∨,′ )

Example

In the Boolean ring (B,+, ·), which builds from the idempodent

elements in (Z6,⊕,⊗) and

a+ b = a⊕ b ⊕ 4⊗ (a⊗ b)

a · b = a⊗ b

The Boolean operations are

a ∧ b = a · b =a⊗ b

a ∨ b = a+ b + a · b =a⊕ b ⊕ (5⊗ a⊗ b)

a′ = 1+ a =1⊕ 5⊗ a

, Digitalteknik L6:17, Ch 3.3

Page 18: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

(B ,∧,∨,′ )

∧ 0 1 3 4

0 0 0 0 0

1 0 1 3 4

3 0 3 3 0

4 0 4 0 4

∨ 0 1 3 4

0 0 1 3 4

1 1 1 1 1

3 3 1 3 1

4 4 1 1 4

0 1

1 0

3 4

4 3

, Digitalteknik L6:18, Ch 3.3

Page 19: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Principle of duality

Theorem (3.18)

For each true expression in 0, 1, ∧, ∨, and ′ in a Boolean algebra

(B, 0, 1,∧,∨,′ ) we also get a true expression if we exchange all

0⇔ 1

∧ ⇔ ∨

, Digitalteknik L6:19, Ch 3.3

Page 20: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Derivation rules for a Boolean algebra

0′ = 1 1′ = 0

a′′ = a

a0 = 0 a ∨ 1 = 1

a1 = a a ∨ 0 = a

aa′ = 0 a ∨ a′ = 1

(Idempotence) aa = a a ∨ a = a

(de Morgan) (ab)′ = a′ ∨ b′ (a ∨ b)′ = a′b′

(Commutative) ab = ba a ∨ b = b ∨ a

(Associative) a(bc) = (ab)c a ∨ (b ∨ c) = (a ∨ b) ∨ c

(Distributive) a(b ∨ c) = ab ∨ ac a ∨ bc = (a ∨ b)(a ∨ c)

(Absorption) a ∨ ab = a a(a ∨ b) = a

(Consensus) ab ∨ a′c = ab ∨ a′c ∨ bc (a ∨ b)(a′ ∨ c) = (a ∨ b)(a′ ∨ c)(b ∨ c)

, Digitalteknik L6:20, Ch 3.3

Page 21: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Example of Boolean calculation

Example

Show that (xz ′ ∨ xy ′)′ = x ′ ∨ yz .

(xz ′ ∨ xy ′)′ = (xz ′)′(xy ′)′ (deMorgan)

= (x ′ ∨ z)(x ′ ∨ y) (deMorgan)

= x ′x ′ ∨ x ′y ∨ x ′z ∨ yz (distributive)

= x ′ ∨ x ′y ∨ x ′z ∨ yz (idempotence)

= x ′ ∨ x ′z ∨ yz (absorbation)

= x ′ ∨ yz (absorbation)

, Digitalteknik L6:21, Ch 3.3

Page 22: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Iterative consensus

Example

One way to simplify Boolean expressions is to, for each term,

iteratively

I expand with all consensus terms,

ab ∨ a′c = ab ∨ a′c ∨ bc

I simplify with absorption,

a ∨ ab = a

Complete by removing all consensus terms.

, Digitalteknik L6:22, Ch 3.3

Page 23: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Example of iterative consensus

Example

Simplify f = x ′1x′2 ∨ x1x

′2x3 ∨ x1x2x3

f = x ′1x′2

A

∨ x1x′2x3B

∨ x1x2x3C

∨ x ′2x3D = C(A, B)

(Add consensus for A)

= x ′1x′2

A

∨ x1x′2x3

B = x1D

∨ x1x2x3C

∨ x ′2x3D

(Remove with absoption)

= x ′1x′2

A

∨ x1x2x3C

∨ x ′2x3D

∨ x1x3E = C(C ,D)

(Add consensus for C)

= x ′1x′2

A

∨ x1x2x3C = x2E

∨ x ′2x3D

∨ x1x3E

(Remove with absoption)

= x ′1x′2

A

∨ x ′2x3D

∨ x1x3E

(Cannot add more consensus)

= x ′1x′2

A

∨ x ′2x3D = C(A, E)

∨ x1x3E

(Remove consensus terms)

= x ′1x′2

A

∨ x1x3E

, Digitalteknik L6:23, Ch 3.3

Page 24: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Set operations

De�nition

LetM and N be subsets of U . ThenI the intersection ofM and N

M∩N = {x | x ∈M and x ∈ N}

I the union ofM and N

M∪N = {x | x ∈M or x ∈ N}

I the complement ofM

M′ = {x | x ∈ U and x 6∈ M}

I the power set of U

P(U) = {X | X ⊆ U}, Digitalteknik L6:24, Ch 3.3

Page 25: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Set operations

Theorem (3.21)

The algebraic system (P(U),∩,∪,′ ) is a Boolean algebra with

�0�= ∅ and �1�= U .

, Digitalteknik L6:25, Ch 3.3

Page 26: Digitalteknik EIT020 · compete for 2 positions. The manager has reached the following conclusions: I Either A or B must pla,y but not both I If C does not pla,y then D must I B must

Set operations

Example

Let U = {0, 1, 2}. Then

P(U) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}

Then, one of de Morgans laws can be used as

({0} ∪ {1})′ = {0, 1}′ = {2}

{0}′ ∩ {1}′ = {1, 2} ∩ {0, 2} = {2}

, Digitalteknik L6:26, Ch 3.3


Recommended