diff --git a/research/coded-reverse-controller/README.md b/research/coded-reverse-controller/README.md new file mode 100644 index 0000000000..998410d16e --- /dev/null +++ b/research/coded-reverse-controller/README.md @@ -0,0 +1,75 @@ +# A consumer for the center-free coded native word: coded reverse stages, A⁻¹-mixed query shears + +**Conditional construction with exact formal and arithmetic checks. No κ is promoted and no physical replay is claimed.** + +PR #4929 removes the eight rank-8 owned-center children per FULL call (64 rank mass) but changes the main +endpoint to `Y ← Y + A X`, `A = I − RᵀR/4 = I − 14P`: symmetric, zero diagonal, eigenvalue 1 on 104 modes and −13 on 8. +Its open question is a caller that can use this code without spending the saving. This package gives one. + +## The construction + +In the query-thinned path controller every thick stage is a *reverse* call except the two end stages; all +even stages are forward query shears. Take + +* every reverse stage = the center-free **backward** word (coupling `−A·Q`), no centers; +* **every** forward stage, including both ends, = a query-only shear whose source is first mixed by `A⁻¹ = I + (A−I)/13` + (scalar adds into the owned copy `Z`; the 112 rank-one jobs are unchanged). + +Then the reverse/forward coupling product is 1 on every mode, so the controller is the standard one in new variables: +`Coded = (A on x-roles) · Standard · (A⁻¹ on x-roles)`. Only the x-roles are converted, only at the controller boundary: +`×A` (dyadic) at the input, `×A⁻¹` (denominator 13) at the output. With thick stages = odd stages only, the invoice is +the published one with the center bill removed and p+1 query stages. + +## What `verify.py` establishes (exact) + +* `A = I − RᵀR/4` for the joint-query packet; `(A−I)(A+13I)=0`; `A⁻¹ = I+(A−I)/13`. +* The coded controller diagonalizes after thinning, for p = 3, 4, 5, 8, with **exactly the standard outputs**; the only new + boundary denominator is 13. Controls: coded reverse with uncoded forward stages, coded forward end stages, and a wrong + inverse code all fail to diagonalize. +* The identity `Coded = (A on x) · Standard · (A⁻¹ on x)` holds exactly as 448×448 matrices (p=2) with the real 112×112 code. +* Arithmetic (same moment model as the published invoice, which it reproduces to 13 digits): raw complex root + **0.00793 (p=8), 0.00758 (p=19)** versus 0.0030218. At p=19 the three strict tail guards pass at C=0.0034 + (α=0.99579, γ=0.9638, δ=0.9516; p=8 fails δ). The repo's strict outer ledger (54 + 4 predicates) accepts every κ up to + **0.0033999971** and first fails at 0.0034 only on `actual_bit_above_effective`. So the complex side stops binding and the + BIT supplier (admitted 0.0034) caps κ at **+12.5%** over 0.0030217758 (+12.6% over 0.00302015). + +## What is not established + +1. **Physical admission of the three scalar mixings.** They are free scalar adds only if the mixed registers share a frame: + the thin-stage sources are the X bank, whose exit frame is the same full frame for all ports (113 distinct main finals = + 112 Y hyperplanes + one shared full frame); the input conversion acts at the ground frame; the output conversion at the + full frame. This bookkeeping is checked from the frame data but no physical phase/Clifford replay was run, and the community + has flagged port-dependent charts for the *forward* word (which this design never uses as a thick stage). +2. **Denominator 13** (thin-stage mixing and output conversion): needs pricing (cf. the division-free Word-RAM transfer + #4630). The design tolerates ~0.5 extra paid rank-one jobs per port per query stage and still exceeds +10%; it tolerates + essentially no paid boundary conversions. +3. The complete compiler for the new invoice (ambient rank 153; the published tensor power 1024 / log power 1000 violates + the shifted-capacity inequality at TESTED≈0.0034 and must be re-tuned, e.g. v ≤ 920), BIT-side hypotheses, hosting and precision. +4. No independent human or kernel review. + +## Overlap + +Same source word as #4929 and the same open question as the caller work in #4933 (Discussion #4930, which leaves the +negative-query banks as coded outputs and names an affordable decoder or recursive interface as the next theorem) and +#4932 (a standalone one-bank adapter needs 112 grade-two channels). This package takes the other branch: never decode the +reverse stages; conjugate the controller so only the x-roles at its boundary and the thin-stage sources are recoded. +Whether those recodings fit the scalar/monomial bill priced in #4933's PHYSICAL.md, and whether #4932's heterogeneous-entrance +bound reaches the thin-stage mixing, are exactly open question 1 below. The raw complex root 0.0076 agrees with the +~0.00765 planning estimate in #4933. + +## Reproduce + +```sh +python3.12 -B research/coded-reverse-controller/verify.py # ~3 minutes, standard library only +``` + +Credit: Dugongue (#4929, the center-free coded word), Cinna Davis (#4694 center-free kernel; #4440 query thinning; #4470), +Cao Yifan (#4610), zxv, Jacob Alan Sussman and the retained lineage. The code, the controller engine and the outer ledger are +theirs; the delta is the coded/inverse-coded stage assignment, its exact diagonalization and the arithmetic above. + +## Open next questions + +See `TASK.json`: (1) a physical replay of the thin-stage mixing and the two boundary conversions at the actual frames; +(2) a priced implementation of ×1/13; (3) the compiler constants for ambient rank 153 and the full outer transfer. + +AI assistance: derivation, scripts and package by Claude (Anthropic) under the author's direction; no independent human or kernel review. diff --git a/research/coded-reverse-controller/SOURCES.json b/research/coded-reverse-controller/SOURCES.json new file mode 100644 index 0000000000..04b67dc9a6 --- /dev/null +++ b/research/coded-reverse-controller/SOURCES.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "base_commit": "cef4b52f2a59009865bf8eabde1be3f159063703", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", + "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "research/kappa-native-resume/causal-controller/sources/research/joint-query/certificate.json.gz", + "usage": "input", + "git_blob": "c6e876d8b48d768214deee265ade428f8983b566", + "sha256": "a5ed85fac5ebf3c091482a113ab0d351eb5a7892fe2841a35e16017ec1ff49f7" + }, + { + "path": "research/kappa-rebuild/bit/complex_controller_factor.py", + "usage": "input", + "git_blob": "cb0cff7c8be5f38f2ee52201d9d0907f9dfd7947", + "sha256": "1de9aaf918e6a4f2f5448754c1f3c3da3b85e6257849ebd097af09859c4e5497" + }, + { + "path": "research/native-center-free-code/CODE.json", + "usage": "input", + "git_blob": "03170f4a31f7a8a3db7228f1cd5a6fdcb32720ae", + "sha256": "8be7f3f073b7981ec91c6af43edff0ac8a89f4824ef6026ae758c287dd6c03d0" + }, + { + "path": "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py", + "usage": "input", + "git_blob": "340e1f0ffb8a1a9c38fbbd9119580b6d23e01b59", + "sha256": "d097e55f06c3f244f2074ffd7c1a0a5f3c4b4b6a6accf9619d1dde5c0ae85e15" + }, + { + "path": "research/kappa-0023-productive-jobs/dependencies/kappa-next-regime/bit-compression/carrier-reuse/reference/joint_pair_dag.py", + "usage": "input", + "git_blob": "8b40135a84e7f0f0cd44bed69655801310b916a7", + "sha256": "8a0de761642d21919e969475c3f13e5d01a4bae7343c1e1f37c586d94b676a85" + } + ] +} diff --git a/research/coded-reverse-controller/TASK.json b/research/coded-reverse-controller/TASK.json new file mode 100644 index 0000000000..1e2a46f85e --- /dev/null +++ b/research/coded-reverse-controller/TASK.json @@ -0,0 +1,102 @@ +{ + "schema_version": 1, + "task_id": "joint-query-controller", + "priority_revision": 7, + "base_commit": "cef4b52f2a59009865bf8eabde1be3f159063703", + "original_card": { + "id": "joint-query-controller", + "question": "Can the installed QQ16 caller win a complete matched protocol bill, or can a changed demand eliminate actual paid work?", + "starting_points": [ + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "research/qq16-caller-install/README.md" + ], + "methods": [ + "Derive the matched whole-caller physical bill for installed and baseline protocols.", + "Change the actual demanded observations and prove a cheaper legal producer/consumer contract." + ], + "acceptance_gate": "Name the changed premise of the fixed F0/B1 observation obstruction. Show exactly which query is recovered, legal native reads and restoration, and a full favorable budget including cover maps, helpers and endpoints. Local inverse identities alone do not close the global controller. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read #4166 COST.md and ADMISSION.json. An actual caller connection is now proposed. Its native-component profile loses; parent park/restore versus external-call costs remain unresolved. Retain the producer and recovery lineage rather than rebuild it.", + "scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately." + }, + "first_experiment": "At the actual installed cut, compare matched complete parent park/restore and external input/return protocols at the same bank/packet geometry, including every later root call and service cost. Alternatively pin both bridge observations and derive a genuinely smaller source-compatible demand. Stop if the complete necessary inequality fails or an essential cost is unknown; no larger decoder scan from a local tape-action saving.", + "bottleneck_link": "The native local words exist; retained query information and its physical access are the missing link to a composed recursive interface.", + "allowed_variations": [ + "One paid query, one changed first pair, or one precisely specified affine helper state.", + "A counterexample or lower bound for that exact proposed repair.", + "One unresolved obligation of a newer local decoder, with exact source heads and a distinct claim/domain." + ], + "scope_change_triggers": [ + "Retaining the fixed first pair and ordinary schedule while allowing only homogeneous selected-only control, already excluded by the witness.", + "Treating cover-map counts as zero-cost physical address operations.", + "Recreating the pending complete local decoder or early-record/output-bank coalescing already under investigation without a distinct audit or changed premise.", + "Treating a completed-output defect inequality as a producer-interior, dirty-range or physical-cost certificate.", + "Recreating completed-output recovery or caller wiring already supplied by #4166 without new independent coverage.", + "Dropping retained later root calls or claiming native-profile dominance from the isolated publication saving." + ], + "overlap_terms": [ + "QQ16", + "joint-query", + "changing-chart controller", + "selected observation", + "1969", + "2540", + "early record", + "output-bank retention", + "complete native decoder", + "2965", + "producer defect", + "dirty-helper range", + "F17 consumer", + "4166", + "qq16-caller-install" + ], + "existing_checks": [ + { + "scope": "PR #4166: author-checked installed producer/service/return/bridge connection; native-component comparison loses.", + "evidence": "research/qq16-caller-install/README.md", + "remaining": "Complete matched physical protocol bill, or changed source-compatible demand/circuit; no affordable supplier yet.", + "status": "author-checked", + "source_commit": "0b082d22a0e9a442d264ab0633e35ef26c790630", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Exact formal diagonalization and arithmetic for a controller that consumes the #4929 center-free coded word with coded reverse stages and A^-1-mixed query shears. No physical replay, no promoted kappa.", + "scope_change_reason": "The card asks for a QQ16 whole-caller bill. The retained question is the consumer of the #4929 center-free coded word: whether the controller, rather than each call, can absorb the 112-port code A. Scoped to the exact controller algebra and the arithmetic root; the physical adapter is not claimed.", + "bottleneck_link": "Removes the 64-rank-per-call owned-center bill (the x-law constant) from the complex invoice if the conjugating scalar maps are admissible; the conditional kappa is then BIT-capped at the admitted 0.0034.", + "budget_minutes": 60, + "stop_rule": "One session; stop when the exact controller identity, invoice root and outer-ledger acceptance were verified and the unverified physical obligations were named.", + "outcome": "partial", + "evidence": "verify.py: A=I-R^TR/4, (A-I)(A+13I)=0; exact diagonalization of the coded controller for p=3,4,5,8 equal to the standard controller; 448x448 conjugation identity at p=2; invoice model reproduces 0.0030201659770 and gives raw complex roots 0.00793 (p=8), 0.00758 (p=19); strict outer ledger passes to 0.0033999971 and first fails at 0.0034 on actual_bit_above_effective. No kernel, no physical replay.", + "author": "Cayden Burkart", + "ai_assistance": "Claude (Anthropic) did the derivation, scripts and package under the author's direction. No independent human or kernel review.", + "open_questions": [ + { + "question": "Are the thin-stage A^-1 source mixing and the x-role input/output conversions realizable at the actual frames, using the phase-correct monomial wrappers of the coded caller (#4933), and at what scalar/monomial bill?", + "why_it_matters": "The conditional 0.0034 holds only if these nonrecursive maps fit the scalar allowance; #4932 bounds only a standalone one-bank adapter.", + "first_step": "Replay one pair: reverse call, the next A^-1-mixed query shear and the boundary conversion with the #4933 normalizers; price every wrapper.", + "blocked_by": "No physical phase/Clifford replay of the controller cuts." + }, + { + "question": "Can multiplication by 1/13 (thin stages, output boundary) be admitted within the precision and Word-RAM budget?", + "why_it_matters": "Every A^-1 mixing and the output conversion carry denominator 13.", + "first_step": "Price x -> x + (A-I)x/13 as a fixed-point operation (cf. #4630) and bound its rounding.", + "blocked_by": "Odd denominator; no fixed-denominator accounting yet." + }, + { + "question": "What compiler constants and outer transfer close the new invoice (ambient rank 153, p=19)?", + "why_it_matters": "The published tensor power 1024 / log power 1000 violates the shifted-capacity inequality near 0.0034.", + "first_step": "Re-tune v (<= 920) and rerun the strictification and integer-height test for the coded invoice.", + "blocked_by": "Compiler constants were not re-run." + } + ] +} diff --git a/research/coded-reverse-controller/VERIFY.json b/research/coded-reverse-controller/VERIFY.json new file mode 100644 index 0000000000..0a50061a78 --- /dev/null +++ b/research/coded-reverse-controller/VERIFY.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/kappa-0023-productive-jobs/dependencies/kappa-next-regime/bit-compression/carrier-reuse/reference/joint_pair_dag.py", + "research/kappa-native-resume/causal-controller/sources/research/joint-query/certificate.json.gz", + "research/kappa-rebuild/bit/complex_controller_factor.py", + "research/native-center-free-code/CODE.json", + "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 600, + "checks": "coded controller diagonalizes to the standard outputs (p=3,4,5,8) with negative controls; 448x448 conjugation identity; invoice root; tail guards; strict outer ledger" + } + ] +} diff --git a/research/coded-reverse-controller/verify.py b/research/coded-reverse-controller/verify.py new file mode 100644 index 0000000000..71f3d8929f --- /dev/null +++ b/research/coded-reverse-controller/verify.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python3 +"""Checks for consuming the center-free coded native word (PR4929) in the query-thinned controller. + +Coded reverse stages carry the code A; every forward stage is a query-only shear that first mixes its +source by A^-1. Standard library only; reads existing repo files. Python 3.9+. +""" +import gzip, importlib.util, json, math, sys +from collections import Counter +from fractions import Fraction as Q +from pathlib import Path + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path[:0] = [str(ROOT/'research/kappa-0023-productive-jobs/dependencies/kappa-next-regime/bit-compression/carrier-reuse/reference'), + str(ROOT/'research/kappa-rebuild/bit')] +import complex_controller_factor as C + +def need(ok, why): + if not ok: + raise SystemExit('FAIL: '+why) + print('PASS', why, flush=True) + +# ---- 1. the code A of PR4929 -------------------------------------------------------------- +NP = 112 +A = [[Q(x) for x in row] for row in json.load(open(ROOT/'research/native-center-free-code/CODE.json'))['A']] +I = [[Q(int(i == j)) for j in range(NP)] for i in range(NP)] +def mm(X, Y): return [[sum(X[i][k]*Y[k][j] for k in range(NP) if X[i][k]) for j in range(NP)] for i in range(NP)] +Ainv = [[I[i][j]+(A[i][j]-I[i][j])/13 for j in range(NP)] for i in range(NP)] +R = [[int(json.load(gzip.open(ROOT/'research/kappa-native-resume/causal-controller/sources/research/joint-query/certificate.json.gz'))['R_rows'][a].get(str(p), 0)) for p in range(NP)] for a in range(8)] +need(all(A[i][j] == A[j][i] for i in range(NP) for j in range(NP)) and all(A[i][i] == 0 for i in range(NP)), 'A symmetric with zero diagonal') +need(all(A[p][q] == I[p][q]-Q(sum(R[a][p]*R[a][q] for a in range(8)), 4) for p in range(NP) for q in range(NP)), 'A = I - R^T R / 4 for the joint-query packet') +need(mm([[A[i][j]-I[i][j] for j in range(NP)] for i in range(NP)], [[A[i][j]+13*I[i][j] for j in range(NP)] for i in range(NP)]) == [[Q(0)]*NP for _ in range(NP)], '(A-I)(A+13I)=0: modes 1 (104) and -13 (8)') +need(mm(A, Ainv) == I, 'A^-1 = I + (A-I)/13') + +# ---- 2. coded controller: exact diagonalization after thinning ------------------------------- +def controller(p, keep, coupling): + """C.controller with a per-stage coupling: forward lower-left coupling*Q^-1, reverse upper-right -coupling*Q.""" + n, stages = 2*p, 2*p+1 + zero = (0,)*(stages+1) + matrix = [[{zero: 1} if i == j else {} for j in range(n)] for i in range(n)] + idle = [] + term = lambda q, sel: (q,)+tuple(int(s in sel) for s in range(stages)) + def idle_call(pair, sel, kind): + retained = bool(keep >> len(idle) & 1) + idle.append(dict(kind=kind, pair=pair, retained=retained)) + if retained: + for role in (2*pair, 2*pair+1): + matrix[role] = [C.monomial_times(x, term(0, sel)) for x in matrix[role]] + def local(stage, pair, reverse): + x, y = 2*pair, 2*pair+1 + if reverse: x, y = y, x + coef = (-1 if reverse else 1)*coupling[stage] + matrix[y] = [C.plus(a, C.monomial_times(b, term(1 if reverse else -1, []), coef)) for a, b in zip(matrix[y], matrix[x])] + for role in (x, y): matrix[role] = [C.monomial_times(z, term(0, [stage])) for z in matrix[role]] + if stage % 2 and stage <= 2*p-3: idle_call((stage+1)//2, list(range(stage+1)), 'initial') + elif stage % 2 == 0 and 2 <= stage <= 2*p-2: idle_call(stage//2, [stage], 'middle') + elif stage == 2*p: + for j in range(p-1): idle_call(j, list(range(2*j+3, 2*p+1)), 'terminal') + def bridge(dst, src, c): + for d, s, cc in ((2*dst, 2*src, c), (2*src+1, 2*dst+1, -c)): + matrix[d] = [C.plus(a, b, cc) for a, b in zip(matrix[d], matrix[s])] + local(0, 0, False) + for j in range(p): + local(2*j+1, j, True) + if j < p-1: bridge(j, j+1, 1) + local(2*j+2, j, False) + if j < p-1: bridge(j, j+1, -1) + for j in reversed(range(p-1)): bridge(j+1, j, 1) + for j in range(p): matrix[2*j], matrix[2*j+1] = matrix[2*j+1], [C.monomial_times(x, zero, -1) for x in matrix[2*j]] + co = {} + for i, row in enumerate(matrix): + for j, poly in enumerate(row): + for key, v in poly.items(): co.setdefault(key, [[Q(0)]*n for _ in range(n)])[i][j] += v + return {k: m for k, m in co.items() if any(any(r) for r in m)}, idle + +def keep_of(p, pat): + _, idle = controller(p, 0, {s: 1 for s in range(2*p+1)}) + return sum(1 << i for i, r in enumerate(idle) if r['kind'] == 'middle' or (r['kind'] == 'initial' and pat[r['pair']-1] in 'IB') or (r['kind'] == 'terminal' and pat[r['pair']] in 'TB')) + +def thin(co, thick): + out = {} + for term, m in co.items(): + key = (term[0],)+tuple(x if s in thick else 0 for s, x in enumerate(term[1:])) + t = out.setdefault(key, [[Q(0)]*len(m) for _ in m]) + for i, row in enumerate(m): + for j, v in enumerate(row): t[i][j] += v + return {k: m for k, m in out.items() if any(any(r) for r in m)} + +C.scalar_program = lambda m: None # the dyadic boundary test is reported below as a denominator instead +def diagonalize(p, pat, coupling): + r = C.factor(thin(controller(p, keep_of(p, pat), coupling)[0], set(range(1, 2*p, 2)))) + if r is None: return None + return sorted(Counter(sum(t[1:]) for t in r['diagonal']).items()), sorted({q.denominator for m in (r['left'], r['right']) for row in m for q in row}) + +c = Q(-13) +for p, pat in [(3, 'IT'), (4, 'IIT'), (5, 'IITT'), (8, 'IIIITTT')]: + coded = {s: (c if s % 2 else 1/c) for s in range(2*p+1)} # reverse = A, forward (incl. both ends) = A^-1 + std = diagonalize(p, pat, {s: Q(1) for s in range(2*p+1)}) + cod = diagonalize(p, pat, coded) + need(std is not None and cod is not None and std[0] == cod[0] and std[1] == [1] and cod[1] == [1, 13], + 'p=%d %s: coded controller diagonalizes with the standard outputs %s; new boundary denominator 13' % (p, pat, cod[0] if cod else None)) +p, pat = 3, 'IT' +need(diagonalize(p, pat, {s: (c if s % 2 else Q(1)) for s in range(2*p+1)}) is None, 'control: coded reverse with uncoded forward stages does not diagonalize') +need(diagonalize(p, pat, {s: (c if (s % 2 or s in (0, 2*p)) else 1/c) for s in range(2*p+1)}) is None, 'control: coded (thick) forward end stages do not diagonalize') +need(diagonalize(p, pat, {s: (c if s % 2 else Q(1, 169)) for s in range(2*p+1)}) is None, 'control: wrong inverse code does not diagonalize') + +# ---- 3. explicit conjugation with the real 112 x 112 code (p=2, numeric Q and D_s) ----------- +def sparse(M): return [[(j, v) for j, v in enumerate(row) if v] for row in M] +SI, SA, SAi = sparse(I), sparse(A), sparse(Ainv) +def build(p, rev, fwd, Qv, Dv): + rows = {(r, q): {(r, q): Q(1)} for r in range(2*p) for q in range(NP)} + def addrow(dst, src, M, coef): + new = {} + for pp in range(NP): + acc = dict(rows[(dst, pp)]) + for q, mv in M[pp]: + for k, v in rows[(src, q)].items(): acc[k] = acc.get(k, 0)+coef*mv*v + new[pp] = {k: v for k, v in acc.items() if v} + rows.update({(dst, pp): new[pp] for pp in range(NP)}) + def scale(role, m): + for q in range(NP): + for k in rows[(role, q)]: rows[(role, q)][k] *= m + def local(stage, pair, reverse): + x, y = 2*pair, 2*pair+1 + if reverse: x, y = y, x; addrow(y, x, rev, -Qv) + else: addrow(y, x, fwd, 1/Qv) + if stage % 2: scale(x, Dv[stage]); scale(y, Dv[stage]) + def bridge(dst, src, cf): + for d, s, cc in ((2*dst, 2*src, cf), (2*src+1, 2*dst+1, -cf)): + for pp in range(NP): + acc = dict(rows[(d, pp)]) + for k, v in rows[(s, pp)].items(): acc[k] = acc.get(k, 0)+cc*v + rows[(d, pp)] = {k: v for k, v in acc.items() if v} + local(0, 0, False) + for j in range(p): + local(2*j+1, j, True) + if j < p-1: bridge(j, j+1, 1) + local(2*j+2, j, False) + if j < p-1: bridge(j, j+1, -1) + for j in reversed(range(p-1)): bridge(j+1, j, 1) + return rows +def mix(rows, p, roles, M, side): + out = {} + for (r, pp), rw in rows.items(): + if side == 'rows' and r in roles: + acc = {} + for q, mv in M[pp]: + for k, v in rows[(r, q)].items(): acc[k] = acc.get(k, 0)+mv*v + elif side == 'cols': + acc = {} + for (cc, q), v in rw.items(): + if cc in roles: + for k, mv in M[q]: acc[(cc, k)] = acc.get((cc, k), 0)+v*mv + else: acc[(cc, q)] = acc.get((cc, q), 0)+v + else: acc = rw + out[(r, pp)] = {k: v for k, v in acc.items() if v} + return out +p = 2; Dv = {s: Q(2*s+3) for s in range(2*p+1)} +std, cod = build(p, SI, SI, Q(2), Dv), build(p, SA, SAi, Q(2), Dv) +xr = set(range(0, 2*p, 2)) +need(mix(mix(std, p, xr, SA, 'rows'), p, xr, Ainv and sparse(Ainv), 'cols') == cod, 'p=2, 448x448: coded controller == (A on x-roles) * standard * (A^-1 on x-roles), exact') +need(mix(mix(std, p, xr, SA, 'rows'), p, xr, SA, 'cols') != cod, 'control: wrong conjugation rejected') + +# ---- 4. invoice and moment root ------------------------------------------------------------- +H = {4: 28, 7: 7, 8: 47, 9: 326} # helpers (unchanged by PR4929) +P_OLD = {1: 2237, 2: 388, 3: 494, 4: 147, 5: 36, 8: 8} # joint-helper-lattice local paid profile +P_NEW = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40} # PR4929 paid profile, both orientations +need(sum(r*n for r, n in P_OLD.items())-sum(r*n for r, n in P_NEW.items()) == 64, 'PR4929 removes exactly 64 rank mass per call') +def invoice(p, pat, thick, prof): + full = frozenset(range(2*p+1)); T, D = Counter(), Counter() + outs = [full, full] + for i, ch in enumerate(pat, 1): outs += [frozenset(range(0, 2*i+1)) if ch == 'I' else frozenset(range(2*i, 2*p+1))]*2 + for s in outs: T[1+8*len(s & thick)] += 112 + for i, ch in enumerate(pat, 1): + if ch == 'I': D[8*len(frozenset(range(0, 2*i)) & thick)] += 224 + else: D[8*len(frozenset(range(2*i+1, 2*p+1)) & thick)] += 224 + for j in range(1, p): D[8*len(frozenset([2*j]) & thick)] += 224 + for r, n in H.items(): T[r] += len(thick)*n + for r, n in prof.items(): D[r] += len(thick)*n + D[1] += 112*(2*p+1-len(thick)) + T.pop(0, None); D.pop(0, None) + return T, D +def root(T, D): + f = lambda cc: sum(n*r**(1-cc) for r, n in T.items())-sum(n*r**(1-cc) for r, n in D.items()) + lo, hi = 0.0, 0.05 + for _ in range(200): + mid = (lo+hi)/2 + if f(mid) > 0: lo = mid + else: hi = mid + return lo +pub = root(*invoice(16, 'I'*7+'T'*8, frozenset({0, 32} | set(range(1, 32, 2))), P_OLD)) +need(abs(pub-0.0030201659770) < 1e-12, 'model reproduces the published p16 raw root 0.0030201659770 (got %.13f)' % pub) +res = {p: root(*invoice(p, 'I'*((p-1)//2)+'T'*(p-1-(p-1)//2), frozenset(range(1, 2*p, 2)), P_NEW)) for p in (8, 19)} +print('coded controller raw complex root: p=8 %.6f, p=19 %.6f' % (res[8], res[19])) +need(res[19] > 0.0034*1.5, 'p=19 raw root is more than 1.5x the BIT cap 0.0034') +def guards(T, D, cc, u=0.2, cut=20, floor=21): + t = 1-cc; Tt = sum(n*r**t for r, n in T.items()); Pt = sum(n*r**t for r, n in D.items()) + return Pt/Tt, sum(n*r**(t+u) for r, n in D.items())/(cut**u*Tt), floor*sum(T.values())/(cut**cc*Tt) +a, g, d = guards(*invoice(19, 'I'*9+'T'*9, frozenset(range(1, 38, 2)), P_NEW), 0.0034) +need(a < 1-1e-9 and g < 0.97 and d < 0.97, 'p=19 tail guards at C=0.0034: alpha=%.8f gamma=%.4f delta=%.4f' % (a, g, d)) + +# ---- 5. the repo's strict outer ledger --------------------------------------------------------- +sys.path.insert(0, str(ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill')) +spec = importlib.util.spec_from_file_location('ledger_mod', ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py') +L = importlib.util.module_from_spec(spec); spec.loader.exec_module(L) +gap, atom = Q(1, 1400000000), Q(1, 250) +def failing(kappa): + prm = {'kappa': kappa, 'tested_saving': kappa+7*gap, 'complex_uniform_saving': kappa+6*gap, 'b': kappa+5*gap, 'a': kappa+4*gap, + 'q': kappa+3*gap, 'bit_saving': Q(17, 5000), 'epsilon': 1-gap, 'beta': 1-3*gap, 'r0': gap/10, 'stop': gap, 'layout': gap, 'd': gap} + out = L.ledger(prm); out['functional_checks']['actual_new_BIT_stock_sublinear'] = prm['beta']*(1-atom) + return [k for part in ('strict_checks', 'functional_checks') for k, x in out[part].items() if x <= 0] +need(failing(Q(60403, 20000000)) == [], 'ledger passes at the selected kappa 0.00302015 (control)') +need(failing(Q(3324, 1000000)) == [] and failing(Q(33999, 10000000)) == [], 'ledger passes at 0.003324 (+10%) and 0.0033999') +need(failing(Q(34, 10000)) == ['actual_bit_above_effective'], 'at 0.0034 the only failing predicate is the BIT cap') +print('DONE: formal and arithmetic checks pass; physical admission of the adapter is NOT checked here')