Presentation is loading. Please wait.

Presentation is loading. Please wait.

BooleanAlgebra.

Similar presentations


Presentation on theme: "BooleanAlgebra."— Presentation transcript:

1 BooleanAlgebra

2 Boolean Algebra Boolean algebra provides the operations and the rules for working with the set {0, 1}. These are the rules that underlie electronic circuits, and the methods we will discuss are fundamental to VLSI design. We are going to focus on three operations: Boolean product, Boolean sum, and Boolean complementation

3 Boolean Operations The Boolean product, denoted by , has the following values (equivalent to logical AND): 1  1 = 1, 1  0 = 0, 0  1 = 0, 0  0 = 0 The Boolean sum, denoted by +, has the following values (equivalent to logical OR): 1 + 1 = 1, = 1, = 1, = 0 The complement is denoted by a bar (equivalent to logical NOT). It is defined by 0 =1 and 1 =0

4 Aside on George Boole Lived from in England, and later Ireland Worked in fields of differential analysis and algebraic logic Laid foundation for Symbolic Logic with papers written around 1850 – now called Boolean Algebra Even though Boole's work took place well before the development of the modern computer, Boolean algebra has become the basis of computer circuit design due to the fact that the native language of computers is expressed in 0s and 1s

5 Aside on Claude Shannon
Lived from As a graduate student at MIT in the late 1930s, he noticed the connection between Boolean algebra and telephone switching networks As part of his master's thesis at M.I.T., Shannon showed that Boolean algebra could be used to simplify electronic switches used in telephone exchanges at the time (same ideas can be used in computer circuits) Shannon's work on switching networks was only the beginning of his career. He went on to develop the mathematical foundations of communication and information theory

6 Boolean Variables and Expressions
Definition: Let B = {0, 1}. The variable x is called a Boolean variable if it assumes values only from B. The Boolean expressions in the variables x1, x2, …, xn are defined recursively as follows: 0, 1, x1, x2, …, xn are Boolean expressions. If E1 and E2 are Boolean expressions, then E 1 , E1∙E2, and E1 + E2 are Boolean expressions. Note that the ∙ is usually omitted when using variables – so E1∙E2 is usually written as E1E2

7 Boolean Expressions So, we can create Boolean expression in the variables x, y, and z using the “building blocks” 0, 1, x, y, and z, and the construction rules: Since x and y are Boolean expressions, so is xy Since z is a Boolean expression, so is 𝑧 Since xy and 𝑧 are Boolean expressions, so is xy + 𝑧 … and so on…

8 Boolean Expressions Precedence rules for Boolean Algebra Parentheses
Complement Multiplication Addition

9 Identities There are useful identities of Boolean expressions that can help us to transform an expression A into an equivalent expression B, e.g.: 𝒙 𝒚

10 Example Use the laws of Boolean algebra to simplify: xy + x y + zy
(x + x )y + zy Distributive Law 1 ∙ y + zy Complement Law y + zy Identity Law (1 + z)y Distributive Law 1 ∙ y Identity Law y Identity Law So, xy + x y + zy is equivalent to y

11 Boolean Functions Definition: A function from Bn, the set defined by {(x1, x2, …, xn) |xiB, 1  i  n}, to B is called a Boolean function of degree n. Boolean functions can be represented using expressions made up from Boolean variables and Boolean operations.

12 Boolean Functions and Expressions
Example: Give a Boolean expression for the Boolean function F(x, y) as defined by the following table: x y F(x, y) 1 Possible solution: F(x, y) = 𝑥 y

13 Boolean Functions and Expressions
Another Example: Possible solution I: F(x, y, z) = 𝑥𝑧+𝑦 1 F(x, y, z) z y x Possible solution II: F(x, y, z) = 𝑥𝑧 𝑦

14 Boolean Functions and Expressions
A Boolean function with k input variables will require a table with 2k rows 2k is very large, even for modest values of k Using a table to define a Boolean function is only feasible for functions with a small number of input variables

15 Boolean Functions and Expressions
There is a simple method for deriving a Boolean expression for a function that is defined by a table. This method is based on minterms. Definition: A literal is a Boolean variable or its complement. A minterm of the Boolean variables x1, x2, …, xn is a Boolean product y1y2…yn, where yi = xi or yi = 𝑋 𝑖 . Hence, a minterm is a product of n literals, with one literal for each variable.

