Search Knowledge

© 2026 LIBREUNI PROJECT

Boolean Algebra

Boolean Algebra

Boolean algebra is the algebraic structure that handles binary variables and logic operations. It is the mathematical foundation of digital circuit design.

Basic Operations

The primary operations are:

  • AND (\cdot or \land): 11=11 \cdot 1 = 1, else 00.
  • OR (++ or \lor): 0+0=00 + 0 = 0, else 11.
  • NOT (xˉ\bar{x} or ¬x\neg x): 1ˉ=0,0ˉ=1\bar{1} = 0, \bar{0} = 1.
python
1def boolean_table(func):
2 print("A | B | Result")
3 print("---------")
4 for a in [0, 1]:
5 for b in [0, 1]:
6 print(f"{a} | {b} | {func(a, b)}")
7 
8# XOR Implementation
9xor_func = lambda a, b: (a or b) and not (a and b)
10boolean_table(xor_func)

Algebraic Laws

  1. Idempotence: x+x=x,xx=xx + x = x, x \cdot x = x.
  2. De Morgan’s Laws: x+y=xˉyˉ\overline{x + y} = \bar{x} \cdot \bar{y} and xy=xˉ+yˉ\overline{x \cdot y} = \bar{x} + \bar{y}.
  3. Absorption: x+(xy)=xx + (x \cdot y) = x.
python
1def de_morgan_test(x, y):
2 lhs = not (x or y)
3 rhs = (not x) and (not y)
4 return lhs == rhs
5 
6print(f"De Morgan (0, 0): {de_morgan_test(0, 0)}")
7print(f"De Morgan (1, 0): {de_morgan_test(1, 0)}")
8print(f"De Morgan (1, 1): {de_morgan_test(1, 1)}")

Sum of Products (SOP) and Simplification

Every boolean function can be represented as a Sum of Products (canonical form). Simplification is typically done using Karnaugh Maps or the Quine-McCluskey algorithm.

What is the result of (A + B) * (A + C) according to distribution laws?

Which gate is considered 'Universal' because it can implement any other gate?