File size: 1,940 Bytes
f2cdec9 bef90df f2cdec9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
---
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
|