16 Boolean Functions and Expressions
Consider F(x,y,z) again: F(x, y, z) = 1 if and only if: x = y = z = 0 or x = y = 0, z = 1 or x = 1, y = z = 0 Therefore, F(x, y, z) = 𝑥 𝑦 𝑧 + 𝑥 𝑦 𝑧+𝑥 𝑦 𝑧 1 F(x, y, z) z y x

17 Boolean Functions and Expressions
Another simple method for deriving a Boolean expression for a function that is defined by a table is based on maxterms. Definition: A maxterm of the Boolean variables x1, x2, …, xn is a Boolean sum y1 + y2 + y3 + … + yn where yi = xi or yi = 𝑋 𝑖 . Hence, a maxterm is a sum of n literals, with one literal for each variable.

18 Boolean Functions and Expressions
Consider F(x,y,z) again: F(x, y, z) = 0 if and only if: x = z = 0, y = 1 or x = 0, y = z = 1 or x = z = 1, y = 0 or x = y = 1, z = 0 or x = y = z = 1 Therefore, F(x, y, z) = 𝑥+ 𝑦 +𝑧 𝑥+ 𝑦 + 𝑧 ( 𝑥 +𝑦+ 𝑧 )( 𝑥 + 𝑦 +𝑧)( 𝑥 + 𝑦 + 𝑧 ) 1 F(x, y, z) z y x

19 Disjunctive Normal Form
Definition: A Boolean expression that is a sum of products of literals is said to be in disjunctive normal form which is sometimes abbreviated as DNF The term "disjunctive" comes from the language of logic and hints at the fact that Boolean algebra is mathematically the same as propositional logic More formally: A Boolean expression is in disjunctive normal form (DNF) if expressed as c1 + c cn where each cj is a product of literals

20 Conjunctive Normal Form
Definition: A Boolean expression that is a product of sums of literals is said to be in conjunctive normal form which is sometimes abbreviated as CNF More formally: A Boolean expression is in conjunctive normal form (DNF) if expressed as d1 ∙ d2 ∙ .... ∙ dn where each dj is a sum of literals

21 Boolean Functions Question: How many different Boolean functions of degree 1 are there? Solution: There are four of them, F1, F2, F3, and F4: x F1 F2 F3 F4 1

22 Boolean Functions Question: How many different Boolean functions of degree 2 are there? Solution: There are 16 of them, F1, F2, …, F16: 1 F2 F1 F3 y x F8 F7 F9 F5 F4 F6 F11 F10 F12 F14 F13 F15 F16

23 Boolean Functions Question: How many different Boolean functions of degree n are there? Solution: There are 2n different n-tuples of 0s and 1s. A Boolean function is an assignment of 0 or 1 to each of these 2n different n-tuples. Therefore, there are 22n different Boolean functions.

24 Functional Completeness
The Boolean operations of multiplication, addition, and complement are sufficient to express any Boolean expression This means the operations are functionally complete Is there a smaller set of operations which are also functionally complete? The answer is yes, there is.

25 Functional Completeness
By applying De Morgan’s laws we get the following: 𝑥+𝑦= 𝑥 ∙ 𝑦 and 𝑥𝑦= 𝑥 + 𝑦 That is, the operations multiplication and complement are functionally complete, as are the operations addition and complement Note that multiplication and addition are not functionally complete, as the complement cannot be expressed using those operations

26 Boolean Satisfiability
Problem of Boolean Satisfiability (SAT for short) is as follows: Given a Boolean function, is there a way to set the values of the input variables so that the function evaluates to 1? If there is a way to set the input variables that causes a Boolean function to evaluate to 1, then the function is said to be satisfiable. Otherwise, the function is unsatisfiable.

27 Boolean Satisfiability
The only known way to show the function f is not satisfiable is to consider every possible setting for the input variables Such an approach will take time proportional to 2n for a function with n input variables There may be some shortcuts possible, but no one knows a provably efficient method to solve SAT, despite years of research effort

28 Boolean Satisfiability
The reason that the SAT problem has been the subject of so much work on the part of computer scientists is that Boolean algebra is capable of expressing many important problems that arise in areas such as business, biology, medicine, and the physical sciences An efficient algorithm to solve SAT would instantly provide a way to solve a whole host of other problems.

