topographo 0.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Swan Factory
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: topographo
3
+ Version: 0.1.0rc1
4
+ Summary: Reusable Cayley-Dickson and sedenion settlement math for Topographo.
5
+ Author: The Swan Factory
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/TheSwanFactory/occurence
8
+ Project-URL: Documentation, https://theswanfactory.github.io/occurence/
9
+ Project-URL: Source, https://github.com/TheSwanFactory/occurence
10
+ Project-URL: Issues, https://github.com/TheSwanFactory/occurence/issues
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy
15
+ Dynamic: license-file
16
+
17
+ # Occurrence Theory
18
+
19
+ This repository contains a draft research paper and verification script for
20
+ Occurrence Theory (OT), defined as an oriented form of Sedenion Settlement
21
+ Dynamics (SSD).
22
+
23
+ The central object is the Aut-invariant settlement channel on the sedenion
24
+ zero-divisor crack. The paper separates theorem, exact computation,
25
+ measurement, interpretation, and conjecture using explicit ledger tags:
26
+
27
+ - `[T]` theorem
28
+ - `[C]` computation
29
+ - `[M]` measurement
30
+ - `[I]` interpretation
31
+ - `[X]` conjecture
32
+
33
+ ## Files
34
+
35
+ - `topographo/` - reusable Python package for Cayley-Dickson algebra,
36
+ validation gates, operators, and SSD helpers.
37
+ - `occurrence-theory.md` - main paper draft.
38
+ - `occurrence_theory_audit.py` - numerical audit and verification script for
39
+ the algebraic claims.
40
+ - `exceptional_algebras_lab.py` - supporting exceptional algebra reproduction
41
+ module used by the audit.
42
+ - `occurrence_theory_prompt.md` - source prompt and writing constraints used to
43
+ generate the paper.
44
+ - `.github/workflows/audit.yml` - CI workflow that compiles and runs the audit
45
+ scripts.
46
+ - `LICENSE` - MIT license.
47
+
48
+ ## Requirements
49
+
50
+ The audit script requires Python 3.11 or newer and NumPy. The verified
51
+ `exceptional_algebras_lab` module is included in this repository and is used by
52
+ the audit at runtime.
53
+
54
+ `uv` is the preferred runner for local audit work:
55
+
56
+ ```bash
57
+ uv run python occurrence_theory_audit.py
58
+ ```
59
+
60
+ For editable package installation:
61
+
62
+ ```bash
63
+ uv pip install -e .
64
+ ```
65
+
66
+ After installation, the core math layer is importable without running the
67
+ Occurrence Theory audit narrative:
68
+
69
+ ```python
70
+ from topographo.core import CayleyDicksonAlgebra, verify_gates
71
+ from topographo.ssd import SedenionAlgebra
72
+ ```
73
+
74
+ API documentation is generated with `pdoc` and published to GitHub Pages:
75
+ <https://theswanfactory.github.io/occurence/>
76
+
77
+ To build it locally:
78
+
79
+ ```bash
80
+ uv run pdoc \
81
+ topographo \
82
+ topographo.core \
83
+ topographo.core.algebra \
84
+ topographo.core.cayley_dickson \
85
+ topographo.core.gates \
86
+ topographo.ssd \
87
+ topographo.ssd.channel \
88
+ topographo.ssd.sedenion \
89
+ -o site
90
+ ```
91
+
92
+ ## Run the Audit
93
+
94
+ From the repository root:
95
+
96
+ ```bash
97
+ uv run python occurrence_theory_audit.py
98
+ ```
99
+
100
+ To save the output:
101
+
102
+ ```bash
103
+ uv run python occurrence_theory_audit.py > audit_results.txt
104
+ ```
105
+
106
+ After installation, the same audit is also available as:
107
+
108
+ ```bash
109
+ occurrence-theory-audit
110
+ ```
111
+
112
+ CI runs the audit workflow on pull requests and pushes to `main`.
113
+
114
+ ## Status
115
+
116
+ This is a research workspace, not a packaged library. The paper is the primary
117
+ artifact; the script is included to reproduce the computation-backed claims.
118
+
119
+ ## License
120
+
121
+ MIT. See `LICENSE`.
@@ -0,0 +1,105 @@
1
+ # Occurrence Theory
2
+
3
+ This repository contains a draft research paper and verification script for
4
+ Occurrence Theory (OT), defined as an oriented form of Sedenion Settlement
5
+ Dynamics (SSD).
6
+
7
+ The central object is the Aut-invariant settlement channel on the sedenion
8
+ zero-divisor crack. The paper separates theorem, exact computation,
9
+ measurement, interpretation, and conjecture using explicit ledger tags:
10
+
11
+ - `[T]` theorem
12
+ - `[C]` computation
13
+ - `[M]` measurement
14
+ - `[I]` interpretation
15
+ - `[X]` conjecture
16
+
17
+ ## Files
18
+
19
+ - `topographo/` - reusable Python package for Cayley-Dickson algebra,
20
+ validation gates, operators, and SSD helpers.
21
+ - `occurrence-theory.md` - main paper draft.
22
+ - `occurrence_theory_audit.py` - numerical audit and verification script for
23
+ the algebraic claims.
24
+ - `exceptional_algebras_lab.py` - supporting exceptional algebra reproduction
25
+ module used by the audit.
26
+ - `occurrence_theory_prompt.md` - source prompt and writing constraints used to
27
+ generate the paper.
28
+ - `.github/workflows/audit.yml` - CI workflow that compiles and runs the audit
29
+ scripts.
30
+ - `LICENSE` - MIT license.
31
+
32
+ ## Requirements
33
+
34
+ The audit script requires Python 3.11 or newer and NumPy. The verified
35
+ `exceptional_algebras_lab` module is included in this repository and is used by
36
+ the audit at runtime.
37
+
38
+ `uv` is the preferred runner for local audit work:
39
+
40
+ ```bash
41
+ uv run python occurrence_theory_audit.py
42
+ ```
43
+
44
+ For editable package installation:
45
+
46
+ ```bash
47
+ uv pip install -e .
48
+ ```
49
+
50
+ After installation, the core math layer is importable without running the
51
+ Occurrence Theory audit narrative:
52
+
53
+ ```python
54
+ from topographo.core import CayleyDicksonAlgebra, verify_gates
55
+ from topographo.ssd import SedenionAlgebra
56
+ ```
57
+
58
+ API documentation is generated with `pdoc` and published to GitHub Pages:
59
+ <https://theswanfactory.github.io/occurence/>
60
+
61
+ To build it locally:
62
+
63
+ ```bash
64
+ uv run pdoc \
65
+ topographo \
66
+ topographo.core \
67
+ topographo.core.algebra \
68
+ topographo.core.cayley_dickson \
69
+ topographo.core.gates \
70
+ topographo.ssd \
71
+ topographo.ssd.channel \
72
+ topographo.ssd.sedenion \
73
+ -o site
74
+ ```
75
+
76
+ ## Run the Audit
77
+
78
+ From the repository root:
79
+
80
+ ```bash
81
+ uv run python occurrence_theory_audit.py
82
+ ```
83
+
84
+ To save the output:
85
+
86
+ ```bash
87
+ uv run python occurrence_theory_audit.py > audit_results.txt
88
+ ```
89
+
90
+ After installation, the same audit is also available as:
91
+
92
+ ```bash
93
+ occurrence-theory-audit
94
+ ```
95
+
96
+ CI runs the audit workflow on pull requests and pushes to `main`.
97
+
98
+ ## Status
99
+
100
+ This is a research workspace, not a packaged library. The paper is the primary
101
+ artifact; the script is included to reproduce the computation-backed claims.
102
+
103
+ ## License
104
+
105
+ MIT. See `LICENSE`.
@@ -0,0 +1,274 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Exceptional Topography of G2 and F4 Varieties -- reproduction script.
4
+
5
+ Self-contained (numpy only) reproduction of the headline numerical results in
6
+ "The Exceptional Topography of G_2 and F_4 Varieties: Deformation Dynamics and
7
+ Morse-Bott Singularities":
8
+
9
+ 1. Octonions O via Cayley-Dickson -> dim Der(O) = dim g2 = 14
10
+ 2. Albert algebra J3(O) -> dim Der(J3(O)) = dim f4 = 52
11
+ 3. F4-invariant cubic determinant -> derivations annihilate det
12
+ 4. det is indefinite on the trace hypersphere (the F4 "crack")
13
+ 5. Peirce decomposition at a primitive idempotent E1 -> (1, 16, 10)
14
+ 6. Hessian signature of det at E1 -> (+1, -9, 0^17), Morse index 9
15
+ 7. (optional) anisotropy audit of the octonion cubic well from the CSV
16
+
17
+ Everything is measured under scale-RELATIVE tolerances and cross-checked; no
18
+ result is assumed. Run: python3 exceptional_algebras_lab.py
19
+ """
20
+ import numpy as np
21
+
22
+ # ----------------------------------------------------------------------
23
+ # Octonions via the Cayley-Dickson construction (R -> C -> H -> O)
24
+ # ----------------------------------------------------------------------
25
+ def cayley_dickson_table(dim):
26
+ """Structure tensor C[i,j,k] with (e_i e_j) = sum_k C[i,j,k] e_k."""
27
+ def mul(a, b):
28
+ n = len(a)
29
+ if n == 1:
30
+ return np.array([a[0] * b[0]])
31
+ h = n // 2
32
+ a1, a2, b1, b2 = a[:h], a[h:], b[:h], b[h:]
33
+ conj = lambda x: np.concatenate([[x[0]], -x[1:]])
34
+ z1 = mul(a1, b1) - mul(conj(b2), a2)
35
+ z2 = mul(b2, a1) + mul(a2, conj(b1))
36
+ return np.concatenate([z1, z2])
37
+ C = np.zeros((dim, dim, dim))
38
+ for i in range(dim):
39
+ for j in range(dim):
40
+ ei, ej = np.zeros(dim), np.zeros(dim)
41
+ ei[i] = ej[j] = 1.0
42
+ C[i, j] = mul(ei, ej)
43
+ return C
44
+
45
+ def relative_nullity(M, rel=1e-9):
46
+ """Nullity of the domain of M under a scale-RELATIVE cutoff."""
47
+ s = np.linalg.svd(M, compute_uv=False)
48
+ cols = M.shape[1]
49
+ rank = int((s > s.max() * rel).sum())
50
+ return cols - rank, s
51
+
52
+ # ----------------------------------------------------------------------
53
+ # 1 + 2. Derivation-defect map for any algebra given its structure tensor
54
+ # ----------------------------------------------------------------------
55
+ def defect_matrix(mu):
56
+ """
57
+ Linear map Delta: End(A) -> Hom(A x A, A) sending L to
58
+ B_L(x,y) = L(x*y) - L(x)*y - x*L(y).
59
+ Kernel of Delta = derivations of the algebra with tensor mu.
60
+ Returns the (n^3, n^2) matrix.
61
+ """
62
+ n = mu.shape[0]
63
+ D = np.zeros((n, n, n, n, n))
64
+ for c in range(n):
65
+ D[:, :, c, c, :] += mu
66
+ for a in range(n):
67
+ D[a, :, :, :, a] -= mu.transpose(1, 2, 0)
68
+ for b in range(n):
69
+ D[:, b, :, :, b] -= mu.transpose(0, 2, 1)
70
+ return D.reshape(n**3, n**2)
71
+
72
+ def derivations(mu, rel=1e-9):
73
+ """Orthonormal basis of Der(A) as (k, n, n)."""
74
+ n = mu.shape[0]
75
+ Delta = defect_matrix(mu)
76
+ _, s, Vt = np.linalg.svd(Delta, full_matrices=False)
77
+ rank = int((s > s.max() * rel).sum())
78
+ return Vt[rank:].reshape(-1, n, n)
79
+
80
+ # ----------------------------------------------------------------------
81
+ # Albert algebra J3(O): 3x3 Hermitian octonion matrices, 27-dimensional
82
+ # ----------------------------------------------------------------------
83
+ class Albert:
84
+ SLOTS = [(0, 1), (1, 2), (0, 2)] # off-diagonal octonion positions
85
+
86
+ def __init__(self):
87
+ self.C8 = cayley_dickson_table(8)
88
+ self.mu = self._structure_tensor() # (27,27,27), sym in (a,b)
89
+ self.T = np.zeros(27); self.T[:3] = 1.0 # trace linear form
90
+ self.I = np.zeros(27); self.I[:3] = 1.0 # Jordan identity
91
+
92
+ def _omul(self, a, b):
93
+ return np.einsum('i,j,ijk->k', a, b, self.C8)
94
+
95
+ def _oconj(self, a):
96
+ r = -a.copy(); r[0] = a[0]; return r
97
+
98
+ def _basis_mat(self, idx):
99
+ M = np.zeros((3, 3, 8))
100
+ if idx < 3:
101
+ M[idx, idx, 0] = 1.0; return M
102
+ idx -= 3; s, t = divmod(idx, 8); i, j = self.SLOTS[s]
103
+ u = np.zeros(8); u[t] = 1.0
104
+ M[i, j] = u; M[j, i] = self._oconj(u); return M
105
+
106
+ def _mat_to_vec(self, M):
107
+ v = np.zeros(27)
108
+ for d in range(3):
109
+ v[d] = M[d, d, 0]
110
+ for s, (i, j) in enumerate(self.SLOTS):
111
+ v[3 + 8 * s: 11 + 8 * s] = M[i, j]
112
+ return v
113
+
114
+ def _matmul3(self, X, Y):
115
+ Z = np.zeros((3, 3, 8))
116
+ for i in range(3):
117
+ for k in range(3):
118
+ for j in range(3):
119
+ Z[i, k] += self._omul(X[i, j], Y[j, k])
120
+ return Z
121
+
122
+ def _jordan(self, X, Y):
123
+ return 0.5 * (self._matmul3(X, Y) + self._matmul3(Y, X))
124
+
125
+ def _structure_tensor(self):
126
+ B = [self._basis_mat(k) for k in range(27)]
127
+ mu = np.zeros((27, 27, 27))
128
+ for a in range(27):
129
+ for b in range(27):
130
+ mu[a, b] = self._mat_to_vec(self._jordan(B[a], B[b]))
131
+ return mu
132
+
133
+ def prod(self, x, y):
134
+ return np.einsum('a,b,abc->c', x, y, self.mu)
135
+
136
+ def det(self, X):
137
+ """F4-invariant cubic via the trace-power formula (basis-free)."""
138
+ X2 = self.prod(X, X); X3 = self.prod(X, X2)
139
+ t1, t2, t3 = self.T @ X, self.T @ X2, self.T @ X3
140
+ return (t1**3 - 3 * t1 * t2 + 2 * t3) / 6.0
141
+
142
+ def trace_form(self):
143
+ return np.einsum('abc,c->ab', self.mu, self.T)
144
+
145
+ def left_mult(self, X):
146
+ return np.einsum('a,abc->cb', X, self.mu)
147
+
148
+
149
+ # ----------------------------------------------------------------------
150
+ # Analyses
151
+ # ----------------------------------------------------------------------
152
+ def octonion_g2():
153
+ C8 = cayley_dickson_table(8)
154
+ dim, _ = relative_nullity(defect_matrix(C8))
155
+ print(f"[1] dim Der(O) = {dim} (expected dim g2 = 14)")
156
+ assert dim == 14
157
+ return dim
158
+
159
+ def albert_f4(alb):
160
+ dim, s = relative_nullity(defect_matrix(alb.mu))
161
+ ssort = np.sort(s)
162
+ print(f"[2] dim Der(J3(O)) = {dim} (expected dim f4 = 52)")
163
+ print(f" singular-value gap: {ssort[dim-1]:.2e} | {ssort[dim]:.2e}")
164
+ assert dim == 52
165
+ return dim
166
+
167
+ def determinant_checks(alb):
168
+ print(f"[3] det(diag(2,3,5)) = {alb.det(np.array([2,3,5]+[0]*24, float)):.4f} (expected 30)")
169
+ Der = derivations(alb.mu)
170
+ rng = np.random.default_rng(1); eps = 1e-5; worst = 0.0
171
+ for _ in range(40):
172
+ X = rng.standard_normal(27); D = Der[rng.integers(len(Der))]
173
+ worst = max(worst, abs((alb.det(X + eps*(D@X)) - alb.det(X - eps*(D@X))) / (2*eps)))
174
+ print(f" max |D.det| over derivations = {worst:.2e} (F4-invariance => ~0)")
175
+ return Der
176
+
177
+ def crack_the_sphere(alb, n_samples=200000):
178
+ G = alb.trace_form()
179
+ L = np.linalg.cholesky(G)
180
+ rng = np.random.default_rng(0); vals = np.empty(n_samples)
181
+ for i in range(n_samples):
182
+ v = np.linalg.solve(L.T, rng.standard_normal(27))
183
+ v /= np.sqrt(v @ G @ v)
184
+ vals[i] = alb.det(v)
185
+ print(f"[4] det on unit trace-hypersphere in [{vals.min():+.3f}, {vals.max():+.3f}]; "
186
+ f"crosses 0: {vals.min() < 0 < vals.max()}")
187
+
188
+ def peirce_and_hessian(alb):
189
+ E1 = np.zeros(27); E1[0] = 1.0
190
+ I = np.eye(27); h = 1e-2
191
+ grad = np.array([(alb.det(E1+h*I[i]) - alb.det(E1-h*I[i])) / (2*h) for i in range(27)])
192
+ print(f"[5] ||grad det(E1)|| = {np.linalg.norm(grad):.2e} (E1 is a singular/critical point)")
193
+
194
+ # exact Hessian (pure cubic -> central mixed differences exact)
195
+ H = np.zeros((27, 27))
196
+ for i in range(27):
197
+ for j in range(27):
198
+ H[i, j] = (alb.det(E1+h*I[i]+h*I[j]) - alb.det(E1+h*I[i]-h*I[j])
199
+ - alb.det(E1-h*I[i]+h*I[j]) + alb.det(E1-h*I[i]-h*I[j])) / (4*h*h)
200
+ H = 0.5 * (H + H.T)
201
+
202
+ LE = alb.left_mult(E1); LE = 0.5 * (LE + LE.T)
203
+ w, V = np.linalg.eigh(LE)
204
+ blocks = {"P1 (radial, lam=1)": V[:, np.abs(w-1.0) < 1e-6],
205
+ "P_1/2 (OP^2, lam=1/2)": V[:, np.abs(w-0.5) < 1e-6],
206
+ "P0 (J2(O), lam=0)": V[:, np.abs(w-0.0) < 1e-6]}
207
+ print("[6] Hessian of det at E1, per Peirce block:")
208
+ tol = 1e-6 * np.max(np.abs(H))
209
+ for name, B in blocks.items():
210
+ ev = np.linalg.eigvalsh(B.T @ H @ B)
211
+ pos = int((ev > tol).sum()); neg = int((ev < -tol).sum()); nul = int((np.abs(ev) <= tol).sum())
212
+ print(f" {name:24s} dim={B.shape[1]:2d} signature (+{pos}, -{neg}, 0x{nul})")
213
+ ev = np.linalg.eigvalsh(H)
214
+ pos = int((ev > tol).sum()); neg = int((ev < -tol).sum()); nul = int((np.abs(ev) <= tol).sum())
215
+ print(f" {'OVERALL':24s} dim=27 signature (+{pos}, -{neg}, 0x{nul}) Morse index = {neg}")
216
+
217
+ def octonion_anisotropy(csv_path="octonion_cubic_cross_variation.csv"):
218
+ import csv, os
219
+ if not os.path.exists(csv_path):
220
+ print(f"[7] (skipped: {csv_path} not found)"); return
221
+ rows = [r for r in csv.reader(open(csv_path))][1:]
222
+ A = np.zeros((28, 28, 28, 28))
223
+ for r in rows:
224
+ if r:
225
+ A[int(r[0]), int(r[1]), int(r[2]), int(r[3])] = float(r[4])
226
+ H = A[1:, 1:, 1:, 1:]; d = 27; I = np.eye(d)
227
+ P = (np.einsum('oi,jk->oijk', I, I) + np.einsum('oj,ik->oijk', I, I)
228
+ + np.einsum('ok,ij->oijk', I, I)) / 3
229
+ c = np.sum(H * P) / np.sum(P * P)
230
+ iso = c * P; aniso = H - iso
231
+ print(f"[7] octonion cubic well anisotropy audit:")
232
+ print(f" pure-27 anisotropic/isotropic norm ratio = "
233
+ f"{np.linalg.norm(aniso)/np.linalg.norm(iso):.1%} (isotropic well => 0%)")
234
+ print(f" tr(h^3)->conformal channel norm = {np.linalg.norm(A[0,1:,1:,1:]):.4f} (isotropic => 0)")
235
+ print(" => the G2 well is STABLE but ANISOTROPIC (symmetry is G2, not O(27)).")
236
+
237
+
238
+ def albert_g2_decomposition(alb):
239
+ """Lift g2 = Der(O) into f4 = Der(J3(O)) and decompose the 27 as a g2-module."""
240
+ g2 = derivations(cayley_dickson_table(8))
241
+ def lift(D):
242
+ M = np.zeros((27, 27))
243
+ for s in range(3):
244
+ M[3 + 8*s: 11 + 8*s, 3 + 8*s: 11 + 8*s] = D
245
+ return M
246
+ G = [lift(D) for D in g2]
247
+ rng = np.random.default_rng(0); worst = 0.0
248
+ for Dh in G:
249
+ for _ in range(5):
250
+ x = rng.standard_normal(27); y = rng.standard_normal(27)
251
+ b = alb.prod(Dh@x, y) + alb.prod(x, Dh@y) - Dh @ alb.prod(x, y)
252
+ worst = max(worst, np.linalg.norm(b))
253
+ s = np.linalg.svd(np.vstack(G), compute_uv=False)
254
+ inv = 27 - int((s > s.max()*1e-9).sum())
255
+ Cas = sum(Dh @ Dh for Dh in G)
256
+ ev = np.linalg.eigvalsh(0.5*(Cas + Cas.T))
257
+ vals, cnts = np.unique(np.round(ev, 4), return_counts=True)
258
+ print(f"[8] g2 lifted into f4: residual defect on J3(O) = {worst:.2e}")
259
+ print(f" g2-invariants in the 27 = {inv} Casimir spectrum = "
260
+ f"{ {float(v): int(c) for v, c in zip(vals, cnts)} }")
261
+ print(f" => J3(O) = 1^(+6) (+) 7^(+3) under g2 (6 trivial + 3x7)")
262
+
263
+
264
+ if __name__ == "__main__":
265
+ print("=" * 68)
266
+ octonion_g2()
267
+ alb = Albert()
268
+ albert_f4(alb)
269
+ determinant_checks(alb)
270
+ crack_the_sphere(alb)
271
+ peirce_and_hessian(alb)
272
+ albert_g2_decomposition(alb)
273
+ octonion_anisotropy()
274
+ print("=" * 68)