Lecture 9 - Boolean Functions and Reversible Logic Gates

Boolean Functions

  • Definition: A Boolean function is a function of the form f:{0,1}n→{0,1}f : \{0, 1\}^n \to \{0, 1\}.

  • Number of Functions: For a given n, the total number of possible Boolean functions is 22n2^{2^n}.

Example Calculations
  • For n=1n = 1: There are 221=22=42^{2^1} = 2^2 = 4 functions:

    • f0:0→0f_0: 0 \to 0

    • f1:0→1f_1: 0 \to 1

    • f2:1→0f_2: 1 \to 0

    • f3:1→1f_3: 1 \to 1

  • For n=2n = 2: There are 222=24=162^{2^2} = 2^4 = 16 functions.

    • Common functions include: AND, OR, NOT, XOR, NAND, NOR.

  • As nn increases, the number of Boolean functions grows super-exponentially.

Normal Forms

  • Conjunctive Normal Form (CNF): Every Boolean function can be expressed as a conjunction of disjunctions of literals.

    • Example: f(x1,x2)=(x1∧x2)∨(¬x1∧x2)f(x1, x2) = (x1 \land x2) \lor (\lnot x1 \land x2) is in CNF.

  • Disjunctive Normal Form (DNF): Every Boolean function can also be represented as a disjunction of conjunctions of literals.

    • Example: f(x1,x2)=(x1∨x2)∧(¬x1∨x2)f(x1, x2) = (x1 \lor x2) \land (\lnot x1 \lor x2) is in DNF.

  • Algebraic Normal Form (ANF): Can express Boolean functions as a sum of products of elements of Z2Z_2 with variables.

    • Example: f(x1,x2)=x1⊕x2f(x1, x2) = x1 \oplus x2 where ⊕\oplus denotes addition modulo 2.

Functional Completeness

  • A set SS is functionally complete if every Boolean function can be expressed in terms of functions from SS.

  • The commonly used functions for functional completeness are NOT, AND, and OR.

  • Post’s Criterion: A set SS is functionally complete if it includes functions not entirely contained within any of the categories: zero-preserving, one-preserving, monotone, linear, and self-dual functions.

Decision Trees and Neural Networks

  • Boolean functions can be visualized as decision trees.

  • The set of all possible inputs forms the vertices of an n-dimensional cube in Rn\mathbb{R}^n.

  • Neural networks can be used to approximate or compute Boolean functions. Each Boolean function can be represented as a configuration of layers and neurons in a neural network.

Reversible Computing

  • Logical reversibility in computing suggests that the output can uniquely determine the input, thus avoiding information loss (e.g., NO bits erased).

  • Landauer's principle states that irreversible operations (like erasing bits) increase entropy and dissipate heat.

  • Example of reversible gates are:

    • CNOT Gate: Operates on two qubits and changes the second qubit based on the value of the first.

    • Toffoli Gate: A three-bit gate that flips one bit based on the values of the other two.

  • Logically reversible gates maintain a one-to-one relationship between inputs and outputs.

Summary

  • Covered key concepts of Boolean functions, CNFs, DNFs, ANFs, functional completeness, the relation between Boolean functions, decision trees, neural networks, and reversible computing, as well as practical implications and examples related to logic gates.