Boolean Algebra. Boolean Algebra. Boolean Algebra. Boolean Algebra

Full text

(1)

Boolean Algebra can operate on logic (or Boolean) variables that can assume just 2 values:

1/0, true/false, on/off, closed/open

3

“ binary events ”, that is conditions that can assume just 2 values

Example

A light bulb can be turned on or off

4

1

2

n

A Boolean function can be defined in many ways, among them the truth table:

a list of the values that F produces for every possible combination of the variables

1

2

n

(2)

1

2

3

n

v3 v2 v1 F 0

0 0 0

0 1

1 1 0

0 1 1

0 1

0 0 1

1 0 0

0 1

0 1 1

1 1 1

0 1

1 1

To pass a certain exam, a student must match one of the following conditions:

s/he passes the written pre-test and then the oral discussion

s/he passes the written test and then the oral discussion

7

Each event is assigned a Boolean variable:

a  pre-test, 1=passed b  written test, 1=passed c  oral test, 1=passed e  exam, 1=passed

8

3

The truth table for the Boolean function “passing the exam” then is:

a b c e 0

0 0 0

0 1

0 0 0

0 1 1

0 1

0 1 1

1 0 0

0 1

0 1 1

1 1 1

0 1

0 1

Meaning of this row:

the student passed pre-test (a=1), didn’t pass (or try) written test (b=0) and passed oral test (c=1), thus s/he passes the whole exam (e=1)

(3)

Boolean Algebra

After looking carefully, condition a = 0, b = 0, and c = 1 cannot happen, because the oral examination can be tried only when the pre- test or the written test has been passed (or both)

For that combination the exam is not passed, but this is an impossible condition, so it could be useful to indicate a don’t care condition (usually represented by a “–”). A don’t care mark will be eventually replaced by either a 0 or a 1 as needed in a next stage

AND, OR, NOT

EXOR

NAND, NOR, EXNOR

11

Operator AND (logic product)

symbol: (like the algebraic product), it is often omitted

it combines 2 values and produces a result following the rules below:

0  0 = 0 0  1 = 0 1  0 = 0 1  1 = 1

Result is True if both operands are True

12

Example

“I go to sea if it is sunny AND it is warm”

X=“it is sunny”

Y=“it is warm”

Z=“I go to sea”

Z = X Y

Both condition must be true to have that “I go to the sea” be true

(4)

Operator OR (Inclusive OR, logic sum)

symbol: + (like the algebraic sum)

it combines 2 values and produces a result following the rules below:

0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1

Result is True if at least one operand is True

“I take car if it is raining OR it is cold”

Example

“I use car if it is raining OR it is cold”

X=“it is raining”

Y=“it is cold”

Z=“I use car”

Z = X + Y

At least one condition must be true to have that “I use car” be true

15

Operator NOT

symbol: a little line over the variable or the expression to be negated, or just a ’ sign

it applies to just one value and produces a result following the rules below:

0 = 1 1 = 0

Result is True if the operand is False, and vice versa

16

Operator EX-OR (Exclusive OR)

symbol: 

it combines 2 values and produces a result following the rules below:

0  0 = 0 0  1 = 1 1  0 = 1 1  1 = 0

Result is True if just one operand is True

(5)

A logic (or Boolean) expression is composed by:

logic variables

constants 0 and 1

logic operators

parentheses Examples

19

1

2

2 1

1

x F

x F

20

1

2

b a F

b a F

2 1

(6)

1

2

are said dual when:

each OR of F1 corresponds to an AND of F2 and vice versa

each 1 of F1corresponds to an 0 of F2and v.v.

