tiny-OR-verified

Formally verified OR gate. Single threshold neuron computing disjunction with 100% accuracy.

Architecture

Component Value
Inputs 2
Outputs 1
Neurons 1
Parameters 3
Weights [1, 1]
Bias -1
Activation Heaviside step

Key Properties

  • 100% accuracy (4/4 inputs correct)
  • Coq-proven correctness
  • Single threshold neuron
  • Integer weights
  • Commutative: OR(x,y) = OR(y,x)
  • Associative: OR(x,OR(y,z)) = OR(OR(x,y),z)
  • Idempotent: OR(x,x) = x

Usage

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

Verification

Coq Theorem:

Theorem or_correct : forall x y, or_circuit x y = orb x y.

Proven axiom-free with properties:

  • Commutativity
  • Associativity
  • Identity (OR with false)
  • Absorption (OR with true)
  • Idempotence

Full proof: coq-circuits/Boolean/OR.v

Circuit Operation

Input combination produces weighted sum:

  • (0,0): 01 + 01 - 1 = -1 < 0 โ†’ 0
  • (0,1): 01 + 11 - 1 = 0 >= 0 โ†’ 1
  • (1,0): 11 + 01 - 1 = 0 >= 0 โ†’ 1
  • (1,1): 11 + 11 - 1 = 1 >= 0 โ†’ 1

Requires at least one input to reach threshold.

Citation

@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}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Collection including phanerozoic/tiny-OR-verified