Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tiny-NOT-prover
|
| 2 |
+
|
| 3 |
+
Formally verified NOT gate. Single threshold neuron computing negation with 100% accuracy.
|
| 4 |
+
|
| 5 |
+
## Architecture
|
| 6 |
+
|
| 7 |
+
| Component | Value |
|
| 8 |
+
|-----------|-------|
|
| 9 |
+
| Inputs | 1 |
|
| 10 |
+
| Outputs | 1 |
|
| 11 |
+
| Neurons | 1 |
|
| 12 |
+
| Parameters | 2 |
|
| 13 |
+
| Weights | [-1] |
|
| 14 |
+
| Bias | 0 |
|
| 15 |
+
| Activation | Heaviside step |
|
| 16 |
+
|
| 17 |
+
## Key Properties
|
| 18 |
+
|
| 19 |
+
- 100% accuracy (2/2 inputs correct)
|
| 20 |
+
- Coq-proven correctness
|
| 21 |
+
- Single threshold neuron
|
| 22 |
+
- Integer weights
|
| 23 |
+
- Involutive: NOT(NOT(x)) = x
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
import torch
|
| 29 |
+
from safetensors.torch import load_file
|
| 30 |
+
|
| 31 |
+
weights = load_file('not.safetensors')
|
| 32 |
+
|
| 33 |
+
def not_gate(x):
|
| 34 |
+
# Heaviside: weighted_sum + bias >= 0
|
| 35 |
+
return int((x * weights['weight'] + weights['bias']) >= 0)
|
| 36 |
+
|
| 37 |
+
# Test
|
| 38 |
+
print(not_gate(0)) # 1
|
| 39 |
+
print(not_gate(1)) # 0
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Verification
|
| 43 |
+
|
| 44 |
+
**Coq Theorem**:
|
| 45 |
+
```coq
|
| 46 |
+
Theorem not_correct : forall x, not_circuit x = negb x.
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
Proven axiom-free. Full proof: [coq-circuits/Boolean/NOT.v](https://github.com/CharlesCNorton/coq-circuits)
|
| 50 |
+
|
| 51 |
+
## Citation
|
| 52 |
+
|
| 53 |
+
```bibtex
|
| 54 |
+
@software{tiny_not_prover_2025,
|
| 55 |
+
title={tiny-NOT-prover: Formally Verified NOT Gate},
|
| 56 |
+
author={Norton, Charles},
|
| 57 |
+
url={https://huggingface.co/phanerozoic/tiny-NOT-prover},
|
| 58 |
+
year={2025}
|
| 59 |
+
}
|
| 60 |
+
```
|