boolean algebras and switching circuits

Post on 13-Nov-2014

2.007 Views

Category:

Documents

8 Downloads

Preview:

Click to see full reader

DESCRIPTION

Basics of Boolean Algebras and switching circuits.

TRANSCRIPT

Boolean Algebra

Dr Amber Habib

Mathematical Sciences Foundation

St. Stephen’s College

Delhi 110007

Algebra of Sets 1

Fix a set X and consider the behaviour of its

subsets relative to the operations of union

(∪), intersection (∩). For every A, B, C ⊂ X,

we have:

• Idempotent Law: A ∪A = A ∩A = A.

• Commutative Law:

A ∪B = B ∪A, A ∩B = B ∩A.

• Associative Law:

A ∪ (B ∪ C) = (A ∪B) ∪ C

A ∩ (B ∩ C) = (A ∩B) ∩ C

• Distributive Law:

A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)

A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)

1

Algebra of Sets 2

Moreover, there are two special subsets: ∅and X. Relative to these, the operations

obey:

• A ∪ ∅ = A, A ∩ ∅ = ∅.

• A ∪X = X, A ∩X = A.

In particular ∅ serves as identity for ∪, while

X does the same for ∩.

Finally, we have the operation of complemen-

tation: Every A ⊂ X has a unique comple-

ment A′ (with respect to X), and

• A ∪A′ = X, A ∩A′ = ∅.

2

Algebra of Logic 1

Now we consider propositional calculus. We

let ∨ stand for ‘or’ and ∧ stand for ‘and’.

Then for all statements A, B, C, we have:

• Idempotent Law: A ∨A = A ∧A = A.

• Commutative Law:

A ∨B = B ∨A, A ∧B = B ∧A.

• Associative Law:

A ∨ (B ∨ C) = (A ∨B) ∨ C

A ∧ (B ∧ C) = (A ∧B) ∧ C

• Distributive Law:

A ∧ (B ∨ C) = (A ∧B) ∨ (A ∧ C)

A ∨ (B ∧ C) = (A ∨B) ∧ (A ∨ C)

3

Algebra of Logic 2

We write T for the statement which is neces-

sarily true and F for the one which is neces-

sarily false. Relative to these, the operations

obey:

• A ∨ F = A, A ∧ F = F .

• A ∨ T = T , A ∧ T = A.

In particular F serves as identity for ∨, while

T does the same for X.

Finally, we have the operation of negation:

Every statement A has a unique negation ¬A,

and

• A ∨ ¬A = T , A ∧ ¬A = F .

4

Boolean Algebras

An abstract Boolean Algebra is a set B with

• Two binary operations ∨ (“join”)and ∧(“meet”),

• Two special elements denoted 0 (“zero”)

and 1 (“unity”),

• An operation ′ (“complement”),

such that for all a, b, c ∈ B we have:

5

Laws of Boolean Algebra

• Idempotent Law: a ∨ a = a ∧ a = a.

• Commutative Law:

a ∨ b = b ∨ a, a ∧ b = b ∧ a.

• Associative Law:

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

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

• Distributive Law:

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

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

• a ∨ 0 = a, a ∧ 0 = 0.

• a ∨ 1 = 1, a ∧ 1 = a.

• a ∨ a′ = 1, a ∧ a′ = 0.

6

The Simplest Example

Let B = {0,1}. Define

• 0 ∧ 0 = 0 ∨ 0 =

1 ∧ 1 = 1 ∨ 1 =

• 0 ∧ 1 =

0 ∨ 1 =

• 0′ =

1′ =

7

The Simplest Example

Let B = {0,1}. Define

• 0 ∧ 0 = 0 ∨ 0 = 0,

1 ∧ 1 = 1 ∨ 1 = 1.

• 0 ∧ 1 =

0 ∨ 1 =

• 0′ =

1′ =

8

The Simplest Example

Let B = {0,1}. Define

• 0 ∧ 0 = 0 ∨ 0 = 0,

1 ∧ 1 = 1 ∨ 1 = 1.

• 0 ∧ 1 = 0,

0 ∨ 1 = 1.

• 0′ =

1′ =

9

The Simplest Example

Let B = {0,1}. Define

• 0 ∧ 0 = 0 ∨ 0 = 0,

1 ∧ 1 = 1 ∨ 1 = 1.

• 0 ∧ 1 = 0,

0 ∨ 1 = 1.

• 0′ = 1,

1′ = 0.

10

The Simplest Example 2

The previous example could also be obtained

as follows: Let B consist of the subsets of a

singleton set X = {x}. Let ∨ = ∪, ∧ = ∩,

and ′ stand for complement. Define

• 0 = ∅

• 1 = X

Then the rules for combining 0,1 are exactly

as on the previous slide.

11

Absorption Law

Let B be a Boolean algebra. If a, b ∈ B, then

a ∧ (a ∨ b) = a ∨ (a ∧ b) = a.

