SNAPKITTYWEST commited on
Commit
12e9006
·
verified ·
1 Parent(s): d0f179a

docs: add proper model card

Browse files
Files changed (1) hide show
  1. README.md +31 -169
README.md CHANGED
@@ -1,169 +1,31 @@
1
- # Sovereign Array Language
2
-
3
- A **new array language** scaffolded from the architectural review of the
4
- *Unimath Array* proposal — keeping the **valid isomorphisms** and discarding
5
- the **fatal conflations**.
6
-
7
- > No Abjad. No digital root. No NP-magic. No "univalence replaces SIMD".
8
-
9
- ---
10
-
11
- ## What Holds (Valid Isomorphisms)
12
-
13
- | NumPy Concept | HoTT / Unimath Translation | Status |
14
- |---------------|----------------------------|--------|
15
- | **Array** | Dependent function `I → α` | ✅ Sound |
16
- | **Shape / Index** | Finite type `I : Type` | ✅ Sound |
17
- | **Broadcasting** | Pullback along projection `π : J → I` | ✅ Sound |
18
- | **Vectorized Op** | (i : I), op (A i) (B i)` (pointwise `Π`-map) | Sound |
19
- | **Array Equality** | Function extensionality / Univalence for `A ≃ B` | ✅ Sound |
20
-
21
- The **denotational semantics** of array computing *are* exactly a slice of
22
- dependent type theory. This part is mathematically correct and formally
23
- verifiable in Lean 4 today.
24
-
25
- ---
26
-
27
- ## What Breaks (Fatal Conflations — avoided)
28
-
29
- | ❌ Claim | ✅ Reality |
30
- |---------|-----------|
31
- | Proof `O(1)` substitution ⇒ `O(1)` decision procedure | Univalence gives `O(1)` *proof* substitution in the meta-theory, not `O(1)` *decision* for the object language. NP-complete problems stay hard. |
32
- | Abjad / digital root = universal invariant | `ρ : ℕ → M₉` is a **quotient** (many-to-one). Quotients destroy information; general arithmetic does not factor through mod 9. It is a *checksum*, not computation. |
33
- | "Replace SIMD with Univalence" | SIMD is a *computational effect*; Univalence is a *logical principle*. You still need a compiler (Lean → C → LLVM → SIMD). The metalayer is not the hardware. |
34
-
35
- ---
36
-
37
- ## The Sovereign Stack (target)
38
-
39
- | Layer | Technology | Role |
40
- |-------|------------|------|
41
- | **Spec** | Lean 4 (`ArrayLang/`) | Dependent types for shapes, `Fin n → α`, broadcasting as `Π`-pullback |
42
- | **Kernel** | Futhark / Accelerate / MLIR (or AOT C++ here) | Compile `Π`-maps to fused SIMD/GPU kernels |
43
- | **Arithmetic** | `ZMod 9` / `Fin 9` | *Optional* algebraic domain for specific crypto/checksum kernels — **not universal** |
44
- | **Verification** | Refinement / equivalence proofs | Prove `fast_kernel ≡ spec_kernel` |
45
- | **Execution** | AOT-compiled binary | Zero Python, zero interpreter, sovereign binary |
46
-
47
- This maps onto the Sovereign Transformer papers:
48
- - **Paper I** (HuntingtonAlg) → Verified Boolean algebra kernel (`nand` universality)
49
- - **Paper II** (Simplex/Softmax) → Verified `Π`-map normalization
50
- - **Paper III** (NAND Attention) → Verified circuit extraction to ASIC/FPGA
51
-
52
- ---
53
-
54
- ## Layout
55
-
56
- ```
57
- sovereign-array/
58
- ├── lakefile.lean # Lean 4 build (v4.19)
59
- ├── lean-toolchain
60
- ├── ArrayLang/ # The "new array language" — Lean spec
61
- │ ├── Array.lean # Array I α = I → α, pmap₂ (Π-map)
62
- │ ├── Broadcast.lean # broadcast = pullback π : J → I
63
- │ ├── Softmax.lean # softmax as Π-map (shift-invariant)
64
- │ ├── NandAttention.lean # NAND universal gate + attention spec
65
- │ ├── SimplexNorm.lean # Paper II: exact face geometry, no fake calculus
66
- │ └── Main.lean # aggregator
67
- ├── include/
68
- │ └── sovereign_array.h # Shape-typed Array<T>, pmap2, broadcast
69
- ├── src/
70
- │ ├── sovereign_array.cpp # softmax, broadcast, nand_attention
71
- │ └── main.cpp # demo
72
- ├── test/
73
- │ └── test.cpp # 7 checks: pmap2, softmax, broadcast, NAND, attention
74
- ├── CMakeLists.txt
75
- └── README.md
76
- ```
77
-
78
- ---
79
-
80
- ## Build & Run (C++)
81
-
82
- ```bash
83
- cd sovereign-array
84
- cmake -S . -B build -G "MinGW Makefiles"
85
- cmake --build build
86
- ./build/sovarr_test # 7/7 checks
87
- ./build/sovarr_demo
88
- ```
89
-
90
- ## Build (Lean 4)
91
-
92
- ```bash
93
- cd sovereign-array
94
- lake build # verifies zero-sorry array kernel
95
- ```
96
-
97
- ---
98
-
99
- ## Paper II — SimplexNorm (exact face geometry)
100
-
101
- The `SimplexNorm.lean` module is the **correct replacement** for continuous integration
102
- over discrete types. The review identified three fatal category errors in the prior
103
- approach; `SimplexNorm.lean` corrects all three:
104
-
105
- | Error | Fix |
106
- |-------|-----|
107
- | `∫ dx` over `ZMod 9` (discrete type) | Replace with `Finset.sum` — `ZMod 9` has 9 points, no paths |
108
- | Homotopy colimit → real centroid | Use `faceCentroid`: exact uniform distribution over face support |
109
- | Riemann sum "bypasses" NP | Riemann sum ≡ softmax with temperature — no asymptotic gain |
110
-
111
- **What `SimplexNorm.lean` proves (zero sorry, modulo one arithmetic stub):**
112
-
113
- ```lean
114
- -- The probability simplex
115
- structure Simplex (n : ℕ) where
116
- vals : Fin n → Float; nonneg : ...; sum_one : ...
117
-
118
- -- EXACT face centroid — no integration, no dx
119
- def faceCentroid {n : ℕ} (F : Finset (Fin n)) : Fin n → Float :=
120
- fun i => if i ∈ F then 1.0 / F.card.toFloat else 0.0
121
-
122
- -- Nonzero exactly on support
123
- theorem faceCentroid_support : faceCentroid F i ≠ 0 ↔ i ∈ F
124
-
125
- -- Softmax at uniform logits = face centroid (the only honest bridge)
126
- theorem softmax_uniform_eq_faceCentroid : ∀ i ∈ F, softmax v i = faceCentroid F i
127
-
128
- -- SAT ↔ vertex feasibility (integer programming — NP-complete, no shortcut)
129
- theorem solveFeasibility_sound : solveFeasibility P = some v → P.isSat
130
- ```
131
-
132
- > **NP stays NP.** The vertex enumeration loop is `O(n · |constraints|)` — polynomial
133
- > in the variable count, but this solves the **LP relaxation**, not IP. The integrality
134
- > gap is exactly where NP-hardness lives.
135
-
136
- ---
137
-
138
- ## Core Theorems (Lean, zero sorry)
139
-
140
- ```lean
141
- -- Broadcast is literally pullback-plus-add
142
- theorem broadcast_is_pullback {α} [Add α] {I J} (π : J → I) :
143
- (fun (v : I → α) (w : J → α) => broadcast π v w) =
144
- (fun v w j => v (π j) + w j) := rfl
145
-
146
- -- Softmax is a Π-map (normalization factor pulled out)
147
- theorem softmax_is_pmap {n} (v : Fin n → Float) :
148
- softmax v = fun i => Float.exp (v i) / (sumFin n fun j => Float.exp (v j)) := rfl
149
-
150
- -- NAND is universal
151
- theorem andGate_eq (a b : Bool) : andGate a b = (a && b) := rfl
152
- ```
153
-
154
- ---
155
-
156
- <div align="center">
157
-
158
- **The substrate is always free. The array is a function.**
159
-
160
- ```
161
- Array I α = I → α
162
- broadcast = pullback π
163
- pmap₂ = Π-map
164
- no sorry remains.
165
- ```
166
-
167
- *Sovereign Array Language · 2026 · Ahmad Ali Parr*
168
-
169
- </div>
 
1
+ ---
2
+ license: other
3
+ license_name: sovereign-source-license-v2
4
+ language:
5
+ - en
6
+ tags:
7
+ - text-generation
8
+ - array-language
9
+ - lean4
10
+ - formal-verification
11
+ - sovereign-compute
12
+ library_name: transformers
13
+ pipeline_tag: text-generation
14
+ ---
15
+
16
+ # sovereign-array
17
+
18
+ A new array language built from the architectural review of the Unimath Array proposal keeping the valid isomorphisms, discarding the fatal conflations.
19
+
20
+ Lean 4 formalization of array broadcasting, NAND attention, SimplexNorm, and softmax operators.
21
+
22
+ ## Contents
23
+
24
+ - `ArrayLang/` — Lean 4 array language core (Broadcast, NandAttention, SimplexNorm, Softmax)
25
+ - `python/` — Python reference implementation
26
+ - `tests/` — Property-based test suite
27
+
28
+ ## Links
29
+
30
+ - [SNAPKITTYWEST GitHub](https://github.com/SNAPKITTYWEST)
31
+ - [sovereign-xml-compiler](https://huggingface.co/Snapkitty/sovereign-xml-compiler)