the order of operator evaluation is the same

)) 0 ( (

) 1 (

2 1

c b a F

c b a F

Reduction can be accomplished in many ways, among them:

Boolean algebra axioms and theorems

Karnaugh maps

23

Axioms and theorems

1. x  0 = 0 x + 1 = 1

2. x  1 = x x + 0 = x

3. x  x = 0 x + x = 1

4. x  x = x x + x = x

5. x  y = y  x x + y = y + x

24

Boolean Algebra Axioms and Th.

6. xyz = (xy)  z = x+y+z = (x+y) + z =

= x  (yz) = = x + (y+z) =

= y  (xz) = y + (x+z)

7. De Morgan’s Theorem

xyz… = x+y+z+… x+y+z+… = xyz…

8. xy+xz = x(y+z) (x+y)(x+z) = x+yz

9. x+xy = x x(x+y) = x

10. xy + xy = x (x+y)(x+y) = x

11. x+xy = x+y x(x+y) = xy

12. xy = xy+xy = xy xy=xy=xy=xy+xy

(7)

Some demonstrations

9. x+xy = x1+xy = x(1+y) = x1 = x

8. (x+y)(x+z) = xx+xz+xy+yz =

= x+xz+xy+yz =

= x1 +xz+xy+yz =

= x(1+z+y)+yz = x1+yz = x+yz

10. xy+xy = x(y+y) = x1 = x

11. x+xy = x1+xy = x(1+y)+xy = x+xy+xy =

= x+y rule 10

b.

27

1. rule 11

rule 3b

rule 1b

2. rule 11b

rule 4 rule 1

Examples of reduction

1 1

) (

1

) (

) (

everything B A B A A

B A B A B B A

B A B A B A B A

C C B

C A BA

C B A B A

 0

) (

28

Another demonstration of rule 11

x+xy = x1+xy = x(y+y)+xy =

= xy+xy+xy = xy+xy+xy+xy = [rule 4b]

= x(y+y)+y(x+x) = x+y

Any term in OR may be duplicated, triplicated, etc.

following rule 4b (backward): x=x+x+x+…

Any term in AND may be duplicated, triplicated, etc. following rule 4a (backward): x=xxx…

(8)

31

SP Canonical Form

Logical sum of products (SP)

Each term (called minterm) is a product of all the variables (some could be affirmed, other negated)

32

PS Canonical Form

Logical product of sums (PS)

Each term (called maxterm) is a sum of all the variables (some could be affirmed, other

negated)

(9)

Because the function must give 1 for some specific combination of input values, for each row with output value 1:

write a product of all the variables (minterm)

Each minterm must give 1 for a specific combination of the input variables, so:

negate each variable whose value is 0 on the input combination corresponding to the minterm

Example

F(a,b,c) = abc+abc+abc+abc

a b c F

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 1

1 1 0 0

1 1 1 0

abc

35

Because the function must give 0 for some specific combination of input values, for each row with output value 0:

write a sum of all the variables (maxterm)

Each maxterm must give 0 for a specific combination of the input variables, so:

negate each variable whose value is 1 on the input combination corresponding to the maxterm

36

Example

F(a,b,c)=(a+b+c)(a+b+c)(a+b+c)(a+b+c)

a b c F

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 1

1 1 0 0

1 1 1 0

(10)

To canonicalize an SP expression

If in a product a variable is missing (e.g. x) multiply the product by (x+x) and solve removing duplicates

Example

F(x,y,z) = xyz+yz+z

= xyz+(x+x)yz+(x+x)(y+y)z

= xyz+xyz+xyz+xyz+xyz+xyz+xyz

To canonicalize a PS expression

If in a sum a variable is missing (e.g. x) add to the sum the term xx and solve removing duplicates

Example

F(x,y,z) = (x+y+z)  (x+z)  x

= (x+y+z)  (x+yy+z)  (x+yy+zz)

= (x+y+z)  (x+y+z)  (x+y+z)  etc.

39

40

(11)

43

44

1.

(12)

2.

Design a digital circuit with inputs:

1. a 2C value D composed by bits a and b

2. a selector: one bit s

and outputs:

1. a 2C value U composed by bits x and y

2. an overflow indicator: one bit w

U

D

s

U

–D

s

w

47

Updating...

References

Updating...

Related subjects :