|
|
---
|
|
|
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
|
|
|
|