Tiny Verified Logic Circuits
Collection
Formally verified threshold logic circuits. Compatible with neuromorphic hardware.
•
33 items
•
Updated
Formally verified 6-out-of-8 threshold gate. Single threshold neuron with 100% accuracy.
| Component | Value |
|---|---|
| Inputs | 8 |
| Outputs | 1 |
| Neurons | 1 |
| Parameters | 9 |
| Weights | [1, 1, 1, 1, 1, 1, 1, 1] |
| Bias | -6 |
| Activation | Heaviside step |
import torch
from safetensors.torch import load_file
weights = load_file('sixoutof8.safetensors')
def sixoutof8_gate(bits):
# bits: list of 8 binary values
inputs = torch.tensor([float(b) for b in bits])
weighted_sum = (inputs * weights['weight']).sum() + weights['bias']
return int(weighted_sum >= 0)
# Test
print({func}_gate([0,0,0,0,0,0,0,0])) # 0 (0/6, below threshold)
print({func}_gate([1,1,1,1,1,0,0,0])) # 0 (5/8, below threshold)
print({func}_gate([1,1,1,1,1,1,0,0])) # 1 (6/8, at threshold)
print(sixoutof8_gate([1,1,1,1,1,1,1,1])) # 1 (8/8, above threshold)
Coq Theorem:
Theorem sixout_eight_correct : forall x0 x1 x2 x3 x4 x5 x6 x7,
sixout_eight_circuit [x0; x1; x2; x3; x4; x5; x6; x7] =
sixout_eight_spec [x0; x1; x2; x3; x4; x5; x6; x7].
Proven axiom-free via:
Full proof: coq-circuits/Threshold/SixOutOfEight.v
Input with h true bits (Hamming weight h):
@software{tiny_6outof8_prover_2025,
title={tiny-6OutOf8-verified: Formally Verified 6-out-of-8 threshold gate},
author={Norton, Charles},
url={https://huggingface.co/phanerozoic/tiny-6OutOf8-verified},
year={2025}
}