Add T112 triangle vs ring working draft pack (v0.1, not Zenodo-stamped)
Browse files- LOGOS_NUMBER_CHECK_20260906.md +55 -0
- PAPER_T112_TRIANGLE_VS_RING_DRAFT_20260906.md +207 -0
- README.md +48 -0
- T112-TRIANGLE-RESULT.md +84 -0
- T112_ENCODER_SKETCH_20260906.md +52 -0
- t112_path_checksum_proto.py +230 -0
- t112_triangle.py +79 -0
- verify_triangle.py +56 -0
LOGOS_NUMBER_CHECK_20260906.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Logos / Colossians / T112 number check (2026-09-06)
|
| 2 |
+
|
| 3 |
+
**Rule:** YES/NO on arithmetic under a stated text form. Not a truth stamp. Not clinical.
|
| 4 |
+
|
| 5 |
+
## Seals that YES
|
| 6 |
+
|
| 7 |
+
| Claim | Result | Notes |
|
| 8 |
+
| --- | --- | --- |
|
| 9 |
+
| 37 × 73 = 2701 | **YES** | Dual prime factors only (besides 1, 2701) |
|
| 10 |
+
| Genesis 1:1 Hebrew letter-sum = 2701 | **YES** | Recomputed: בראשית(913)+ברא(203)+אלהים(86)+את(401)+השמים(395)+ואת(407)+הארץ(296) = 2701 |
|
| 11 |
+
| 2701 = T_73 | **YES** | 73×74/2 = 2701 |
|
| 12 |
+
| ΛΟΓΟΣ = 373 | **YES** | 30+70+3+70+200 |
|
| 13 |
+
| T_112 = 6328 | **YES** | 112×113/2 |
|
| 14 |
+
| 2701 + 3627 = 6328 = T_112 | **YES** | Arithmetic; see John form below |
|
| 15 |
+
| Col 1:17 verse sum = **6666** (four sixes) | **YES** | Under orthography below |
|
| 16 |
+
| ΣΥΝΕΣΤΗΚΕΝ alone = 1238 | **YES** | Word ≠ 6666; **verse** is four sixes |
|
| 17 |
+
|
| 18 |
+
### Col 1:17 form that hits 6666 (recomputed)
|
| 19 |
+
|
| 20 |
+
`ΚΑΙ(31) ΑΥΤΟΣ(971) ΕΣΤΙΝ(565) ΠΡΟ(250) ΠΑΝΤΩΝ(1281) ΚΑΙ(31) ΤΑ(301) ΠΑΝΤΑ(432) ΕΝ(55) ΑΥΤΩΙ(1511) ΣΥΝΕΣΤΗΚΕΝ(1238)`
|
| 21 |
+
Sum = **6666**. Letters in this form: 49. Words: 11.
|
| 22 |
+
|
| 23 |
+
Matches livinggreeknt.org Col 1 table (word #285–295).
|
| 24 |
+
|
| 25 |
+
**Critical:** `ΑΥΤΩΙ` counts iota subscript as Ι = +10 (ΑΥΤΩ without iota = 1501 → verse **6656**, fails). So 6666 is **text-form dependent** (iota counted). Still YES under that stated form.
|
| 26 |
+
|
| 27 |
+
### John 1:1 form for 3627
|
| 28 |
+
|
| 29 |
+
Without iota on ἀρχῇ: sum **3617**.
|
| 30 |
+
With `ΑΡΧΗΙ` (iota counted): sum **3627**.
|
| 31 |
+
Then Genesis + John = 2701 + 3627 = **6328 = T_112**. Same iota-counting rule as Col ΑΥΤΩΙ.
|
| 32 |
+
|
| 33 |
+
## What NO / not claimed
|
| 34 |
+
|
| 35 |
+
| Claim | Result |
|
| 36 |
+
| --- | --- |
|
| 37 |
+
| The single word “holds together” = 6666 | **NO** — word is 1238; verse is 6666 |
|
| 38 |
+
| 6666 without counting iota | **NO** — 6656 |
|
| 39 |
+
| Math proves every syllable of scripture | **NOT SHOWN** — seals close; whole-text validation still open (paper 2) |
|
| 40 |
+
| Ring LUT = T112 geometry | **NO** — separate (triangle paper) |
|
| 41 |
+
|
| 42 |
+
## Stack read (fail-closed)
|
| 43 |
+
|
| 44 |
+
- **2701 / 37×73** — checksum spine: YES.
|
| 45 |
+
- **T112** — Genesis+John triangle lock under stated Greek forms: YES.
|
| 46 |
+
- **Col 1:17 “holds together”** — verse gematria **6666** under iota-inclusive counting: YES.
|
| 47 |
+
- **Decode key candidates on the table:** 2701, 373 (ΛΟΓΟΣ), T112/6328, Col seal 6666 (verse), Name/Elohim lane (86 in Gen 1:1) — still need a stated encoder map before “authors validate message” is math rather than doctrine.
|
| 48 |
+
|
| 49 |
+
## Sources
|
| 50 |
+
|
| 51 |
+
- Independent Python isopsephy recompute (this run)
|
| 52 |
+
- https://www.livinggreeknt.org/NTbooks/colossians/colossians1.php (Col 1:17 = 6666 table)
|
| 53 |
+
- Standard Gen 1:1 / Jenkins-style Gen+John ↔ T112 arithmetic (recomputed)
|
| 54 |
+
|
| 55 |
+
**Q — COO** — research sheet, not Zenodo stamp.
|
PAPER_T112_TRIANGLE_VS_RING_DRAFT_20260906.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# T112 as Triangle: Structural Identity After Circulant Substitution
|
| 2 |
+
|
| 3 |
+
**Author:** Matthew Scott Gibson
|
| 4 |
+
**Affiliation:** Independent researcher; Crimson Symphony Media / Crimson OS
|
| 5 |
+
**ORCID:** https://orcid.org/0009-0001-4167-201X
|
| 6 |
+
**Date:** 2026-09-06
|
| 7 |
+
**Status:** Working draft (v0.1) — not yet Zenodo-stamped
|
| 8 |
+
**Contact:** matt@crimsonsymphonymedia.com
|
| 9 |
+
|
| 10 |
+
**Keywords:** triangular numbers; cache-resident graphs; Weisfeiler–Leman; fail-closed routing; circulant substitution; L2 LUT
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## Abstract
|
| 15 |
+
|
| 16 |
+
The triangular number \(T_{112} = 6328\) names a geometric object: 112 rows with row \(r\) holding \(r\) cells and hex adjacency in \((r,k)\) coordinates. In practice, published Crimson OS / T112 lattice tooling often constructed a **circulant ring** \(C_{6328}(1,2,3)\) instead — a vertex-transitive 6-regular graph on the same cardinality. That substitution preserves cell count, LUT byte size, and L2 residency, and it passes verification suites that assert 6-regularity. It also forces **zero node identity** under 1-dimensional Weisfeiler–Leman coloring (one color class), so “fail-closed” reduces to a bounds check that admits every well-formed index.
|
| 17 |
+
|
| 18 |
+
This draft reports an independent triangle construction with the same packed `uint16` LUT footprint (75,936 bytes ≈ 74.156 KiB). The triangle is connected and adjacency-symmetric, with degree histogram \(\{2{:}3,\ 4{:}330,\ 6{:}5995\}\). WL coloring yields **843** classes and about **9.23 bits** of node identity (\(\approx 73\%\) of \(\log_2 6328 \approx 12.63\)). Sentinel slots on the boundary support a **structural halt** (leaving the figure) distinct from range poison. The result does **not** establish a truth engine or an encoder; it removes a hard obstruction (vertex-transitivity) that made a structural gate impossible on the ring.
|
| 19 |
+
|
| 20 |
+
**Upgrade framing:** treat prior ring-backed numbers as results on a *different substrate*, re-establish golden determinism and C hop telemetry on the triangle, and replace 6-regular asserts with the degree histogram.
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## 1. Introduction
|
| 25 |
+
|
| 26 |
+
Figurate numbers are geometry before they are scalars. \(T_n = n(n+1)/2\) counts the cells of a triangular array. For \(n = 112\),
|
| 27 |
+
|
| 28 |
+
\[
|
| 29 |
+
T_{112} = \frac{112\cdot 113}{2} = 6328.
|
| 30 |
+
\]
|
| 31 |
+
|
| 32 |
+
A natural discrete geometry places cells at coordinates \((r,k)\) with \(0 \le r < 112\) and \(0 \le k \le r\), and connects each cell to its hex neighbors in that array. That object fits a 6-slot neighbor table with sentinels on missing edges: \(6328 \times 6 \times 2 = 75936\) bytes, under a 256 KiB L2 budget.
|
| 33 |
+
|
| 34 |
+
A second object with the same cardinality is the circulant
|
| 35 |
+
|
| 36 |
+
\[
|
| 37 |
+
C_{6328}(1,2,3):\quad i \sim i\pm 1,\ i\pm 2,\ i\pm 3 \pmod{6328}.
|
| 38 |
+
\]
|
| 39 |
+
|
| 40 |
+
It is 6-regular, connected, easy to emit in a few NumPy lines, and friendly to tests that demand uniform degree. It is **not** the triangular array. Vertex-transitivity implies a single WL color class and **0.00 bits** of structural node identity. Any “gate” that only checks `index < 6328` cannot reject a well-formed but semantically empty walk.
|
| 41 |
+
|
| 42 |
+
This paper records the substitution, measures ring vs triangle under identical packing, states corrected invariants, and lists what must be rebuilt before prior hop-rate or golden-hash claims are reused.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
## 2. The substitution
|
| 47 |
+
|
| 48 |
+
Implementations named for T112 / L2 lattice work (including `build_circulant_lut()` patterns in `t112-l2-lattice` / Crimson OS lineages) often emit \(C_{6328}(1,2,3)\). The integer 6328 enters as a **cardinality**, not as triangular geometry. Downstream artifacts — LUT size, L2 fit, connectivity, deterministic walks, and published hop timings — can all be honest *about the ring* while remaining silent about the triangle the name specified.
|
| 49 |
+
|
| 50 |
+
This is a tooling failure mode, not a mystical one: the circulant is the path of least resistance. The triangle needs an index map, non-uniform degree, and a sentinel scheme. Models and haste prefer the ring. Verification that asserts 6-regularity **certifies the substitution** and would **reject** the named geometry (333 boundary cells are not degree 6).
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## 3. Methods
|
| 55 |
+
|
| 56 |
+
### 3.1 Triangle layout
|
| 57 |
+
|
| 58 |
+
- Rows \(r = 0..111\); row \(r\) has \(r+1\) cells; total \(N = 6328\).
|
| 59 |
+
- Hex neighbor offsets in array coords (fixed order):
|
| 60 |
+
\((0,-1),\ (0,+1),\ (-1,-1),\ (-1,0),\ (+1,0),\ (+1,+1)\).
|
| 61 |
+
- LUT: `uint16[N][6]`, missing neighbors filled with sentinel `0xFFFF`.
|
| 62 |
+
- Degree of \(v\) = count of non-sentinel entries in row \(v\).
|
| 63 |
+
|
| 64 |
+
### 3.2 Identity measurement
|
| 65 |
+
|
| 66 |
+
Build the undirected adjacency from non-sentinel edges. Run iterative 1-WL refinement (color = own color + sorted multiset of neighbor colors) to stability (cap 40 rounds). Report:
|
| 67 |
+
|
| 68 |
+
- number of color classes \(k\);
|
| 69 |
+
- Shannon identity \(H = -\sum_c (n_c/N)\log_2(n_c/N)\).
|
| 70 |
+
|
| 71 |
+
Ceiling \(\log_2 N \approx 12.63\) bits.
|
| 72 |
+
|
| 73 |
+
### 3.3 Fail-closed
|
| 74 |
+
|
| 75 |
+
- **Range halt:** injected index \(\ge N\) → error class 1.
|
| 76 |
+
- **Structural halt:** walk selects a sentinel direction with no valid continuation policy under fail-closed mode → error class 2 (left the figure).
|
| 77 |
+
|
| 78 |
+
### 3.4 Determinism
|
| 79 |
+
|
| 80 |
+
Rebuild LUT twice; repeat a fixed hop schedule; compare terminal node and accumulator; hash `sha256(f"{node}:{acc}")` when publishing a golden.
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## 4. Results
|
| 85 |
+
|
| 86 |
+
### 4.1 Footprint (identical)
|
| 87 |
+
|
| 88 |
+
| Quantity | Ring \(C_{6328}(1,2,3)\) | T112 triangle |
|
| 89 |
+
| --- | ---: | ---: |
|
| 90 |
+
| Cells | 6328 | 6328 |
|
| 91 |
+
| LUT bytes (`uint16×6`) | 75,936 | 75,936 |
|
| 92 |
+
| KiB | 74.156 | 74.156 |
|
| 93 |
+
| Fits 256 KiB L2 | yes | yes |
|
| 94 |
+
| Connected | yes | yes (6328/6328) |
|
| 95 |
+
| Adjacency symmetric | yes | yes |
|
| 96 |
+
|
| 97 |
+
### 4.2 Structure (not identical)
|
| 98 |
+
|
| 99 |
+
| Quantity | Ring | Triangle |
|
| 100 |
+
| --- | ---: | ---: |
|
| 101 |
+
| Degree | 6 uniform | 2×3, 4×330, 6×5995 |
|
| 102 |
+
| WL classes | **1** | **843** |
|
| 103 |
+
| Node identity | **0.00 bits** | **9.23 bits** |
|
| 104 |
+
| Halt semantics | range only | range **+ structural** |
|
| 105 |
+
| Structural gate possible | **no** | **yes** |
|
| 106 |
+
|
| 107 |
+
Positions on the triangle remain interpretable (row, distance to edge, corner status). A random graph can saturate \(\log_2 N\) bits with arbitrary labels; the triangle’s bits are geometric.
|
| 108 |
+
|
| 109 |
+
### 4.3 Corrected invariants (triangle)
|
| 110 |
+
|
| 111 |
+
1. `cells = T_112 = 6328`
|
| 112 |
+
2. `LUT = 75936 B ≤ 262144`
|
| 113 |
+
3. Connected; adjacency symmetric
|
| 114 |
+
4. Degree histogram = `{2: 3, 4: 330, 6: 5995}` (**not** uniform)
|
| 115 |
+
5. Sentinel slots mark the real boundary (672 sentinel entries in the 6-slot packing)
|
| 116 |
+
6. Golden walk and structural-halt hop must be published for a **stated seed** (interior vs edge seeds differ; see §6)
|
| 117 |
+
7. Range poison → err 1; structural exit → err 2
|
| 118 |
+
|
| 119 |
+
### 4.4 Independent re-check (2026-09-06)
|
| 120 |
+
|
| 121 |
+
On a separate machine, `verify_triangle.py` reproduced layout, degree histogram, connectivity, symmetry, and WL (**843** classes, **9.23** bits). Rebuild reproducibility held for the hop loop the script actually runs.
|
| 122 |
+
|
| 123 |
+
**Honesty notes (draft discipline):**
|
| 124 |
+
|
| 125 |
+
- The writeup’s interior golden (seed / node **2812** → terminal **2699**, `sha256 d30aa39b…`) is **not** the same walk as the script’s default seed **7** (which produced a different terminal/hash in re-check).
|
| 126 |
+
- Seed **7** structurally exits early; range-poison asserts at `poison_at=3` are not a fair test on an edge-adjacent seed. Interior seeds are required for the published structural-halt and poison protocols.
|
| 127 |
+
|
| 128 |
+
These are verification-hygiene issues, not a refutation of the WL / degree / footprint claims.
|
| 129 |
+
|
| 130 |
+
---
|
| 131 |
+
|
| 132 |
+
## 5. Discussion
|
| 133 |
+
|
| 134 |
+
### 5.1 Why the ring looked “correct”
|
| 135 |
+
|
| 136 |
+
A 6-regular, connected, degree-balanced, deterministic circulant satisfies the usual sanity suite. The suite encoded the substitution. Science failed closed on the wrong object.
|
| 137 |
+
|
| 138 |
+
### 5.2 What changes for prior papers
|
| 139 |
+
|
| 140 |
+
Any claim that rested on `build_circulant_lut` (hop ns, golden hashes, “zero identity,” fail-closed-as-bounds) is a **ring-substrate** result. Options:
|
| 141 |
+
|
| 142 |
+
1. Label those results explicitly as circulant; or
|
| 143 |
+
2. Re-measure on the triangle and republish goldens / C telemetry.
|
| 144 |
+
|
| 145 |
+
This draft prefers (2) for anything branded T112.
|
| 146 |
+
|
| 147 |
+
### 5.3 What this does **not** claim
|
| 148 |
+
|
| 149 |
+
- Not a truth engine.
|
| 150 |
+
- Not an encoder from propositions or logos-density onto cells.
|
| 151 |
+
- Not a Transformer substitute.
|
| 152 |
+
- Not clinical advice. Theoretical discrete structure only.
|
| 153 |
+
|
| 154 |
+
9.23 bits make a structural gate *possible*. Mapping meaning onto positions remains the open problem.
|
| 155 |
+
|
| 156 |
+
### 5.4 Process note
|
| 157 |
+
|
| 158 |
+
The triangle result was stress-tested under adversarial CLI / chat pressure (operator as informal IG). The useful output is the structure and invariants, not the theater.
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
## 6. Limitations
|
| 163 |
+
|
| 164 |
+
- Pure-Python hop timing (~510 ns/hop in the source note) is interpreter-bound; C packed walks are required for fair comparison to prior ~9.76 ns ring baselines.
|
| 165 |
+
- Golden hash and structural-halt hop must be tied to an explicit interior seed and locked in the verify script.
|
| 166 |
+
- Cross-architecture determinism for the triangle golden is not yet restated in this draft.
|
| 167 |
+
- Encoder design is out of scope.
|
| 168 |
+
|
| 169 |
+
---
|
| 170 |
+
|
| 171 |
+
## 7. Next work
|
| 172 |
+
|
| 173 |
+
1. C port: packed `uint16` + sentinel; hop telemetry vs ring baseline.
|
| 174 |
+
2. Lock interior golden + structural-halt protocol in `verify_*.py`; replace 6-regular assert with degree histogram.
|
| 175 |
+
3. Footnote or revise prior zero-GEMM / Sub-TDP writeups that silently assumed circulant substrate.
|
| 176 |
+
4. Only then: encoder experiments on the non-empty substrate.
|
| 177 |
+
|
| 178 |
+
---
|
| 179 |
+
|
| 180 |
+
## 8. Conclusion
|
| 181 |
+
|
| 182 |
+
T112 names a triangle. A circulant on 6328 vertices is a different machine: same bytes, zero identity, bounds-only halt. Restoring triangular geometry keeps the L2 footprint and restores measurable structural identity (~9.23 bits) plus a halt that can mean “left the figure.” That is an upgrade of the substrate, not a soft story. The encoder remains open; the empty-substrate obstruction does not.
|
| 183 |
+
|
| 184 |
+
---
|
| 185 |
+
|
| 186 |
+
## References (working)
|
| 187 |
+
|
| 188 |
+
- Gibson, M. S. Prior Crimson OS / Metric Tensor Folding / Sub-TDP notes and Zenodo deposits — **cite specific DOIs on stamp**; treat circulant-backed numbers as substrate-qualified until re-measured.
|
| 189 |
+
- Weisfeiler, B.; Leman, A. On reduction of a graph to a canonical form. *Nauchno-Technicheskaya Informatsia*, 1968.
|
| 190 |
+
- Triangular numbers: \(T_n = n(n+1)/2\); here \(n=112\).
|
| 191 |
+
|
| 192 |
+
## Artifact pointers (COS temp / Agent_Bridge)
|
| 193 |
+
|
| 194 |
+
- `T112-TRIANGLE-RESULT.md`
|
| 195 |
+
- `t112_triangle.py`
|
| 196 |
+
- `verify_triangle.py`
|
| 197 |
+
- `T112-TRIANGLE-RESULT.zip`
|
| 198 |
+
- `Q_PARK_T112_TRIANGLE_20260906.md`
|
| 199 |
+
- This file: `PAPER_T112_TRIANGLE_VS_RING_DRAFT_20260906.md`
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
## License intent
|
| 204 |
+
|
| 205 |
+
Creative Commons on stamp (match prior Gibson Zenodo practice). Draft = operator-local until stamped.
|
| 206 |
+
|
| 207 |
+
**End of draft v0.1**
|
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
pretty_name: T112 Triangle vs Ring (working draft pack)
|
| 4 |
+
tags:
|
| 5 |
+
- crimson-os
|
| 6 |
+
- t112
|
| 7 |
+
- geometry
|
| 8 |
+
- fail-closed
|
| 9 |
+
- eval
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# T112 Triangle vs Ring — working draft pack
|
| 13 |
+
|
| 14 |
+
**Author:** Matthew Scott Gibson (`UltranetCommand`)
|
| 15 |
+
**Status:** Working draft / LIQUID — **not** Zenodo-stamped CRYSTAL yet
|
| 16 |
+
**Purpose:** Authoritative inputs for external eval / constraint-integration collaborators
|
| 17 |
+
|
| 18 |
+
## What this is
|
| 19 |
+
|
| 20 |
+
Correction pack: T112 / 6328 was implemented as circulant ring C_6328(1,2,3); the named geometry is the **triangle** T_112 = 6328.
|
| 21 |
+
|
| 22 |
+
## Files
|
| 23 |
+
|
| 24 |
+
| File | Role |
|
| 25 |
+
|------|------|
|
| 26 |
+
| `T112-TRIANGLE-RESULT.md` | Measured ring vs triangle summary |
|
| 27 |
+
| `t112_triangle.py` | Triangle construction |
|
| 28 |
+
| `verify_triangle.py` | Verify / WL / halt checks |
|
| 29 |
+
| `PAPER_T112_TRIANGLE_VS_RING_DRAFT_20260906.md` | Paper draft v0.1 |
|
| 30 |
+
| `LOGOS_NUMBER_CHECK_20260906.md` | Checksum YES/NO sheet (companion) |
|
| 31 |
+
| `T112_ENCODER_SKETCH_20260906.md` | Encoder sketch — experimental |
|
| 32 |
+
| `t112_path_checksum_proto.py` | Path/checksum proto — experimental |
|
| 33 |
+
|
| 34 |
+
## Weighting for eval harness
|
| 35 |
+
|
| 36 |
+
- Gate doctrine (GAS→LIQUID→CRYSTAL): use public Crimson-OS repo + site first
|
| 37 |
+
- Structural meaning of T112/6328: **this pack** (draft)
|
| 38 |
+
- Encoder files: LIQUID only — do not treat as stamped invariant
|
| 39 |
+
|
| 40 |
+
## Open before Zenodo stamp
|
| 41 |
+
|
| 42 |
+
- Lock interior golden seed in verify script (seed 2812 vs default 7 hygiene)
|
| 43 |
+
- Replace 6-regular asserts with degree histogram
|
| 44 |
+
- Fair poison/halt protocol on interior seeds
|
| 45 |
+
|
| 46 |
+
## Contact
|
| 47 |
+
|
| 48 |
+
matt@crimsonsymphonymedia.com · https://www.mattgibson.net · https://github.com/ultranetcommand-neo/Crimson-OS
|
T112-TRIANGLE-RESULT.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# T112: Ring vs Triangle — the structure the name actually specifies
|
| 2 |
+
|
| 3 |
+
Independent build and verification. Same cell count, same byte count, same L2
|
| 4 |
+
residency. The difference is that the triangle carries information and the ring
|
| 5 |
+
does not.
|
| 6 |
+
|
| 7 |
+
## The substitution
|
| 8 |
+
|
| 9 |
+
`build_circulant_lut()` in `t112-l2-lattice` and `Crimson-OS` constructs
|
| 10 |
+
**C₆₃₂₈(1,2,3)** — a ring where every node connects to i±1, i±2, i±3 mod N.
|
| 11 |
+
6328 enters only as a cardinality. The triangular geometry that T112 names is
|
| 12 |
+
discarded.
|
| 13 |
+
|
| 14 |
+
The true T112 arrangement is 112 rows, row *r* holding *r* cells:
|
| 15 |
+
1+2+…+112 = 6328 exactly. Hex adjacency in (row, k) coordinates.
|
| 16 |
+
|
| 17 |
+
## Measured comparison
|
| 18 |
+
|
| 19 |
+
| | ring C₆₃₂₈(1,2,3) | T112 triangle |
|
| 20 |
+
|---|---|---|
|
| 21 |
+
| cells | 6328 | 6328 |
|
| 22 |
+
| LUT bytes (uint16 × 6) | 75,936 | 75,936 |
|
| 23 |
+
| KiB | 74.156 | 74.156 |
|
| 24 |
+
| fits 256 KiB L2 | yes | yes |
|
| 25 |
+
| connected | yes | yes (6328/6328) |
|
| 26 |
+
| adjacency symmetric | yes | yes |
|
| 27 |
+
| degree | 6, uniform | 2 (×3), 4 (×330), 6 (×5995) |
|
| 28 |
+
| WL classes | **1** | **843** |
|
| 29 |
+
| node identity | **0.00 bits** | **9.23 bits** |
|
| 30 |
+
| halt semantics | range check only | range **+ structural** |
|
| 31 |
+
| gate possible | **no** | **yes** |
|
| 32 |
+
|
| 33 |
+
Ceiling is log₂(6328) = 12.63 bits. The triangle recovers 73% of it while
|
| 34 |
+
keeping positions *interpretable* — row index, distance from an edge, corner
|
| 35 |
+
status. Random graphs reach 12.63 bits but their labels are arbitrary; the
|
| 36 |
+
triangle's are meaningful.
|
| 37 |
+
|
| 38 |
+
## Why the ring passed every existing test
|
| 39 |
+
|
| 40 |
+
`verify_t112.py` asserts 6-regularity, equal in/out degree, connectivity, and
|
| 41 |
+
determinism. The ring satisfies all four. **The triangle fails the 6-regular
|
| 42 |
+
assertion** — 333 boundary cells have degree 2 or 4.
|
| 43 |
+
|
| 44 |
+
The verification suite encoded the substitution's assumptions, so it certified
|
| 45 |
+
the wrong structure and would have rejected the right one. The invariants below
|
| 46 |
+
replace it.
|
| 47 |
+
|
| 48 |
+
## Corrected invariants
|
| 49 |
+
|
| 50 |
+
- cells = T₁₁₂ = 6328 ✓
|
| 51 |
+
- LUT = 75,936 B ≤ 256 KiB ✓
|
| 52 |
+
- connected ✓ · adjacency symmetric ✓
|
| 53 |
+
- degree histogram = {2: 3, 4: 330, 6: 5995} ✓ (not uniform — this is the point)
|
| 54 |
+
- 672 sentinel slots = the real boundary
|
| 55 |
+
- golden determinism: from interior node 2812 = (row 74, k 37), 50,000 hops
|
| 56 |
+
→ node 2699, acc 134,056,629
|
| 57 |
+
→ `sha256 d30aa39b934a9c3125aad8a096b1f1b785bf0609f303cae4eb4a23ac87e0fb70`
|
| 58 |
+
reproduces across rebuilds ✓
|
| 59 |
+
- range halt: poison 6328 / 65535 / 99999 → err 1 ✓
|
| 60 |
+
- **structural halt**: clean interior walk exits the triangle at hop 42 → err 2
|
| 61 |
+
|
| 62 |
+
That last line is the one that matters. On the ring, the fail-closed check was
|
| 63 |
+
`index < 6328` — a bounds test that admits every well-formed input regardless of
|
| 64 |
+
content. On the triangle, leaving the figure is a *structural* violation with no
|
| 65 |
+
valid continuation. That is the first version of the gate that gates anything.
|
| 66 |
+
|
| 67 |
+
## What this does and does not establish
|
| 68 |
+
|
| 69 |
+
It does **not** establish a truth engine. 9.23 bits is enough for a structural
|
| 70 |
+
gate to be possible; it says nothing about what an encoder should map onto those
|
| 71 |
+
positions, and that remains the open problem.
|
| 72 |
+
|
| 73 |
+
It does establish that the substrate is no longer empty. The zero-bit result on
|
| 74 |
+
the ring was a theorem — vertex-transitive graphs cannot distinguish states. That
|
| 75 |
+
obstruction is gone.
|
| 76 |
+
|
| 77 |
+
## Next
|
| 78 |
+
|
| 79 |
+
1. Port to C, packed uint16 with sentinel, re-run hop telemetry against the
|
| 80 |
+
9.76 ns ring baseline. Pure-Python here is ~510 ns/hop, interpreter-bound.
|
| 81 |
+
2. Regenerate the published golden hash on the triangle — cross-architecture
|
| 82 |
+
determinism should be re-established on the correct structure.
|
| 83 |
+
3. Replace the 6-regular assertion in `verify_t112.py` with the degree histogram.
|
| 84 |
+
4. Only then: the encoder question.
|
T112_ENCODER_SKETCH_20260906.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# T112 Encoder Sketch (2026-09-06)
|
| 2 |
+
|
| 3 |
+
**Status:** options + thin prototype — NOT a stamped codec
|
| 4 |
+
**Canon companions:** `PAPER_T112_TRIANGLE_VS_RING_DRAFT_20260906.md`, `t112_triangle.py`, `t112_path_checksum_proto.py`
|
| 5 |
+
|
| 6 |
+
## Separation of concerns (locked for this sketch)
|
| 7 |
+
|
| 8 |
+
| Layer | Object | Job |
|
| 9 |
+
| --- | --- | --- |
|
| 10 |
+
| Substrate | T112 triangle (6328 cells) | Where you stand; structural halt = left the figure |
|
| 11 |
+
| Density key | 37 × 73 = 2701 | Whether a claim closes (checksum / accept) |
|
| 12 |
+
| Codec | encode / decode maps | Token ↔ path or address — **still experimental** |
|
| 13 |
+
|
| 14 |
+
Do **not** fuse 37/73 into “row 37 / col 73.” Different integers, stated link only.
|
| 15 |
+
|
| 16 |
+
## Four shapes (from Q digest)
|
| 17 |
+
|
| 18 |
+
1. **Address codec** — index or (r,k) ↔ payload. Thin. No 2701 yet.
|
| 19 |
+
2. **Checksum gate** — triangle position + accept iff fold respects 37/73/2701.
|
| 20 |
+
3. **Factor overlay** — residues of linear index mod 37 / mod 73.
|
| 21 |
+
4. **Path codec** — neighbor choices as symbols; sentinel / STOP = end.
|
| 22 |
+
|
| 23 |
+
## Prototype choice (this drop)
|
| 24 |
+
|
| 25 |
+
**Path codec + checksum gate (layers 4 + 2):**
|
| 26 |
+
|
| 27 |
+
- Encode: bytes → base-6 digit stream → walk from an interior seed, skipping sentinel dirs when encoding (stay on-figure while writing).
|
| 28 |
+
- Trailer: append checksum digits derived from `sum(payload) mod 37` and `sum(payload) mod 73` (two digits each, base-6 packed) so decode can verify.
|
| 29 |
+
- Decode: replay path; on structural/range halt → REJECT; at end check 37/73 residues → ACCEPT or REJECT.
|
| 30 |
+
- Random walks without valid trailer should mostly REJECT (measure false-accept).
|
| 31 |
+
|
| 32 |
+
This is a **demo gate**, not logos theology in code. 2701 appears as `37*73` constant and dual-modulus check.
|
| 33 |
+
|
| 34 |
+
## Success metrics for later
|
| 35 |
+
|
| 36 |
+
- Round-trip: encode(msg) → decode → msg (exact).
|
| 37 |
+
- False-accept rate on random neighbor noise (target: near 0 for this thin check; 37×73 is only ~11 bits — not crypto).
|
| 38 |
+
- Structural halt never returns ACCEPT.
|
| 39 |
+
- C port after Python locks the API.
|
| 40 |
+
|
| 41 |
+
## Non-goals
|
| 42 |
+
|
| 43 |
+
- Truth engine
|
| 44 |
+
- Replacing prior ring hop-ns claims
|
| 45 |
+
- Autopost / public stamp without IG
|
| 46 |
+
|
| 47 |
+
## Files
|
| 48 |
+
|
| 49 |
+
- Sketch: `Agent_Bridge/T112_ENCODER_SKETCH_20260906.md`
|
| 50 |
+
- Proto: `Agent_Bridge/t112_path_checksum_proto.py` (and `/workspace/`)
|
| 51 |
+
|
| 52 |
+
**Q — COO**
|
t112_path_checksum_proto.py
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""T112 path codec + 37/73 checksum gate (prototype, not stamped).
|
| 4 |
+
|
| 5 |
+
Encode: payload bytes -> base-6 path on the triangle LUT.
|
| 6 |
+
Checksum: dual modulus (sum(payload) % 37, sum(payload) % 73) packed as
|
| 7 |
+
four base-6 digits appended to the path (thin demo — ~11 bits, not crypto).
|
| 8 |
+
Decode: replay path; structural/range halt => REJECT; verify moduli => ACCEPT.
|
| 9 |
+
|
| 10 |
+
Depends on t112_triangle.py in the same directory.
|
| 11 |
+
"""
|
| 12 |
+
from __future__ import annotations
|
| 13 |
+
|
| 14 |
+
import random
|
| 15 |
+
import sys
|
| 16 |
+
from dataclasses import dataclass
|
| 17 |
+
from typing import List, Optional, Tuple
|
| 18 |
+
|
| 19 |
+
from t112_triangle import DEG, N, SENTINEL, build_triangle_lut
|
| 20 |
+
|
| 21 |
+
MOD_A = 37
|
| 22 |
+
MOD_B = 73
|
| 23 |
+
PRODUCT = MOD_A * MOD_B # 2701
|
| 24 |
+
CHECK_DIGITS = 4 # two base-6 digits per modulus (6^2=36 < 37, so digs encode 0..35; 36 unused for A)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def _interior_seed(lut) -> int:
|
| 28 |
+
"""Pick a high-degree cell near the middle of the index range."""
|
| 29 |
+
for v in range(N // 2, N):
|
| 30 |
+
if int((lut[v] != SENTINEL).sum()) == 6:
|
| 31 |
+
return int(v)
|
| 32 |
+
for v in range(N):
|
| 33 |
+
if int((lut[v] != SENTINEL).sum()) >= 4:
|
| 34 |
+
return int(v)
|
| 35 |
+
return 2812 % N
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def _valid_dirs(lut, node: int) -> List[int]:
|
| 39 |
+
return [d for d in range(DEG) if int(lut[node, d]) != SENTINEL]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _bytes_to_base6(data: bytes) -> List[int]:
|
| 43 |
+
"""Big-endian bit pack into base-6 digits (0..5)."""
|
| 44 |
+
if not data:
|
| 45 |
+
return []
|
| 46 |
+
n = int.from_bytes(data, "big")
|
| 47 |
+
if n == 0:
|
| 48 |
+
return [0]
|
| 49 |
+
digits: List[int] = []
|
| 50 |
+
while n:
|
| 51 |
+
digits.append(n % 6)
|
| 52 |
+
n //= 6
|
| 53 |
+
digits.reverse()
|
| 54 |
+
return digits
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def _base6_to_bytes(digits: List[int], length: int) -> bytes:
|
| 58 |
+
n = 0
|
| 59 |
+
for d in digits:
|
| 60 |
+
if not 0 <= d <= 5:
|
| 61 |
+
raise ValueError("bad digit")
|
| 62 |
+
n = n * 6 + d
|
| 63 |
+
if length <= 0:
|
| 64 |
+
return b""
|
| 65 |
+
return n.to_bytes(length, "big")
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def _mod_to_two_digits(m: int, mod: int) -> List[int]:
|
| 69 |
+
"""Encode residue mod `mod` into two base-6 digits (value 0..35)."""
|
| 70 |
+
r = m % mod
|
| 71 |
+
if r > 35:
|
| 72 |
+
# 37 needs 0..36; clamp map: store r % 36 and rely on dual check — document limitation
|
| 73 |
+
r = r % 36
|
| 74 |
+
return [r // 6, r % 6]
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def _two_digits_to_mod(d0: int, d1: int) -> int:
|
| 78 |
+
return d0 * 6 + d1
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
@dataclass
|
| 82 |
+
class EncodeResult:
|
| 83 |
+
seed: int
|
| 84 |
+
path: List[int] # neighbor slot choices 0..5
|
| 85 |
+
payload_len: int
|
| 86 |
+
sum_mod37: int
|
| 87 |
+
sum_mod73: int
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
@dataclass
|
| 91 |
+
class DecodeResult:
|
| 92 |
+
ok: bool
|
| 93 |
+
reason: str
|
| 94 |
+
payload: Optional[bytes] = None
|
| 95 |
+
halted_at: Optional[int] = None
|
| 96 |
+
err: Optional[int] = None
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def encode(payload: bytes, lut=None, seed: Optional[int] = None) -> EncodeResult:
|
| 100 |
+
if lut is None:
|
| 101 |
+
lut, _ = build_triangle_lut()
|
| 102 |
+
node = _interior_seed(lut) if seed is None else int(seed) % N
|
| 103 |
+
start = node
|
| 104 |
+
body = _bytes_to_base6(payload)
|
| 105 |
+
s = sum(payload) if payload else 0
|
| 106 |
+
check = _mod_to_two_digits(s, MOD_A) + _mod_to_two_digits(s, MOD_B)
|
| 107 |
+
# length prefix: three base-6 digits => 0..215 bytes
|
| 108 |
+
if len(payload) > 215:
|
| 109 |
+
raise ValueError("payload too long for 3-digit length prefix")
|
| 110 |
+
L = len(payload)
|
| 111 |
+
length_digits = [(L // 36) % 6, (L // 6) % 6, L % 6]
|
| 112 |
+
stream = length_digits + body + check
|
| 113 |
+
|
| 114 |
+
path: List[int] = []
|
| 115 |
+
for want in stream:
|
| 116 |
+
# Map desired symbol onto an available direction; if want is sentinel, walk alternatives
|
| 117 |
+
dirs = _valid_dirs(lut, node)
|
| 118 |
+
if not dirs:
|
| 119 |
+
raise RuntimeError(f"stuck at node {node}")
|
| 120 |
+
# Prefer exact slot if valid, else dirs[want % len(dirs)]
|
| 121 |
+
if want in dirs:
|
| 122 |
+
d = want
|
| 123 |
+
else:
|
| 124 |
+
d = dirs[want % len(dirs)]
|
| 125 |
+
path.append(d)
|
| 126 |
+
node = int(lut[node, d])
|
| 127 |
+
if node == SENTINEL or node >= N:
|
| 128 |
+
raise RuntimeError("encoder walked off figure — choose different seed")
|
| 129 |
+
return EncodeResult(
|
| 130 |
+
seed=start,
|
| 131 |
+
path=path,
|
| 132 |
+
payload_len=len(payload),
|
| 133 |
+
sum_mod37=s % MOD_A,
|
| 134 |
+
sum_mod73=s % MOD_B,
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def decode(path: List[int], seed: int, lut=None) -> DecodeResult:
|
| 139 |
+
if lut is None:
|
| 140 |
+
lut, _ = build_triangle_lut()
|
| 141 |
+
node = int(seed) % N
|
| 142 |
+
symbols: List[int] = []
|
| 143 |
+
for i, d in enumerate(path):
|
| 144 |
+
if not 0 <= d < DEG:
|
| 145 |
+
return DecodeResult(False, "bad_dir", halted_at=i, err=1)
|
| 146 |
+
nxt = int(lut[node, d])
|
| 147 |
+
if nxt == SENTINEL:
|
| 148 |
+
return DecodeResult(False, "structural_halt", halted_at=i, err=2)
|
| 149 |
+
if nxt >= N:
|
| 150 |
+
return DecodeResult(False, "range_halt", halted_at=i, err=1)
|
| 151 |
+
symbols.append(d) # record commanded slot (codec alphabet)
|
| 152 |
+
node = nxt
|
| 153 |
+
|
| 154 |
+
if len(symbols) < 3 + CHECK_DIGITS:
|
| 155 |
+
return DecodeResult(False, "too_short")
|
| 156 |
+
|
| 157 |
+
length_digits = symbols[:3]
|
| 158 |
+
L = length_digits[0] * 36 + length_digits[1] * 6 + length_digits[2]
|
| 159 |
+
body_and_check = symbols[3:]
|
| 160 |
+
if len(body_and_check) < CHECK_DIGITS:
|
| 161 |
+
return DecodeResult(False, "missing_checksum")
|
| 162 |
+
body, check = body_and_check[:-CHECK_DIGITS], body_and_check[-CHECK_DIGITS:]
|
| 163 |
+
# Body digit count is whatever remains; convert using declared length
|
| 164 |
+
try:
|
| 165 |
+
# Recompute expected body digits from L by taking the integer from body digits
|
| 166 |
+
payload = _base6_to_bytes(body, L) if L else b""
|
| 167 |
+
except Exception as e:
|
| 168 |
+
return DecodeResult(False, f"body_decode:{e}")
|
| 169 |
+
|
| 170 |
+
# Remap issue: encoder may have substituted dirs when `want` was invalid.
|
| 171 |
+
# For prototype honesty: verify checksum on payload bytes only if round-trip
|
| 172 |
+
# used exact slots. Here we verify declared moduli from check digits vs sum(payload).
|
| 173 |
+
got_a = _two_digits_to_mod(check[0], check[1])
|
| 174 |
+
got_b = _two_digits_to_mod(check[2], check[3])
|
| 175 |
+
s = sum(payload) if payload else 0
|
| 176 |
+
# Accept if check digits match sum mod 36-mapped residues (see encode limitation)
|
| 177 |
+
exp_a = (s % MOD_A) % 36
|
| 178 |
+
exp_b = (s % MOD_B) % 36
|
| 179 |
+
if got_a != exp_a or got_b != exp_b:
|
| 180 |
+
return DecodeResult(False, "checksum_fail", payload=payload)
|
| 181 |
+
|
| 182 |
+
# Soft extra: product constant present in module
|
| 183 |
+
assert PRODUCT == 2701
|
| 184 |
+
return DecodeResult(True, "accept", payload=payload)
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def false_accept_trial(lut, path_len: int, trials: int = 200, seed: Optional[int] = None) -> Tuple[int, int]:
|
| 188 |
+
"""Random paths of path_len from seed; count decode ACCEPT."""
|
| 189 |
+
start = _interior_seed(lut) if seed is None else seed
|
| 190 |
+
accepts = 0
|
| 191 |
+
for _ in range(trials):
|
| 192 |
+
node = start
|
| 193 |
+
path: List[int] = []
|
| 194 |
+
ok_walk = True
|
| 195 |
+
for _ in range(path_len):
|
| 196 |
+
dirs = _valid_dirs(lut, node)
|
| 197 |
+
if not dirs:
|
| 198 |
+
ok_walk = False
|
| 199 |
+
break
|
| 200 |
+
d = random.choice(dirs)
|
| 201 |
+
path.append(d)
|
| 202 |
+
node = int(lut[node, d])
|
| 203 |
+
if not ok_walk:
|
| 204 |
+
continue
|
| 205 |
+
r = decode(path, start, lut)
|
| 206 |
+
if r.ok:
|
| 207 |
+
accepts += 1
|
| 208 |
+
return accepts, trials
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def main() -> int:
|
| 212 |
+
random.seed(2701)
|
| 213 |
+
lut, _ = build_triangle_lut()
|
| 214 |
+
msg = b"YHWH"
|
| 215 |
+
enc = encode(msg, lut)
|
| 216 |
+
dec = decode(enc.path, enc.seed, lut)
|
| 217 |
+
print("[proto] PRODUCT", PRODUCT)
|
| 218 |
+
print("[proto] seed", enc.seed, "path_len", len(enc.path))
|
| 219 |
+
print("[proto] sum%37", enc.sum_mod37, "sum%73", enc.sum_mod73)
|
| 220 |
+
print("[proto] decode", dec.ok, dec.reason, dec.payload)
|
| 221 |
+
round_trip = dec.ok and dec.payload == msg
|
| 222 |
+
print("[proto] round_trip", round_trip)
|
| 223 |
+
|
| 224 |
+
fa, trials = false_accept_trial(lut, path_len=len(enc.path), trials=300, seed=enc.seed)
|
| 225 |
+
print(f"[proto] false_accept {fa}/{trials} on random same-length paths")
|
| 226 |
+
return 0 if round_trip else 1
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
if __name__ == "__main__":
|
| 230 |
+
sys.exit(main())
|
t112_triangle.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""T112 triangular lattice: the structure T112 actually names.
|
| 3 |
+
|
| 4 |
+
Rows 1..112, row r holds r cells -> sum = T112 = 6328 exactly.
|
| 5 |
+
Hex adjacency in axial (r,k) coords. Degree is NOT uniform:
|
| 6 |
+
boundary cells have fewer neighbours, and the empty slots are
|
| 7 |
+
filled with SENTINEL -- which makes the fail-closed check a real
|
| 8 |
+
structural gate rather than a bounds test.
|
| 9 |
+
"""
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
import numpy as np
|
| 12 |
+
|
| 13 |
+
ROWS = 112
|
| 14 |
+
N = ROWS * (ROWS + 1) // 2 # 6328
|
| 15 |
+
DEG = 6
|
| 16 |
+
SENTINEL = 0xFFFF
|
| 17 |
+
LUT_BYTES = N * DEG * 2
|
| 18 |
+
|
| 19 |
+
# hex neighbourhood in triangular-array coords, fixed order
|
| 20 |
+
NBR = ((0, -1), (0, 1), (-1, -1), (-1, 0), (1, 0), (1, 1))
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def build_index():
|
| 24 |
+
idx = {}
|
| 25 |
+
c = 0
|
| 26 |
+
for r in range(ROWS):
|
| 27 |
+
for k in range(r + 1):
|
| 28 |
+
idx[(r, k)] = c
|
| 29 |
+
c += 1
|
| 30 |
+
assert c == N
|
| 31 |
+
return idx
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def build_triangle_lut():
|
| 35 |
+
idx = build_index()
|
| 36 |
+
lut = np.full((N, DEG), SENTINEL, dtype=np.uint16)
|
| 37 |
+
for (r, k), v in idx.items():
|
| 38 |
+
for d, (dr, dk) in enumerate(NBR):
|
| 39 |
+
t = (r + dr, k + dk)
|
| 40 |
+
if t in idx:
|
| 41 |
+
lut[v, d] = idx[t]
|
| 42 |
+
return lut, idx
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def degree_hist(lut):
|
| 46 |
+
deg = (lut != SENTINEL).sum(axis=1)
|
| 47 |
+
return {int(d): int((deg == d).sum()) for d in np.unique(deg)}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def hop_loop(lut, hops, seed):
|
| 51 |
+
"""Walk with structural halting: leaving the triangle IS the abort."""
|
| 52 |
+
node = seed % N
|
| 53 |
+
acc = 0
|
| 54 |
+
for i in range(hops):
|
| 55 |
+
d = (node + i) % DEG
|
| 56 |
+
nxt = int(lut[node, d])
|
| 57 |
+
if nxt == SENTINEL: # hit an edge of the triangle
|
| 58 |
+
d2 = next((j for j in range(DEG) if lut[node, (d + j) % DEG] != SENTINEL), None)
|
| 59 |
+
nxt = int(lut[node, (d + d2) % DEG])
|
| 60 |
+
node = nxt
|
| 61 |
+
acc += node
|
| 62 |
+
return node, acc
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def hop_loop_failclosed(lut, hops, seed, poison_at=-1, poison_val=-1):
|
| 66 |
+
node = seed % N
|
| 67 |
+
for i in range(hops):
|
| 68 |
+
if i == poison_at:
|
| 69 |
+
nxt = N + 1 if poison_val < 0 else poison_val
|
| 70 |
+
if nxt >= N:
|
| 71 |
+
return i, 1
|
| 72 |
+
d = (node + i) % DEG
|
| 73 |
+
nxt = int(lut[node, d])
|
| 74 |
+
if nxt == SENTINEL:
|
| 75 |
+
return i, 2 # STRUCTURAL halt: fell off the triangle
|
| 76 |
+
if nxt >= N:
|
| 77 |
+
return i, 1 # range halt
|
| 78 |
+
node = nxt
|
| 79 |
+
return hops, 0
|
verify_triangle.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import hashlib, math, numpy as np
|
| 2 |
+
from collections import defaultdict
|
| 3 |
+
from t112_triangle import *
|
| 4 |
+
|
| 5 |
+
def wl_bits(lut):
|
| 6 |
+
adj=defaultdict(set)
|
| 7 |
+
for v in range(N):
|
| 8 |
+
for u in lut[v]:
|
| 9 |
+
if u!=SENTINEL: adj[v].add(int(u)); adj[int(u)].add(v)
|
| 10 |
+
col={v:0 for v in range(N)}
|
| 11 |
+
for _ in range(40):
|
| 12 |
+
new={v:(col[v],tuple(sorted(col[u] for u in adj[v]))) for v in range(N)}
|
| 13 |
+
m={s:i for i,s in enumerate(sorted(set(new.values()),key=lambda x:hashlib.md5(str(x).encode()).hexdigest()))}
|
| 14 |
+
nc={v:m[new[v]] for v in range(N)}
|
| 15 |
+
if len(set(nc.values()))==len(set(col.values())): col=nc; break
|
| 16 |
+
col=nc
|
| 17 |
+
sz=defaultdict(int)
|
| 18 |
+
for v in col: sz[col[v]]+=1
|
| 19 |
+
return len(sz), -sum((c/N)*math.log2(c/N) for c in sz.values())
|
| 20 |
+
|
| 21 |
+
def connected(lut):
|
| 22 |
+
seen=np.zeros(N,bool); st=[0]; seen[0]=True; c=1
|
| 23 |
+
while st:
|
| 24 |
+
v=st.pop()
|
| 25 |
+
for u in lut[v]:
|
| 26 |
+
if u!=SENTINEL and not seen[u]: seen[u]=True; c+=1; st.append(int(u))
|
| 27 |
+
return c
|
| 28 |
+
|
| 29 |
+
lut,idx=build_triangle_lut()
|
| 30 |
+
print("[+] layout ", LUT_BYTES, "B uint16, <=256 KiB:", LUT_BYTES<=262144)
|
| 31 |
+
print("[+] cells ", N, "= T112")
|
| 32 |
+
print("[+] degrees ", degree_hist(lut), " (NOT uniform - this is the point)")
|
| 33 |
+
print("[+] connected ", f"{connected(lut)}/{N}", connected(lut)==N)
|
| 34 |
+
print("[+] symmetric ", all(v in [int(x) for x in lut[int(u)] if x!=SENTINEL]
|
| 35 |
+
for v in range(N) for u in lut[v] if u!=SENTINEL))
|
| 36 |
+
|
| 37 |
+
k,H = wl_bits(lut)
|
| 38 |
+
print(f"[+] WL classes {k} node identity = {H:.2f} bits (ring baseline: 1 class, 0.00 bits)")
|
| 39 |
+
|
| 40 |
+
node,acc = hop_loop(lut, 50_000, 7)
|
| 41 |
+
golden = hashlib.sha256(f"{node}:{acc}".encode()).hexdigest()
|
| 42 |
+
print(f"[+] golden node={node} acc={acc}")
|
| 43 |
+
print(f"[+] sha256 {golden}")
|
| 44 |
+
|
| 45 |
+
# determinism across repeats & a second construction
|
| 46 |
+
lut2,_ = build_triangle_lut()
|
| 47 |
+
n2,a2 = hop_loop(lut2, 50_000, 7)
|
| 48 |
+
print("[+] reproducible ", (n2,a2)==(node,acc))
|
| 49 |
+
|
| 50 |
+
# fail-closed: structural halt vs range halt
|
| 51 |
+
hops,err = hop_loop_failclosed(lut, 10_000, 7)
|
| 52 |
+
print(f"[+] structural halt at hop {hops} err={err} (2 = fell off the triangle edge)")
|
| 53 |
+
for p in (6328, 65535, 99999):
|
| 54 |
+
h,e = hop_loop_failclosed(lut, 10_000, 7, poison_at=3, poison_val=p)
|
| 55 |
+
assert e==1, p
|
| 56 |
+
print("[+] range halt 6328/65535/99999 -> err=1 at hop 3")
|