Tiny Verified Logic Circuits
Collection
Formally verified threshold logic circuits. Compatible with neuromorphic hardware.
โข
33 items
โข
Updated
Formally verified OR gate. Single threshold neuron computing disjunction with 100% accuracy.
| Component | Value |
|---|---|
| Inputs | 2 |
| Outputs | 1 |
| Neurons | 1 |
| Parameters | 3 |
| Weights | [1, 1] |
| Bias | -1 |
| Activation | Heaviside step |
import torch
from safetensors.torch import load_file
weights = load_file('or.safetensors')
def or_gate(x, y):
# Heaviside: weighted_sum + bias >= 0
inputs = torch.tensor([float(x), float(y)])
weighted_sum = (inputs * weights['weight']).sum() + weights['bias']
return int(weighted_sum >= 0)
# Test
print(or_gate(0, 0)) # 0
print(or_gate(0, 1)) # 1
print(or_gate(1, 0)) # 1
print(or_gate(1, 1)) # 1
Coq Theorem:
Theorem or_correct : forall x y, or_circuit x y = orb x y.
Proven axiom-free with properties:
Full proof: coq-circuits/Boolean/OR.v
Input combination produces weighted sum:
Requires at least one input to reach threshold.
@software{tiny_or_prover_2025,
title={tiny-OR-verified: Formally Verified OR Gate},
author={Norton, Charles},
url={https://huggingface.co/phanerozoic/tiny-OR-verified},
year={2025}
}