an introduction to boolean algebras paolo prinetto politecnico di torino (italy) university of...

80
An introduction to An introduction to Boolean Algebras Boolean Algebras Paolo PRINETTO Politecnico di Torino (Italy) University of Illinois at Chicago, IL (USA) [email protected] [email protected] www.testgroup.polito.it Lecture 3.1

Upload: margaretmargaret-miller

Post on 24-Dec-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

An introduction to An introduction to Boolean AlgebrasBoolean AlgebrasAn introduction to An introduction to Boolean AlgebrasBoolean Algebras

Paolo PRINETTOPolitecnico di Torino (Italy)

University of Illinois at Chicago, IL (USA)

[email protected] [email protected]

www.testgroup.polito.it

Lecture

3.1

2 3.1

Goal

This lecture first provides several definitions of Boolean Algebras, and then focuses on some significant theorems and properties.

It eventually introduces Boolean Expressions and Boolean Functions.

3 3.1

Prerequisites

Students are assumed to be familiar with the fundamental concepts of:

Algebras, as presented, for instance, in:

F.M. Brown: “Boolean reasoning: the logic of boolean equations,” Kluwer Academic Publisher, Boston MA (USA), 1990, (chapter 1, pp. 1-21)

4 3.1

Prerequisites (cont’d)

Number systems and codes, as presented, for instance, in:

E.J.McCluskey: “Logic design principles with emphasis on testable semicustom circuits”, Prentice-Hall, Englewood Cliffs, NJ, USA, 1986, (chapter 1, pp. 1-28)

or

5 3.1

Prerequisites (cont’d)

[Haye_94] chapter 2, pp. 51-123

or

M. Mezzalama, N. Montefusco, P. Prinetto:“Aritmetica degli elaboratori e codifica dell’informazione”,UTET, Torino (Italy), 1989 (in Italian), (chapter 1, pp. 1-38).

6 3.1

Homework

Prove some of the properties of Boolean Algebras, presented in slides 39 ÷ 59.

7 3.1

Further readings

Students interested in a deeper knowledge of the arguments covered in this lecture can refer, for instance, to:

F.M. Brown: “Boolean reasoning: the logic of boolean equations,” Kluwer Academic Publisher, Boston MA (USA), 1990, (chapter 2, pp. 23-69 )

8 3.1

OutlineOutline

Boolean Algebras Definitions

Examples of Boolean Algebras

Boolean Algebras properties

Boolean Expressions

Boolean Functions.

9 3.1

Boolean Algebras Definitions Boolean Algebras Definitions

Boolean Algebras are defined, in the literature, in many different ways:

definition by lattices

definition by properties

definition by postulates [Huntington].

10 3.1

Definition by lattices

A Boolean Algebra is a complemented distributive lattice.

11 3.1

Definition through properties

A Boolean Algebra is an algebraic system

( B , + , · , 0 , 1 )

where:

B is a set, called the carrier

+ and · are binary operations on B

0 and 1 are distinct members of B

which has the following properties:

12 3.1

P1: idempotent

a B:

a + a = a

a · a = a

13 3.1

P2: commutative

a, b B:

a + b = b + a

a · b = b · a

14 3.1

P3: associative

a, b, c B:

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

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

15 3.1

P4: absorptive

a, b B:

a + (a · b) = a

a · (a + b) = a

16 3.1

P5: distributive

Each operation distributes w.r.t. the other one:

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

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

17 3.1

P6: existence of the complement

a B, a’ B |

a + a’ = 1

a · a’ = 0.

The element a’ is referred to as complement of a.

18 3.1

Definition by postulates

A Boolean Algebra is an algebraic system

( B , + , · , 0 , 1 )

where:

B is a set

+ and · are binary operations in B

0 and 1 are distinct elements in B

satisfying the following postulates:

19 3.1

A1: closure

a, b B:

a + b B

a · b B

20 3.1

A2 : commutative

a, b B:

