phanerozoic commited on
Commit
bbff33a
·
verified ·
1 Parent(s): dd062f7

Update README with current stats and verification status

Browse files
Files changed (1) hide show
  1. README.md +102 -96
README.md CHANGED
@@ -1,48 +1,32 @@
1
- # 8bit-threshold-computer-10166
2
-
3
- **A Turing-complete 8-bit CPU implemented as threshold logic gates.**
4
-
5
- This is the original, uncompressed model containing 10,166 bits of information.
6
-
7
- ```
8
- Parameters: 2,392
9
- Unique Weights: 19
10
- Information: 10,166 bits
11
- ```
12
-
13
  ---
14
 
15
- ## Naming Convention
16
 
17
- The number in the repo name represents the **information content in bits**:
 
 
18
 
19
  ```
20
- Bits = Parameters × log₂(Unique Weights)
21
- = 2,392 × log₂(19)
22
- = 2,392 × 4.25
23
- = 10,166 bits
24
  ```
25
 
26
- This naming scheme allows direct comparison of model complexity across the family:
27
-
28
- | Model | Parameters | Unique Weights | Bits | Compression |
29
- |-------|------------|----------------|------|-------------|
30
- | **8bit-threshold-computer-10166** | 2,392 | 19 | **10,166** | Original |
31
- | [8bit-threshold-computer-1640](https://huggingface.co/phanerozoic/8bit-threshold-computer-1640) | 386 | 19 | 1,640 | Pattern deduplication |
32
- | [8bit-threshold-computer-772](https://huggingface.co/phanerozoic/8bit-threshold-computer-772) | 386 | 4 | 772 | Evolutionary minimization |
33
-
34
- Lower bits = more compressed = same computation in less information.
35
-
36
  ---
37
 
38
  ## What Is This?
39
 
40
- A complete 8-bit processor where every logic gate is implemented as a threshold neuron:
41
-
42
- ```
43
- output = 1 if (Σ wᵢxᵢ + b) ≥ 0
44
- 0 otherwise
45
- ```
46
 
47
  | Component | Specification |
48
  |-----------|---------------|
@@ -52,96 +36,122 @@ output = 1 if (Σ wᵢxᵢ + b) ≥ 0
52
  | Flags | Zero, Negative, Carry, Overflow |
53
  | Control | JMP, JZ, JNZ, JC, JNC, JN, JP, JV, JNV, CALL, RET, PUSH, POP |
54
 
55
- **Turing complete.** Verified against 95 programs including loops, recursion, and self-modification.
56
 
57
  ---
58
 
59
- ## Model Structure
60
 
61
- This model stores each circuit component as a separate tensor:
 
 
 
 
 
 
 
 
 
 
62
 
63
- | Metric | Value |
64
- |--------|-------|
65
- | Total tensors | 1,194 |
66
- | Total parameters | 2,392 |
67
- | Unique weight values | 19 |
68
- | File size | 119,960 bytes (~120 KB) |
69
 
70
- ### Weight Vocabulary
71
 
72
  ```python
73
- [-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 8, 16, 32, 64, 128, 256]
74
- ```
75
-
76
- These 19 values are sufficient to implement all Boolean logic and arithmetic circuits.
77
 
78
- ---
79
 
80
- ## Circuit Categories
 
81
 
82
- The 1,194 tensors implement 93 distinct circuit types:
 
 
83
 
84
- | Category | Circuits | Examples |
85
- |----------|----------|----------|
86
- | Boolean | 10 | AND, OR, NOT, NAND, NOR, XOR, XNOR, IMPLIES, BIIMPLIES |
87
- | Arithmetic | 18 | Half adder, full adder, 2/4/8-bit ripple carry, comparators |
88
- | ALU | 8 | 8-bit ADD, SUB, AND, OR, XOR, NOT, SHL, SHR + control |
89
- | Combinational | 12 | MUX (2:1, 4:1, 8:1), DEMUX, encoders, decoders, barrel shifter |
90
- | Control Flow | 15 | JMP, conditional jumps (8 types), CALL, RET, PUSH, POP |
91
- | Error Detection | 12 | Parity, checksum, CRC-4/8, Hamming encode/decode |
92
- | Threshold | 10 | k-of-n gates, majority, minority |
93
- | Pattern Recognition | 8 | Popcount, leading/trailing ones, symmetry detection |
94
 
95
  ---
96
 
97
- ## Files
98
 
99
- | File | Description |
100
- |------|-------------|
101
- | `neural_computer.safetensors` | All 1,194 circuit tensors (120 KB) |
102
- | `turing_completeness_test.py` | Verification suite |
103
 
104
- ---
 
 
 
105
 
106
- ## Usage
107
 
108
- ```python
109
- from safetensors.torch import load_file
 
 
 
 
 
 
 
 
110
 
111
- # Load model
112
- tensors = load_file("neural_computer.safetensors")
 
 
 
113
 
114
- print(f"Tensors: {len(tensors)}")
115
- # Output: Tensors: 1194
116
 
117
- # Check weight vocabulary
118
- all_weights = set()
119
- for t in tensors.values():
120
- all_weights.update(t.flatten().tolist())
121
- print(f"Unique weights: {len(all_weights)}")
122
- # Output: Unique weights: 19
 
 
 
 
 
123
  ```
124
 
125
  ---
126
 
127
- ## Compression Opportunity
 
 
 
 
 
 
 
 
128
 
129
- Many of the 1,194 tensors are **duplicates** — the same weight pattern reused across different circuits. This model can be compressed via:
130
 
131
- 1. **Pattern deduplication** [8bit-threshold-computer-1640](https://huggingface.co/phanerozoic/8bit-threshold-computer-1640)
132
- 2. **Weight vocabulary minimization** → [8bit-threshold-computer-772](https://huggingface.co/phanerozoic/8bit-threshold-computer-772)
 
 
133
 
134
  ---
135
 
136
  ## Citation
137
 
138
  ```bibtex
139
- @misc{8bit-threshold-computer-10166,
140
- title={8bit-threshold-computer-10166: A Threshold Logic CPU},
141
- author={phanerozoic},
142
- year={2026},
143
  howpublished={Hugging Face},
144
- url={https://huggingface.co/phanerozoic/8bit-threshold-computer-10166}
145
  }
146
  ```
147
 
@@ -153,11 +163,7 @@ MIT
153
 
154
  ---
155
 
156
- ## See Also
157
-
158
- - [8bit-threshold-computer-1640](https://huggingface.co/phanerozoic/8bit-threshold-computer-1640) — Pattern-deduplicated (6.2× smaller)
159
- - [8bit-threshold-computer-772](https://huggingface.co/phanerozoic/8bit-threshold-computer-772) — Evolutionarily minimized (13.2× smaller)
160
-
161
- ---
162
 
163
- *2,392 parameters. 19 weights. 10,166 bits. The original.*
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - threshold-logic
5
+ - neuromorphic
6
+ - computer-architecture
7
+ - turing-complete
8
+ - loihi
9
+ - truenorth
10
+ - akida
 
 
11
  ---
12
 
13
+ # 8bit-threshold-computer
14
 
15
+ **A Turing-complete 8-bit CPU implemented entirely as threshold logic gates.**
16
+
17
+ Every logic gate is a threshold neuron: `output = 1 if (Σ wᵢxᵢ + b) ≥ 0 else 0`
18
 
19
  ```
20
+ Tensors: 1,482
21
+ Parameters: 3,188
22
+ Tests: 4,416/4,416 passing
 
23
  ```
24
 
 
 
 
 
 
 
 
 
 
 
25
  ---
26
 
27
  ## What Is This?
28
 
29
+ A complete 8-bit processor where every operation—from Boolean logic to arithmetic to control flow—is implemented using only weighted sums and step functions. No traditional gates.
 
 
 
 
 
30
 
31
  | Component | Specification |
32
  |-----------|---------------|
 
36
  | Flags | Zero, Negative, Carry, Overflow |
37
  | Control | JMP, JZ, JNZ, JC, JNC, JN, JP, JV, JNV, CALL, RET, PUSH, POP |
38
 
39
+ **Turing complete.** Verified with loops, conditionals, recursion, and self-modification.
40
 
41
  ---
42
 
43
+ ## Circuit Categories
44
 
45
+ | Category | Circuits | Examples |
46
+ |----------|----------|----------|
47
+ | Boolean | 9 | AND, OR, NOT, NAND, NOR, XOR, XNOR, IMPLIES, BIIMPLIES |
48
+ | Arithmetic | 18 | Half/full adder, 2/4/8-bit ripple carry, comparators |
49
+ | ALU | 3 | 8-bit ALU, control decoder, flag computation |
50
+ | Combinational | 10 | MUX (2:1, 4:1, 8:1), DEMUX, encoders, decoders |
51
+ | Control Flow | 16 | JMP, conditional jumps, CALL, RET, PUSH, POP |
52
+ | Error Detection | 11 | Parity (XOR tree), checksum, CRC, Hamming |
53
+ | Modular | 11 | Divisibility by 2-12 (multi-layer for non-powers-of-2) |
54
+ | Threshold | 13 | k-of-n gates, majority, minority, exactly-k |
55
+ | Pattern | 10 | Popcount, leading/trailing ones, symmetry |
56
 
57
+ ---
 
 
 
 
 
58
 
59
+ ## Usage
60
 
61
  ```python
62
+ import torch
63
+ from safetensors.torch import load_file
 
 
64
 
65
+ tensors = load_file("neural_computer.safetensors")
66
 
67
+ def heaviside(x):
68
+ return (x >= 0).float()
69
 
70
+ # AND gate: fires when both inputs are 1
71
+ w = tensors['boolean.and.weight'] # [1, 1]
72
+ b = tensors['boolean.and.bias'] # [-2]
73
 
74
+ for a, b_in in [(0,0), (0,1), (1,0), (1,1)]:
75
+ inp = torch.tensor([a, b_in], dtype=torch.float32)
76
+ out = heaviside(inp @ w + b)
77
+ print(f"AND({a}, {b_in}) = {int(out.item())}")
78
+ ```
 
 
 
 
 
79
 
80
  ---
81
 
82
+ ## Verification
83
 
84
+ The model includes `iron_eval.py` which exhaustively tests all circuits:
 
 
 
85
 
86
+ ```bash
87
+ python iron_eval.py
88
+ # Output: Fitness: 1.000000 (4416/4416 tests passing)
89
+ ```
90
 
91
+ ### Verification Status
92
 
93
+ | Category | Status | Notes |
94
+ |----------|--------|-------|
95
+ | Boolean gates | Coq-derived | Original formal proofs |
96
+ | Arithmetic | Coq-derived | Adders, comparators |
97
+ | ALU | Coq-derived | All 16 operations |
98
+ | Control flow | Coq-derived | Jumps, stack ops |
99
+ | Threshold | Coq-derived | k-of-n gates |
100
+ | **Modular (mod 3,5,6,7,9,10,11,12)** | **Hand-verified** | Multi-layer circuits added manually |
101
+ | **Parity** | **Hand-verified** | XOR tree structure added manually |
102
+ | Modular (mod 2,4,8) | Exact | Single-layer, trivial |
103
 
104
+ The modular arithmetic circuits for non-powers-of-2 and the parity circuits were hand-constructed because:
105
+ - Divisibility by 3, 5, etc. is **not linearly separable** in binary
106
+ - 8-bit parity (XOR of all bits) requires a tree of XOR gates
107
+
108
+ These circuits pass exhaustive testing but lack formal proofs.
109
 
110
+ ---
 
111
 
112
+ ## Tensor Naming Convention
113
+
114
+ ```
115
+ {category}.{circuit}[.{layer}][.{component}].{weight|bias}
116
+
117
+ Examples:
118
+ boolean.and.weight
119
+ boolean.xor.layer1.neuron1.weight
120
+ arithmetic.ripplecarry8bit.fa7.ha2.sum.layer1.or.weight
121
+ modular.mod5.layer2.eq3.weight
122
+ error_detection.paritychecker8bit.stage2.xor1.layer1.nand.bias
123
  ```
124
 
125
  ---
126
 
127
+ ## Hardware Compatibility
128
+
129
+ All weights are integers. All activations are Heaviside step. Designed for:
130
+
131
+ - **Intel Loihi** — Neuromorphic research chip
132
+ - **IBM TrueNorth** — 1M neuron chip
133
+ - **BrainChip Akida** — Edge neuromorphic processor
134
+
135
+ ---
136
 
137
+ ## Files
138
 
139
+ | File | Description |
140
+ |------|-------------|
141
+ | `neural_computer.safetensors` | All 1,482 circuit tensors (~152 KB) |
142
+ | `iron_eval.py` | Comprehensive test suite (4,416 tests) |
143
 
144
  ---
145
 
146
  ## Citation
147
 
148
  ```bibtex
149
+ @misc{8bit-threshold-computer,
150
+ title={8bit-threshold-computer: A Turing-Complete Threshold Logic CPU},
151
+ author={Norton, Charles},
152
+ year={2025},
153
  howpublished={Hugging Face},
154
+ url={https://huggingface.co/phanerozoic/8bit-threshold-computer}
155
  }
156
  ```
157
 
 
163
 
164
  ---
165
 
166
+ ## Links
 
 
 
 
 
167
 
168
+ - [Coq Proofs](https://github.com/CharlesCNorton/coq-circuits) Original formal verification
169
+ - [HuggingFace](https://huggingface.co/phanerozoic) — Other models