threshold-and3

3-input AND gate. Fires when all three inputs are active. The 3-of-3 threshold gate.

Circuit

    a   b   c
    β”‚   β”‚   β”‚
    β””β”€β”€β”€β”Όβ”€β”€β”€β”˜
        β”‚
        β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ w: 1,1,1β”‚
   β”‚ b:  -3  β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β–Ό
   AND(a,b,c)

The Unanimity Requirement

3-input AND is the smallest non-trivial unanimity gate:

Inputs Sum Output
000 -3 0
001 -2 0
010 -2 0
011 -1 0
100 -2 0
101 -1 0
110 -1 0
111 0 1

Only when all three contribute does the sum reach the threshold.

Generalization from 2-input AND

Gate Weights Bias Threshold
AND(a,b) [1, 1] -2 2 votes needed
AND(a,b,c) [1, 1, 1] -3 3 votes needed
AND(a,b,c,d) [1, 1, 1, 1] -4 4 votes needed

The pattern: n inputs, all weight +1, bias -n.

Single Point of Veto

Any single 0 input blocks the gate:

  • a=0: max sum = 0 + 1 + 1 - 3 = -1 < 0
  • b=0: max sum = 1 + 0 + 1 - 3 = -1 < 0
  • c=0: max sum = 1 + 1 + 0 - 3 = -1 < 0

Each input has veto power. This is unanimous consent.

Parameters

Component Value
Weights [1, 1, 1]
Bias -3
Total 4 parameters

Optimality

Exhaustive enumeration of all 1,289 weight configurations at magnitudes 0-6 confirms this circuit is already at minimum magnitude (6). There is exactly one valid configuration at magnitude 6, and no valid configurations exist below it.

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

def and3(a, b, c):
    inp = torch.tensor([float(a), float(b), float(c)])
    return int((inp * w['weight']).sum() + w['bias'] >= 0)

print(and3(1, 1, 1))  # 1
print(and3(1, 1, 0))  # 0

Files

threshold-and3/
β”œβ”€β”€ model.safetensors
β”œβ”€β”€ model.py
β”œβ”€β”€ config.json
└── README.md

License

MIT

Downloads last month
16
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including phanerozoic/threshold-and3