a + b = b + a

a · b = b · a

21 3.1

A3: distributive

a, b, c B:

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

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

22 3.1

A4: identities

0 B | a B, a + 0 = a

1 B | a B, a · 1 = a

23 3.1

A5: existence of the complement

a B, a’ B |

a + a’ = 1

a · a’ = 0.

24 3.1

Some definitions

The elements of the carrier set B={0,1} are called constants

All the symbols that get values B are called variables (hereinafter they will be referred to as x1, x2, , xn )

A letter is a constant or a variable

A literal is a letter or its complement.

25 3.1

OutlineOutline

Boolean Algebras Definitions

Examples of Boolean Algebras

Boolean Algebras properties

Boolean Expressions

Boolean Functions.

26 3.1

Examples of Boolean Algebras

Examples of Boolean Algebras

Let us consider some examples of Boolean Algebras:

the algebra of classes

propositional algebra

arithmetic Boolean Algebras

binary Boolean Algebra

quaternary Boolean Algebra.

27 3.1

The algebra of classes

Suppose that every set of interest is a subset of a fixed nonempty set S.

We call

S a universal set

its subsets the classes of S.

The algebra of classes consists of the set 2S (the set of subsets of S) together with two operations on 2S , namely union and intersection.

28 3.1

This algebra satisfies the postulates for a Boolean Algebra, provided the substitutions:

B2S

+

·

0

1S

Thus, the algebraic system

( 2S, , , , S )

ia a Boolean Algebra.

