From 2d28bf7eee1d086815de8bf273cf1313b4b86498 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:16:57 +0800 Subject: [PATCH 01/10] theory(CGC-01): derive protected task dimension, nonlinear repair and exact affine recurrent quotient --- .../causal_gauge_compactification/THEORY.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 research/causal_gauge_compactification/THEORY.md diff --git a/research/causal_gauge_compactification/THEORY.md b/research/causal_gauge_compactification/THEORY.md new file mode 100644 index 000000000..5e88bec37 --- /dev/null +++ b/research/causal_gauge_compactification/THEORY.md @@ -0,0 +1,194 @@ +# CGC-01: protected causal compactification of shared-weight recurrent computation + +**Mathematical research addendum, 18 November 2026.** Bridges [BPD SF01–SF05B](https://github.com/MoralityLabAI/BPD), the [RC-01 recurrent circuit quotient](../recurrent_circuits_v1/THEORY.md), [LSV-15 exact LayerNorm gauges](../levin_sieve_v1/pretrained_trm/GAUGE_QUOTIENT.md), [LSV-18 semiconjugacy](../levin_sieve_v1/pretrained_trm/LSV18_SEMICONJUGACY.md), [SCM-15 causal dimension atlas](../dimensional_atlas/SCM15_THEORY.md), [SMC-15 native near-null SAE pairs](../real_recurrence_sae_v1/SMC15_RESULTS.md), the [NOR local contraction certificates](../nor01_numerical_orbit_sketch/NOR04.md), and the [precision/description frontier](../precision_entropy_frontier/README.md). + +**Evidence:** Propositions below are mathematical deductions, some resting on classical linear-algebra and state-space results, with deterministic finite-dimensional Python and exact-rational witnesses in [`finite_audit.py`](finite_audit.py). They have **not** been Lean-kernel formalized and have **not** been measured on a newly trained BPD/SAE/TRM model. In BPD itself, the registered SF03 strong incremental test **failed 0/32 roots**, SF04 public-safe partial-coalition gate **failed 3/8**, and the newer SF05B source-closure ablations were development-only and failed their combined public/authorized objectives. These failures remain evidence, not overridden results. + +## 1. Define the observer and the computation being compacted + +Consider a complete recurrent state `h in R^d` and a time-homogeneous physical transition `F_x`, with any time-varying forcing `x` explicitly supplied or included in the state. Fix the state `h` and a declared physical Euclidean inner product. Collect protected outputs into a differentiable map `P: R^d -> R^p`: e.g. actual current normalized logits and future **unauthorized** readouts under a specified query history. Collect desired downstream task outputs into `T: R^d -> R^m`: e.g. authorized source retrieval, task success margins, or future reasoning-program readouts. Multiple horizons and contexts can be stacked in `T` with *predeclared* output weights/whitening. Crucially, all future maps must execute the **true** recurrent continuation, not a probe or teacher-forced proxy. + +At the same complete recurrent state define + +\[ +B=D P(h),\quad K=\ker B,\quad Q\in\mathbb R^{d\times k},\quad Q^TQ=I_k,\quad\operatorname{im}Q=K,\quad A=D T(h)Q.\tag{1} +\] + +The `k=d-rank(B)` directions form the **local protected-readout tangent kernel**. They leave `P` unchanged only at first order. If an exact architectural gauge is known, such as the channel-shift symmetry of a LayerNorm, its finite/infinite-radius invariance is a separate stronger statement. `P` must represent the real monitor information set; protecting a single scalar when full vocabulary logits or an entire observable trace are available is insufficient for a transcript privacy claim. + +The *safe task rank* is + +\[ +r_{\rm task}(h;P,T)=\operatorname{rank}(A)=\operatorname{rank}(DT(h)|_K).\tag{2} +\] + +It is relative to the chosen physical metric, output metric, horizon and task/observer pair. It counts independent **first-order task effects accessible while holding the protected output fixed to first order**. It does *not* count the number of neural mechanisms or establish a global invariant quotient. In particular, selecting a BPD component by large post-rollout gradient can recover an ordinary task-sensitive direction without discovering a reusable parameter circuit. + +## 2. Protected task spectrum and the optimal local block + +**Theorem CGC-01 (protected Eckart–Young compactification).** Let the singular values of `A=DT(h)Q` be `sigma_1>=...>=sigma_k>=0`, padding zeros when needed. Among all `r`-dimensional orthogonal subspaces `E` of `K`, with physical projector `Pi_E`, + +\[ +\min_{\dim E=r}\|DT(h)(\Pi_K-\Pi_E)\|_{\rm op}=\sigma_{r+1},\quad +\min_{\dim E=r}\|DT(h)(\Pi_K-\Pi_E)\|_F^2 +=\sum_{j>r}\sigma_j^2.\tag{3} +\] + +A minimizer is the physical span of the first `r` **right singular directions of `A` mapped back by `Q`**. The protected task Gramian in kernel coordinates is + +\[ +G_K=A^TA=Q^T DT(h)^TDT(h)Q.\tag{4} +\] + +For an isotropically chosen intervention `delta` on the radius-`rho` sphere **inside K**, and the top-`r` projector, the exact first-order mean-square omitted task response is + +\[ +\mathbb E\|DT(h)(I-\Pi_E)\delta\|^2 +=\frac{\rho^2}{k}\sum_{j>r}\sigma_j^2,\quad k>0.\tag{5} +\] + +**Proof.** Every `E` inside `K` corresponds to an orthogonal projector `V V^T` in the `Q` coordinates. The linear omitted map is `A(I-VV^T)`. Its rank-`r` complement is `AVV^T`, a rank-at-most-`r` approximation to `A`; truncated SVD attains the classical Eckart–Young–Mirsky minima in both norms. For the spherical statement, `E[delta delta^T]=(rho^2/k) Pi_K`; trace the omitted squared response. QED. + +**Rank lower bound.** If a differentiable `r`-coordinate encoder `phi` and decoder `D` exactly factor `T` on an open local neighborhood of `h` **within the affine slice `h+K`**, the chain rule implies `rank(DT(h)Q)<=r`. This is a necessary local dimension for exact task behavior on the slice. For an `epsilon`-approximation, the tail in (3) is a *first-order error frontier*, not a claim of exact factorization. A local task map being representable says nothing about whether an encoder can evolve autonomously with the recurrent transition. + +**Important identifiability qualification.** Singular values and spectral error are well defined in the **fixed physical metric**. If `sigma_r=sigma_{r+1}`, the selected rank-`r` subspace need not be unique. A nonorthogonal physical change of hidden-state coordinates changes Euclidean singular values unless the metric is transformed with it. By contrast, the *component-coordinate* gauge `V -> V R, U -> R^{-1} U` in BPD leaves the physical hidden state and physical operator fixed, so it leaves this task Gramian unchanged. + +The result provides a falsifiable definition of **local protected causal dimension**. It does not imply that the weight matrix's own top singular vectors optimize task transport. For example, `W=diag(10,1)` and task readout `T(h)=h_2`: the top physical-weight SVD selects the first coordinate yet the task reads only the second. This exact counterexample is in the tests. + +## 3. A nonlinear local compactification guarantee + +**Theorem CGC-02 (finite-radius task-error certificate).** Suppose `T` is `C^2` on the closed Euclidean ball `B_rho(h)`, with uniform Hessian bilinear operator norm `||D^2 T|| <= M` on that ball. Let `E` be the top-`r` protected task block from CGC-01. For every `delta in K` with `||delta||<=rho`, + +\[ +\|T(h+\delta)-T(h+\Pi_E\delta)\| +\le\rho\sigma_{r+1}+M\rho^2.\tag{6} +\] + +**Proof.** Expand each task value around `h`: `T(h+v)=T(h)+DT(h)v+R(v)` with `||R(v)|| <= M||v||^2/2`. The linear difference is bounded by `sigma_(r+1)||delta||`, since `delta-Pi_E delta` lies in `K`. Bound the two Taylor remainders by `M(||delta||^2+||Pi_E delta||^2)/2 <= M rho^2`. QED. + +Thus a **sufficient, local** dimension certificate under error budget `epsilon` is the smallest `r` for which `rho*sigma_(r+1)+M*rho^2 <= epsilon`. This bound can be conservative even at full rank because it compares two independent Taylor remainders. It does not prove that a proposed projection preserves the protected outputs at finite radius; `P` needs its own nonlinear bound or an exact level-set correction. This distinction is central to SF05. + +For trained transformer features, validated Hessian bounds from the SCM-14 program can in principle supply `M`. A floating Jacobian/SVD alone gives a diagnostic curve rather than an exact certificate. + +## 4. Multichannel finite public-level-set correction + +**Theorem CGC-03 (minimum-norm correction and second-order residual).** Assume the *current protected readout* has an **exact affine/architectural** kernel `K_0` with orthonormal column basis `Q_0`; along this kernel it is truly unchanged for finite edits. Let `P_U: R^d -> R^p` be the future protected public output under a fixed query program. Given a current-dark candidate displacement `d in K_0`, define + +\[ + e=P_U(h+d)-P_U(h),\quad J=DP_U(h+d)Q_0.\tag{7} +\] + +If `J` has full row rank and smallest singular value `sigma_min(J)>=gamma>0`, the minimum-Euclidean-norm **linearized** correction inside `K_0` is + +\[ + s=-Q_0 J^\dagger e,\quad \|s\|\le\|e\|/\gamma,\quad + D P_U(h+d)s=-e.\tag{8} +\] + +If the Hessian bilinear operator norm of `P_U` is at most `M_U` along the segment from `h+d` to `h+d+s`, the **actual finite public residual after one exact step** obeys + +\[ + \|P_U(h+d+s)-P_U(h)\| + \le\frac{M_U}{2}\|s\|^2 + \le\frac{M_U}{2\gamma^2}\|e\|^2.\tag{9} +\] + +**Proof.** In kernel coordinates `s=Q_0 z`, the equation `J z=-e` has the least-norm solution `z=-J^dagger e` by the Moore–Penrose characterization; full row rank makes it exact and bounds the pseudoinverse norm by `1/gamma`. Taylor expansion about `h+d` cancels the zeroth and first-order residuals, leaving the Hessian remainder. QED. + +This extends the *scalar* source-locked SF05-A2 Newton construction to a collection of **joint public outputs**. In a language model that may mean all monitored normalized logits/token sites, where full row rank can be impossible if `p>dim K_0`. If `J` lacks full row rank, an arbitrary public residual may be unreachable by such a repair; the actual least-squares leftover is `(I-JJ^dagger)e`. Any apparent success after silently collapsing a full output vector to one scalar is observer-dependent. A public-only output correction can also move the authorized target, so source-specific task retention must be checked after the finite edit. + +A simple analytic negative control is `P_U(h)=h_0+h_1^2` at `h=0`, with current readout `q(h)=h_0`. The finite edit `d=(0,0.2,0)` is tangent-safe because the initial public gradient in the `h_1` direction vanishes, yet changes the actual future public output by `0.04`. A Newton step at `h+d` is `s=(0,-0.1,0)`, which leaves residual `0.01`, exactly the quadratic bound for `M_U=2` and `||s||=0.1`. Stage A found a more complicated trained-model failure: projecting the *original* physical donor displacement onto the tangent plane could worsen finite public behavior. + +## 5. From local rank to an exact dynamic quotient + +The protected task spectrum above is **not** an exact recurrent compactification. To make the distinction constructive, specialize to a real-affine controlled recurrence on the *full declared state domain*, + +\[ + h_{t+1}=A_a h_t+b_a,\quad y_t=C h_t,\quad a\in\mathcal U.\tag{10} +\] + +Let `V_0=rowspan(C)` and iteratively close the output row space under every permitted action, + +\[ +V_{n+1}=V_n+\sum_{a\in\mathcal U}V_n A_a,\qquad V_*=\lim_nV_n.\tag{11} +\] + +**Theorem CGC-04 (minimal real-linear affine recurrent quotient).** If `B` is a row basis of `V_*`, of rank `r_*`, there exist matrices `D_a` and a readout `R` such that + +\[ + B A_a=D_a B,\qquad C=RB,\qquad + z'=D_a z+B b_a,\quad y=Rz,\quad z=Bh.\tag{12} +\] + +Every **linear** encoder preserving `C` and admitting such closed affine reduced transitions for all actions has rank at least `r_*`. Moreover, for any states `h,h'`, all future output words agree under the same action program if and only if `B(h-h')=0`. Over the full continuous state space, the quotient has *dimension* `r_*`, while a finite bit count requires a declared precision and bounded domain. + +**Proof.** The row-space iteration spans precisely the rows `C A_{a_k}...A_{a_1}` for all finite operation words. Their common kernel is the set of invisible state differences under every future word. Closure guarantees `BA_a` lies in the rowspace of `B`, giving `D_a`, while `C` lies there as well and factors as `RB`; offsets descend as `Bb_a`. Conversely, any closed linear encoder must contain the rows of `C` and be invariant under all `A_a`, hence contain `V_*`. QED. This is the standard linear-systems observability construction over the reals, parallel to [RC-01's exact F2 circuit theorem](../recurrent_circuits_v1/THEORY.md), rather than a claimed novel result in control theory. + +For a **single** fixed real-affine map, the finite observability matrix is + +\[ +\mathcal O_H=\begin{bmatrix}C\\CA\\\vdots\\CA^{H-1}\end{bmatrix},\quad +G_H=\mathcal O_H^T\mathcal O_H.\tag{13} +\] + +Its rank is nondecreasing in horizon `H`, and stabilizes at the exact quotient rank by `H=d` (Cayley–Hamilton). The Gramian satisfies `G_(H+1)-G_H=(CA^H)^T(CA^H)` positive semidefinite. The singular tail of a finite **protected** observability stack supplies the task-relative local analogue of this exact invariant row-space closure, but says nothing about whether the proposed protected kernel remains invariant during rollout. + +**Contraction connection.** If `||A||op = lambda < 1`, the unobserved squared Frobenius energy beyond a finite horizon is bounded by + +\[ +\sum_{j=H}^\infty \|C A^j\|_F^2 +\le\frac{\|C\|_F^2\lambda^{2H}}{1-\lambda^2}.\tag{14} +\] + +For a nonnormal recurrence, `spectral radius(A)<1` alone gives **no** `lambda<1` bound in this physical norm and does not prevent large early amplification. The toy `A=[[0.5,3],[0,0.5]]` has spectral radius 0.5 yet `||A||op>3` at the first step. The NOR block-derivative/invariant-basin certificates are therefore the more relevant route to trained looped networks than assuming a spectral-radius contraction. + +## 6. Independent information/precision obstruction + +**Proposition CGC-05 (finite distinguishable-future code lower bound).** Fix an input/decoder/side-information contract. Suppose `N` reachable states have pairwise task-future outputs at least `Delta` apart, under one declared future protocol. An encoder-decoder with worst-case task-output error strictly less than `Delta/2` must assign **distinct codes** to those `N` states. Any fixed-length quantized code needs at least `ceil(log2 N)` bits, and if it uses `r` mutable coordinates with at most `b` bits each then + +\[ + r b\ge\lceil\log_2 N\rceil.\tag{15} +\] + +**Proof.** If two separated targets shared a code, their common decoded output would be within less than `Delta/2` of each, violating the triangle inequality. Thus there are `N` distinct codes. Count them. QED. + +This is a **global finite-code requirement**, distinct from the differential task rank. For example, NOR's two separated recurrent attracting basins require one terminal basin bit for a joint compact code even when each individual basin contracts to a locally zero-dimensional limit. Conversely, a small observed local tangent dimension says nothing about the number of discrete basins, the precision required to distinguish nearly coincident futures, or the cost of computing the code. Treat the encoder's parameters, query-dependent selection, external state and decimal precision as part of RC-01's resource ledger. + +## 7. Gauge, causal witnesses, and a new compactness frontier + +For a physically frozen BPD matrix `W=VU`, let any invertible `R in GL(c)` act as `V'=VR, U'=R^{-1}U`. The full write `W`, its physical output-SVD projector and its functional continuation are unchanged. A singleton/diagonal mask is generally **not** invariant: on an invertible factorization, it must commute with each aligned relative gauge transformation to define the same physical intervention (see [BPD optimal basis/invariant-mask theorem](https://github.com/MoralityLabAI/BPD/blob/main/mechinterp/bpd/theory/OPTIMAL_BASIS_AND_MASKS.md)). The task-conditioned spectral block in Theorem CGC-01 is likewise invariant to *component-coordinate reparameterization* because it is constructed from the unchanged physical dynamics and actual task/observer derivatives. + +These are different mathematical quotients: + +| Quotient / dimension | What it preserves | What it does not yet establish | +|---|---|---| +| Factor-gauge physical block `VU` | Same weight operator | Identifiable singleton neuron/SAE feature | +| Protected tangent `K=ker DP` | First-order protected output | Finite public output preservation | +| Task spectrum on `K` | Best linearized causal task response for a given block rank | Causal component specificity or autonomous recurrence | +| Exact affine row-space quotient `V_*` | Every declared future readout under every action | Nonlinear-model compression or finite-bit storage | +| Finite code lower bound | Distinguishable task-future classes at a specified margin | Trained decoder, inference cost, or reachable-basin classification | + +A well-specified **compact causal computation frontier** should therefore report + +\[ +\mathcal F_{\mathrm{CGC}}=(r,\ b,\ T,\ C_{\rm compute},\ \epsilon_{\rm task},\ \epsilon_{\rm public},\ \epsilon_{\rm closure},\ \epsilon_{\rm gauge};\ \mathcal O,\ \mathcal U,\ \mathsf{family}).\tag{16} +\] + +Here `r` is selected **physical causal subspace dimension**, `b` is retained precision per coordinate, `T` is execution depth and `C_compute` includes any learned encoder/policy and oracle calls. The observer information `O`, legal interventions `U`, source family and task/public metrics must be declared. Finite-radius and rollout-closure failures remain separate from weight reconstruction or probe decodability. + +**Central extrapolated hypothesis, unproved:** for some trained compact recurrent models, a low-dimensional gauge-stable physical subspace approximates several task-conditioned future readouts at multiple passes while preserving designated public outputs, and the dimension remains stable under deeper shared-weight execution. This is falsifiable: the dimension may increase with horizon, factor fits may be degenerate, gradient-matched shams may reproduce the effect, or exact current readout matching may yield too few naturally reachable interventions. + +## 8. Prospective BPD / Compactification / EvalMath experimental contract + +The accompanying [CGC-01 protocol](PROTOCOL.md) defines a source-only reference suite and a separate unrun trained-model study. The scientific target is a **causally sufficient, gauge-stable block across recurrent depth**. Candidate models: compact TRMs and looped transformers with true per-pass readouts, accompanied by synthetic source-binding and exact EvalMath program-state tasks with new independently generated source families. + +Predefine a full normalized-logit or task-protocol readout, compute the protected kernel and task Gramian on **development** states, select physical subspaces by the task singular spectrum and compare them with physical-weight SVD, independent BPD factorizations, naturally active SAE subspaces, hidden-state random-dark controls, norm-and-future-Jacobian matched shams, and no-edit/donor full-state positive controls. Then **freeze** the basis, rank and radius before evaluating different model roots, heldout programs and additional loop counts. + +The strong hypothesis is that a *small physical block*, with the same selection rule, transfers actual heldout causal task effects beyond the source/calibrated shams while remaining numerically public-safe and maintaining task utility. Require the complete teacher and BPD native execution path, finite-radius perturbation sweeps, all attempted/eligible donor denominators, gauge rotations, output whitening, model-root-level uncertainty and a phase-disjoint dictionary-training control. Source-only spectral identities cannot satisfy those gates. The sealed ARG-03-N split remains unused, and existing BPD and Compactification-Theory receipts are unchanged. + +## Sources and scope + +- Classical best rank-`r` truncation: [Eckart–Young theorem, EPFL notes, Thm. 9.1](https://www.epfl.ch/schools/ic/ipg/wp-content/uploads/2019/09/ITSP2019_Sept20.pdf). +- Classical matrix model reduction and the Moore–Penrose pseudoinverse: [Max Planck Institute, Matrix Equations and Model Reduction](https://www.mpi-magdeburg.mpg.de/2517709/MathBasics.pdf). +- Internal contextual sources: [BPD SF03](https://github.com/MoralityLabAI/BPD/blob/main/mechinterp/bpd/theory/sf03_tangent_null/RESULTS.md), [BPD SF04](https://github.com/MoralityLabAI/BPD/blob/main/mechinterp/bpd/theory/sf04_source_binding/RESULTS.md), and [BPD SF05B Stage 2-B PR #64](https://github.com/MoralityLabAI/BPD/pull/64), with the last remaining a development-only result at the time of this note. +- Existing work in this repository: RC-01, LSV-15/18, SCM-14/15, NOR-04/10, SMC-15/27 and the precision-entropy frontier; see links at the top. New novelty is in the **combined observer-protected causal compactness contract**, with explicit negative controls and numerical certificates. The individual SVD, observability, pseudoinverse and counting statements are classical or straightforward deductions. From d69a018707195ef47752032422366479c740f352 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:16:59 +0800 Subject: [PATCH 02/10] docs(CGC-01): register source-only checks and future trained BPD/compact model falsifiers --- .../causal_gauge_compactification/PROTOCOL.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 research/causal_gauge_compactification/PROTOCOL.md diff --git a/research/causal_gauge_compactification/PROTOCOL.md b/research/causal_gauge_compactification/PROTOCOL.md new file mode 100644 index 000000000..6d766a980 --- /dev/null +++ b/research/causal_gauge_compactification/PROTOCOL.md @@ -0,0 +1,36 @@ +# CGC-01 source-only mathematical audit and future physical-block study + +**18 November 2026.** This protocol accompanies [THEORY.md](THEORY.md). The initial code tests are source-only checks of explicitly specified finite matrices and exact rational witnesses. They are **not** a prospective neural-model experiment and have no newly scored scientific roots. Future neural tests require a new source/observer lock before model captures. + +## Stage 0: executable mathematical checks (included) + +From repository root, with `numpy` installed: + +```bash +python -m unittest discover -s research/causal_gauge_compactification -p 'test_*.py' -v +python research/causal_gauge_compactification/finite_audit.py +``` + +The finite tests cover these mathematical claims under explicit contracts: a protected current/future readout Jacobian generates a physical orthonormal null basis; the task-conditioned truncated SVD minimizes worst-case and Frobenius first-order error; a high-magnitude physical weight singular direction can be task irrelevant; BPD component-gauge shears preserve the complete physical operator and its SVD intervention; Euclidean singular values depend on the physical state metric; a full-row-rank multioutput public Jacobian admits the advertised minimum-norm protected correction; a nonlinear tangent-safe edit can still change finite public outputs; the correction's exact quadratic residual fits a Hessian bound; the real-linear affine row-space quotient is closed under all supplied actions; the toy rational Krylov rank matches the independent floating quotient rank; full-action observability may require more state dimensions than a passive single-action probe; observability Gramian rank cannot decrease with horizon; nonnormal recurrences have early gain despite small eigenvalues; separated futures incur a quantized-code bit lower bound. All data are generated from short, fixed matrices contained in source. + +**Exactness:** `Fraction`-based Gaussian elimination gives an exact rank certificate for the integer examples. NumPy SVD/projectors and floating normative tests are numerical checks against analytical formulae at small scale, **not** formal verification of arbitrary real matrices. The analytic theorems have handwritten proofs, not Lean certificates. Record Python/NumPy versions in CI output. + +## Stage 1: prospective physical-model campaign (not executed) + +**Hypothesis:** A development-selected rank-`r` *physical* BPD block built from the protected task Gramian transports a task-specific causal variable across previously unseen recurrent passes and source/program families, beyond equal-norm, matched-future-Jacobian and matched-task-sensitivity shams, while respecting a complete protected observable channel. + +Choose one frozen model family and named recurrent state bus. Candidate first pair: a small trained TRM (source-generated Sudoku/task-variable interventions) and a compact looped transformer (source-generated Horn-graph/equation tasks); the second model should constitute independent replication, not a substitute for root replication within the first. Before any checkpoint outcome, freeze: + +- The *full* readout definition, including normalization/head, all token sites needed for the behavioral target, exact protected output conditioning and input context. Preserve true full recurrent state, caches and forcing. +- Output metric/whitening, physical hidden metric, selected development visit/horizon, radius ladder, and the rank/soft-rank tolerance; the public protected Jacobian and future task Jacobian must come from the true frozen target model on development samples. +- The physical BPD reconstruction fit (including residual weights, active masks, dictionary training phases), independent dictionary initializations, GL factor gauge checks, physical output-SVD and task-optimal SVD, independent SAE decoder frames, and full native BPD replay. Avoid selecting a rank from heldout task scores. +- Admissible donor pairs, independent task-variable label oracle, current true normalized-logit match, protected future output tolerance, whether any finite public-level-set corrector uses privileged future gradients, source family hashes, and count of *attempted* donors. Exact LayerNorm shift gauges may be treated separately from merely Jacobian-null directions. +- Minimality and utility criteria: heldout native task correctness, effect on an independent target variable, recurrent depth extrapolation, finite-radius protection of all monitored outputs, total forward/fit/scheduling costs, and model-root-level uncertainty. + +**Controls:** full native state transplant, no edit, full physical `VU` reconstruction, output-SVD of `VU`, task-conditioned Gramian block of the *teacher physical transition*, randomized protected dark subspaces at matched norm, equal signed target-gradient responses, task-sensitivity-matched negative block, best-rank `W` SVD baseline, fixed cross-root gauge alignment and phase-disjoint learned-dictionary training. A compact factor claim must beat relevant controls and not merely reproduce the whole physical matrix. + +**Causal ranking:** let `R_B` be independent task-variable donor recovery after the selected block edit, and `R_0..R_63` the same eligible-pair recovery under 64 development-calibrated shams per independent teacher root. Report total task effect, first-order future-response prediction, residual nonlinear effect and the physical/gauge stability of the selected subspace. Use root as inferential unit, not token/pair/sham. A preregistered strong effect must clear an independent-root null tolerance rather than a conveniently chosen single random direction. A 59-root maximum of identically distributed sham-derived root statistics supplies a one-sided 95th-percentile bound with ~95% confidence under the stated iid root law, and must be fixed before a separate >=32-root confirmation cohort. Source-family-disjoint tasks and effective sample counts are required for any behavioral transfer claim. + +**Falsifiers:** dominant task eigenvectors collapse to matched target-gradient controls; equally good BPD fits yield inconsistent physical subspaces without a prescribed alignment; top physical-weight SVD suffices; best causal block merely preserves a local tangent and breaks finite public protection; the observed low-dimensional map fails semiconjugacy under additional passes; a small decoder hides task labels in a schedule/external memory; global separated-basin counts defeat the local rank frontier; or eligible natural interventions are too rare to support a robust claim. A negative is recorded without redefining the metric or moving the rank threshold. + +**Protected exclusions:** no existing NOR, SMC, SCM, LSV, BPD SF03/04/05 or other source-locked receipts are revised; do not access ARG-03-N's sealed 168-case set. Stage 0 passing is proof-oracle hygiene only. The exact finite results must never be reported as evidence that a trained TRM has learned this quotient. From 07f69b69e87f6cdd89eeeea6cae6e8c8b688a8c3 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:02 +0800 Subject: [PATCH 03/10] docs(CGC-01): connect BPD causal subspaces with NOR, LSV, SMC and precision frontiers --- .../causal_gauge_compactification/README.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 research/causal_gauge_compactification/README.md diff --git a/research/causal_gauge_compactification/README.md b/research/causal_gauge_compactification/README.md new file mode 100644 index 000000000..ebaf713ec --- /dev/null +++ b/research/causal_gauge_compactification/README.md @@ -0,0 +1,30 @@ +# CGC-01: protected causal compactification + +[Mathematical theory](THEORY.md) · [Source-only audit and future protocol](PROTOCOL.md) · [Executable finite reference](finite_audit.py) + +The **CGC-01** bridge takes BPD's negative controls on recurrent secret/source transport and turns them into a task-specific dimension question for compact recurrent models: *How few physically meaningful directions can explain future task behavior while respecting a precisely defined protected observer?* + +For a complete recurrent state `h`, a differentiable protected output `P`, a task-output stack `T` and physical Euclidean metric, form the protected kernel `K=ker DP(h)` and stack future task Jacobians on that kernel. The singular spectrum of `DT(h)|_K` gives an **optimal local linear rank/error frontier**. A uniform task Hessian bound gives an explicit finite-radius extension. A separately derived minimum-norm correction addresses multichannel finite public-output residuals **only when** its restricted Jacobian has adequate row rank; current-readout finite equality needs an exact affine/architectural gauge. + +For an exact real-affine recurrence, iterative row-span closure recovers the smallest linear state quotient preserving all declared future observations/actions. This distinguishes a locally task-informative subspace from an autonomously recurrent macrostate. Global separated-future codes impose a separate precision-bit lower bound, and nonnormal early amplification matters even when the recurrence ultimately contracts. + +## Run source-only checks + +```bash +python -m pip install numpy +python -m unittest discover -s research/causal_gauge_compactification -p 'test_*.py' -v +python research/causal_gauge_compactification/finite_audit.py +``` + +All numerical witnesses use static synthetic matrices; one independent exact rational row-rank oracle is included. **No trained BPD success, SAE discovery, model compression gain, neuron interpretation or actual secret protection is claimed.** Theoretical identities concern explicitly stated physical metrics, output weightings, protected channels and task horizons. + +## Crosswalk + +- [BPD source/intervention experiments](https://github.com/MoralityLabAI/BPD): SF03's signed-gradient null, SF04 source-binding failure, SF05 finite versus tangent public repair, SF05B source-closure training tradeoff. The full physical BPD matrix and gauge-invariant blocks are the candidate units, subject to heldout causal validation. +- [RC-01](../recurrent_circuits_v1/THEORY.md): resource-bounded compactness and exact affine `F_2` quotient. CGC-01 adds a real-linear controlled version and protected task-conditioned tangent analysis. +- [LSV-15](../levin_sieve_v1/pretrained_trm/GAUGE_QUOTIENT.md) / [LSV-18](../levin_sieve_v1/pretrained_trm/LSV18_SEMICONJUGACY.md): exact LayerNorm symmetry and future-closed latent state criteria. +- [NOR-04/10](../nor01_numerical_orbit_sketch/NOR04.md): source-locked block contraction and the two-basin terminal-bit obstruction. Local tangent rank and global basin-label bits are different. +- [SMC-15](../real_recurrence_sae_v1/SMC15_RESULTS.md) / [SCM-15](../dimensional_atlas/SCM15_THEORY.md): output-near-null SAE coalitions, tangent atlas and physical frame comparisons. +- [Precision frontier](../precision_entropy_frontier/README.md): task-separated futures and quantized code/parameter cost. + +A future neural experiment should be registered as a separate CGC/BPD-GM follow-up with new source-family and independent model-root evaluation. CGC-01 remains a **source-only mathematical addition**. From 77c0b4d4a3ff01d3d3ac271958012b1b92c255f7 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:05 +0800 Subject: [PATCH 04/10] feat(CGC-01): executable protected spectrum, multi-output correction and exact affine quotient --- .../finite_audit.py | 305 ++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 research/causal_gauge_compactification/finite_audit.py diff --git a/research/causal_gauge_compactification/finite_audit.py b/research/causal_gauge_compactification/finite_audit.py new file mode 100644 index 000000000..838c5dfa5 --- /dev/null +++ b/research/causal_gauge_compactification/finite_audit.py @@ -0,0 +1,305 @@ +"""CGC-01 mathematical reference for task-protected recurrent compactification. + +Source-only finite-dimensional linear algebra; no neural model, pretrained +checkpoint, trained BPD result, privileged heldout datum, or security claim. +The Euclidean physical-state metric and output weights must be declared. +""" +from __future__ import annotations + +from dataclasses import dataclass +from fractions import Fraction +from math import ceil +from typing import Sequence + +import numpy as np + + +@dataclass(frozen=True) +class ProtectedSpectrum: + protected_basis: np.ndarray + available_dimension: int + task_singular_values: np.ndarray + task_rank: int + task_gramian: np.ndarray + + +def numerical_rank(singular_values: np.ndarray, *, tol: float = 1e-10) -> int: + """Thresholded numerical rank; tol is an absolute, stated threshold.""" + return int(np.count_nonzero(np.asarray(singular_values) > tol)) + + +def null_basis(jacobian: np.ndarray, *, tol: float = 1e-10) -> np.ndarray: + """Orthonormal Euclidean columns spanning the null space of a 2-D map.""" + b = np.asarray(jacobian, dtype=float) + if b.ndim != 2: + raise ValueError("expected 2D protected Jacobian") + _, s, vt = np.linalg.svd(b, full_matrices=True) + rank = numerical_rank(s, tol=tol) + return vt[rank:].T.copy() + + +def protected_task_spectrum(protected: np.ndarray, task: np.ndarray, + *, tol: float = 1e-10) -> ProtectedSpectrum: + """Task-observability Gramian restricted to first-order protected kernel. + + `task` may stack weighted future readouts from multiple horizons/tasks. + """ + b = np.asarray(protected, dtype=float) + a = np.asarray(task, dtype=float) + if b.ndim != 2 or a.ndim != 2 or b.shape[1] != a.shape[1]: + raise ValueError("protected/task matrices must share physical state dimension") + q = null_basis(b, tol=tol) + restricted = a @ q + s = np.linalg.svd(restricted, compute_uv=False) + gramian = restricted.T @ restricted + return ProtectedSpectrum(q, q.shape[1], s, numerical_rank(s, tol=tol), gramian) + + +def task_optimal_block(protected: np.ndarray, task: np.ndarray, rank: int, + *, tol: float = 1e-10) -> tuple[np.ndarray, float, float]: + """Rank-r physical-state block; exact first-order spectral/Frobenius tails. + + Returns physical orthonormal basis E, operator residual and squared + Frobenius residual on the protected kernel. These are local linear facts. + """ + spec = protected_task_spectrum(protected, task, tol=tol) + k = spec.available_dimension + if not (0 <= rank <= k): + raise ValueError("rank must be between 0 and dimension of protected kernel") + a = np.asarray(task, dtype=float) @ spec.protected_basis + _, s, vt = np.linalg.svd(a, full_matrices=True) + e = spec.protected_basis @ vt[:rank, :].T + tail = s[rank:] + operator_error = float(tail[0]) if tail.size else 0.0 + frob_sq_error = float(tail @ tail) + return e, operator_error, frob_sq_error + + +def physical_svd_write(feature_delta: np.ndarray, physical_weight: np.ndarray, + rank: int) -> tuple[np.ndarray, float | None]: + """Physical output SVD truncation, invariant to V,U factor re-gauging. + + For row-state convention: feature_delta [N, d_in], W [d_in, d_out]. + """ + x = np.asarray(feature_delta, dtype=float) + w = np.asarray(physical_weight, dtype=float) + if x.ndim != 2 or w.ndim != 2 or x.shape[1] != w.shape[0]: + raise ValueError("incompatible physical write shapes") + u, s, vt = np.linalg.svd(w, full_matrices=False) + if not (1 <= rank <= len(s)): + raise ValueError("rank outside allowed physical SVD range") + basis = vt[:rank, :] + write = x @ w + result = (write @ basis.T) @ basis + gap = float(s[rank-1] - s[rank]) if rank < len(s) else None + return result, gap + + +def least_norm_public_repair(protected_kernel_basis: np.ndarray, + public_jacobian: np.ndarray, + public_residual: np.ndarray, + *, tol: float = 1e-10) -> np.ndarray: + """Minimum-L2 tangent correction inside the existing protected kernel. + + Requires full row rank of public_jacobian restricted to K so every + first-order public-output residual can be cancelled. No finite safety + assertion is made without a second-order remainder certificate. + """ + q = np.asarray(protected_kernel_basis, dtype=float) + b = np.asarray(public_jacobian, dtype=float) + residual = np.asarray(public_residual, dtype=float).reshape(-1) + if q.ndim != 2 or b.ndim != 2 or b.shape[1] != q.shape[0] or b.shape[0] != residual.size: + raise ValueError("incompatible kernel, public Jacobian, or residual") + if not np.allclose(q.T @ q, np.eye(q.shape[1]), atol=1e-8): + raise ValueError("kernel columns must be orthonormal") + restricted = b @ q + if np.linalg.matrix_rank(restricted, tol=tol) != b.shape[0]: + raise ValueError("public Jacobian is not surjective on the protected kernel") + return q @ (-np.linalg.pinv(restricted, rcond=tol) @ residual) + + +def local_finite_compactification_bound(sigma_next: float, radius: float, + hessian_operator_bound: float) -> float: + """||G(h+delta)-G(h+P_E delta)|| <= rho*sigma_(r+1) + M*rho^2. + + Requires both edits to lie in an r-radius convex neighborhood on which + ||D^2 G||op <= M; block E must be first-order task-optimal. + """ + if min(sigma_next, radius, hessian_operator_bound) < 0: + raise ValueError("nonnegative bound arguments required") + return float(radius*sigma_next + hessian_operator_bound*radius*radius) + + +def finite_newton_remainder_bound(hessian_operator_bound: float, + step: np.ndarray) -> float: + """||public residual after exact tangent cancellation|| <= M||s||^2/2.""" + if hessian_operator_bound < 0: + raise ValueError("Hessian bound cannot be negative") + return float(0.5*hessian_operator_bound * np.linalg.norm(step)**2) + + +def rowspace_basis(rows: np.ndarray, *, tol: float = 1e-10) -> np.ndarray: + b = np.asarray(rows, dtype=float) + if b.ndim != 2: + raise ValueError("expected 2D row matrix") + _, s, vt = np.linalg.svd(b, full_matrices=False) + return vt[:numerical_rank(s, tol=tol), :].copy() + + +@dataclass(frozen=True) +class AffineQuotient: + encoder: np.ndarray + transitions: tuple[np.ndarray, ...] + readout: np.ndarray + input_offsets: tuple[np.ndarray, ...] + dimension: int + + +def minimal_real_affine_quotient(transition_matrices: Sequence[np.ndarray], + output_matrix: np.ndarray, + translations: Sequence[np.ndarray] | None = None, + *, tol: float = 1e-10) -> AffineQuotient: + """Construct minimal exact real-*linear* future-observable affine quotient. + + Rowspace closure is the real-field counterpart of the RC-01 F2 theorem. + It proves minimality among linear sufficient encoders for this full state + domain and supplied action alphabet, not a nonlinear-model certificate. + """ + c = np.asarray(output_matrix, dtype=float) + if c.ndim != 2: + raise ValueError("output must be 2D") + d = c.shape[1] + aa = tuple(np.asarray(a, dtype=float) for a in transition_matrices) + if not aa or any(a.shape != (d,d) for a in aa): + raise ValueError("nonempty alphabet of square, shared-dimension matrices required") + if translations is None: + bb = tuple(np.zeros(d) for _ in aa) + else: + bb = tuple(np.asarray(b,dtype=float).reshape(-1) for b in translations) + if len(bb) != len(aa) or any(b.shape != (d,) for b in bb): + raise ValueError("translations must match action alphabet") + basis = rowspace_basis(c,tol=tol) + for _ in range(d+1): + grown = rowspace_basis(np.vstack((basis,)*(1) + tuple(basis @ a for a in aa)),tol=tol) + if grown.shape[0] == basis.shape[0]: + basis = grown + break + basis = grown + else: + raise AssertionError("row-span closure exceeded state dimension") + reduced = tuple(basis @ a @ basis.T for a in aa) + out = c @ basis.T + off = tuple(basis @ b for b in bb) + for a,hat in zip(aa,reduced): + if not np.allclose(basis @ a,hat @ basis,atol=1e-7): + raise AssertionError("row space did not close") + if not np.allclose(out @ basis,c,atol=1e-7): + raise AssertionError("readout factorization failed") + return AffineQuotient(basis,reduced,out,off,basis.shape[0]) + + +def affine_observability_matrix(transition: np.ndarray, readout: np.ndarray, + horizon: int) -> np.ndarray: + """Stack C, C A, ..., C A^(horizon-1) for one fixed affine transition.""" + a = np.asarray(transition,dtype=float) + c = np.asarray(readout,dtype=float) + if horizon < 1 or a.ndim != 2 or a.shape[0] != a.shape[1] or c.ndim != 2 or c.shape[1] != a.shape[0]: + raise ValueError("invalid observability input") + acc = np.eye(len(a)) + rows = [] + for _ in range(horizon): + rows.append(c @ acc) + acc = acc @ a + return np.vstack(rows) + + +def observability_gramian(transition: np.ndarray, readout: np.ndarray, + horizon: int, protected_basis: np.ndarray | None = None) -> np.ndarray: + stacked = affine_observability_matrix(transition,readout,horizon) + if protected_basis is not None: + stacked = stacked @ np.asarray(protected_basis,dtype=float) + return stacked.T @ stacked + + +def minimum_code_bits(separated_futures: int, bits_per_coordinate: int) -> tuple[int,int]: + """If decoder error < half the target separation, N states need ceil(log2 N) bits. + + The dimension bound assumes each stored coordinate has at most b bits; + inputs, decoder, selector and any side information must be fixed/charged. + """ + if separated_futures < 1 or bits_per_coordinate < 1: + raise ValueError("positive N and precision required") + bits = (separated_futures-1).bit_length() + return bits,ceil(bits/bits_per_coordinate) + + +def exact_rational_rank(matrix: Sequence[Sequence[int | Fraction]]) -> int: + """Small exact rational rank oracle independent of floating-point SVD.""" + if not matrix: + return 0 + a = [[Fraction(x) for x in row] for row in matrix] + width = len(a[0]); nrows = len(a) + if any(len(row) != width for row in a): + raise ValueError("ragged matrix") + pos=0 + for col in range(width): + pivot = next((row for row in range(pos,nrows) if a[row][col]),None) + if pivot is None: + continue + a[pos],a[pivot]=a[pivot],a[pos] + k=a[pos][col] + a[pos]=[v/k for v in a[pos]] + for i in range(nrows): + if i!=pos: + coef=a[i][col] + a[i]=[v-coef*p for v,p in zip(a[i],a[pos])] + pos+=1 + if pos==nrows: + break + return pos + + +def exact_affine_krylov_rank(a: Sequence[Sequence[int]], c: Sequence[Sequence[int]]) -> int: + """Exact rank of [C;CA;...;CA^(d-1)] over rational numbers for integer data.""" + aa=[[Fraction(x) for x in row] for row in a] + cc=[[Fraction(x) for x in row] for row in c] + d=len(aa) + if not aa or any(len(row)!=d for row in aa) or any(len(row)!=d for row in cc): + raise ValueError("invalid rational affine system") + block = cc + rows=[] + for _ in range(d): + rows.extend(block) + block=[[sum(row[k]*aa[k][j] for k in range(d)) for j in range(d)] for row in block] + return exact_rational_rank(rows) + + +def synthetic_receipt() -> dict[str,object]: + """All claims below concern exact/simple linear-algebra constructions only.""" + a = np.array([[1.,1.,0.],[0.,1.,0.],[0.,0.,.5]]) + c = np.array([[1.,0.,0.]]) + exact = exact_affine_krylov_rank([[1,1,0],[0,1,0],[0,0,1]],[[1,0,0]]) + q = minimal_real_affine_quotient([a],c) + p=np.array([[1.,0.,0.]]) + target=np.array([[0.,0.,1.]]) + basis, op_tail, frob = task_optimal_block(p,target,1) + physical=np.diag([10.,1.]) + feature=np.array([[1.,1.]]) + physical_top,_=physical_svd_write(feature,physical,1) + return { + "source_only":True, + "full_real_affine_quotient_rank":q.dimension, + "integer_rational_krylov_rank":exact, + "protected_kernel_dimension":int(null_basis(p).shape[1]), + "protected_task_rank":protected_task_spectrum(p,target).task_rank, + "protected_task_one_rank_operator_tail":op_tail, + "physical_weight_top_singular_output":physical_top[0].tolist(), + "task_gradient_orthogonal_to_top_weight_output":bool(abs(physical_top[0] @ np.array([0.,1.]))<1e-12), + "trained_BPD_evidence":False, + "real_model_privacy_evidence":False, + } + + +if __name__ == "__main__": + import json + print(json.dumps(synthetic_receipt(),indent=2,sort_keys=True)) From 26fc8408d2c9c8299ebce83be5192385ad6acd15 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:08 +0800 Subject: [PATCH 05/10] test(CGC-01): 18 analytic, exact-rational, nonlinear and gauge controls --- .../test_finite_audit.py | 205 ++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 research/causal_gauge_compactification/test_finite_audit.py diff --git a/research/causal_gauge_compactification/test_finite_audit.py b/research/causal_gauge_compactification/test_finite_audit.py new file mode 100644 index 000000000..89e6de8be --- /dev/null +++ b/research/causal_gauge_compactification/test_finite_audit.py @@ -0,0 +1,205 @@ +"""CGC-01 exact/numerical source-only reference tests. + +All inputs are toy finite matrices; there are no trained checkpoints or +protected test-set outcomes. The independent rational witness uses Fraction. +""" +import unittest + +import numpy as np + +from finite_audit import ( + affine_observability_matrix, exact_affine_krylov_rank, + exact_rational_rank, finite_newton_remainder_bound, + least_norm_public_repair, local_finite_compactification_bound, + minimal_real_affine_quotient, minimum_code_bits, null_basis, + observability_gramian, physical_svd_write, + protected_task_spectrum, synthetic_receipt, task_optimal_block, +) + + +class CompactificationMathematics(unittest.TestCase): + def test_protected_intersection_rank_and_task_singulars(self): + p=np.array([[1.,0,0,0]]) + task=np.array([[0.,3,0,0],[0.,0,1,0]]) + s=protected_task_spectrum(p,task) + self.assertEqual(s.available_dimension,3) + self.assertEqual(s.task_rank,2) + self.assertTrue(np.allclose(s.task_singular_values[:2],[3,1],atol=1e-10)) + self.assertTrue(np.allclose(s.task_gramian.T,s.task_gramian)) + + def test_exact_truncated_spectrum_frobenius_and_operator(self): + p=np.array([[1.,0,0,0]]) + task=np.array([[0.,3,0,0],[0.,0,1,0]]) + e, op, sq=task_optimal_block(p,task,1) + self.assertAlmostEqual(op,1.0) + self.assertAlmostEqual(sq,1.0) + self.assertTrue(np.allclose(e.T@e,np.eye(1))) + self.assertTrue(np.allclose(p@e,0)) + q=null_basis(p) + full=task@q + omitted=full@(np.eye(3)-q.T@e@e.T@q) + self.assertAlmostEqual(np.linalg.norm(omitted,2),op) + self.assertAlmostEqual(np.linalg.norm(omitted,'fro')**2,sq) + e2,op2,sq2=task_optimal_block(p,task,2) + self.assertAlmostEqual(op2,0.,places=10) + self.assertAlmostEqual(sq2,0.,places=10) + self.assertTrue(np.allclose(p@e2,0)) + + def test_rank_lower_bound_for_exact_linear_decoder(self): + p=np.array([[1.,0.,0.,0.]]) + a=np.array([[0.,0.,3.,0.],[0.,2.,0.,0.]]) + rank=protected_task_spectrum(p,a).task_rank + self.assertEqual(rank,2) + # An r=1 encoder makes D H Q have rank<=1, so cannot equal A Q. + q=null_basis(p) + h=np.array([[1.,0,0,0]]) + self.assertLessEqual(np.linalg.matrix_rank(h@q),1) + self.assertEqual(np.linalg.matrix_rank(a@q),2) + + def test_weight_svd_can_miss_the_task_direction(self): + w=np.diag([10.,1.]); features=np.array([[1.,1.]]) + full=features@w + top,gap=physical_svd_write(features,w,1) + self.assertTrue(np.allclose(full,[10,1])) + self.assertTrue(np.allclose(top,[10,0])) + self.assertAlmostEqual(gap,9) + task=np.array([[0.,1.]]) + e,tail,_=task_optimal_block(np.zeros((0,2)),task,1) + self.assertAlmostEqual(tail,0) + self.assertAlmostEqual(np.linalg.norm(task@e),1) + self.assertAlmostEqual(float((task@top[0]).item()),0) + + def test_physical_factor_gl_gauge_invariance(self): + g=np.random.default_rng(61) + v=g.normal(size=(5,3));u=g.normal(size=(3,4));delta=g.normal(size=(20,5)) + r=np.eye(3);r[0,1]=.7;r[1,2]=-.3 + w=v@u + gauged=(v@r)@np.linalg.solve(r,u) + self.assertTrue(np.allclose(w,gauged,atol=1e-13)) + for rank in (1,2,3,4): + a, gap=physical_svd_write(delta,w,rank) + b, gap2=physical_svd_write(delta,gauged,rank) + self.assertTrue(np.allclose(a,b,atol=1e-11)) + self.assertEqual(gap is None,gap2 is None) + + def test_state_orthogonal_frame_equivariance(self): + p=np.array([[1.,0.,0.,0.]]) + t=np.array([[0.,3.,0.,0.],[0.,0.,2.,0.]]) + q,_=np.linalg.qr(np.random.default_rng(9).normal(size=(4,4))) + e,tail,_=task_optimal_block(p,t,2) + rotated_e,rotated_tail,_=task_optimal_block(p@q.T,t@q.T,2) + self.assertAlmostEqual(tail,rotated_tail,places=12) + self.assertTrue(np.allclose(rotated_e@rotated_e.T,q@e@e.T@q.T,atol=1e-10)) + + def test_nonorthogonal_state_change_alters_euclidean_singular_values(self): + task=np.array([[1.,0.]]) + scale=np.diag([4.,1.]) + untransformed=protected_task_spectrum(np.zeros((0,2)),task) + changed=protected_task_spectrum(np.zeros((0,2)),task@np.linalg.inv(scale)) + self.assertAlmostEqual(untransformed.task_singular_values[0],1) + self.assertAlmostEqual(changed.task_singular_values[0],.25) + + def test_multichannel_public_minimum_norm_repair(self): + p=np.array([[1.,0,0,0]]) + q=null_basis(p) + public=np.array([[0.,1.,0.,0.],[0.,0.,1.,0.]]) + residual=np.array([.4,-.2]) + step=least_norm_public_repair(q,public,residual) + self.assertTrue(np.allclose(p@step,0)) + self.assertTrue(np.allclose(public@step,-residual)) + self.assertTrue(np.allclose(step,np.array([0,-.4,.2,0]))) + random=np.array([0.,0.,0.,2.]) + self.assertGreater(np.linalg.norm(step+random),np.linalg.norm(step)) + + def test_undercapacity_public_linear_correction_is_rejected(self): + q=null_basis(np.array([[1.,0,0]])) + b=np.array([[0.,1,0],[0.,2,0]]) + with self.assertRaisesRegex(ValueError,"not surjective"): + least_norm_public_repair(q,b,np.array([1.,1.])) + + def test_nonlinear_tangent_safety_failure_and_newton_remainder(self): + # At base h=(0,0,0), public G=h0+h1^2, so d=(0,.2,0) + # is first-order invisible but changes public G by .04. + d=np.array([0.,.2,0.]); public=lambda z:z[0]+z[1]**2 + self.assertAlmostEqual(public(d)-public(np.zeros(3)),.04) + p=np.array([[1.,0,0]]) + q=null_basis(p) + pub_jacobian=np.array([[1.,.4,0.]]) + residual=np.array([public(d)]) + step=least_norm_public_repair(q,pub_jacobian,residual) + self.assertTrue(np.allclose(step,np.array([0,-.1,0]),atol=1e-12)) + corrected=public(d+step) + self.assertAlmostEqual(corrected,.01) + self.assertLessEqual(corrected,finite_newton_remainder_bound(2.,step)+1e-12) + + def test_local_second_order_tail_bound_on_scalar_task(self): + rho=.1 + # Task g(x1)=x1+.5*x1^2, Hessian uniformly bounded by M=1. + error=.1+.5*.1**2 + bound=local_finite_compactification_bound(1.,rho,1.) + self.assertLessEqual(error,bound+1e-12) + self.assertAlmostEqual(bound,.11) + with self.assertRaises(ValueError): + local_finite_compactification_bound(1.,-.1,1.) + + def test_real_affine_minimal_quotient_and_exact_fraction_rank(self): + a=np.array([[1.,1.,0.],[0.,1.,0.],[0.,0.,1.]]) + c=np.array([[1.,0.,0.]]) + b=np.array([.1,.2,.3]) + quo=minimal_real_affine_quotient([a],c,[b]) + self.assertEqual(quo.dimension,2) + self.assertEqual(exact_affine_krylov_rank([[1,1,0],[0,1,0],[0,0,1]],[[1,0,0]]),2) + self.assertTrue(np.allclose(quo.encoder@a,quo.transitions[0]@quo.encoder)) + self.assertTrue(np.allclose(quo.readout@quo.encoder,c)) + for _ in range(10): + h=np.array([1.1,2.2,3.3]); z=quo.encoder@h + self.assertTrue(np.allclose(quo.encoder@(a@h+b),quo.transitions[0]@z+quo.input_offsets[0])) + break + # Coordinate 3 is invisible for all depths. + self.assertTrue(np.allclose(quo.encoder@np.array([1,2,3]),quo.encoder@np.array([1,2,9]))) + + def test_controlled_action_alphabet_can_force_full_dimension(self): + a=np.array([[1.,1,0],[0,1,0],[0,0,1]]) + perm=np.array([[1.,0,0],[0,0,1],[0,1,0]]) + c=np.array([[1.,0,0]]) + self.assertEqual(minimal_real_affine_quotient([a],c).dimension,2) + self.assertEqual(minimal_real_affine_quotient([a,perm],c).dimension,3) + + def test_observability_rank_grows_then_saturates_with_horizon(self): + a=np.array([[1.,1,0],[0,1,0],[0,0,.5]]) + c=np.array([[1.,0,0]]) + ranks=[np.linalg.matrix_rank(affine_observability_matrix(a,c,k)) for k in (1,2,3,4)] + self.assertEqual(ranks,[1,2,2,2]) + grams=[observability_gramian(a,c,k) for k in (1,2,3)] + for g,h in zip(grams,grams[1:]): + self.assertGreaterEqual(np.linalg.eigvalsh(h-g).min(),-1e-12) + + def test_nonnormal_transient_can_exceed_spectral_radius(self): + a=np.array([[.5,3.],[0,.5]]) + self.assertAlmostEqual(max(abs(np.linalg.eigvals(a))),.5) + self.assertGreater(np.linalg.norm(a,2),3.) + self.assertGreater(np.linalg.norm(a@np.array([0.,1.])),3.) + self.assertLess(np.linalg.norm(np.linalg.matrix_power(a,20)),.01) + + def test_separated_futures_need_precision_bits(self): + self.assertEqual(minimum_code_bits(2,1),(1,1)) + self.assertEqual(minimum_code_bits(9,1),(4,4)) + self.assertEqual(minimum_code_bits(9,2),(4,2)) + self.assertEqual(minimum_code_bits(1,8),(0,0)) + with self.assertRaises(ValueError): minimum_code_bits(0,1) + + def test_exact_fraction_rank_separates_rational_dependencies(self): + self.assertEqual(exact_rational_rank([[1,1,0],[2,2,0],[0,0,1]]),2) + self.assertEqual(exact_rational_rank([[1,1,0],[1,0,1],[0,1,1]]),3) + + def test_synthetic_receipt_keeps_scientific_scope_explicit(self): + r=synthetic_receipt() + self.assertEqual(r["full_real_affine_quotient_rank"],2) + self.assertEqual(r["integer_rational_krylov_rank"],2) + self.assertEqual(r["protected_task_rank"],1) + self.assertTrue(r["task_gradient_orthogonal_to_top_weight_output"]) + self.assertFalse(r["trained_BPD_evidence"]) + + +if __name__ == '__main__': + unittest.main() From 187ea7cc12da600abc1c9b11f99d2abdf71b58c5 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:32 +0800 Subject: [PATCH 06/10] test(CGC-01): independently recompute archived source-only theorem witness --- .../source_only_receipt_audit.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 research/causal_gauge_compactification/source_only_receipt_audit.py diff --git a/research/causal_gauge_compactification/source_only_receipt_audit.py b/research/causal_gauge_compactification/source_only_receipt_audit.py new file mode 100644 index 000000000..cd7a16d35 --- /dev/null +++ b/research/causal_gauge_compactification/source_only_receipt_audit.py @@ -0,0 +1,19 @@ +"""Validate the archived CGC-01 source-only witness against live finite matrices.""" +from __future__ import annotations +import json +from pathlib import Path +import unittest +from finite_audit import synthetic_receipt + + +def audit() -> dict[str, object]: + path=Path(__file__).with_name('SOURCE_ONLY_RECEIPT.json') + archived=json.loads(path.read_text(encoding='utf-8')) + observed=synthetic_receipt() + if observed != archived: + raise AssertionError(f'CGC-01 source-only receipt drift: {observed!r} != {archived!r}') + return archived + + +if __name__=='__main__': + print(json.dumps(audit(),indent=2,sort_keys=True)) From af0c44f18ed739ff45852f392d82618798788431 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:35 +0800 Subject: [PATCH 07/10] results(CGC-01): record exact synthetic quotient and causal spectrum receipt --- .../SOURCE_ONLY_RECEIPT.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 research/causal_gauge_compactification/SOURCE_ONLY_RECEIPT.json diff --git a/research/causal_gauge_compactification/SOURCE_ONLY_RECEIPT.json b/research/causal_gauge_compactification/SOURCE_ONLY_RECEIPT.json new file mode 100644 index 000000000..511cb6311 --- /dev/null +++ b/research/causal_gauge_compactification/SOURCE_ONLY_RECEIPT.json @@ -0,0 +1,15 @@ +{ + "full_real_affine_quotient_rank": 2, + "integer_rational_krylov_rank": 2, + "physical_weight_top_singular_output": [ + 10.0, + 0.0 + ], + "protected_kernel_dimension": 2, + "protected_task_one_rank_operator_tail": 0.0, + "protected_task_rank": 1, + "real_model_privacy_evidence": false, + "source_only": true, + "task_gradient_orthogonal_to_top_weight_output": true, + "trained_BPD_evidence": false +} From 4db94b73867c4a6d47288985e232f2caa8d54cb6 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:38 +0800 Subject: [PATCH 08/10] ci(CGC-01): source-only numerical/exact-rational theorem checks --- .github/workflows/cgc01-source-math.yml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/cgc01-source-math.yml diff --git a/.github/workflows/cgc01-source-math.yml b/.github/workflows/cgc01-source-math.yml new file mode 100644 index 000000000..4de05ab4d --- /dev/null +++ b/.github/workflows/cgc01-source-math.yml @@ -0,0 +1,37 @@ +name: CGC-01 protected causal compactification source mathematics + +on: + pull_request: + paths: + - "research/causal_gauge_compactification/**" + - ".github/workflows/cgc01-source-math.yml" + push: + branches: + - "research/cgc01-*" + paths: + - "research/causal_gauge_compactification/**" + - ".github/workflows/cgc01-source-math.yml" + workflow_dispatch: + +permissions: + contents: read + +jobs: + source-only-causal-compactification: + runs-on: ubuntu-latest + timeout-minutes: 6 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install source-only numerical dependency + run: python -m pip install "numpy>=1.26,<3" + - name: Eighteen independent analytic and exact-rational checks + run: python -m unittest discover -s research/causal_gauge_compactification -p 'test_*.py' -v + - name: Reproduce pinned toy quotient and protected causal spectrum + run: python research/causal_gauge_compactification/finite_audit.py + - name: Verify source-only receipt by recomputation + run: python research/causal_gauge_compactification/source_only_receipt_audit.py + - name: Check source syntax + run: python -m compileall -q research/causal_gauge_compactification From cf3d69f4852510b6e352e2b42173153c808e986e Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:17:40 +0800 Subject: [PATCH 09/10] chore(CGC-01): register mathematical reference package --- research/causal_gauge_compactification/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 research/causal_gauge_compactification/__init__.py diff --git a/research/causal_gauge_compactification/__init__.py b/research/causal_gauge_compactification/__init__.py new file mode 100644 index 000000000..2755433b3 --- /dev/null +++ b/research/causal_gauge_compactification/__init__.py @@ -0,0 +1 @@ +"""CGC-01: protected causal compactification, source-only reference.""" From e400ef3a06eb7ca34ba39b6ccf07e77a156fc7e5 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Wed, 18 Nov 2026 12:18:02 +0800 Subject: [PATCH 10/10] docs(CGC-01): surface BPD-to-compactification causal geometry framework on project homepage --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0277c513b..05f4ea02c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +**CGC-01 protected causal compactification (November 18, 2026):** [Task-conditioned safe causal dimension, finite-radius nonlinear bounds, exact recurrent quotient and precision-bit obstructions](research/causal_gauge_compactification/README.md). [Mathematical derivations](research/causal_gauge_compactification/THEORY.md) and 18 deterministic numerical/exact-rational tests connect BPD's source-binding controls with the NOR, LSV, SMC, SCM and recurrent-circuit compactification tracks. Source-only theory; no newly trained model result. + **NOR-12:** [Task-supervised basin-conditioned residual readout](research/nor12_task_readout/README.md) fits four 16×14 matched residual rankers over the frozen 1,000-parameter RRC-25 GRU using only exact degree-192 public demo verification labels. The first heldout run yielded 44/72 future-correct for the basin residual vs. 42/72 original, with both gains arising from a single aliased late-source feature tensor. Four independent seed-separated 72-case confirmations yielded 167/288 vs. 160/288, matched by the random-feature control, with unadjusted case-level paired p≈0.21. An ablation of the basin feature left the first split's 44/72 result unchanged. [NOR-12B hosted independent results](https://github.com/MoralityLabAI/Compactification-Theory/actions/runs/43709095616) passed, and [NOR-12C frozen receipt audit](https://github.com/MoralityLabAI/Compactification-Theory/actions/runs/43709504979) is green. The original GRU is unchanged, and basin-specific task gains remain unestablished. **NOR-10:** [Constructive one-bit terminal metric for two source-certified GRU attractors](research/nor01_numerical_orbit_sketch/NOR10.md) uses a single shared rational inter-center distance and one runtime basin-label bit to represent all late 24-step states of the signed and squared source streams. Exact integer-square-root quantization and source-locked nonlinear contraction yield an all-pair late-tail error <=1.096e-11 after 64 retained blocks, while a zero-bit shared code must incur >5.0209 cross-basin error. This one-dimensional terminal representation requires the two previously certified source labels and is separate from unseen-input basin classification and native task performance. [NOR-10 CI](https://github.com/MoralityLabAI/Compactification-Theory/actions/runs/43704307173) passed.