metadata
license: mit
tags:
- pytorch
- safetensors
- threshold-logic
- neuromorphic
- functionally-complete
threshold-nor
The silence detector. Fires only when both inputs are quiet.
Circuit
x y
β β
βββ¬ββ
βΌ
ββββββββββ
βw: -1,-1β
β b: 0 β
ββββββββββ
β
βΌ
NOR(x,y)
Mechanism
With bias 0, we start exactly at threshold. Any input subtracts, pushing us below:
| x | y | sum | output |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | -1 | 0 |
| 1 | 0 | -1 | 0 |
| 1 | 1 | -2 | 0 |
NOR is OR with inverted output. It's also NOT extended to two inputs: NOR(x,x) = NOT(x).
Parameters
| Weights | [-1, -1] |
| Bias | 0 |
| Total | 3 parameters |
Optimality
Exhaustive enumeration of all 7 weight configurations at magnitudes 0-2 confirms this circuit is already at minimum magnitude (2). There is exactly one valid configuration at magnitude 2, and no valid configurations exist below it.
Functional Completeness
Like NAND, NOR can build any Boolean function:
- NOT(x) = NOR(x, x)
- OR(x,y) = NOT(NOR(x,y)) = NOR(NOR(x,y), NOR(x,y))
- AND(x,y) = NOR(NOT(x), NOT(y))
NOR logic was used in the Apollo Guidance Computer.
Usage
from safetensors.torch import load_file
import torch
w = load_file('model.safetensors')
def nor_gate(x, y):
inputs = torch.tensor([float(x), float(y)])
return int((inputs * w['weight']).sum() + w['bias'] >= 0)
Files
threshold-nor/
βββ model.safetensors
βββ model.py
βββ config.json
βββ README.md
License
MIT