The algebra of classes (cont'd)

29 3.1

PropositionsPropositions

A proposition is a formula which is necessarily TRUE or FALSE (principle of the excluded third), but cannot be both (principle of no contradiction).

As a consequence, Russell's paradox :

“this sentence is false”

is not a proposition, since if it is assumed to be TRUE its content implies that is is FALSE, and vice-versa.

30 3.1

Propositional calculus

Let:

P a set of propositional functions

F the formula which is always false (contradiction)

T the formula which is always true (tautology)

the disjunction (or)

the conjunction (and)

the negation (not)

31 3.1

The system

( P, , , F , T )

is a Boolean Algebra:

BP

+ · 0F

1T

Propositional calculus (cont'd)

32 3.1

Arithmetic Boolean Algebra

Let:

n be the result of a product of the elements of a set of prime numbers

D the set of all the dividers of n

lcm the operation that evaluates the lowest common multiple

GCD the operation that evaluates the Greatest Common Divisor.

33 3.1

The algebraic system:

( D, lcm, GCD, 1, n )

Is a Boolean Algebra:

BD

+lcm

· GCD

01

1n

Arithmetic Boolean Algebra (cont'd)

34 3.1

Binary Boolean Algebra

The system

( {0,1} , + , · , 0 , 1 )

is a Boolean Algebra, provided that the two operations + and · be defined as follows:

+ 0 1

0 0 1

1 1 1

· 0 1

0 0 0

1 0 1

35 3.1

Quaternary Boolean Algebra

The system

( {a,b,0,1} , + , · , 0 , 1 )

is a Boolean Algebra provided that the two operations + and · be defined as follows:

+ 0 a b 1 · 0 a b 1

0 0 a b 1 0 0 0 0 0

a a a 1 1 a 0 a 0 a

b b 1 b 1 b 0 0 b b

1 1 1 1 1 1 0 a b 1

36 3.1

OutlineOutline

Boolean Algebras Definitions

Examples of Boolean Algebras

Boolean Algebras properties

Boolean Expressions

Boolean Functions.

37 3.1

Boolean Algebras propertiesBoolean Algebras properties

All Boolean Algebras satisfy interesting properties.

In the following we focus on some of them, particularly helpful on several applications.

38 3.1

The Stone Representation Theorem

“Every finite Boolean Algebra is isomorphic to the Boolean Algebra of subsets of some finite set ”. [Stone, 1936]

39 3.1

Corollary

In essence, the only relevant difference among the various Boolean Algebras is the cardinality of the carrier.

Stone’s theorem implies that the cardinality of the carrier of a Boolean Algebra must be a power of 2.

40 3.1

Consequence

Boolean Algebras can thus be represented resorting to the most appropriate and suitable formalisms.

E.g., Venn diagrams can replace postulates.

41 3.1

Duality

Every identity is transformed into another identity by interchanging:

+ and ·

and the identity elements 0 and 1.

42 3.1

Examples

a + 1 = 1

a · 0 = 0

a + a’ b = a + b

a (a’ + b) = a b

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

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

43 3.1

The inclusion relation

On any Boolean Algebra an inclusion relation ( ) is defined as follows:

a b iff a · b’ = 0.

44 3.1

The inclusion relation is a partial order relation, i.e., it’s:

reflexive : a a

antisimmetric : a b e b a a = b

transitive : a b e b c a c

Properties of the inclusion relation

45 3.1

The relation gets its name from the fact that, in the algebra of classes, it is usually represented by the symbol :

A B A B’ =

AABB

The inclusion relation in the algebra of classes

46 3.1

In propositional calculus, inclusion relation corresponds to logic implication:

a b a b

The inclusion relation in propositional calculus

47 3.1

The following expressions are all equivalent:

a b

a b’ = 0

a’ + b = 1

b’ a’

a + b = b

a b = a .

Note

48 3.1

Properties of inclusion

a a + b

a b a

49 3.1

Complement unicity

The complement of each element is unique.

50 3.1

(a’)’ = a

Involution

51 3.1

(a + b)’ = a’ · b’

(a · b)’ = a’ + b’

De Morgan’s Laws

52 3.1

Generalized Absorbing

a + a’ b = a + b

a (a’+ b) = a b

53 3.1

Consensus Theorem

a b + a’ c + b c = a b + a’ c

(a + b) (a’ + c) (b + c) = (a + b) (a’ + c)

54 3.1

Equality

a = b iff a’ b + a b’ = 0

Note

The formula

a’ b + a b’

appears so often in expressions that it has been given a peculiar name: exclusive-or or exor or modulo 2 sum.

55 3.1

Boole’s expansion theorem

Every Boolean function f : Bn B :

f (x1, x2, …, xn)

can be expressed as:

f (x1, x2, …, xn) =

= x1’ · f (0, x2, …, xn) + x1 · f (1, x2, …, xn)

(x1, x2, …, xn) B

56 3.1

Dual form

f (x1, x2, …, xn) =

= [ x1’ + f (0, x2, …, xn) ] · [x1 + f (1, x2, …, xn) ]

(x1, x2, …, xn) B

57 3.1

Remark

The expansion theorem, first proved by Boole in 1954, is mostly known as Shannon Expansion.

58 3.1

Note

According to Stone’s theorem, Boole’s theorem holds independently from the cardinality of the carrier B.

59 3.1

Cancellation rule

The so called cancellation rule, valid in usual arithmetic algebras, cannot be applied to Boolean algebras.

This means, for instance, that from the expression:

x + y = x + z

you cannot deduce that

y = z.

60 3.1

Demonstration

x y z x+y x+z x+y = x+z y=z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

61 3.1

Demonstration

x y z x+y x+z x+y = x+z y=z

0 0 0 0 0 T T

0 0 1 0 1 F F

0 1 0 1 0 F F

0 1 1 1 1 T T

1 0 0 1 1 T T

1 0 1 1 1 TT FF

1 1 0 1 1 TT FF

1 1 1 1 1 T T

62 3.1

Demonstration

x y z x+y x+z x+y = x+z y=z

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

63 3.1

Demonstration

x y z x+y x+z x+y = x+z y=z

0 0 0 0 0

0 0 1 0 1

0 1 0 1 0

0 1 1 1 1

1 0 0 1 1

1 0 1 1 1

1 1 0 1 1

1 1 1 1 1

64 3.1

Demonstration

x y z x+y x+z x+y = x+z y=z

0 0 0 0 0 T T

0 0 1 0 1 F F

0 1 0 1 0 F F

0 1 1 1 1 T T

1 0 0 1 1 T T

1 0 1 1 1 TT FF

1 1 0 1 1 TT FF

1 1 1 1 1 T T

65 3.1

Demonstration

x y z x+y x+z x+y = x+z y=z

0 0 0 0 0 T T

0 0 1 0 1 F F

0 1 0 1 0 F F

0 1 1 1 1 T T

1 0 0 1 1 T T

1 0 1 1 1 TT FF

1 1 0 1 1 TT FF

1 1 1 1 1 T T

66 3.1

Some Boolean Algebras satisfy some peculiar specific properties not satisfied by other Boolean Algebras.

An example

The properties:

x + y = 1 iff x = 1 or y = 1

x · y = 0 iff x = 0 or y = 0

hold for the binary Boolean Algebra (see slide #28), only.

Specific properties

67 3.1

OutlineOutline

Boolean Algebras Definitions

Examples of Boolean Algebras

Boolean Algebras properties

Boolean Expressions

Boolean Functions.

68 3.1

Boolean Expressions

Given a Boolean Algebra defined on a carrier B, the set of Boolean expressions can be defined specifying:

A set of operators

A syntax.

69 3.1

Boolean Expressions

A Boolean expression is a formula defined on constants and Boolean variables, whose semantic is still a Boolean value.

70 3.1

Syntax

Two syntaxes are mostly adopted:

Infix notationInfix notation

Prefix notation.Prefix notation.

71 3.1

Infix notation

elements of B are expressions

symbols x1, x2, …, xn are expressions

if g and h are expressions, then:

(g) + (h)

(g) · (h)

(g)’

are expressions as well

a string is an expression iff it can be derived by recursively applying the above rules.

72 3.1

Syntactic conventions

Conventionally we are used to omit most of the parenthesis, assuming the “·” operation have a higher priority over the “+” one.

When no ambiguity is possible, the “·” symbol is omitted as well.

As a consequence, for instance, the expression

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

Is usually written as:

a b + c

73 3.1

Prefix notation

Expressions are represented by functions composition.

Examples:

U = · (x, y)

F = + (· ( x, ‘ ( y ) ), · ( ‘ ( x ), y ) )

74 3.1

OutlineOutline

Boolean Algebras Definitions

Examples of Boolean Algebras

Boolean Algebras properties

Boolean Expressions

Boolean Functions.

75 3.1

Boolean functions

Several definitions are possible.

We are going to see two of them:

Analytical definition

Recursive definition.

76 3.1

Boolean functions:Analytical definition

A Boolean function of n variables is a function f : Bn B which associates each set of valuesx1, x2, …, xn B with a value b B:

f ( x1, x2, …, xn ) = b.

77 3.1

Boolean functions:Recursive definition

An n-variable function f : Bn B is defined recursively by the following set of rules:

b B, the constant function defined as

f( x1, x2, …, xn ) = b, ( x1, x2, …, xn ) Bn

is an n-variable Boolean function

xi { x1, x2, …, xn } the projection function, defined as

f( x1, x2, …, xn ) = xi ( x1, x2, …, xn ) Bn

is an n-variable Boolean function

78 3.1

Boolean functions:Recursive definition (cont’d)

If g and h are n-variable Boolean functions, then the functions g + h, g · h, e g’, defined as

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

g(x1, x2, …, xn ) + h(x1, x2, …, xn )

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

g(x1, x2, …, xn ) · h(x1, x2, …, xn )

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

xi { x1, x2, …, xn } are also n-variable Boolean function

79 3.1

Boolean functions:Recursive definition (cont’d)

Nothing is an n-variable Boolean function unless its being so follows from finitely many applications of rules 1, 2, and 3 above.