12

Absorption Law

Let B be a Boolean algebra. If a, b ∈ B, then

a ∧ (a ∨ b) = a ∨ (a ∧ b) = a.

Proof. First, by Distributive Law,

a ∧ (a ∨ b) = (a ∧ a) ∨ (a ∧ b) = a ∨ (a ∧ b).

13

Absorption Law

Let B be a Boolean algebra. If a, b ∈ B, then

a ∧ (a ∨ b) = a ∨ (a ∧ b) = a.

Proof. First, by Distributive Law,

a ∧ (a ∨ b) = (a ∧ a) ∨ (a ∧ b) = a ∨ (a ∧ b).

Then,

a ∧ (a ∨ b) = [a ∧ (a ∨ b)] ∨ [b ∧ b′]

14

Absorption Law

Let B be a Boolean algebra. If a, b ∈ B, then

a ∧ (a ∨ b) = a ∨ (a ∧ b) = a.

Proof. First, by Distributive Law,

a ∧ (a ∨ b) = (a ∧ a) ∨ (a ∧ b) = a ∨ (a ∧ b).

Then,

a ∧ (a ∨ b) = [a ∧ (a ∨ b)] ∨ [b ∧ b′]

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

∧(a ∨ b ∨ b′)

15

Absorption Law

Let B be a Boolean algebra. If a, b ∈ B, then

a ∧ (a ∨ b) = a ∨ (a ∧ b) = a.

Proof. First, by Distributive Law,

a ∧ (a ∨ b) = (a ∧ a) ∨ (a ∧ b) = a ∨ (a ∧ b).

Then,

a ∧ (a ∨ b) = [a ∧ (a ∨ b)] ∨ [b ∧ b′]

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

∧(a ∨ b ∨ b′)

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

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

= a ∨ (b ∧ b′)

= a ∨ 1 = a.

16

Cancellation Law

Let B be a Boolean algebra. Suppose there

are a, b, c ∈ B such that

a ∨ b = a ∨ c

a ∧ b = a ∧ c.

Then b = c.

17

Cancellation Law

Let B be a Boolean algebra. Suppose there

are a, b, c ∈ B such that

a ∨ b = a ∨ c

a ∧ b = a ∧ c.

Then b = c.

Proof. We repeatedly use the Absorption

Law:

b = b ∧ (a ∨ b)

18

Cancellation Law

Let B be a Boolean algebra. Suppose there

are a, b, c ∈ B such that

a ∨ b = a ∨ c

a ∧ b = a ∧ c.

Then b = c.

Proof. We repeatedly use the Absorption

Law:

b = b ∧ (a ∨ b)

= b ∧ (a ∨ c)

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

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

= c ∧ (a ∨ b)

= c ∧ (a ∨ c) = c.

19

Uniqueness of Complement

Let B be a Boolean algebra. Suppose a, b ∈ Bsuch that

a ∨ b = 1

a ∧ b = 0.

Then b = a′.

20

Uniqueness of Complement

Let B be a Boolean algebra. Suppose a, b ∈ Bsuch that

a ∨ b = 1

a ∧ b = 0.

Then b = a′.

Proof. We have

a ∨ b = a ∨ a′ = 1

a ∧ b = a ∧ a′ = 0.

Hence, by the Cancellation Law, b = a′.

Corollary: a′′ = a.

Corollary: 0′ = 1, 1′ = 0.

21

De Morgan’s Laws

Let B be a Boolean algebra and a, b ∈ B.

Then

• (a ∨ b)′ = a′ ∧ b′.

• (a ∧ b)′ = a′ ∨ b′.

22

De Morgan’s Laws

Let B be a Boolean algebra and a, b ∈ B.

Then

• (a ∨ b)′ = a′ ∧ b′.

• (a ∧ b)′ = a′ ∨ b′.

Proof. Let c = (a ∨ b)′. Then

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

= 0 ∨ 0 = 0,

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

= 1 ∧ 1 = 1.

23

Switching Circuits 1

Our aim is to study circuits such as the fol-lowing:

|b′

| |a b

|a

• Each mark, such as |a

represents aswitch (in this case, named a).

• Each switch has two states, “on” and“off” (or 1 and 0).

• If two switches always have the same state,we consider them to be the same. In par-ticular, they have the same name.

• If two switches always have opposite states,we call one the complement of the other,and denote it by a ′ (e.g. b and b′).

24

Switching Circuits 2

|b′

| |a b

|a

The specific question is: How do the states

of the individual switches affect the state of

the entire circuit? Or, which combinations

of states of individual switches lead to the

entire circuit being “on” (current can pass

from one end to the other) or “off” (current

cannot pass).

In the above example, the circuit is on exactly

when a is on, and b is off. Hence we could

just as well use the simpler circuit

| |a b′

25

Series Connection

| |a b

a ∧ b

