Boolean Algebra and Logic Circuits . Duality

Post on 10-Jan-2016

82 views 2 download

Tags:

description

Discrete mathematics. Boolean Algebra and Logic Circuits . Duality. N.V. Bilous. Faculty of computer sciences Software department, KNURE. KNURE, Software department, Ph. 7021-446, e-mail: belous@kture.Kharkov.ua. Topic 1 Boolean Algebra and Logic Circuits. ХНУРЭ,кафедра ПО ЭВМ, - PowerPoint PPT Presentation

Transcript of Boolean Algebra and Logic Circuits . Duality

KNURE, Software department,Ph. 7021-446, e-mail: belous@kture.Kharkov.ua

N.V. Bilous

Faculty of computer sciences

Software department, KNURE

Boolean Algebra and Boolean Algebra and Logic CircuitsLogic Circuits. .

Duality Duality

Discrete mathematicsDiscrete mathematics

Topic 1Topic 1 Boolean Algebra and Boolean Algebra and

Logic CircuitsLogic Circuits

ХНУРЭ,кафедра ПО ЭВМ,Тел. 7021-446, e-mail: belous@kture.Kharkov.ua

3

Boolean Variables and FunctionsBoolean Variables and Functions

Let B = {0, 1}.

The variable x is called a Boolean variableBoolean variable or a logic variablelogic variable if it assumes values only from B.

Values 0 and 1 Boolean variables is called Boolean constantsBoolean constants.

4

Boolean Variables and FunctionsBoolean Variables and Functions

A function y=f(x1,x2,...,xn) is called a Boolean Boolean functionfunction or a logic functionlogic function if it assumes values from B and each of its variables also assumes values from B.

A Boolean function is called a Boolean Boolean function of degree nfunction of degree n if its formula contains n different variables.

5

The conjunctionThe conjunction

L(x1, x2)= x1x2

where L=1 if x1=1 and x2=1,

L=0 otherwise.

The “ ” symbol is called the conjunctionconjunction or ANDAND operatoroperator, and the circuit in Figure 1 is said to implement the conjunction.

Figure 1 – The conjunction (series connection)

6

The disjunctionThe disjunction

L(x1, x2) = x1x2

where L=1 if x1=1 or x2=1 or if x1=x2=1,

L=0 if x1=x2=1.

The symbol is called the disjunctiondisjunction or OR OR operatoroperator, and the circuit in Figure 2 is said to implement the disjunction.

Figure 2 – The disjunction (parallel connection)

7

The negationThe negation

L(x) = x

where L=1 if x=0

L=0 if x=1.

The value of this function is the inverse of the value of the input variable. Instead of using the word inverse, it is more common to use the term negationnegation or complementcomplement.

8

Methods of Boolean function Methods of Boolean function representationrepresentation

I. Truth tableI. Truth table

The values of a Boolean function are often displayed in the form of a table called the truth tabletruth table.

The rows amount in a truth table is equal to the amount of different interpretations of the function (2n).

9

The Boolean Functions for 1 variablesThe Boolean Functions for 1 variables

1.0 0  – the constant of zero;

2.1 = x  – the repetition of the argument;

3.2 =   – the negation of the argument;

4.3 1  – the constant of unity.

x 0 1 2 3

0 0 0 1 1

1 0 1 0 1

x

y=f(x)

10

The Boolean Functions of Degree 2The Boolean Functions of Degree 2

x y f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15

0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

z=f(x,y)

11

The Boolean Functions of Degree 2The Boolean Functions of Degree 2

Func-tion Denote Names of the functions

Another denote

Read

f0(x,y) 0 The constant of zero constant 0

f1(x,y) xy The conjunction (“logical and”) ·, &, &&,*, , AND,

min

x and y

f2(x,y) The negation of the implication > x and not y

f3(x,y) x The repetition of the first argument like x

f4(x,y) The negation of the inverse implication

< not x and y

f5(x,y) y The repetition of the second argument

like y

f6(x,y) xy The sum to the module two

(or “exclusive or”)

, < >, > <, !=, XOR

x not like y

