Threshold Logic Circuits
Collection
Boolean gates, voting functions, modular arithmetic, and adders as threshold networks.
β’
248 items
β’
Updated
β’
1
Unanimity detector. Fires only when all 8 inputs are set. Equivalent to 8-input AND.
xβ xβ xβ xβ xβ xβ
xβ xβ
β β β β β β β β
ββββ΄βββ΄βββ΄βββΌβββ΄βββ΄βββ΄βββ
βΌ
βββββββββββ
β w: all 1β
β b: -8 β
βββββββββββ
β
βΌ
HW = 8
The strictest threshold in the k-out-of-8 family. No tolerance for missing inputs.
| Circuit | Bias | Fires when |
|---|---|---|
| 1-out-of-8 | -1 | HW β₯ 1 (= 8-input OR) |
| ... | ... | ... |
| 7-out-of-8 | -7 | HW β₯ 7 |
| 8-out-of-8 | -8 | HW = 8 (this = 8-input AND) |
The family spans from OR (bias -1) to AND (bias -8). All use the same weights.
| Weights | [1, 1, 1, 1, 1, 1, 1, 1] |
| Bias | -8 |
| Total | 9 parameters |
from safetensors.torch import load_file
import torch
w = load_file('model.safetensors')
def all_8(bits):
inputs = torch.tensor([float(b) for b in bits])
return int((inputs * w['weight']).sum() + w['bias'] >= 0)
threshold-alloutof8/
βββ model.safetensors
βββ model.py
βββ config.json
βββ README.md
MIT