Tiny Verified Logic Circuits
Collection
Formally verified threshold logic circuits. Compatible with neuromorphic hardware.
โข
33 items
โข
Updated
Formally verified NOR gate. Single threshold neuron computing negated disjunction with 100% accuracy.
| Component | Value |
|---|---|
| Inputs | 2 |
| Outputs | 1 |
| Neurons | 1 |
| Parameters | 3 |
| Weights | [-1, -1] |
| Bias | 0 |
| Activation | Heaviside step |
import torch
from safetensors.torch import load_file
weights = load_file('nor.safetensors')
def nor_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(nor_gate(0, 0)) # 1
print(nor_gate(0, 1)) # 0
print(nor_gate(1, 0)) # 0
print(nor_gate(1, 1)) # 0
Coq Theorem:
Theorem nor_correct : forall x y, nor_circuit x y = negb (orb x y).
Proven axiom-free with properties:
Full proof: coq-circuits/Boolean/NOR.v
Input combination produces weighted sum:
Fires only when both inputs are false.
NOR is functionally complete - any Boolean function can be built from NOR gates alone. This makes it particularly important for circuit composition.
@software{tiny_nor_prover_2025,
title={tiny-NOR-verified: Formally Verified NOR Gate},
author={Norton, Charles},
url={https://huggingface.co/phanerozoic/tiny-NOR-verified},
year={2025}
}