Chapter 4 – Logic Functions and Boolean algebra Boolean algebra: An algebra in which all elements can take only one of two values (typically 0 and 1, or "true" and "false") and are subject to operations based on AND, OR and NOT is called Boolean algebra. Boolean algebra is the algebra of two values 0 and 1. The name “Boolean” comes from the name of a logician called George Boole, an English mathematician born in 1815. About George Boole: Born on 2nd November, 1815 in industrial town, Lincoln, of England. Famous mathematician and logician. Founder of Boolean algebra Died on December 8, 1864 (aged 49), in County Cork, Ireland) Proposition: A proposition is a statement that can either be true or false. It can be represented by letters. For e.g. (a) ‘A’ stands for the proposition “You are a student. [TRUE] (b) ‘B’ stands for the proposition “You are from Bhaktapur. [FALSE] “What is your name?” [NOT A PROPOSITION] Predicates: Predicates are also the declarative statement that can either be true or false, but differ from propositions in that they contain variables. For e.g. (a) ‘x>3’ is a predicate. Once the value is assigned to x (say 4) the predicate becomes the proposition 4>3, which is true. Negation: It is the conversion of a two-state (binary signal or proposition) to its opposite state. Let ‘p’ is any proposition, then the negation of ‘p’ is denoted by ~p and is read as not p, is a proposition which is false when p is true and true when p is false. Operations, Operands and Operators: An operation is any specific action (task) performed on operands by operators. For example, The subtraction 9-2 is an arithmetic operation. The result of the operation is 7. The operator is a symbol that signifies a particular operation. In this example the symbol ‘-‘ signifies the operations named ‘subtraction’ The operands are the data items on which the operator performs operation. In the example ‘9’ and ‘2’ are two operands. Boolean Operators: These are the operators used to perform complex logical calculations. AND, OR and NOT are the basic Boolean operators. Similarly some other Boolean operators are NAND, NOR, XOR and XNOR. Truth Table: Truth Table is a table of combinations showing all input and output possibilities for a Boolean expression. This document is downloaded from www.sushilupreti.com.np 1 of 7 mail@sushilupreti.com.np Logic gate: A logic gate is an electronic circuit that operates on one or more inputs signals and produces an output signal. The gates are AND, OR, NAND, NOR, NOT, XOR, XNOR. a) AND Gate: Definition: The AND gate is a logic device that has two or more inputs and one output. The AND gate produces a logic 1 at its output only when all of the inputs are high. A logic low state is produced when one or more of the inputs are low. Boolean Equation: X=ABC The symbol for an AND operation is a center dot (). Truth Table: A 1 1 1 1 0 0 0 0 Input B 1 1 0 0 1 1 0 0 Symbol: C 1 0 1 0 1 0 1 0 Output X 1 0 0 0 0 0 0 0 b) OR Gate: Definition: The OR gate is a logic device that has two or more inputs and one output. The OR gate produces a logic 1 when one or more of its inputs are high. A logic low state is produced only when all of the inputs are low. Boolean Equation: X=A+B+C The symbol for an OR operation is a +. Truth Table: A 1 1 1 1 0 0 0 0 Input B 1 1 0 0 1 1 0 0 Symbol: C 1 0 1 0 1 0 1 0 Output X 1 1 1 1 1 1 1 0 This document is downloaded from www.sushilupreti.com.np 2 of 7 mail@sushilupreti.com.np c) NOT Gate (Inverter): Definition: The inverter is a logic device that only has one input and one output. The inverter performs the logic function called inversion or complementation. If the input singal is low then high output signal is obtained and vice versa. Boolean Equation: A complement bar (also called an overbar) is placed over the assigned input letter. The expression is reads as "X" is equal to NOT "A". Truth Table: Symbol: Input A 1 0 Output X 0 1 d) NAND Gate: Definition: The NAND gate is a logic device that has two or more inputs and one output. The NAND gate produces a logic 0 at its output only when all of the inputs are logic 1. A logic 1 is produced when any of the inputs are low. Boolean Equation: Truth Table: Input A B 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 Symbol: C 1 0 1 0 1 0 1 0 Output X 0 1 1 1 1 1 1 1 e) NOR Gate: Definition: The NOR gate is a logic device that has two or more inputs and one output. The NOR gate produces a logic 1 at its output only when all inputs are "low". A logic 0 is generated if any of the inputs is a "high". Boolean Equation: This document is downloaded from www.sushilupreti.com.np 3 of 7 mail@sushilupreti.com.np Truth Table: A 1 1 1 1 0 0 0 0 Input B 1 1 0 0 1 1 0 0 Symbol: C 1 0 1 0 1 0 1 0 Output X 0 0 0 0 0 0 0 1 f) XOR Gate: Definition: The Exclusive - OR (or Ex-OR) gate is a logic device that always has two inputs and one output. The XOR gate produces a logic 1 at its output only when the inputs are at opposite states. A logic 0 is produced when the two inputs are the same. Boolean Equation: Truth Table: A 1 1 0 0 Input B 1 0 1 0 Symbol: Output X 0 1 1 0 g) X-NOR Gate: Definition: The Exclusive - NOR ( or Ex-NOR) gate is a logic device that always has two inputs and one output. The X-NOR gate produces a logic 1 at its output only when the inptus are at same states. A logic 0 is produced when both inputs are of opposite states. Boolean Equation: Truth Table: A 1 1 0 0 Input B 1 0 1 0 Symbol: Output X 1 0 0 1 This document is downloaded from www.sushilupreti.com.np 4 of 7 mail@sushilupreti.com.np Boolean Laws a. Associative Law The associative law states that there is no effect of ORing or ANDing operation on the method of variable grouping. i. (A+B) + C = A + (B+C) ii. (A.B).C = A.(B.C) Proof: (i) (A+B) + C = A + (B+C) If A=1, B=0, C=1 then LHS = (1+0)+1 = 1 + 1 = 1 RHS = 1 + (0+1) = 1 + 1 = 1 LHS = RHS (ii) (A.B).C = A.(B.C) If A=1, B=0, C=1 then LHS = (1.0).1 = 0.1 = 0 RHS = 1.(0.1) = 1.0 = 0 LHS = RHS b. Distributive Law i. A.(B+C) = A.B + A.C Proof: If A=1, B=0, C=1 then LHS = 1.(0+1)= 1.1 = 1 RHS = 1.0+1.1= 0 + 1 = 1 LHS = RHS c. Commutative Law The commutative law states that the order in which you add or multiply input signals does not affect the result. i. A+B = B+A ii. A.B = B.A Proof: (i) A+B = B+A (ii) A.B = B.A If A=1, B=0 then If A=1, B=0 then Principle LHSof=Duality 1+0 = 1 LHS = 1.0 = 0 The dual ofRHS any statement algebra is the statement obtained interchanging +(OR) and .(AN = 0 + 1in=a Boolean 1 RHS = by 0.1 = 0 LHS = RHS LHS = RHS Principle of Duality The dual of any statement in a Boolean algebra is the statement obtained by interchanging +(OR) and .(AND), and simultaneously inter-changing the elements 0(FALSE) and 1(TRUE) in the statement. Example: (i) The dual of the statement (x . 1 )(0 + x') = 0 is given by (x + 0)(1 . x') = 1 (ii) The dual of the statement (x + y)(y + z) = x.z + y is x.y + y.z = (x + z).y This document is downloaded from www.sushilupreti.com.np 5 of 7 mail@sushilupreti.com.np Augustus De Morgan Born in Jan. 27, 1806 and died in March 18, 1871 He was entered in Trinity College at age 16 in 1823, and appointed professor of mathematics in university at the age of 22. He is famous for his theorems known as De Morgan theorems which is a foundation of many logic circuits used in electronic equipments. De Morgan’s Theorem First Theorem: The complement of a sum equals to the product of the complements. (A+B)’=A’.B’ Proof: A 0 0 1 1 B 0 1 0 1 A’ 1 1 0 0 B’ 1 0 1 0 A+B 0 1 1 1 (A+B) ’ 1 0 0 0 A’.B’ 1 0 0 0 Second Theorem: The complement of a product equals the sum of the complements. (A.B)’=A’+B’ Proof: A 0 0 1 1 B 0 1 0 1 A’ 1 1 0 0 B’ 1 0 1 0 A.B 0 0 0 1 (A.B) ’ 1 1 1 0 This document is downloaded from www.sushilupreti.com.np 6 of 7 A’+B’ 1 1 1 0 mail@sushilupreti.com.np Venn diagram A Venn diagram is an illustration of the relationships between and among sets, group of objects that share something in common. It is made up of two or more overlapping circles. It is mainly used to represent abstract information in a concrete form. This type of diagram is used in scientific and engineering presentations, in theoretical mathematics, in computer applications, and in statistics. Some Venn diagrams of logic gates are drawn below. A B A AND: Output = A.B B OR: Output = A+B A A’ B A NOT: Output = A’ A NAND: Output = (A.B)’ B A XOR: Output = A’B+AB’ NOR: Output = (A+B)’ A B B XNOR: Output = AB+A’B’ This document is downloaded from www.sushilupreti.com.np 7 of 7 mail@sushilupreti.com.np