29 Boolean Satisfiability
SAT is one of the first problems that was proven to be NP-complete This means that all problems in the complexity class NP, which includes a wide range of natural decision and optimization problems, are at most as difficult to solve as SAT

30 Boolean Satisfiability
There is no known algorithm that efficiently solves SAT It is generally believed that no such algorithm exists This has not been proven mathematically, and resolving the question whether SAT has an efficient algorithm is equivalent to the P versus NP problem, which is the most famous open problem in the theory of computing.

31 Computational Complexity
Note that this topic will be covered in GREAT detail in CSCI 4325 Computational complexity theory focuses on classifying computational problems according to their inherent difficulty, and relating those classes to each other A decision problem is a question in some formal system with a yes-or-no answer, depending on the values of some input parameters Is the integer N prime?

32 Complexity Classes P NP NP-complete NP hard
The set of decision problems which can be answered in polynomial time NP The set of decision problems which can be answered non-deterministically in polynomial time NP-complete A problem p in NP is NP-complete if every other problem in NP can be transformed (or reduced) into p in polynomial time NP hard A decision problem H is NP-hard when for every problem L in NP, there is a polynomial-time reduction from L to H There are decision problems that are NP-hard but not NP-complete, for example the halting problem

33 Complexity Classes By Behnam Esfahbod, CC BY-SA 3.0,

34 Using SAT to Express Scheduling
Consider a department with 5 classes, A, B, C, D, E, to be scheduled in one of two periods Each class needs to be scheduled in one of the periods, subject to certain constraints Some pairs of courses cannot be scheduled at the same time: (A, B), (B, E), (D, C), and (C, E) The problem is: Can an assignment of courses to periods be found?

35 Using SAT to Express Scheduling
This course scheduling problem can be expressed in the form of a Boolean satisfiability problem as follows: Each class needs to be scheduled in one of the periods resulting in terms looking like ( 𝑥 𝐵1 + 𝑥 𝐵2 )( 𝑥 𝐵1 𝑥 𝐵2 ) The first term evaluates to 1 if B is scheduled in at least one of the two periods. The second term evaluates to 1 if B is not scheduled during both periods.

36 Using SAT to Express Scheduling
To handle the scheduling conflicts we do the following Consider the pair (B, E) that cannot be scheduled at the same time. For each such conflicting pair, there are two terms: ( 𝑥 𝐵1 𝑥 𝐸1 )( 𝑥 𝐵2 𝑥 𝐸2 ) The first term will evaluate to 1 if B and E are not both scheduled during period 1. Similarly, the second term will evaluate to 1 if B and E are not both scheduled during period 2

37 Using SAT to Express Scheduling
Here is the final Boolean expression:

38 Logic Gates Electronic circuits consist of so-called gates. There are three basic types of gates: x -x inverter x y x+y OR gate x y xy AND gate

39 Logic Gates Every Boolean expression can be represented by a circuit composed of combinations of these gates The class of circuits called combinatorial circuits are those in which the output of the circuit depends only on the present combination of input values, and not on the state of the circuit These circuits can be represented by Boolean expressions.

40 Logic Gates Example: How can we build a circuit that computes the function xy+ x y ? xy + x y x y xy x y

41 Logic Gates Could this circuit be simplified? xy+ x y = (x+ x )y
So it can be simplified

42 Logic Gates What about an adder circuit? 0 + 0 = 0 1 + 0 = 1 0 + 1 = 1
1 + 1 = 0 with carry 1 So the sum can be calculated as the XOR of the inputs, while the carry is the AND of the inputs. But how do we create the XOR?

43 XOR Gate Since A XOR B is 1 only if A and B have opposite values, it seems that 𝐴⊕𝐵= 𝐴 𝐵+𝐴 𝐵 So, to add the bits, we have Sum = 𝐴⊕𝐵= 𝐴 𝐵+𝐴 𝐵 Carry = 𝐴𝐵

44 Half Adder Circuit So we get the circuit corresponding to
Sum = 𝐴⊕𝐵= 𝐴 𝐵+𝐴 𝐵 Carry = 𝐴𝐵

45 Full Adder Circuit The full adder includes circuitry to include a possible carry Carry Half Adder Sum B Carry Half Adder A


Download ppt "BooleanAlgebra."

Similar presentations


Ads by Google