Parallel Connection

|a

|b

a ∨ b

26

Series Connection

| |a b

a ∧ b

Parallel Connection

|a

|b

a ∨ b

A Series-Parallel Circuit

|b′

| |a b

|a

27

Series Connection

| |a b

a ∧ b

Parallel Connection

|a

|b

a ∨ b

A Series-Parallel Circuit

|b′

| |a b

|a

((a ∧ b) ∨ a) ∧ b′

28

Series-Parallel Circuits

Not only switches, but circuits can be placed

in series or parallel connections. Suppose we

have circuits A and B, which we denote by:

A B

We can connect them in series:

A B A ∧B

Or in parallel:

A

B

A ∨B

29

The Algebra of Switching Circuits 1

Consider two circuits A and B made fromswitches a, b, c, . . . . We consider them equalif for any choice of states of a, b, c, . . . , A andB have the same state.

We have defined two operations ∧ and ∨ onthe set of switching circuits. We have thefollowing identities for these operations:

• Idempotent Law: A ∨A = A ∧A = A.

A A =A

A

= A

• Commutative Law:

A ∨B = B ∨A, A ∧B = B ∧A.

• Associative Law:

A ∨ (B ∨ C) = (A ∨B) ∨ C

A ∧ (B ∧ C) = (A ∧B) ∧ C

30

The Algebra of Switching Circuits 2

Distributive Law

• A ∧ (B ∨ C) = (A ∧B) ∨ (A ∧ C)

|A

|B

|C

=|A

|B

|A

|C

• A ∨ (B ∧ C) = (A ∨B) ∧ (A ∨ C)

|A

|B

|C

=|A

|B

|A

|C

31

The Algebra of Switching Circuits 3Zero, Unity, Complements

We introduce two special switches:

• The switch named 1 is always on.

• The switch named 0 is always off.

It is easy to see that for any circuit A,

• A ∨ 0 = A, A ∧ 0 = 0.

• A ∨ 1 = 1, A ∧ 1 = A.

Two circuits are termed complementary ifthey are always in opposite states, and wethen name them A and A′. We have

• A ∨A′ = 1

• A ∧A′ = 0

32

The Boolean Algebra of Switching Circuits

The previous few slides show that switching

circuits follow the rules of Boolean algebra.

This enables us to develop systematic meth-

ods for analyzing them, especially for replac-

ing circuits by smaller ones with the same

behaviour.

For instance, consider the equality

|b′

| |a b

|a

= | |a b′

This can be derived by algebra:

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

by the Absorption Law.

33

Switching Circuits and Truth-Tables

Recall that truth-tables are a useful way of

exploring the structure of logic. Since switch-

ing circuits have the same algebraic struc-

ture, we can expect a similar role for truth-

tables in this context. For instance, the cir-

cuit given by the expression a ∧ b′ has the

table:

a�b 0 10 0 01 1 0

or

a b a ∧ b′

0 0 00 1 01 1 01 0 1

Similarly, the circuit (a ∧ b) ∨ (a′ ∧ b′) has the

table:

a�b 0 10 1 01 0 1

or

a b a ∧ b′

0 0 10 1 01 1 11 0 0

34

Karnaugh Maps

Given a switching circuit, we can generate

its table in a mechanical way. Conversely,

given its table, we can generate the Boolean

expression corresponding to the circuit.

Karnaugh maps are a way of using the table

to generate a simple or efficient expression

for the circuit.

35

Karnaugh Maps For Two Switches

We start by looking at some possibilities for

a circuit involving two switches a and b:

a′ ∧ b′

a�b 0 10 1 01 0 0

a ∧ b′

a�b 0 10 0 01 1 0

aa�b 0 10 0 01 1 1

b′

a�b 0 10 1 01 1 0

(a′ ∧ b′) ∨ (a ∧ b)a�b 0 10 1 01 0 1

a′ ∨ b′

a�b 0 10 1 11 1 0

1a�b 0 10 1 11 1 1

0a�b 0 10 0 01 0 0

36

Karnaugh Maps For Two Switches 2

From the tables on the last slide, we canconclude the following:

• Whenever 1’s occur in vertical or hori-zontal pairs, the pair of boxes representsa single switch (or its complement – soone switch drops out).

• Whenever 1’s occur in a 2 × 2, square,the square represents the constant 1 (twoswitches drop out).

We illustrate the use of these observationsby an example:

a�b 0 10 1 11 1 0

1 1 ⇒ a′

11

⇒ b′

Hence the circuit is represented by a′ ∨ b′.37

Karnaugh Maps For Three Switches

We use tables of the following format:

a�bc 00 01 11 1001

Example 1:

a�bc 00 01 11 100 1 1 11 1

1 1 ⇒ a′ ∧ c11

⇒ b′ ∧ c′

So the circuit is represented by

(a′ ∧ c) ∨ (b′ ∧ c′).

38

top related