e164e8381237eb2385a7f265d7d9487e.ppt
- Количество слайдов: 70
Boolean Algebra
Boolean algebra • Boolean algebra, like any other deductive mathematical system, may be defined with – a set of elements, – a set of operators, and – a number of unproved axioms or postulates.
A set of elements • A set of elements is any collection of objects having a common property. – If S is a set, and x and y are certain objects, – then x S denotes that x is member of the set S, and – y S denotes that y is not an element of S. – a set with a denumerable (countable) number of elements is specified by braces: A = {1, 2, 3, 4}, i. e. , the elements of set A are the numbers 1, 2, 3, and 4.
operator • A binary operator defined on a set S of elements is a rule that assigns to each pair of elements from S a unique element from S. – as an example, consider the relation a * b = c. – we say that * is a binary operator if it specifies a rule for finding c from the pair (a, b) and also if a, b, c S. – however, * is not a binary operator if a, b S, whereas the rule finds c S.
postulates • The postulates of a mathematical system form the basic assumptions from which it is possible to deduce the rules, theorem, and properties of the system. • The postulates are basic axioms of the algebraic structure and need no proof. • The theorem must be proven from the postulates.
common postulates • The most common postulates used to formulate various algebraic structures are: 1. Closure 2. Associative law 3. Commutative law 4. Identity element 5. Inverse 6. Distributive law -
Closure • A set S is closed with respect to a binary operator if, for every pair of elements of S, the binary operator specifies a rule for obtaining a unique element of S. • for example, the set of natural numbers N = { 1, 2, 3, …} is closed with respect to the binary operator plus (+) by the rules of arithmetic addition, since for any a, b N we obtain a unique c N by the operation a + b = c. • the set of natural numbers is not closed with respect to the binary operator minus (-) by the rules of arithmetic subtraction because 2 -3 = -1 and 2, 3 N , while -1 N.
Associative law • A binary operator * on a set S is said to be associative whenever (x * y) * z = x * (y * z) associative for all x, y, z S - causing association. - Independent of the grouping of elements.
Commutative law • A binary operator * on a set S is said to be commutative whenever x*y = y*x for all x, y S commute - to make substitution or exchange commutative - exchangeable
Identity element • A set S is said to have an identity element with respect to binary operation * on S if there exists an element e S with the property e*x=x*e=x for every x S Example: the element 0 is an identity element with respect to operation + on the set of integers I = { …, -2, -1, 0, 1, 2, …. } since x+0 = 0+x = x for any x I The set of natural numbers N has no identity element since 0 is excluded from the set.
Inverse • A set S having the identity element e with respect to a binary operator * is said to have an inverse whenever, for every x S, there exists an element y S such that x*y= e for every x S Example: In the set if integers I with e = 0, the inverse of an element a is (-a) since a + (-a) = 0. Example: In the set if biniry digits B with e = 1, the inverse of an element a is (a’) since a + (a’) = 1. Example: In the set if biniry digits B with e = 0, the inverse of an element a is (a’) since a. (a’) = 0.
Distributive law • If * and. are two binary operators on a set S, * is said to be distributive over. whenever x * (y. z) = (x * y). (y * z)
Axiomatic definition of Boolean Algebra • In 1854 George Boole introduced a systematic treatment of logic and developed for this purpose an algebraic system called Boolean Algebra. • In 1938 C. E. Shanon introduced a two-valued Boolean algebra called Switching Algebra, in which he demonstrated the properties of bistable electrical switching circuits can be represented by this algebra. • For the formal definition of Boolean algebra, we shall employ the postulates formulated by E. V. Huntington in 1904.
Axiomatic definition of Boolean Algebra • Boolean Algebra is an algebraic structure defined on a set of elements B together with two binary operators + and. Provided the following (Huntington) postulates are satisfied: 1. (a) Closure with respect to the operator + (b) Closure with respect to the operator. 2. (a) An identity element with respect to the operator + , designated by 0: x + 0 = 0 + x = x (b) An identity element with respect to the operator. , designated by 1: x. 1 = 1. x = x 3. (a) Commutative with respect to +: x + y = y + x (b) Commutative with respect to. : x. y = y. x 4. (a). is distributive over +: x. (y + z) = (x. y) + (x. z) (b) + is distributive over. : x + (y. z) = (x + y). (x + z) 5. For every element x B, there exists an element x’ B (called the complement of x) such that (a) x + x’ = 1 and (b) x. x’ = 0 6. There exists at least two elements x, y B such that x y
Boolean algebra vs. arithmetic algebra • Comparing Boolean algebra with arithmetic and ordinary algebra ( the field of real numbers), we note the following differences: 1. Huntington postulates do not include the associative law. However, this law holds for Boolean algebra and can be derived (theorem, for both operators) from the other postulates. 2. The distributive law of + is distributive over. : x + (y. z) = (x + y). (x + z), valid for Boolean algebra, but not for ordinary algebra. 3. Boolean algebra does not have additive or multiplicative inverses; therefore, there are no subtraction or division operations. 4. Postulate 5 defines an operator called complement that is not available in ordinary algebra. 5. Ordinary algebra deals with the real numbers, which constitute an infinite set of elements. Boolean algebra deals with the as yet undefined set of elements B, but in the two-valued Boolean algebra, B is defined as a set with only two elements, 0 and 1.
similarity • The choice of symbols + and. is intentional to facilitate Boolean algebraic manipulations.
Requirements • In order to have a Boolean Algebra, one must show: 1. The elements of the set B, 2. the rules of operation for the two binary operators, and 3. that the set of elements B, together with the two operators, satisfies the six Huntington postulates. • One can formulate many Boolean algebras, depending on the choice of elements of B and the rules of operation.
Two-valued Boolean Algebra • A two-valued Boolean algebra is defined on a set of two elements, B = {0, 1}, with rules for the two binary operators + and. As shown in the following operator tables. The rule for the complement operator is for verification of postulate 5: • We are interested in a two-valued Boolean algebra to apply to gatetype circuits.
Switching Algebra
Switching Algebra • The two-valued Boolean algebra is also called “Switching algebra” by engineers and computer scientists.
Two-valued Boolean Algebra 1. Closure is obvious from the tables since the result of each operation(+and. ) is either 1 or 0 and 1, 0 B 2. From the tables we see that (a) 0 + 0 = 0 0+1=1+0=1 identity 0 for + (b) 1. 1 = 1 1. 0=0. 1=0 identity 1 for. 3. (a) Commutative with respect to +: x + y = y + x holds (b) Commutative with respect to. : x. y = y. x holds 4. (a). is distributive over +: x. (y + z) = (x. y) + (x. z) holds (b) + is distributive over. : x + (y. z) = (x + y). (x + z) holds 5. For every element x B, there exists an element x’ B (called the complement of x) such that (a) x + x’ = 1 and (b) x. x’ = 0 6. There exists at least two elements x, y B such that x y Boolean algebra has two distinct elements, 1 and 0 with 1 0
Switching algebra • “switching algebra” – deals with boolean values -- 0, 1 • Positive-logic convention – analog voltages LOW, HIGH --> 0, 1 • Negative logic -- seldom used • Signal values denoted by variables (X, Y, FRED, etc. )
Boolean operators • Complement: • AND: • OR: X¢ (opposite of X) X×Y binary operators, described X+Y functionally by truth table. • Axiomatic definition: A 1 -A 5, A 1¢-A 5¢
More definitions • Literal: a variable or its complement X, X¢, FRED¢, CS_L • Expression: literals combined by AND, OR, parentheses, complementation X+Y P×Q×R A+B×C ((FRED × Z¢) + CS_L × A × B¢ × C + Q 5) × RESET¢ • Equation: Variable = expression P = ((FRED × Z¢) + CS_L × A × B¢ × C + Q 5) × RESET¢
Logic symbols
Theorems with one variable • Proofs by perfect induction
Theorems with two or more variables
Theorems
Complement notations ~x x’ x x x’ prime notation is the easiest to type.
The proofs of theorems or, by other theorems or postulates x + x. y = x. 1+x. y = x. (1+y) = x. 1 =x or, by perfect induction x + x. y = x + x. 1 =x+x =x = x + x. 0 =x+0 =x
Duality • The Huntington postulates have been listed in pairs and designated by part (a) and part (b). • One part may be obtained from the other if the binary operators and the identity elements are interchanged. • This important property of Boolean algebra is called the duality principle. • Every algebraic expression deductible from the postulates of Boolean algebra remain valid if the operators and identity elements are interchanged • Note: before taking its dual parenthesize an expression fully, otherwise you might end up absurd result.
Duality • Swap 0 and 1, AND and OR – Result: Theorems still true X + 0 = X; X. 1 = X • Counterexample: X + X × Y = X (T 9) X × X + Y = X (dual) X + (X × Y) = X (T 9) X + Y = X (T 3¢) X × (X + Y) = X (dual) ? ? ? (X × X) + (X × Y) = X (T 8) X + (X × Y) = X (T 3¢) parentheses, operator precedence!
Operator precedence 1. 2. 3. 4. Parentheses NOT AND OR
N-variable Theorems • Prove using finite induction • Most important: De. Morgan’s theorems
De. Morgan’s theorem • An n-input AND gate whose output is complemented is equivalent to an n-input OR gate whose inputs are complemented. (x. y)’ = x’ + y’
De. Morgan Symbol Equivalence
Likewise for OR
De. Morgan Symbols
Boolean function • A Boolean function is an expression formed with binary variables, the binary operators OR and AND, and unary operator NOT, parentheses, and an equal sign. • For a given value of the variables, the function can be either 0 or 1. F = x. Y. z’
Simplify a Boolean function F = x. (x’ + y) = x. x’ + x. y = 0 + x. y = x. y F = x. y + x’. z + y. z consensus, T 11 = x. y + x’. z + y. z. (x + x’) = x. y + x’. z + y. z. x’ = x. y. (1 + z) + x’. z. (1 + y) = x. y + x’. z
Simplify a Boolean function F = x’. y. (z + y’x) + y’. z distributive. over + = x’. y. z + x’. y. y’. x + y’. z = x’. y. z + 0 + y’. z = z. (x’. y + y’) distributive + over. = z. ((x’ + y’). (y + y’)) = z. ((x’ + y’). 1) = z. (x’ + y’) = z. x’ + z. y’
Simplify a Boolean function F = a. b. c + a. b. d + a’. b. c’ + c. d + b. d’ = a. b. c + b. (d’ + a. d) + a’. b. c’ + c. d = a. b. c + b. ((a+d’). (d’ + d ) + a’. b. c’ + c. d = a. b. c + b. ((a+d’). 1) + a’. b. c’ + c. d = a. b. c + a. b + bd’ + a’. b. c’ + c. d = a. b. c + a. b + a’. b. c’ + bd’ + c. d = a. b. c + b. (a + a’. c’) + bd’ + c. d = a. b. c + b. (a + c’) + bd’ + c. d = a. b + b. c’ + a. b. c + bd’ + c. d = a. b + b. (c’ + a. c) + bd’ + c. d = a. b + b. (c’ + a) + bd’ + c. d = a. b + b. c’ + a. b + bd’ + c. d = a. b + b. c’ + b. d’ + c. d = a. b + b. (c’ + d’) + c. d = a. b + b. (c. d)’ + c. d = a. b + c. d
Truth table • The most basic representation of a logic function is the truth table. • This representation simply lists the output of the circuit for every possible input combination. • Normally, the input combinations are arranged in rows in ascending order, and the corresponding outputs are written in a column next to the rows. • The truth table for an n-variable logic function has 2 n rows. • Obviously truth tables are practical for logic functions with small n. • John Wakerly mentioned that for students it is about 10 and for everyone else it is about 4.
Truth table • The information contained in a truth table can also be conveyed algebraically.
Even more definitions (Sec. 4. 1. 6) • Literal • • is a variable or complement of a variable X, X’, Y, Y’, FRED’ Product term - a logical product of two or more literals X, X. Y. Z’ Sum-of-products expression -a logical sum of product terms X + X. Y. Z’ Sum term - a logical sum of two or more literals X, X+Y+Z’ Product-of-sums expression - a logical product of sum terms X. X+Y+Z’
Even more definitions (Sec. 4. 1. 6) • Normal term - a product or sum term in which no variables more than once X. Y. X+Y+Z’ normal X. X. Y + X. Y. Z’ not normal • Minterm (n variables) - a normal product term (1 s) with n literals; 2 n such terms 0 0 0, 0 0 1 truth table rows X’. Y’. Z’, X’. Y’. Z 3 -variable minterms (1 s) • Maxterm (n variables) - a normal sum term (0 s) with n literals; 2 n such terms 0 0 0, 0 0 1 truth table rows X+Y+Z, X+Y+Z’ 3 -variable maxterms (0 s)
Truth table vs. minterms & maxterms
Minterm and Maxterm • Each minterm is obtained from an AND term of the n variables, with each variable being primed if the corresponding bit of the binary number is a 0 and unprimed if a 1. • Each maxterm is obtained from an OR term of the n variables, with each variable being unprimed if the corresponding bit of the binary number is a 0 and primed if a 1.
Boolean function from truth table • A Boolean function may be expressed algebraically from a given truth table by forming a minterm for each combination of the variables that produces a 1 in the function, and then taking the OR of all those terms. • Any Boolean function can be expressed as a canonical sum (sum of minterms). • Any Boolean function can be expressed as a canonical product (product of maxterms).
Minterm and maxterm i • Minterm i to denote the minterm corresponding to row i of the truth table. m 0 = X’. Y’. Z’ m 1 = X’. Y’. Z truth table value is 0 0 0 truth table value is 0 0 1 • Maxterm i to denote the maxterm corresponding to row i of the truth table. M 0 = X+Y+Z M 1 = X+Y+Z’ truth table value is 0 0 0 truth table value is 0 0 1
Boolean function as a sum of minterms: • Any Boolean function can be expressed as a canonical sum. • The canonical sum of a logic function is a sum of the minterms corresponding to truth-table rows for which the function produces a 1 output. 10011011 i = 01234567 F = x, y, z (0, 3, 4, 6, 7) = X’. Y’. Z’ + X’. Y. Z + X. Y’. Z’ + X. Y. Z
Boolean function as a pruduct of maxterms: • Any Boolean function can be expressed as a canonical pruduct. • The canonical pruduct of a logic function is a pruduct of the maxterms corresponding to truth-table rows for which the function produces a 0 output. 10011011 i = 01234567 F = x, y, z (1, 2, 5) = (X+Y+Z’). (X+Y’+Z). (X’+Y+Z’)
F = x, y, z (0, 3, 4, 6, 7) = x, y, z (1, 2, 5) 10011011 i = 01234567 F’ = x, y, z (1, 2, 5) F’ = X’. Y’. Z + X’. Y. Z’ + X. Y’. Z (F’)’ = (X’. Y’. Z + X’. Y. Z’ + X. Y’. Z)’ F = (X+Y+Z’). (X+Y’+Z). (X’+Y+Z’) F = x, y, z (1, 2, 5)
Combinational-Circuit Analysis • We analyze a combinational logic circuit by obtaining a formal description of its logic function. • Once we have a description of the logic function: • we can determine the behaviour of the circuit for various input combinations. • We can manipulate the algebraic description to suggest different circuit structure. • We can convert to sum-of-products expression for PLDs. • We can use to analyze a larger system that includes it.
Combinational analysis • There a number of ways to obtain a formal description of the circuit’s function.
Obtaining truth table • Produce output from different input combinations (2 n).
Signal expressions • Multiply out: F = ((X + Y’). Z) + (X’. Y. Z’) = (X. Z) + (Y’. Z) + (X’. Y. Z’)
New circuit, same function
“Add out” logic function • Circuit:
Boolean function as a sum of minterms: • Any Boolean function can be expressed as a canonical sum. • The canonical sum of a logic function is a sum of the minterms corresponding to truth-table rows for which the function produces a 1 output. 01100101 F = x, y, z (0, 1, 2, 5, 7) = X’. Y’. Z’ + X’. Y’. Z + X’. Y. Z’ + X. Y’. Z + X. Y. Z
Boolean function as a pruduct of maxterms: • Any Boolean function can be expressed as a canonical pruduct. • The canonical pruduct of a logic function is a pruduct of the maxterms corresponding to truth-table rows for which the function produces a 0 output. 01100101 F = x, y, z (0, 3, 4, 6) = (X+Y+Z). (X+Y’+Z’). (X’+Y+Z). (X’+Y’+Z)
Shortcut: Symbol substitution
Different circuit, same function
Another example
Circuit Descriptions and Designs • What is the starting point for designing combinational logic circuit? • Usually, we are given a word description of a problem • occasionally, the description is a list of input combinations (ON, OFF), the verbal equivalent of a truth table or the canonical sum or product.
Example, 4 -bit prime number detector • Given a 4 -bit input combination N = N 3 N 2 N 1 N 0, this function produces a 1 output for N = 1, 2, 3, 5, 7, 11, 13 and 0 otherwise. • A logic function described in this way can be designed directly from the canonical sum or product expression. 0111 0101 0001 0100 i = 0123 4567 89 AB CDEF F = N N (1, 2, 3, 5, 7, 11, 13) = N’ 3 N’ 2 N’ 1 N 0 + N’ 3 N’ 2 N 1 N’ 0 + N’ 3 N’ 2 N 1 N 0 + … 3 2 1 0
Circuit Descriptions and Designs • The alarm output is 1 if the PANIC input is 1, or • if the ENABLE input is 1, the EXITING input is 0, and the house is not secure; • the house is secure if the WINDOW, DOOR, and GARAGE inputs are all 1. ALARM = PANIC + ENABLE. EXITING’. SECURE’ SECURE = WINDOW. DOOR. GARAGE ALARM = PANIC + ENABLE. EXITING’. (WINDOW. DOOR. GARAGE)’
Alarm Circuit
Modified Alarm Function ALARM = PANIC + ENABLE. EXITING’. (WINDOW. DOOR. GARAGE)’ ALARM = PANIC + ENABLE. EXITING’. (WINDOW’ + DOOR’ + GARAGE’) ALARM = PANIC + ENABLE. EXITING’. WINDOW’ + ENABLE. EXITING’. DOOR’ + ENABLE. EXITING’. GARAGE’
Modified Alarm Circuit
e164e8381237eb2385a7f265d7d9487e.ppt