--- license: mit tags: - pytorch - safetensors - threshold-logic - neuromorphic --- # threshold-implies Material implication: x → y. The only two-input Boolean function with asymmetric weights. ## Circuit ``` x y │ │ └─┬─┘ ▼ ┌───────┐ │w: -1,1│ │ b: 0 │ └───────┘ │ ▼ x → y ``` ## Mechanism The antecedent x has weight -1 (inhibitory), the consequent y has weight +1 (excitatory): | x | y | sum | output | meaning | |---|---|-----|--------|---------| | 0 | 0 | 0 | 1 | false → false | | 0 | 1 | +1 | 1 | false → true | | 1 | 0 | -1 | 0 | true → false ✗ | | 1 | 1 | 0 | 1 | true → true | The only failure: asserting a true antecedent with a false consequent. This is the only thing implication forbids. ## Equivalent Forms - x → y = ¬x ∨ y - x → y = ¬(x ∧ ¬y) The weights [-1, +1] directly implement ¬x + y. ## Parameters | | | |---|---| | Weights | [-1, +1] | | Bias | 0 | | Total | 3 parameters | ## Optimality Exhaustive enumeration of all 25 weight configurations at magnitudes 0-2 confirms this circuit is **already at minimum magnitude (2)**. There is exactly one valid configuration at magnitude 2, and no valid configurations exist below it. ## Properties - Linearly separable (unlike XOR) - Not commutative: (x → y) ≠ (y → x) - Reflexive: x → x = 1 - Ex falso quodlibet: 0 → y = 1 ## Usage ```python from safetensors.torch import load_file import torch w = load_file('model.safetensors') def implies_gate(x, y): inputs = torch.tensor([float(x), float(y)]) return int((inputs * w['weight']).sum() + w['bias'] >= 0) ``` ## Files ``` threshold-implies/ ├── model.safetensors ├── model.py ├── config.json └── README.md ``` ## License MIT