Threshold Logic Circuits
Collection
Boolean gates, voting functions, modular arithmetic, and adders as threshold networks.
β’
248 items
β’
Updated
β’
1
3-input NOR gate. Fires only when all inputs are silent. The silence detector.
a b c
β β β
βββββΌββββ
β
βΌ
ββββββββββββ
βw: -1,-1,-1β
β b: 0 β
ββββββββββββ
β
βΌ
NOR(a,b,c)
3-input NOR fires only on complete absence:
| Inputs | Sum | Output |
|---|---|---|
| 000 | 0 | 1 |
| 001 | -1 | 0 |
| 010 | -1 | 0 |
| 011 | -2 | 0 |
| 100 | -1 | 0 |
| 101 | -2 | 0 |
| 110 | -2 | 0 |
| 111 | -3 | 0 |
Any activity silences the gate.
With bias 0, we start exactly at threshold:
sum = -a - b - c + 0 = -HW
fires when -HW >= 0
fires when HW = 0
No tolerance. The slightest input pushes us below threshold.
Like NAND, NOR is universal:
NOR logic powered the Apollo Guidance Computer.
| Gate | Weights | Bias |
|---|---|---|
| NOR(a,b) | [-1, -1] | 0 |
| NOR(a,b,c) | [-1, -1, -1] | 0 |
| NOR(a,b,c,d) | [-1, -1, -1, -1] | 0 |
All have bias 0. Only the number of inputs changes.
| Component | Value |
|---|---|
| Weights | [-1, -1, -1] |
| Bias | 0 |
| Total | 4 parameters |
Exhaustive enumeration of all 129 weight configurations at magnitudes 0-3 confirms this circuit is already at minimum magnitude (3). There is exactly one valid configuration at magnitude 3, and no valid configurations exist below it.
from safetensors.torch import load_file
import torch
w = load_file('model.safetensors')
def nor3(a, b, c):
inp = torch.tensor([float(a), float(b), float(c)])
return int((inp * w['weight']).sum() + w['bias'] >= 0)
print(nor3(0, 0, 0)) # 1
print(nor3(0, 0, 1)) # 0
threshold-nor3/
βββ model.safetensors
βββ model.py
βββ config.json
βββ README.md
MIT