Back to Bug Lab

Boolean logic · Digital circuits

Logic Gates

Wire AND / OR / NOT / XOR. The primitives every CPU is built from.

Every CPU on Earth is built from a small set of logical primitives: AND, OR, NOT, XOR. Compose them and you can implement any computation. The patterns you wire here are the same patterns inside an addition circuit, a memory cell, and every Boolean condition you'll ever write in code.

What’s happening under the hood

  • Boolean algebra: 0 and 1, AND/OR/NOT operations. George Boole (1854) → Claude Shannon (1937, applied to switching circuits) → every digital computer that followed.
  • Functional completeness: NAND alone can express every logical operation. Real CPUs are built from billions of these primitives etched into silicon.
  • Boolean expressions in your code (`if (x > 0 && !done)`) compile down to these same gate operations on the CPU's ALU.

Dig deeper

Phase 0 · How Computers Think

The concept you just explored is taught with full depth in the formal DURA curriculum.