Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.A neuron as a logic gate
In 1943 Warren McCulloch, a neurophysiologist, and Walter Pitts, a logician, proposed that a neuron could be modelled very simply: it receives on/off signals, gives each a weight, adds them up and fires if the total reaches a threshold. With the right weights and threshold such a unit acts as an AND gate, an OR gate or a NOT gate. Since any logical function can be built from these gates, networks of such neurons can in principle compute anything a logic circuit can.
Every artificial neuron in a modern network is a descendant of this unit, with the hard threshold replaced by a smooth activation so it can be trained by gradients. Threshold units are still the model for spiking and neuromorphic hardware and for binary neural networks on tiny devices.
- 1. A McCulloch–Pitts neuron fires when…
- 2. Its inputs and output are…
- 3. The model was proposed in…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Unit: y = 1 if Σᵢ wᵢxᵢ ≥ θ, else 0, with each input xᵢ equal to 0 or 1.
- Gates:
- AND: w = (1, 1), θ = 2;
- OR: w = (1, 1), θ = 1;
- NOT: w = −1, θ = 0;
- NAND: w = (−1, −1), θ = −1;
- majority of three: w = (1, 1, 1), θ = 2.
- XOR is impossible for one unit: it needs 0 at (0, 0), so θ > 0; 1 at (1, 0) and (0, 1), so w₁ ≥ θ and w₂ ≥ θ; then w₁ + w₂ ≥ 2θ ≥ θ, so it fires at (1, 1). Contradiction.
- Two layers suffice: XOR = (x₁ OR x₂) AND NOT (x₁ AND x₂).
- Counting: there are 2^(2ⁿ) Boolean functions of n inputs: 16 for n = 2, 256 for n = 3.
- 1. OR with weights (1, 1) needs θ =…
- 2. Boolean functions of 3 inputs:
- 3. XOR needs at least…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Threshold units in code
Exercise 1. Single units computed AND, OR and NOT, and the two-layer network computed XOR. A search over all integer weights in [−3, 3] and thresholds in [−6.5, 6.5] found no single unit computing XOR.
Practice.
- A threshold unit is a linear classifier with a step output; the perceptron (E6-2) learns its weights from data.
- Binary and spiking networks still use hard thresholds, trained with surrogate gradients that replace the step’s zero derivative by a smooth stand-in.
- A threshold gate’s weights and threshold can be scaled together without changing its function, so many weight choices give the same gate.
step = lambda z: (z >= 0).astype(float)
and_gate = lambda x: step(x @ np.array([1, 1]) - 2)- 1. Scaling all weights and θ by 2 changes the gate's function?
- 2. Spiking networks are trained with…
- 3. The perceptron is…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Universality. Since AND, OR and NOT are threshold units and every Boolean function has a disjunctive normal form, a two-layer network of threshold units (an AND unit per true row, then an OR) computes any Boolean function, though possibly with exponentially many hidden units.
Threshold functions. A Boolean function computed by a single unit is a threshold (linearly separable) function. Their number grows like 2^(n²) (Zuev, 1989), far slower than 2^(2ⁿ), so the fraction of all functions that one unit can compute tends to zero: 4/4, 14/16, 104/256, 1882/65 536.
Weights needed. Some threshold functions of n inputs need integer weights as large as roughly n^(n/2)/2ⁿ in the worst case (Håstad, 1994). For n ≤ 4 small weights suffice; exercise 2 finds the maximum is 2 for three inputs and 3 for four.
From logic to learning. McCulloch and Pitts fixed the weights by hand. Hebb (1949) proposed that connections strengthen with use, and Rosenblatt (1958) gave the perceptron learning rule, turning the logic unit into a learning machine.
- 1. Two layers of threshold units can compute…
- 2. The fraction of n-input functions computable by one unit…
- 3. Who proposed the perceptron learning rule?
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.How many functions can one unit compute?
History.
- W. McCulloch and W. Pitts (1943) published the threshold-logic neuron.
- S. Kleene (1956) related networks of such neurons to finite automata and regular expressions.
- D. Hebb (1949) proposed his learning postulate; F. Rosenblatt (1958) the perceptron.
- S. Muroga (1971) catalogued threshold logic for circuit design.
Exercise 2. Count the Boolean functions of n inputs that a single threshold unit computes, by enumerating integer weights up to a bound with every distinct threshold, and cross-check with the perceptron run on every truth table.
| n | weights ≤ 1 | ≤ 2 | ≤ 3 | ≤ 4 | all functions | perceptron check |
|---|---|---|---|---|---|---|
| 1 | 4 | 4 | 4 | 4 | 4 | 4 |
| 2 | 14 | 14 | 14 | 14 | 16 | 14 |
| 3 | 56 | 104 | 104 | 104 | 256 | 104 |
| 4 | 218 | 986 | 1882 | 1882 | 65 536 | — |
- A single unit computes only 2.9% of four-input functions, and the fraction keeps collapsing with n.
- Weights of ±1 are not enough beyond two inputs: three inputs need weights up to 2, four up to 3.
- The perceptron’s exhaustive check agrees for up to three inputs, and 1882 matches the known count for four.
Threshold units in AI, robotics and aerospace
- Neuromorphic and spiking hardware for low-power sensing uses threshold neurons.
- Binary neural networks with ±1 weights and step activations run on microcontrollers and FPGAs in small drones and satellites.
- Safety logic: threshold voting (for example 2-of-3 majority) is standard in redundant flight-control and spacecraft systems.
References
- W. S. McCulloch, W. Pitts (1943). “A logical calculus of the ideas immanent in nervous activity.” Bulletin of Mathematical Biophysics 5.
- S. C. Kleene (1956). “Representation of events in nerve nets and finite automata.” In Automata Studies, Princeton University Press.
- S. Muroga (1971). Threshold Logic and Its Applications. Wiley.
- J. Håstad (1994). “On the size of weights for threshold gates.” SIAM J. Discrete Mathematics 7(3).