f7(x,y) xy The disjunction (or “ logical or ") OR, +, max x or у

yx

yx

12

The Boolean Functions of Degree 2The Boolean Functions of Degree 2 Func-tion Denote Names of the functions

Another denote

Read

f8(x,y) xy The negation of the disjunction (or “ logical not-or ”, Piers pointer)

not x and not y

f9(x,y) xy The equivalence

, , Eqv, =

x like y

f10(x,y) The negation of the second argument y not y

f11(x,y) xy The inverse implication x, if y

(x or not y)

f12(x,y) The negation of the first argument x not x

f13(x,y) xy The implication

, , Imp

if x, then y

(not x or y)

f14(x,y) x | y The negation of the conjunction not x or not y

f15(x,y) 1 The constant of unity constant 1

x

y

yx

yx

13

Methods of Boolean function Methods of Boolean function representationrepresentation

II. Numbers of Boolean functions and interpretationsII. Numbers of Boolean functions and interpretations

Every function has a sequence number as a natural number a binary code of which is a column of function values in a truth table.

A least significant bit is consider a lowermost row (value of function on interpretation (1,1,.,1)), and senior — most overhead (value of function on interpretation (0,0,.,0)).

14

Methods of Boolean function Methods of Boolean function representationrepresentation

Every interpretation of Boolean function has the number – value of binary code which is interpretation.

Interpretation, which is written in the overhead row of truth table, has a number 0, after interpretation has number 1 and etc.

In a lowermost row interpretation is located with a number 2n–1, where n is an amount of variables which depends a Boolean function.

15

ExampleExample

Find the sequence number for function f(x,y), which has next values: f(0,0)=1, f(0,1)=1, f(1,0)=0, f(1,1)=1.

x y f(x,y)

0 0 1

0 1 1

1 0 0

1 1 1

Binary code for the value of this function – 1101.

11012 = 123 +122 +021 +120 = =8+4+0+1=1310

Thus,f13(x,y) = (1101)2

16

ExampleExample

Build the truth table for function f198(x,y)

x y z f (x,y,z)0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

000

0

11

11

2|49|12|99|0

2|198

2|12|02|24|1

2|6|0

1|12|3|0

17

Methods of Boolean function Methods of Boolean function representationrepresentation

III. Boolean function representation with using III. Boolean function representation with using formulas formulas

A formulaformula is expression which propose some function as superposition of another functions.

SuperpositionSuperposition is a method of new functions construction by the substitution of one function values in place of argument values of another function

18

ExampleExample

Consider the formula of boolean algebra for function f(x,y,z)

This formula has functions:

g(x1) – negation,

s(x1,x2) – conjunction,

l(x1,x2) – disjunction.

Present this formula as superposition of the indicated functions as follows:

f (x,y,z) = l(s(x,g(y)),z)

z)yx()z,y,x(f

19

Precedence ofPrecedence of operationsoperations

1.Negation.

2.Conjunction.

3.Disjunction.

4.Implication.

5.Equivalence.

~

ExampleExample

Clean all possible brackets

Add some brackets taking into account precedence of operations

)())(( yxzyx

yx~zyyx yx~)zy()yx( yx~))zy()yx(( )yx(~))zy()yx(( yx~zy)yx(

yxzyx

20

Equivalent functionEquivalent function

Two different Boolean expressions that represent the same function are called equivalentequivalent.

For instance, all the Boolean expressions xy1, xy0, and xy are equivalent.

21

Boolean IdentitiesBoolean Identities

1) Commutative laws xy = yx xy = yx

2) Associative laws x(yz)= (xy)z x(yz)=(xy)z

3) Distributive laws x(yz) = (xy)(xz)x(yz) = (xy)(xz)

22

Boolean IdentitiesBoolean Identities

4) Idempotent laws

xx =

xx =

5) The excluded middle law

6) The contradiction law

7) The absorption laws (elimination laws)

x(xy) =

x(xy) =

xx

xx

xx

1

0

x

x

23

Boolean IdentitiesBoolean Identities

8) Identity laws x0 = x1 =

9) Domination laws x1 = x0 =

10) Law of the double negation

11) De Morgan`s laws

x

yxyx

yxyx

xx

10

x

Topic 2Topic 2DualityDuality

ХНУРЭ,кафедра ПО ЭВМ,Тел. 7021-446, e-mail: belous@kture.Kharkov.ua

25

Dual Boolean functionDual Boolean function

Function f*(x1,…,xn) is called dualdual to function f(x1,…,xn), if

),...,(),...,( 11*

nn xxfxxf

26

Selfdual Boolean functionSelfdual Boolean function

A Boolean function is called selfdual if

),...,(),...,(*),...,( 111 nnn xxfxxfxxf

27

Selfdual Boolean functionSelfdual Boolean function

It is easy to define if a given Boolean function is selfdual or not by its truth table. For this we divide a truth table by half, using the symmetrical line. If any arc connects equal values, then the function is not selfdual. If every arc connects different values, then the function is selfdual.

28

Selfdual Boolean functionSelfdual Boolean function

Example.

Define if the function f14(x,y) is selfdual.

Solution.

Given function is not selfdual.

x y f14 = x|y

0 0 1

0 1 1

1 0 1

1 1 0

29

Example.Define, if function f(x,y,z) is selfdual.

Solution. f(x,y,z) — selfdual.

x y z f (x,y,z) f* (x,y,z)0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 1

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

Selfdual Boolean functionSelfdual Boolean function

0

1

1

1

0

0

0

1

30

Duality principleDuality principle

The function f is given by superposition of function f0,…,fn, where nN. Function f*, dual to f, can be obtained, changing functions f0,…,fn in the formula f for dual to f0*,…,fn*.

31

Example.Find dual functions.

Solution.

yxyxf ),(

Duality principleDuality principle

xxf )(

yx

0)( xf

)(* xf

0

),(* yxf yx ),( yxf

)(xfx x

)(* xf )(xf1

32

To obtain dual formula of Boolean algebra it is needed to change all conjunctions for disjunctions, disjunctions for conjunctions, 0 for 1, 1 for 0 in it, and use brackets where it is needed to keep previous order of fulfilling operations.

Rule of obtaining dual formulaRule of obtaining dual formula

33

Example.

Find function dual to function

Solution.

Let’s use previous rule of obtaining dual formula.

0)( zyxf

Rule of obtaining dual formulaRule of obtaining dual formula

1)()*0)((* zyxzyxf

34

If functions are equal then dual to them functions are equal too.

Let f1 and f2 are some functions expressing by such formulas. If

f1 = f2 , then

f1* = f2*

Rule of obtaining dual formulaRule of obtaining dual formula