phanerozoic commited on
Commit
1671ae0
·
verified ·
1 Parent(s): 80fb666

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +86 -0
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - formal-verification
5
+ - coq
6
+ - threshold-logic
7
+ - neuromorphic
8
+ ---
9
+
10
+ # tiny-1OutOf8-prover
11
+
12
+ Formally verified 1-out-of-8 threshold gate. Single threshold neuron with 100% accuracy.
13
+
14
+ ## Architecture
15
+
16
+ | Component | Value |
17
+ |-----------|-------|
18
+ | Inputs | 8 |
19
+ | Outputs | 1 |
20
+ | Neurons | 1 |
21
+ | Parameters | 9 |
22
+ | Weights | [1, 1, 1, 1, 1, 1, 1, 1] |
23
+ | Bias | -1 |
24
+ | Activation | Heaviside step |
25
+
26
+ ## Key Properties
27
+
28
+ - 100% accuracy (256/256 inputs correct)
29
+ - Coq-proven correctness
30
+ - Single threshold neuron
31
+ - Integer weights
32
+ - Fires when at least 1 of 8 inputs are true
33
+
34
+
35
+ ## Usage
36
+
37
+ ```python
38
+ import torch
39
+ from safetensors.torch import load_file
40
+
41
+ weights = load_file('oneoutof8.safetensors')
42
+
43
+ def oneoutof8_gate(bits):
44
+ # bits: list of 8 binary values
45
+ inputs = torch.tensor([float(b) for b in bits])
46
+ weighted_sum = (inputs * weights['weight']).sum() + weights['bias']
47
+ return int(weighted_sum >= 0)
48
+
49
+ # Test
50
+ print(oneoutof8_gate([0,0,0,0,0,0,0,0])) # 0 (no bits set)
51
+ print({func}_gate([1,0,0,0,0,0,0,0])) # 1 (1/8, at threshold)
52
+ print(oneoutof8_gate([1,1,1,1,1,1,1,1])) # 1 (8/8, above threshold)
53
+ ```
54
+
55
+ ## Verification
56
+
57
+ **Coq Theorem**:
58
+ ```coq
59
+ Theorem oneout_eight_correct : forall x0 x1 x2 x3 x4 x5 x6 x7,
60
+ oneout_eight_circuit [x0; x1; x2; x3; x4; x5; x6; x7] =
61
+ oneout_eight_spec [x0; x1; x2; x3; x4; x5; x6; x7].
62
+ ```
63
+
64
+ Proven axiom-free via:
65
+ 1. **Exhaustive**: All 256 inputs verified
66
+ 2. **Universal**: Quantified proof over boolean combinations
67
+ 3. **Algebraic**: Hamming weight ≥ 1
68
+
69
+ Full proof: [coq-circuits/Threshold/OneOutOfEight.v](https://github.com/CharlesCNorton/coq-circuits)
70
+
71
+ ## Circuit Operation
72
+
73
+ Input with h true bits (Hamming weight h):
74
+ - Weighted sum: h - 1
75
+ - Output: 1 if h ≥ 1, else 0
76
+
77
+ ## Citation
78
+
79
+ ```bibtex
80
+ @software{tiny_1outof8_prover_2025,
81
+ title={tiny-1OutOf8-prover: Formally Verified 1-out-of-8 threshold gate},
82
+ author={Norton, Charles},
83
+ url={https://huggingface.co/phanerozoic/tiny-1OutOf8-prover},
84
+ year={2025}
85
+ }
86
+ ```