[{"file": "composed-theorems.lean", "src": "/-!\nPaperGraph PROOF stage \u2014 composed theorems for ASSUMPTION-TRANSFER AT-2 and\nAT-3.  Companion to data/discovery/PROOFS.md.\n\nStyle: core Lean 4 only, mathlib-free, axiomatized fragment \u2014 consistent with\ndata/lean/*.json.  Source claims from the corpus (each of which lives in\ndata/lean as a `theorem \u2026 := by sorry`) are recorded here as named axioms, as\nare the bridging assumptions argued on paper in PROOFS.md; the COMPOSED\nresults are then PROVED from those axioms, so the composition itself is\nmachine-checked.\n\n  AT-2 (verdict: proof-complete)\n    powerattention_needs_near_linear_layers, power_reach_vs_layers\n  AT-3 (verdict: proof-complete-modulo-bridges; bridges = named axioms below)\n    smyrf_not_universally_exact, smyrf_assumptions_fail_somewhere\n-/\n\n-- ===== Abstract reals (axiomatized fragment; no mathlib) =====\naxiom R : Type\naxiom R.add : R \u2192 R \u2192 R\naxiom R.sub : R \u2192 R \u2192 R\naxiom R.mul : R \u2192 R \u2192 R\naxiom R.lt : R \u2192 R \u2192 Prop\naxiom R.le : R \u2192 R \u2192 Prop\naxiom natCast : Nat \u2192 R\nnoncomputable instance : Add R := \u27e8R.add\u27e9\nnoncomputable instance : Sub R := \u27e8R.sub\u27e9\nnoncomputable instance : Mul R := \u27e8R.mul\u27e9\ninstance : LT R := \u27e8R.lt\u27e9\ninstance : LE R := \u27e8R.le\u27e9\nnoncomputable instance (n : Nat) : OfNat R n := \u27e8natCast n\u27e9\naxiom rpowR : R \u2192 R \u2192 R   -- real power x^y\n\n/- ====================================================================\n   AT-2: Under the Orthogonal Vectors Conjecture, PowerAttention's\n   power-of-2 pattern needs \u03a9\u0303(n^{1\u2212o(1)}) layers for BigBird's Task 1,\n   despite log-hop reachability.\n     L = 2007.14062#12 (proposition, 073_limit.tex:40) + #11 (conj:ovc)\n     P = 2503.03588#0  (theorem, 070appendix.tex:21)\n   ==================================================================== -/\n\n/-- Attention-graph families: one directed graph on [n] per sequence length n.\n`F n i j` means query position i attends to (evaluates an inner product with)\nkey position j \u2014 BigBird's out-neighbor convention (071_uapprox.tex:35-38). -/\ndef GraphFamily : Type := Nat \u2192 Nat \u2192 Nat \u2192 Prop\n\n/-- Edge count of the length-n member (opaque; meaningful for the concrete\nfamilies used here). -/\naxiom edgeCount : GraphFamily \u2192 Nat \u2192 Nat\n\n/-- \u00d5(n) edges: edgeCount \u2264 C \u00b7 n \u00b7 (log\u2082 n + 1)^k. -/\ndef PolylogLinearEdges (F : GraphFamily) : Prop :=\n  \u2203 C k : Nat, \u2200 n : Nat, edgeCount F n \u2264 C * n * (Nat.log2 n + 1) ^ k\n\n/-- BigBird's Task 1 (073_limit.tex:15): n unit vectors in R^d,\nd = \u0398(log\u00b2 n); output the furthest (= minimum-inner-product) vector for each\nposition.  Opaque, as in data/lean/2007.14062.json. -/\naxiom TaskOne : Type\naxiom task1 : TaskOne\naxiom solvableByOneFullAttnLayer : TaskOne \u2192 Prop   -- H=1, m=2d, q=0\n\n/-- `SparseSolves T F L`: some network in T_{F(n)}^{H=O(d),m=O(d),q=O(d)}\nwith L n layers at length n evaluates T.  Log-precision networks are a\nsubclass, so lower bounds transfer to them a fortiori (bridge B2.4).\nOpaque solvability semantics. -/\naxiom SparseSolves : TaskOne \u2192 GraphFamily \u2192 (Nat \u2192 Nat) \u2192 Prop\n\n/-- Orthogonal Vectors Conjecture (2007.14062 conj:ovc, 073_limit.tex:30). -/\naxiom OrthogonalVectorsConjecture : Prop\n\n/-- \u03a9\u0303(n^{1\u2212o(1)}) layers, schematically as in data/lean/2007.14062.json:\nfor every eps > 0, eventually L n \u2265 n^{1\u2212eps}. -/\ndef NearLinearLayers (L : Nat \u2192 Nat) : Prop :=\n  \u2200 eps : R, (0 : R) < eps \u2192 \u2203 N : Nat, \u2200 n : Nat, N \u2264 n \u2192\n    rpowR (natCast n) ((1 : R) - eps) \u2264 natCast (L n)\n\n/-- SOURCE CLAIM L, first half (2007.14062#12, Part 1): one full-attention\nlayer evaluates Task 1. -/\naxiom bigbird_task1_one_layer : solvableByOneFullAttnLayer task1\n\n/-- SOURCE CLAIM L, second half (2007.14062#12, Part 2), OVC-conditional,\nwith the paper's universal quantification over the sparse graph D made\nexplicit (\"for ANY sparse-attention network \u2026 with graph D having \u00d5(n)\nedges \u2026 would require \u03a9\u0303(n^{1\u2212o(1)}) layers\"). -/\naxiom bigbird_sparse_lower :\n    OrthogonalVectorsConjecture \u2192\n    \u2200 (F : GraphFamily) (L : Nat \u2192 Nat),\n      PolylogLinearEdges F \u2192 SparseSolves task1 F L \u2192 NearLinearLayers L\n\n/-- SOURCE SYSTEM P: the PowerAttention pattern (2503.03588,\n070appendix.tex:22-23): edges (i, j) iff i \u2212 j = 2^k, the same oblivious\ngraph at every layer. -/\ndef powerFamily : GraphFamily :=\n  fun _n i j => j < i \u2227 \u2203 k : Nat, i - j = 2 ^ k\n\n/-- 2503.03588#0 part 1 (out-degree < log n), summed over the n vertices:\nat most n\u00b7(log\u2082 n + 1) edges (bridge B2.1, PROOFS.md \u00a71.4; recorded as an\naxiom only because `edgeCount` is opaque). -/\naxiom power_edgeCount :\n    \u2200 n : Nat, edgeCount powerFamily n \u2264 n * (Nat.log2 n + 1)\n\n/-- s-step reachability in the length-n member of a graph family. -/\ndef reachIn (F : GraphFamily) (n : Nat) : Nat \u2192 Nat \u2192 Nat \u2192 Prop\n  | 0, i, j => i = j\n  | s+1, i, j => i = j \u2228 \u2203 m, F n i m \u2227 reachIn F n s m j\n\n/-- 2503.03588#0 part 2: log-hop reachability of the power-of-2 DAG. -/\naxiom power_log_reach :\n    \u2200 n i j : Nat, 1 \u2264 j \u2192 j < i \u2192 i \u2264 n \u2192\n      reachIn powerFamily n (Nat.log2 n + 1) i j\n\n/-- Composed lemma (bridge B2.1 discharged): the PowerAttention family\nsatisfies BigBird's \u00d5(n)-edge precondition. -/\ntheorem power_polylog_edges : PolylogLinearEdges powerFamily := by\n  refine \u27e81, 1, fun n => ?_\u27e9\n  have h := power_edgeCount n\n  rw [Nat.one_mul, Nat.pow_one]\n  exact h\n\n/-- COMPOSED THEOREM AT-2 (PROOFS.md \u00a71.2): under the OVC, any network using\nthe PowerAttention pattern (H, m, q = O(d)) that evaluates BigBird's Task 1\nneeds \u03a9\u0303(n^{1\u2212o(1)}) layers. -/\ntheorem powerattention_needs_near_linear_layers\n    (hOVC : OrthogonalVectorsConjecture)\n    (L : Nat \u2192 Nat) (hsolve : SparseSolves task1 powerFamily L) :\n    NearLinearLayers L :=\n  bigbird_sparse_lower hOVC powerFamily L power_polylog_edges hsolve\n\n/-- Contrast corollary: full log-hop reachability of the attention DAG\ncoexists with the near-linear layer lower bound \u2014 reachability of the\nreceptive field is not capability. -/\ntheorem power_reach_vs_layers\n    (hOVC : OrthogonalVectorsConjecture)\n    (L : Nat \u2192 Nat) (hsolve : SparseSolves task1 powerFamily L) :\n    (\u2200 n i j : Nat, 1 \u2264 j \u2192 j < i \u2192 i \u2264 n \u2192\n        reachIn powerFamily n (Nat.log2 n + 1) i j)\n      \u2227 NearLinearLayers L :=\n  \u27e8power_log_reach, powerattention_needs_near_linear_layers hOVC L hsolve\u27e9\n\n/- ====================================================================\n   AT-3: SMYRF's exactness assumption triple is not universally\n   satisfiable on the OV-embedded Task-1 family (conditional on OVC).\n     L1 = 2010.05315#5 (theorem exactness, SMYRF.tex:994), assumptions\n          #2-#4, in the abstract-weights reading (R1) of PROOFS.md \u00a72.2\n     L2 = 2007.14062#11 (conj:ovc) via the Part-2 reduction pattern\n     P  = SMYRF's complexity claim (SMYRF.tex:312): O(H\u00b7N\u00b7log N)\n   Verdict: proof-complete-modulo-bridges; the bridges are the named\n   axioms `exactness_yields_fast_ov` (B3.1+B3.2, proved on paper in\n   PROOFS.md \u00a72.4 Steps 0-2) and `no_soft_linear_ov` (B3.3: OVC in\n   randomized form, or deterministic OVC under the every-realization\n   reading).\n   ==================================================================== -/\n\n/-- The OV-embedded Task-1 input family (PROOFS.md \u00a72.4 Step 0): normalized\nnonzero Boolean vectors u_i in d = \u0398(log\u00b2 n) dimensions, queries \u2212\u03b2\u00b7u_i with\n\u03b2 = 4\u00b7d\u00b7ln n, keys = values = u_j.  Opaque. -/\naxiom OVInput : Type\n\n/-- A SMYRF configuration: a constant number of hashing rounds H and a\nbalanced clustering schedule with cluster size \u2264 polylog(N) \u2014 the paper's\nown operating regime (L = O(N), H = O(1), SMYRF.tex:312).  Opaque. -/\naxiom SMYRFConfig : Type\n\n/-- The realized assumption triple 2010.05315#2-#4 (sparsity of weights,\nLSH-fairness, LSH-effectiveness) on input x, for the clusterings SMYRF\nrealizes under configuration cfg \u2014 abstract-weights reading (R1), exactly as\nin data/lean/2010.05315.json (anchor SMYRF.tex:994). -/\naxiom AssumptionTriple : SMYRFConfig \u2192 OVInput \u2192 Prop\n\n/-- `SMYRFEqualsDense cfg x`: on input x, SMYRF's merged output equals the\ndense softmax attention output (for every hash realization; see B3.3). -/\naxiom SMYRFEqualsDense : SMYRFConfig \u2192 OVInput \u2192 Prop\n\n/-- SOURCE CLAIM L1 (2010.05315#5, Theorem exactness): the assumption triple\nimplies exactness. -/\naxiom smyrf_exact_of_triple :\n    \u2200 (cfg : SMYRFConfig) (x : OVInput),\n      AssumptionTriple cfg x \u2192 SMYRFEqualsDense cfg x\n\n/-- Opaque machine model, as in data/lean/2007.14062.json (conj:ovc). -/\naxiom Alg : Type\n/-- A decides OV on the embedded family (Boolean vectors, d \u2265 c\u00b7log n,\nzero-padded to d = \u0398(log\u00b2 n)). -/\naxiom decidesOVEmbedded : Alg \u2192 Prop\naxiom runTime : Alg \u2192 Nat \u2192 Nat\n\n/-- \u00d5(n) running time. -/\ndef SoftlyLinearTime (A : Alg) : Prop :=\n  \u2203 K k : Nat, \u2200 n : Nat, runTime A n \u2264 K * n * (Nat.log2 n + 1) ^ k\n\n/-- SOURCE CLAIM L2 in the form used by the reduction, plus BRIDGE B3.3:\nthe Orthogonal Vectors Conjecture (2007.14062 conj:ovc) rules out \u00d5(n)-time\ndeciders for the embedded family.  `OVCEmbedded` is conj:ovc strengthened to\nbounded-error randomized algorithms \u2014 or plain conj:ovc when universal\nexactness is read over every hash realization (then the algorithm is\nderandomized by fixing one seed); see PROOFS.md \u00a72.5 B3.3. -/\naxiom OVCEmbedded : Prop\naxiom no_soft_linear_ov :\n    OVCEmbedded \u2192 \u00ac \u2203 A : Alg, decidesOVEmbedded A \u2227 SoftlyLinearTime A\n\n/-- BRIDGES B3.1 + B3.2 (proved on paper, PROOFS.md \u00a72.4 Steps 0-2): if one\nSMYRF layer were exact on every input of the embedded family, the \u03b2-scaled\nsoftmax layer with the 1/(2d) threshold test would decide OV, and SMYRF's own\nO(H\u00b7N\u00b7log N) complexity claim makes the whole decider run in \u00d5(n) time. -/\naxiom exactness_yields_fast_ov :\n    \u2200 cfg : SMYRFConfig,\n      (\u2200 x : OVInput, SMYRFEqualsDense cfg x) \u2192\n      \u2203 A : Alg, decidesOVEmbedded A \u2227 SoftlyLinearTime A\n\n/-- COMPOSED THEOREM AT-3\u2032, deviation clause (PROOFS.md \u00a72.3): under OVC, no\nconstant-round polylog-cluster SMYRF configuration is exact on the whole\nOV-embedded Task-1 family. -/\ntheorem smyrf_not_universally_exact\n    (cfg : SMYRFConfig) (hOVC : OVCEmbedded) :\n    \u00ac \u2200 x : OVInput, SMYRFEqualsDense cfg x :=\n  fun hall => no_soft_linear_ov hOVC (exactness_yields_fast_ov cfg hall)\n\n/-- COMPOSED THEOREM AT-3\u2032, assumption-failure clause, via the contrapositive\nof the exactness theorem: some input of the family violates at least one of\nAssumptions 1-3 (for the realized clustering). -/\ntheorem smyrf_assumptions_fail_somewhere\n    (cfg : SMYRFConfig) (hOVC : OVCEmbedded) :\n    \u2203 x : OVInput, \u00ac AssumptionTriple cfg x :=\n  Classical.byContradiction fun hne =>\n    smyrf_not_universally_exact cfg hOVC fun x =>\n      smyrf_exact_of_triple cfg x\n        (Classical.byContradiction fun hx => hne \u27e8x, hx\u27e9)\n"}, {"file": "composed-theorems-r2-kv.lean", "src": "/-!\nPaperGraph PROOF stage, round 2 \u2014 composed theorems for the KV-cache /\nstreaming-attention cluster (`assumption-transfer-r2-kv.md`): AT2-KV-1,\nAT2-KV-4, AT2-KV-6.  Companion to data/discovery/PROOFS-r2.md; round-1\nsibling: composed-theorems.lean (AT-2, AT-3).\n\nStyle: core Lean 4 only, mathlib-free, axiomatized fragment \u2014 consistent with\ndata/lean/*.json and the round-1 file.  Source claims from the corpus are\nrecorded as named axioms with their anchors; bridging assumptions argued on\npaper in PROOFS-r2.md are further named axioms; the COMPOSED results are then\nPROVED from those axioms, so the composition layer itself is machine-checked\nand sorry-free.\n\n  AT2-KV-1 (verdict: proof-complete, with a precision correction \u2014 the\n            honest bound is \u03a9(min{\u03b5\u207b\u00b2, n}/(d\u00b7p)); see PROOFS-r2.md \u00a71)\n    eviction_budget_lower, eviction_budget_lower_retrieval,\n    eviction_budget_lower_div\n  AT2-KV-4 (verdict: proof-complete; window combinatorics proved outright)\n    window_mono, window_retains_matching, window_evicted_scores_low,\n    matching_window_sliding_lossless, matching_window_margin_recovers\n  AT2-KV-6 (verdict: proof-complete for the k > 3 clause; the 2 < k \u2264 3\n            o(n) clause is NOT formalized \u2014 documented gap, PROOFS-r2.md \u00a73)\n    powerlaw_vbudget_constant\n-/\n\n-- ===== Abstract reals (axiomatized fragment; no mathlib) =====\naxiom R : Type\naxiom R.add : R \u2192 R \u2192 R\naxiom R.sub : R \u2192 R \u2192 R\naxiom R.mul : R \u2192 R \u2192 R\naxiom R.lt : R \u2192 R \u2192 Prop\naxiom R.le : R \u2192 R \u2192 Prop\naxiom natCast : Nat \u2192 R\nnoncomputable instance : Add R := \u27e8R.add\u27e9\nnoncomputable instance : Sub R := \u27e8R.sub\u27e9\nnoncomputable instance : Mul R := \u27e8R.mul\u27e9\ninstance : LT R := \u27e8R.lt\u27e9\ninstance : LE R := \u27e8R.le\u27e9\nnoncomputable instance (n : Nat) : OfNat R n := \u27e8natCast n\u27e9\naxiom expR : R \u2192 R   -- e^x\naxiom logR : R \u2192 R   -- natural log\naxiom divR : R \u2192 R \u2192 R\n/- Standard order facts of \u211d, taken as axioms of the fragment (each is a\ntheorem of the real ordered field; nothing model-specific). -/\naxiom R.le_trans : \u2200 {a b c : R}, a \u2264 b \u2192 b \u2264 c \u2192 a \u2264 c\naxiom R.add_le_add_left : \u2200 {a b : R} (c : R), a \u2264 b \u2192 c + a \u2264 c + b\naxiom R.add_le_add_right : \u2200 {a b : R} (c : R), a \u2264 b \u2192 a + c \u2264 b + c\n\n/- ====================================================================\n   AT2-KV-1: Any prefix-decided KV eviction/merging policy is a one-pass\n   streaming algorithm, hence inherits BalanceKV's INDEX space lower\n   bound: token budget B = \u03a9(min{\u03b5\u207b\u00b2, n}/(d\u00b7p)).\n     L = 2502.07861 thm:lower_bound (arxiv_camera_ready.tex:233; INDEX\n         machinery at arxiv_camera_ready.tex:989\u20131080 \u2014 the claims file\n         flags the headline bound as untyped/skipped; statement recovered\n         from source in assumption-transfer-r2-kv.md)\n     P = structural bridge B1.1: a budget-B token-retaining policy IS a\n         streaming algorithm with state \u2264 B\u00b7d\u00b7p bits (PROOFS-r2.md \u00a71.4)\n   ==================================================================== -/\n\n/-- One-pass streaming algorithms for attention/KV-cache queries (opaque\nmachine model, as in the round-1 file's `Alg`). -/\naxiom StreamAlg : Type\n\n/-- Bits of inter-step state, worst case over the stream. -/\naxiom space : StreamAlg \u2192 Nat\n\n/-- The operating regime of the transplant (opaque predicate on (n, d)):\nkey-norm scale r\u00b2 = (\u221ad/2)\u00b7ln(n/d), which meets the source theorem's\nprecondition r\u00b2 \u2264 d iff n \u2264 d\u00b7e^{2\u221ad}, and at which the source bound's\nd\u00b7e^{2r\u00b2/\u221ad} term equals n (PROOFS-r2.md \u00a71.3, Step 2). -/\naxiom IndexRegime : Nat \u2192 Nat \u2192 Prop\n\n/-- `MeetsObjective A n d e`: algorithm A answers every query with\n\u2016q\u2016\u2082 \u2264 r from its state only, meeting BalanceKV's error objective\neq:objective (arxiv_camera_ready.tex:165):\n\u2016z \u2212 Attn(q,K,V)\u2016\u2082 \u2264 \u03b5\u00b7\u2016softmax(Kq/\u221ad)\u2016\u2082\u00b7\u2016V\u2016_F with probability \u2265 0.999,\nwhere e = \u230a\u03b5\u207b\u00b2\u230b is the accuracy budget.  Opaque. -/\naxiom MeetsObjective : StreamAlg \u2192 Nat \u2192 Nat \u2192 Nat \u2192 Prop\n\n/-- SOURCE CLAIM L (2502.07861 thm:lower_bound at the INDEX scale,\narxiv_camera_ready.tex:233): there is an absolute constant c \u2265 1 such that\nany streaming algorithm meeting eq:objective with probability 0.999 in the\nregime r\u00b2 = (\u221ad/2)\u00b7ln(n/d) \u2264 d uses space \u2265 min{\u03b5\u207b\u00b2, d\u00b7e^{2r\u00b2/\u221ad}}/c\n= min{e, n}/c bits.  (The paper states \u03a9(min{1/\u03b5\u00b2, d\u00b7e^{2r\u00b2/\u221ad}}); the\nregime arithmetic d\u00b7e^{2r\u00b2/\u221ad} = n is bridge-free, folded into\n`IndexRegime`.) -/\naxiom balancekv_space_lower :\n    \u2203 c : Nat, 0 < c \u2227 \u2200 (A : StreamAlg) (n d e : Nat),\n      IndexRegime n d \u2192 MeetsObjective A n d e \u2192 min e n \u2264 c * space A\n\n/-- A prefix-decided token-retaining cache policy: at each stream step it\nkeeps \u2264 B token-level records of d p-bit scalars each and answers queries\nfrom the retained state only.  Covers score-based eviction\n(Scissorhands/H2O, 2305.17118), merging (KeepKV, 2504.09936 \u2014 its O(B)\nelectoral-vote scalars are absorbed by d \u21a6 d+1), NOSA's eviction component\nk_e (2510.13602), and BalanceKV's own coresets. -/\nstructure EvictionPolicy where\n  B : Nat   -- token budget (retained records)\n  d : Nat   -- scalars per retained record (head dim; +1 for merging extras)\n  p : Nat   -- bits per stored scalar\n\n/-- BRIDGE B1.1 (structural; PROOFS-r2.md \u00a71.4): the policy, run as a\none-pass algorithm, IS a streaming algorithm \u2014 its entire inter-step state\nis the retained records. -/\naxiom asStream : EvictionPolicy \u2192 StreamAlg\n\n/-- BRIDGE B1.1, quantitative half: that state is \u2264 B\u00b7d\u00b7p bits (O(1)\nbookkeeping absorbed into the source constant c). -/\naxiom eviction_space :\n    \u2200 E : EvictionPolicy, space (asStream E) \u2264 E.B * E.d * E.p\n\n/-- COMPOSED THEOREM AT2-KV-1 (PROOFS-r2.md \u00a71.2): every prefix-decided\nbudget-B policy meeting BalanceKV's objective on the INDEX-scale regime has\nB\u00b7d\u00b7p = \u03a9(min{\u03b5\u207b\u00b2, n}) \u2014 the same c as in the source bound. -/\ntheorem eviction_budget_lower :\n    \u2203 c : Nat, 0 < c \u2227 \u2200 (E : EvictionPolicy) (n e : Nat),\n      IndexRegime n E.d \u2192 MeetsObjective (asStream E) n E.d e \u2192\n      min e n \u2264 c * (E.B * E.d * E.p) := by\n  obtain \u27e8c, hc, hL\u27e9 := balancekv_space_lower\n  refine \u27e8c, hc, fun E n e hreg hobj => ?_\u27e9\n  exact Nat.le_trans (hL (asStream E) n E.d e hreg hobj)\n    (Nat.mul_le_mul (Nat.le_refl c) (eviction_space E))\n\n/-- COMPOSED COROLLARY, retrieval regime: at accuracy \u03b5 \u2264 n^{-1/2}\n(i.e. n \u2264 e \u2014 the accuracy at which INDEX decoding is information-bearing),\nthe bound reads B\u00b7d\u00b7p = \u03a9(n). -/\ntheorem eviction_budget_lower_retrieval :\n    \u2203 c : Nat, 0 < c \u2227 \u2200 (E : EvictionPolicy) (n e : Nat),\n      IndexRegime n E.d \u2192 MeetsObjective (asStream E) n E.d e \u2192 n \u2264 e \u2192\n      n \u2264 c * (E.B * E.d * E.p) := by\n  obtain \u27e8c, hc, hcomp\u27e9 := eviction_budget_lower\n  refine \u27e8c, hc, fun E n e hreg hobj hne => ?_\u27e9\n  have hmin := hcomp E n e hreg hobj\n  rwa [Nat.min_eq_right hne] at hmin\n\n/-- COMPOSED COROLLARY in the headline \u03a9(n/(d\u00b7p)) form: in the retrieval\nregime the token budget itself satisfies B \u2265 n/(c\u00b7d\u00b7p) (Nat division). -/\ntheorem eviction_budget_lower_div :\n    \u2203 c : Nat, 0 < c \u2227 \u2200 (E : EvictionPolicy) (n e : Nat),\n      0 < E.d \u2192 0 < E.p \u2192\n      IndexRegime n E.d \u2192 MeetsObjective (asStream E) n E.d e \u2192 n \u2264 e \u2192\n      n / (c * E.d * E.p) \u2264 E.B := by\n  obtain \u27e8c, hc, hcomp\u27e9 := eviction_budget_lower_retrieval\n  refine \u27e8c, hc, fun E n e hd hp hreg hobj hne => ?_\u27e9\n  have h1 : n \u2264 c * (E.B * E.d * E.p) := hcomp E n e hreg hobj hne\n  have h2 : n \u2264 E.B * (c * E.d * E.p) := by\n    rwa [show c * (E.B * E.d * E.p) = E.B * (c * E.d * E.p) by\n      simp [Nat.mul_comm, Nat.mul_left_comm]] at h1\n  have hpos : 0 < c * E.d * E.p := Nat.mul_pos (Nat.mul_pos hc hd) hp\n  calc n / (c * E.d * E.p)\n      \u2264 E.B * (c * E.d * E.p) / (c * E.d * E.p) := Nat.div_le_div_right h2\n    _ = E.B := Nat.mul_div_cancel E.B hpos\n\n/- ====================================================================\n   AT2-KV-4: The (L, \u03b4)-matching-window assumption makes a content-\n   oblivious sliding-window cache of budget B \u2265 L deterministically\n   \u03b5\u2032-lossless for COPY.\n     L = 2410.03810 constant_copy_attention (acl_latex.tex:335), under\n         assum:attention-copy; contrast within the same paper:\n         constant_copy (acl_latex.tex:326) \u2014 the SSM analogue needs a\n         score threshold exponential in L, so no such budget-L statement\n         holds for recurrent-state compression.\n     P = S_i(L,\u03b4) \u2286 (i\u2212L, i] by definition; window-retention and\n         score-transfer are PROVED below; the two analytic steps\n         (softmax tail, renormalization shift) are bridges B4.2/B4.3.\n   ==================================================================== -/\n\n/-- Instances of the COPY task family (2410.03810 \u00a72; opaque). -/\naxiom Inst : Type\n\n/-- `matchSet x i j`: position j lies in the matching set S_i(L,\u03b4) at query\nposition i (opaque carrier; the (L,\u03b4) properties are the hypotheses of\n`MatchingWindow` below). -/\naxiom matchSet : Inst \u2192 Nat \u2192 Nat \u2192 Prop\n\n/-- Pre-softmax attention score q_i\u00b7k_j. -/\naxiom score : Inst \u2192 Nat \u2192 Nat \u2192 R\n\n/-- `posT x i`: the COPY target position pos(i) (2410.03810 notation). -/\naxiom posT : Inst \u2192 Nat \u2192 Nat\n\n/-- Value-norm bound V_max (= M\u00b7\u221ad in l2 for values in [\u2212M, M]^d). -/\naxiom Vmax : Inst \u2192 R\n\n/-- COPY error at position i of the constant-size attention module of\nconstant_copy_attention, with the FULL cache. -/\naxiom errFull : Inst \u2192 Nat \u2192 R\n\n/-- The same module with attention restricted to the retained position set\nC and renormalized over C. -/\naxiom errCache : (Nat \u2192 Prop) \u2192 Inst \u2192 Nat \u2192 R\n\n/-- Total softmax mass the full model places outside C at position i. -/\naxiom droppedMass : Inst \u2192 Nat \u2192 (Nat \u2192 Prop) \u2192 R\n\n/-- `Margin x i c`: the source theorem's score-margin hypothesis\nq_i\u00b7k_{pos(i)} \u2265 log(L\u0303) + c, with L\u0303 = max{L, i \u2212 |S_i|}\n(2410.03810 constant_copy_attention).  Opaque. -/\naxiom Margin : Inst \u2192 Nat \u2192 R \u2192 Prop\n\n/-- `epsCopy c`: the COPY error bound constant_copy_attention certifies at\nmargin constant c. -/\naxiom epsCopy : R \u2192 R\n\n/-- Window membership j \u2208 (i\u2212B, i], in truncated-subtraction-free form. -/\ndef inWindow (B i j : Nat) : Prop := i < j + B \u2227 j \u2264 i\n\n/-- assum:attention-copy at parameters (L, \u03b4) (2410.03810): the matching set\nlies in the last L positions, every score outside it is below \u03b4, and it\ncontains the COPY target.  (`containsTarget` is consumed inside the source\ntheorem, not by the composition steps below; recorded for faithfulness.) -/\nstructure MatchingWindow (L : Nat) (delta : R) (x : Inst) (i : Nat) : Prop where\n  window : \u2200 j, matchSet x i j \u2192 i < j + L \u2227 j \u2264 i\n  separated : \u2200 j, \u00ac matchSet x i j \u2192 score x i j < delta\n  containsTarget : matchSet x i (posT x i)\n\n/-- SOURCE CLAIM L (2410.03810 constant_copy_attention, acl_latex.tex:335):\nunder assum:attention-copy and the log(L\u0303)+c score margin, the constant-size\nattention module solves COPY with error \u2264 epsCopy c. -/\naxiom copy_err_full :\n    \u2200 (x : Inst) (i L : Nat) (delta c : R),\n      MatchingWindow L delta x i \u2192 Margin x i c \u2192 errFull x i \u2264 epsCopy c\n\n/-- BRIDGE B4.2 (softmax tail count, PROOFS-r2.md \u00a72.5): for a retained set\nC that contains the last L positions and only drops sub-\u03b4 scores, at most\ni\u2212L \u2264 L\u0303 positions are dropped, each with unnormalized weight < e^\u03b4, while\nthe margin alone pins the partition function \u2265 e^{log L\u0303 + c} = L\u0303\u00b7e^c;\nhence the dropped mass is \u2264 e^{\u03b4\u2212c}. -/\naxiom dropped_mass_le :\n    \u2200 (x : Inst) (i L : Nat) (delta c : R) (C : Nat \u2192 Prop),\n      (\u2200 j, (i < j + L \u2227 j \u2264 i) \u2192 C j) \u2192\n      (\u2200 j, \u00ac C j \u2192 score x i j < delta) \u2192\n      MatchingWindow L delta x i \u2192 Margin x i c \u2192\n      droppedMass x i C \u2264 expR (delta - c)\n\n/-- BRIDGE B4.3 (renormalization shift, PROOFS-r2.md \u00a72.5): dropping softmax\nmass \u2264 m and renormalizing moves the attention output by \u2264 2\u00b7m\u00b7V_max in l2\n(total-variation \u2264 m between the two weightings, values bounded by V_max),\nso the restricted module's COPY error exceeds the full module's by at most\nthat shift. -/\naxiom err_restrict :\n    \u2200 (x : Inst) (i : Nat) (C : Nat \u2192 Prop) (m : R),\n      droppedMass x i C \u2264 m \u2192\n      errCache C x i \u2264 errFull x i + (2 : R) * m * Vmax x\n\n/-- COMPOSED LEMMA (proved): window monotonicity \u2014 a budget-B window\ncontains the last-L window when B \u2265 L. -/\ntheorem window_mono (L B i : Nat) (hBL : L \u2264 B) :\n    \u2200 j, (i < j + L \u2227 j \u2264 i) \u2192 inWindow B i j := fun j h =>\n  \u27e8Nat.lt_of_lt_of_le h.1 (Nat.add_le_add_left hBL j), h.2\u27e9\n\n/-- COMPOSED LEMMA (proved): the combinatorial heart of AT2-KV-4 \u2014 with\nbudget B \u2265 L, the content-oblivious sliding window retains every position\nof the matching set. -/\ntheorem window_retains_matching (L B i : Nat) (hBL : L \u2264 B) (x : Inst)\n    (delta : R) (h : MatchingWindow L delta x i) :\n    \u2200 j, matchSet x i j \u2192 inWindow B i j := fun j hj =>\n  window_mono L B i hBL j (h.window j hj)\n\n/-- COMPOSED LEMMA (proved): with budget B \u2265 L, every evicted position\nscores below \u03b4 \u2014 the `separated` clause transfers from the matching set to\nthe window complement. -/\ntheorem window_evicted_scores_low (L B i : Nat) (hBL : L \u2264 B) (x : Inst)\n    (delta : R) (h : MatchingWindow L delta x i) :\n    \u2200 j, \u00ac inWindow B i j \u2192 score x i j < delta := fun j hj =>\n  h.separated j (fun hmem => hj (window_retains_matching L B i hBL x delta h j hmem))\n\n/-- COMPOSED THEOREM AT2-KV-4 (PROOFS-r2.md \u00a72.2): under\nassum:attention-copy at (L, \u03b4) and the source margin, the sliding-window\ncache of any budget B \u2265 L achieves COPY error \u2264 epsCopy c + 2\u00b7e^{\u03b4\u2212c}\u00b7V_max\n\u2014 deterministically, per instance (the worst-case counterpart of\nScissorhands' probabilistic theo:budgeted_cache, 2305.17118\nA05_Proofs.tex:308). -/\ntheorem matching_window_sliding_lossless\n    (L B i : Nat) (hBL : L \u2264 B) (x : Inst) (delta c : R)\n    (hMW : MatchingWindow L delta x i) (hM : Margin x i c) :\n    errCache (inWindow B i) x i\n      \u2264 epsCopy c + (2 : R) * expR (delta - c) * Vmax x :=\n  R.le_trans\n    (err_restrict x i (inWindow B i) (expR (delta - c))\n      (dropped_mass_le x i L delta c (inWindow B i)\n        (window_mono L B i hBL)\n        (window_evicted_scores_low L B i hBL x delta hMW)\n        hMW hM))\n    (R.add_le_add_right _ (copy_err_full x i L delta c hMW hM))\n\n/-- BRIDGE B4.4 (pure exp/log algebra, PROOFS-r2.md \u00a72.5): a margin\nconstant c \u2265 \u03b4 + log(2\u00b7V_max/\u03b5\u2032) makes the dropped-mass term \u2264 \u03b5\u2032. -/\naxiom margin_absorbs :\n    \u2200 (x : Inst) (delta c epsPrime : R),\n      delta + logR (divR ((2 : R) * Vmax x) epsPrime) \u2264 c \u2192\n      (2 : R) * expR (delta - c) * Vmax x \u2264 epsPrime\n\n/-- COMPOSED COROLLARY: raising the margin constant by log(2\u00b7V_max/\u03b5\u2032)\nrecovers windowed COPY error \u2264 epsCopy c + \u03b5\u2032 \u2014 the \u03b5\u2032-lossless form of the\nconjecture. -/\ntheorem matching_window_margin_recovers\n    (L B i : Nat) (hBL : L \u2264 B) (x : Inst) (delta c epsPrime : R)\n    (hMW : MatchingWindow L delta x i) (hM : Margin x i c)\n    (hc : delta + logR (divR ((2 : R) * Vmax x) epsPrime) \u2264 c) :\n    errCache (inWindow B i) x i \u2264 epsCopy c + epsPrime :=\n  R.le_trans\n    (matching_window_sliding_lossless L B i hBL x delta c hMW hM)\n    (R.add_le_add_left _ (margin_absorbs x delta c epsPrime hc))\n\n/- ====================================================================\n   AT2-KV-6: Scissorhands' power-law attention-weight model (exponent\n   k > 3) makes vAttention's verified sampling budget O(1) in the\n   context length n.\n     A = 2510.05688 vector-sum-estimation (text/method_1.tex:38),\n         corr:num (text/theory.tex:48), corr:den (text/theory.tex:55),\n         ratio-combination (text/method_1.tex:53) \u2014 the eq:theoretical\n         budget chain (text/method_1.tex:64)\n     B = 2305.17118 power-law weight model of theo:budgeted_cache\n         (A05_Proofs.tex:308): w_j iid, pdf \u221d (x + b)^{\u2212k}\n     Bridges: B6.1 (variance computation), B6.2 (monotonicity, class (a)),\n         B6.3 (LLN at k > 3).  The 2 < k \u2264 3 sublinear clause of the\n         dossier is NOT formalized \u2014 see PROOFS-r2.md \u00a73.6.\n   ==================================================================== -/\n\n/-- Attention-decode models: head dimension, value vectors with\n\u2016v_j\u2016 \u2264 v_max, and the weight-generating law; context length n varies\n(opaque). -/\naxiom Model : Type\n\n/-- Power-law exponent k of the model's iid unnormalized-weight law\n(2305.17118: pdf \u221d (x + b)^{\u2212k}). -/\naxiom exponent : Model \u2192 R\n\n/-- Structural hypothesis: \u2016v_j\u2016\u2082 \u2264 v_max for all values. -/\naxiom ValuesBounded : Model \u2192 Prop\n\n/-- Structural hypothesis (non-cancellation): \u2016\u03a3_j \u03b2_j v_j\u2016\u2082 \u2265 v_min > 0.\nGenuinely additional \u2014 cancellation can drive \u2016N\u2016 \u2192 0 at nonzero variance\n(dossier, derivation note (iii)). -/\naxiom NonCancellation : Model \u2192 Prop\n\n/-- `pivot M n`: the pivot quantity n\u00b7\u03a3_{j\u2264n} \u03b2_j\u00b2 = n\u00b7\u03a3w_j\u00b2/(\u03a3w_j)\u00b2 of the\nderivation, read as its (1\u2212\u03b4\u2032)-quantile envelope over the weight draw at\nlength n (the probabilistic qualifier is coarsened into this envelope;\nPROOFS-r2.md \u00a73.5, bridge B6.3). -/\naxiom pivot : Model \u2192 Nat \u2192 R\n\n/-- `vBudget M n eps delta`: the minimal per-step sampling budget b making\nvAttention an (\u03b5, \u03b4)-verified approximation of SDPA at context length n \u2014\n2510.05688 eq:theoretical (text/method_1.tex:64). -/\naxiom vBudget : Model \u2192 Nat \u2192 R \u2192 R \u2192 R\n\n/-- `budgetBound M eps delta x`: the closed form\n\u03a6\u207b\u00b9(1\u2212\u03b4/2)\u00b2\u00b7(v_max/v_min)\u00b2\u00b7x/\u03b5\u00b2 as a function of the pivot value x\n(opaque). -/\naxiom budgetBound : Model \u2192 R \u2192 R \u2192 R \u2192 R\n\n/-- SOURCE CLAIM A (2510.05688 eq:theoretical chain: vector-sum-estimation,\ncorr:num, corr:den, ratio-combination) + BRIDGE B6.1 (variance computation,\nPROOFS-r2.md \u00a73.4 Step 1: n_s\u00b2\u00b7Tr\u03a3 \u2264 n_s\u00b7\u03a3\u2016r_i\u2016\u00b2 \u2264 n_s\u00b7D\u00b2\u00b7v_max\u00b2\u00b7\u03a3\u03b2_i\u00b2 and\n\u2016N\u2016\u00b2 \u2265 D\u00b2\u00b7v_min\u00b2): under the value bounds, the verified budget is at most\nbudgetBound applied to the pivot. -/\naxiom vbudget_le_pivotBound :\n    \u2200 (M : Model) (n : Nat) (eps delta : R),\n      ValuesBounded M \u2192 NonCancellation M \u2192\n      vBudget M n eps delta \u2264 budgetBound M eps delta (pivot M n)\n\n/-- BRIDGE B6.2 (class (a): the coefficients \u03a6\u207b\u00b9(1\u2212\u03b4/2)\u00b2, (v_max/v_min)\u00b2,\n1/\u03b5\u00b2 are all nonnegative): budgetBound is monotone in the pivot. -/\naxiom budgetBound_mono :\n    \u2200 (M : Model) (eps delta : R) {x y : R},\n      x \u2264 y \u2192 budgetBound M eps delta x \u2264 budgetBound M eps delta y\n\n/-- SOURCE CLAIM B (2305.17118 power-law model, A05_Proofs.tex:308) +\nBRIDGE B6.3 (LLN, PROOFS-r2.md \u00a73.4 Step 3): for exponent k > 3 the law has\nE[w\u00b2] < \u221e, so n\u00b7\u03a3\u03b2_j\u00b2 \u2192 E[w\u00b2]/E[w]\u00b2 and the pivot envelope is eventually\nbounded by a constant K = K(M) independent of n. -/\naxiom powerlaw_pivot_bounded :\n    \u2200 (M : Model), (3 : R) < exponent M \u2192\n      \u2203 (K : R) (N0 : Nat), \u2200 n : Nat, N0 \u2264 n \u2192 pivot M n \u2264 K\n\n/-- COMPOSED THEOREM AT2-KV-6, k > 3 regime (PROOFS-r2.md \u00a73.2): under\nScissorhands' power law with exponent k > 3 plus the value-norm and\nnon-cancellation hypotheses, vAttention's verified budget is bounded by a\nconstant independent of the context length n \u2014 sampling-based KV compression\nprovably needs only O(1) token reads per decode step at fixed verified\naccuracy. -/\ntheorem powerlaw_vbudget_constant\n    (M : Model) (eps delta : R) (hk : (3 : R) < exponent M)\n    (hv : ValuesBounded M) (hnc : NonCancellation M) :\n    \u2203 (C : R) (N0 : Nat), \u2200 n : Nat, N0 \u2264 n \u2192 vBudget M n eps delta \u2264 C := by\n  obtain \u27e8K, N0, hK\u27e9 := powerlaw_pivot_bounded M hk\n  exact \u27e8budgetBound M eps delta K, N0, fun n hn =>\n    R.le_trans (vbudget_le_pivotBound M n eps delta hv hnc)\n      (budgetBound_mono M eps delta (hK n hn))\u27e9\n"}, {"file": "composed-theorems-r2-lg.lean", "src": "/-!\nPaperGraph PROOF stage, round 2 \u2014 length-generalization / expressivity\ncluster.\n\nComposed theorems for AT2-LG-3, AT2-LG-4, AT2-LG-6, AT2-LG-7 (conjectures in\ndata/discovery/assumption-transfer-r2-lg.md) and the F2 derived trade-off\n(data/discovery/contradictions-r2.md).  Companion prose with the full bridge\nclassification: data/discovery/PROOFS-r2.md.\n\nStyle: core Lean 4 only (no mathlib), one namespace per composed result,\nconsistent with round 1 (composed-theorems.lean).  Corpus source claims are\nrecorded as named axioms with anchors; bridging assumptions argued on paper\nin PROOFS-r2.md are named axioms flagged BRIDGE; every COMPOSED theorem is\nthen PROVED from those axioms \u2014 the file is sorry-free.\n\n  AT2-LG-3  proof-complete            ATLG3.diagreal_no_modcount\n                                      ATLG3.gd_capable_cannot_count_mod3\n                                      ATLG3.gd_statetracking_dissociation\n  AT2-LG-4  proof-complete            ATLG4.stu_in_TC0, ATLG4.stu_no_s5\n                                      ATLG4.stu_two_sided\n  AT2-LG-6  lower bound: proof-       ATLG6.copy_needs_many_passes\n            complete-modulo-bridges;  ATLG6.copy_iteration_tradeoff\n            optimality clause partial\n            (bridge K open)\n  AT2-LG-7  proof-complete            ATLG7.coverage_class_relative\n            (conditional TC\u2070 \u2260 NC\u00b9)   ATLG7.naive_transfer_false\n  F2        proof-complete            F2.no_free_lunch\n                                      F2.completeness_costs_parallelism\n                                      F2.structure_dichotomy\n-/\n\n/- ====================================================================\n   AT2-LG-3: The diagonal-real LRNN class that provably implements\n   in-context gradient descent cannot count mod 3 (at any depth) and,\n   single-layer, is inconsistent on subtraction.\n     P  = 2410.11687 prop-one-step-gd-multivariate (main_arxiv.tex:266),\n          prop-multi-step-gd (:676), prop-cross-entropy-gd (:364),\n          prop-nonlinear-gd (:719)\n     L1 = 2309.07412 prop:dlrnn (acl_latex.tex:182)\n     L2 = 2411.12537 thm:modcount (main.tex:374)\n   Verdict: proof-complete (mod-3 route; the composition inductions are\n   proved below, the linear-algebra inputs are textbook axioms).\n   ==================================================================== -/\nnamespace ATLG3\n\n/-- Real square matrices of the (fixed, arbitrary) state dimension; opaque. -/\naxiom Mat : Type\naxiom Mat.id : Mat\naxiom Mat.mul : Mat \u2192 Mat \u2192 Mat\n\n/-- `DiagReal A`: A is a diagonal matrix over \u211d. -/\naxiom DiagReal : Mat \u2192 Prop\n\n/-- `RealSpec A`: every eigenvalue of A (over \u2102) has zero imaginary part. -/\naxiom RealSpec : Mat \u2192 Prop\n\n/-- Textbook linear algebra (the only analytic inputs; class (a) in\nPROOFS-r2.md \u00a75.4): identity is diagonal-real; diagonal-real matrices are\nclosed under products; a diagonal real matrix's eigenvalues are its diagonal\nentries, hence real. -/\naxiom diagReal_id : DiagReal Mat.id\naxiom diagReal_mul :\n    \u2200 {A B : Mat}, DiagReal A \u2192 DiagReal B \u2192 DiagReal (Mat.mul A B)\naxiom diagReal_realSpec : \u2200 {A : Mat}, DiagReal A \u2192 RealSpec A\n\n/-- Tokens of the extended alphabet obtained by folding 2410.11687's size-3\nstride-2 sliding-window preprocessing into the token set (BRIDGE W,\nPROOFS-r2.md \u00a75.4: folding preserves diagonality; stride-2 downsampling maps\n(1^3)^* to counting windows mod 3 \u2014 or mod 6 with phase \u2014 still not a power\nof two). -/\naxiom Tok : Type\n\n/-- Finite-precision multi-layer linear RNN in 2411.12537's eq. (linrnn)\nform: per layer, an input-dependent transition matrix per token. -/\nstructure LRNN where\n  depth : Nat\n  trans : Nat \u2192 Tok \u2192 Mat\n  finitePrecision : Prop\n\n/-- The 2410.11687 architecture class: every transition matrix of every\nlayer is diagonal over \u211d. -/\ndef DiagRealLRNN (M : LRNN) : Prop := \u2200 l tok, DiagReal (M.trans l tok)\n\n/-- Transition-matrix product along an input word, at layer l. -/\nnoncomputable def wordProd (M : LRNN) (l : Nat) : List Tok \u2192 Mat\n  | [] => Mat.id\n  | t :: w => Mat.mul (M.trans l t) (wordProd M l w)\n\n/-- PROVED (composition step 1): a diagonal-real stack has diagonal-real\ntransition products at every layer, along every word.  No layer of the\nstack can ever manufacture a non-real eigenvalue. -/\ntheorem wordProd_diagReal (M : LRNN) (h : DiagRealLRNN M) (l : Nat) :\n    \u2200 w : List Tok, DiagReal (wordProd M l w) := by\n  intro w\n  induction w with\n  | nil => simp only [wordProd]; exact diagReal_id\n  | cons t w ih => simp only [wordProd]; exact diagReal_mul (h l t) ih\n\n/-- `RecognizesModM M m`: M recognizes (1^m)^* (over the folded alphabet) at\narbitrary lengths.  Opaque, as in the source claim. -/\naxiom RecognizesModM : LRNN \u2192 Nat \u2192 Prop\n\n/-- `ImplementsICGD M l`: M implements l steps of in-context gradient\ndescent (the 2410.11687 sense: one/multi-step, cross-entropy, nonlinear\nvariants).  Opaque. -/\naxiom ImplementsICGD : LRNN \u2192 Nat \u2192 Prop\n\ndef NotPow2 (m : Nat) : Prop := \u2200 k : Nat, m \u2260 2 ^ k\n\n/-- SOURCE CLAIM L2 (2411.12537 thm:modcount, main.tex:374): a\nfinite-precision L-layer LRNN recognizing (1^m)^*, m not a power of two,\nmust have some layer i and inputs x_1,\u2026,x_{2^{i-1}} whose transition product\nA(x_1)\u22efA(x_{2^{i-1}}) has an eigenvalue with nonzero imaginary part.\nSchematic rendering: existence of some layer and some word with a non-real\nproduct eigenvalue \u2014 existence is all the composition needs. -/\naxiom modcount_needs_nonreal :\n    \u2200 (M : LRNN) (m : Nat), M.finitePrecision \u2192 NotPow2 m \u2192\n      RecognizesModM M m \u2192\n      \u2203 (l : Nat) (w : List Tok), \u00ac RealSpec (wordProd M l w)\n\n/-- SOURCE CLAIM L1 (2309.07412 prop:dlrnn, acl_latex.tex:182): a diagonal\ninput-dependent (single-layer) LRNN is inconsistent in representing\nsubtraction.  \"Inconsistent\" is rendered opaquely \u2014 the claims file records\nit informally; the mod-3 route above is the load-bearing one. -/\naxiom InconsistentOnSubtraction : LRNN \u2192 Prop\naxiom dlrnn_subtraction :\n    \u2200 M : LRNN, DiagRealLRNN M \u2192 M.depth = 1 \u2192 InconsistentOnSubtraction M\n\n/-- SOURCE SYSTEM P (2410.11687 prop-one-step-gd-multivariate:266,\nprop-multi-step-gd:676, prop-cross-entropy-gd:364, prop-nonlinear-gd:719):\nGRIL \u2014 the stack of diagonal, real, input-dependent linear recurrent layers\nwith windowed token preprocessing \u2014 exists, is finite-precision, and\nimplements l steps of in-context GD using l of its layers.  `gril_diag`\ncarries BRIDGE W (window folding preserves diagonality). -/\naxiom gril : LRNN\naxiom gril_diag : DiagRealLRNN gril\naxiom gril_finprec : gril.finitePrecision\naxiom gril_gd : \u2200 l : Nat, l \u2264 gril.depth \u2192 ImplementsICGD gril l\n\n/-- PROVED helper: 1 \u2264 2^k. -/\ntheorem two_pow_pos : \u2200 k : Nat, 1 \u2264 2 ^ k\n  | 0 => Nat.le_refl 1\n  | k + 1 => by\n      have h := two_pow_pos k\n      rw [Nat.pow_succ]\n      omega\n\n/-- PROVED (composition step 2): 3 is not a power of two. -/\ntheorem three_notPow2 : NotPow2 3 := by\n  intro k h\n  match k, h with\n  | 0, h => exact absurd h (by decide)\n  | 1, h => exact absurd h (by decide)\n  | k + 2, h =>\n    have h1 : 1 \u2264 2 ^ k := two_pow_pos k\n    have h2 : 2 ^ (k + 2) = 2 ^ k * 4 := by\n      rw [Nat.pow_succ, Nat.pow_succ, Nat.mul_assoc]\n    omega\n\n/-- COMPOSED THEOREM AT2-LG-3 (general form): no diagonal-real\nfinite-precision LRNN \u2014 any depth, any width \u2014 recognizes (1^m)^* for m not\na power of two.  Proof: its transition products are diagonal-real\n(wordProd_diagReal), hence real-spectrum, contradicting thm:modcount's\nnecessary condition. -/\ntheorem diagreal_no_modcount (M : LRNN) (hdiag : DiagRealLRNN M)\n    (hfp : M.finitePrecision) {m : Nat} (hm : NotPow2 m) :\n    \u00ac RecognizesModM M m := fun hrec =>\n  match modcount_needs_nonreal M m hfp hm hrec with\n  | \u27e8l, w, hnr\u27e9 => hnr (diagReal_realSpec (wordProd_diagReal M hdiag l w))\n\n/-- COMPOSED THEOREM AT2-LG-3 (instantiated): the in-context-GD-capable\nclass cannot count mod 3. -/\ntheorem gd_capable_cannot_count_mod3 : \u00ac RecognizesModM gril 3 :=\n  diagreal_no_modcount gril gril_diag gril_finprec three_notPow2\n\n/-- The dissociation, packaged: one fixed model provably implements\nin-context GD at every available depth and provably cannot count mod 3 \u2014\nin-context-GD expressivity gives zero leverage against the eigenvalue\nobstruction. -/\ntheorem gd_statetracking_dissociation :\n    (\u2200 l : Nat, l \u2264 gril.depth \u2192 ImplementsICGD gril l) \u2227\n      \u00ac RecognizesModM gril 3 :=\n  \u27e8gril_gd, gd_capable_cannot_count_mod3\u27e9\n\n/-- Secondary clause via L1: every single-layer member of the class (e.g.\nthe one-step-GD construction of prop-one-step-gd-multivariate) is\nadditionally inconsistent on subtraction. -/\ntheorem gd_singlelayer_subtraction (M : LRNN) (hdiag : DiagRealLRNN M)\n    (h1 : M.depth = 1) : InconsistentOnSubtraction M :=\n  dlrnn_subtraction M hdiag h1\n\n/- Boundary remark (deliberately no theorem): parity is NOT blocked \u2014\n2411.12537 thm:parity (main.tex:366) needs only an eigenvalue outside\n[0,\u221e), which diagonal real entries at \u22121 provide.  The separation task is\nmod 3, not parity; the composite is consistent with diagonal LRNNs solving\nparity. -/\n\nend ATLG3\n\n/- ====================================================================\n   AT2-LG-4: Spectral-filtering (STU) networks are input-independent-\n   transition systems, hence in L-uniform TC\u2070; conditional on TC\u2070 \u2260 NC\u00b9\n   they solve no NC\u00b9-hard state-tracking task (S5) \u2014 while carrying the\n   corpus's strongest length-generalization guarantee.\n     L = 2404.08819 thm:non-gated (SSM-NoStateTracking.tex:470),\n         lem:general (:452), cor:exp-log-softplus (appendix.tex:350),\n         corollary at :575\n     P = 2411.01035 thm:lengthgeneralization (provable_length_gen.tex:35),\n         two-autoregressive variant (:78), tensorized (tensors.tex:24)\n   Verdict: proof-complete (stage decomposition proved by induction; the\n   Hankel-filter constants are on the same fixed-constant footing as\n   thm:non-gated's own A, B, C matrices \u2014 bridge (a), PROOFS-r2.md \u00a76.4).\n   ==================================================================== -/\nnamespace ATLG4\n\n/-- Families of sequence functions (one function per input length); opaque. -/\naxiom Fam : Type\n\n/-- Computable by an L-uniform TC\u2070 circuit family (2404.08819's notion,\nlog precision, constant depth, poly size). -/\naxiom InTC0 : Fam \u2192 Prop\n\n/-- Identity family and (constant-depth) composition of families. -/\naxiom idFam : Fam\naxiom comp : Fam \u2192 Fam \u2192 Fam\n\n/-- The STU stage types (2411.01035): `filterConv` \u2014 convolution with the\nfixed Hankel-eigenvector filter bank \u03c6_i and learned linear mixing M_i;\n`autoreg` \u2014 the fixed order-2 autoregression y_t = a\u2081y_{t\u22121} + a\u2082y_{t\u22122};\n`mlp` \u2014 position-wise MLP nonlinearity between layers. -/\ninductive Stage where\n  | filterConv\n  | autoreg\n  | mlp\n\n/-- The sequence-function family a single stage computes; opaque. -/\naxiom stageFam : Stage \u2192 Fam\n\n/-- An STU network is a finite (constant-depth) stack of stages. -/\ndef STUNet := List Stage\n\nnoncomputable def eval : STUNet \u2192 Fam\n  | [] => idFam\n  | s :: net => comp (stageFam s) (eval net)\n\n/-- SOURCE CLAIM L, per stage.\n`filterConv_tc0`: the filter convolution is a fixed linear map \u2014 iterated\naddition of products with input-independent constants \u2014 TC\u2070 by 2404.08819\nlem:general (SSM-NoStateTracking.tex:452); the Hankel filters are fixed\nconstants exactly as thm:non-gated's fixed A, B, C matrices (bridge (a)).\n`autoreg_tc0`: unrolling the order-2 autoregression is powering of the\nfixed 2\u00d72 companion matrix \u2014 the C\u00b7A\u1d57\u00b7B computation thm:non-gated\n(SSM-NoStateTracking.tex:470) handles.\n`mlp_tc0`: position-wise MLPs are TC\u2070 by cor:exp-log-softplus\n(appendix.tex:350). -/\naxiom filterConv_tc0 : InTC0 (stageFam Stage.filterConv)\naxiom autoreg_tc0 : InTC0 (stageFam Stage.autoreg)\naxiom mlp_tc0 : InTC0 (stageFam Stage.mlp)\n\n/-- TC\u2070 contains the identity and is closed under composing constantly many\nstages (standard; used by 2404.08819 itself for its multi-layer statement). -/\naxiom id_tc0 : InTC0 idFam\naxiom tc0_comp : \u2200 {f g : Fam}, InTC0 f \u2192 InTC0 g \u2192 InTC0 (comp f g)\n\n/-- PROVED: every stage is TC\u2070. -/\ntheorem stage_tc0 : \u2200 s : Stage, InTC0 (stageFam s)\n  | Stage.filterConv => filterConv_tc0\n  | Stage.autoreg => autoreg_tc0\n  | Stage.mlp => mlp_tc0\n\n/-- COMPOSED THEOREM AT2-LG-4, part (ii): every STU network is in\nL-uniform TC\u2070 \u2014 proved by induction on the stack. -/\ntheorem stu_in_TC0 (net : STUNet) : InTC0 (eval net) := by\n  induction net with\n  | nil => simp only [eval]; exact id_tc0\n  | cons s rest ih => simp only [eval]; exact tc0_comp (stage_tc0 s) ih\n\naxiom Problem : Type\n/-- The S5 word problem (NC\u00b9-complete state tracking). -/\naxiom s5 : Problem\naxiom NC1hard : Problem \u2192 Prop\n/-- Barrington's theorem, as invoked by 2404.08819\n(SSM-NoStateTracking.tex:575). -/\naxiom s5_nc1_hard : NC1hard s5\naxiom Solves : Fam \u2192 Problem \u2192 Prop\naxiom TC0_eq_NC1 : Prop\n\n/-- SOURCE CLAIM (the corollary shape at SSM-NoStateTracking.tex:575): a\nTC\u2070 family solving an NC\u00b9-hard problem collapses NC\u00b9 to TC\u2070. -/\naxiom tc0_solves_collapse :\n    \u2200 (f : Fam) (P : Problem), InTC0 f \u2192 Solves f P \u2192 NC1hard P \u2192 TC0_eq_NC1\n\n/-- COMPOSED: conditional impossibility \u2014 unless TC\u2070 = NC\u00b9, no STU network\nof any constant depth solves the S5 word problem. -/\ntheorem stu_no_s5 (net : STUNet) (h : \u00ac TC0_eq_NC1) :\n    \u00ac Solves (eval net) s5 := fun hs =>\n  h (tc0_solves_collapse (eval net) s5 (stu_in_TC0 net) hs s5_nc1_hard)\n\n/-- The paper's own two-autoregressive architecture as a concrete stack:\nfilter bank, then order-2 autoregression, then MLP readout. -/\ndef stuAR2 : STUNet := [Stage.mlp, Stage.autoreg, Stage.filterConv]\n\n/-- `LengthGenLDS f`: f carries 2411.01035's length-generalization\nguarantee \u2014 \u221aT unfair regret against full-context comparators from context\nT^q on marginally-stable LDS with spec(A) in the paper's [0,1] bands. -/\naxiom LengthGenLDS : Fam \u2192 Prop\n\n/-- SOURCE SYSTEM P (2411.01035 thm:lengthgeneralization,\nprovable_length_gen.tex:35, two-autoregressive variant :78): the STU\npredictor length-generalizes on its admissible LDS class. -/\naxiom stu_length_gen : LengthGenLDS (eval stuAR2)\n\n/-- COMPOSED THEOREM AT2-LG-4 (two-sided characterization): the same\narchitecture family carries the strongest provable length-generalization\nguarantee in the corpus AND a conditional ceiling strictly below\nfinite-group state tracking.  Stated in no corpus paper. -/\ntheorem stu_two_sided (h : \u00ac TC0_eq_NC1) :\n    LengthGenLDS (eval stuAR2) \u2227 \u2200 net : STUNet, \u00ac Solves (eval net) s5 :=\n  \u27e8stu_length_gen, fun net => stu_no_s5 net h\u27e9\n\nend ATLG4\n\n/- ====================================================================\n   AT2-LG-6: Looped Periodic+Local transformers need\n   T(n) \u2265 n / (2\u00b7C\u00b7(\u230alog\u2082 n\u230b + 1)) iterations for n-token copy;\n   n-RASP-L's T(n) = n is optimal up to the log factor.\n     L1 = 2410.02140 thm:comm-comp-limit-transformer\n          (main_arxiv_noComments.tex:904), symmetrized (BRIDGE M)\n     L2 = 2402.01032 lem:fixed_state (icml2024/appendix_proof.tex:294) +\n          cor:lower_bound (icml2024/theoretical_motivation.tex:135)\n     S  = 2409.15647 prop-copy (iclr2025_conference.tex:241)\n   Verdict: lower bound proof-complete-modulo-bridges (M, P argued in\n   PROOFS-r2.md \u00a77.4); optimality clause PARTIAL \u2014 bridge K (compilation of\n   the n-RASP-L program into the Periodic+Local class) remains open.\n   ==================================================================== -/\nnamespace ATLG6\n\n/-- A looped transformer whose per-pass computation is a Periodic+Local\nLimitTransformer and which feeds back a bounded-alphabet token sequence\nbetween passes (the n-RASP-L discipline \u2014 no covert wide channel). -/\nstructure LoopedPL where\n  passes : Nat\n  perPassPL : Prop\n  boundedFeedback : Prop\n\n/-- `SolvesCopy M n`: M copies arbitrary n-token strings (the x\u2081\u2026x_n \u25b7 #^n'\nformat of 2409.15647), exactly, at its pass budget. -/\naxiom SolvesCopy : LoopedPL \u2192 Nat \u2192 Prop\n\n/-- Bits exchanged across the fixed balanced input cut (source half with\nAlice, emission half with Bob) during pass t at input length n, in the\ntwo-party simulation of the looped model.  Opaque cost functional. -/\naxiom passComm : LoopedPL \u2192 Nat \u2192 Nat \u2192 Nat\n\n/-- The communication constant of 2410.02140's theorem (absorbing the\nfactor 2 for the symmetrized, both-directions version \u2014 BRIDGE M). -/\naxiom Cconst : Nat\naxiom Cconst_pos : 1 \u2264 Cconst\n\n/-- SOURCE CLAIM L1 (2410.02140 thm:comm-comp-limit-transformer,\nmain_arxiv_noComments.tex:904), SYMMETRIZED (BRIDGE M, PROOFS-r2.md \u00a77.4):\none pass of a Periodic+Local LimitTransformer advances both halves of the\ncomputation with at most C\u00b7(\u230alog\u2082 n\u230b + 1) bits exchanged in total (C\nabsorbs the two directions).  Bounded feedback keeps the per-pass inputs in\na bounded alphabet, so the bound applies at every pass (BRIDGE P). -/\naxiom pass_comm_bound :\n    \u2200 (M : LoopedPL) (n t : Nat), M.perPassPL \u2192 M.boundedFeedback \u2192\n      passComm M n t \u2264 Cconst * (Nat.log2 n + 1)\n\n/-- Total communication over the first T passes. -/\nnoncomputable def totalComm (M : LoopedPL) (n : Nat) : Nat \u2192 Nat\n  | 0 => 0\n  | t + 1 => totalComm M n t + passComm M n t\n\n/-- PROVED (composition step 1, the pass-summation induction):\ntotalComm \u2264 T \u00b7 C \u00b7 (\u230alog\u2082 n\u230b + 1). -/\ntheorem totalComm_le (M : LoopedPL) (n : Nat)\n    (h1 : M.perPassPL) (h2 : M.boundedFeedback) :\n    \u2200 T : Nat, totalComm M n T \u2264 T * (Cconst * (Nat.log2 n + 1)) := by\n  intro T\n  induction T with\n  | zero => simp only [totalComm]; exact Nat.zero_le _\n  | succ t ih =>\n    have hp := pass_comm_bound M n t h1 h2\n    simp only [totalComm]\n    rw [Nat.succ_mul]\n    omega\n\n/-- SOURCE CLAIM L2 (2402.01032 lem:fixed_state + cor:lower_bound) plus\nBRIDGE P (protocol extraction, PROOFS-r2.md \u00a77.4): an exact copier moves\nthe source half across the cut; below (n/2)\u00b7log\u2082 D \u2212 O(1) bits the copy\nerror exceeds 1/2, so a solver's total communication carries at least\nn/2 bits (alphabet size D \u2265 2, schematically without the \u2212O(1)). -/\naxiom copy_info_lower :\n    \u2200 (M : LoopedPL) (n : Nat), M.perPassPL \u2192 M.boundedFeedback \u2192\n      SolvesCopy M n \u2192 n / 2 \u2264 totalComm M n M.passes\n\n/-- PROVED arithmetic bridge: from n/2 \u2264 T\u00b7B (B \u2265 1) conclude\nn/(2\u00b7B) \u2264 T. -/\ntheorem div_bound {n T B : Nat} (hB : 1 \u2264 B) (h : n / 2 \u2264 T * B) :\n    n / (2 * B) \u2264 T := by\n  have hn : n \u2264 2 * (T * B) + 1 := by omega\n  have hpos : 0 < 2 * B := by omega\n  have hlt : n < (T + 1) * (2 * B) := by\n    have hexp : (T + 1) * (2 * B) = 2 * (T * B) + 2 * B := by\n      rw [Nat.succ_mul, Nat.mul_left_comm]\n    omega\n  exact Nat.le_of_lt_succ ((Nat.div_lt_iff_lt_mul hpos).mpr hlt)\n\n/-- PROVED (composition step 2): the accounting \u2014 the information the copy\ntask moves across the cut is bounded by the summed per-pass communication. -/\ntheorem copy_comm_accounting (M : LoopedPL) (n : Nat)\n    (h1 : M.perPassPL) (h2 : M.boundedFeedback) (hs : SolvesCopy M n) :\n    n / 2 \u2264 M.passes * (Cconst * (Nat.log2 n + 1)) :=\n  Nat.le_trans (copy_info_lower M n h1 h2 hs) (totalComm_le M n h1 h2 M.passes)\n\n/-- COMPOSED THEOREM AT2-LG-6 (lower bound): any looped Periodic+Local\ntransformer solving n-token copy needs\nT(n) \u2265 n / (2\u00b7C\u00b7(\u230alog\u2082 n\u230b + 1)) = \u03a9(n / log n) passes. -/\ntheorem copy_needs_many_passes (M : LoopedPL) (n : Nat)\n    (h1 : M.perPassPL) (h2 : M.boundedFeedback) (hs : SolvesCopy M n) :\n    n / (2 * (Cconst * (Nat.log2 n + 1))) \u2264 M.passes := by\n  have hL : 1 \u2264 Nat.log2 n + 1 := by omega\n  have hB : 1 \u2264 Cconst * (Nat.log2 n + 1) := by\n    calc 1 = 1 * 1 := rfl\n      _ \u2264 Cconst * (Nat.log2 n + 1) := Nat.mul_le_mul Cconst_pos hL\n  exact div_bound hB (copy_comm_accounting M n h1 h2 hs)\n\n/-- SOURCE SYSTEM S (2409.15647 prop-copy, iclr2025_conference.tex:241)\nwith BRIDGE K \u2014 the OPEN compilation step (n-RASP-L's copy program lands in\nthe Periodic+Local per-pass class; PROOFS-r2.md \u00a77.4 documents this as the\none genuinely unresolved bridge): a looped PL solver with T(n) = n passes\nexists. -/\naxiom copy_upper :\n    \u2200 n : Nat, \u2203 M : LoopedPL,\n      M.perPassPL \u2227 M.boundedFeedback \u2227 M.passes = n \u2227 SolvesCopy M n\n\n/-- COMPOSED tradeoff (upper clause conditional on BRIDGE K): the two\ncorpus papers pin down the two ends of one curve \u2014 T(n)\u00b7log n = \u03a9(n) for\nevery solver, and T(n) = n is achieved. -/\ntheorem copy_iteration_tradeoff (n : Nat) :\n    (\u2200 M : LoopedPL, M.perPassPL \u2192 M.boundedFeedback \u2192 SolvesCopy M n \u2192\n        n / (2 * (Cconst * (Nat.log2 n + 1))) \u2264 M.passes)\n      \u2227 \u2203 M : LoopedPL,\n          M.perPassPL \u2227 M.boundedFeedback \u2227 M.passes = n \u2227 SolvesCopy M n :=\n  \u27e8fun M h1 h2 hs => copy_needs_many_passes M n h1 h2 hs, copy_upper n\u27e9\n\nend ATLG6\n\n/- ====================================================================\n   AT2-LG-7: Full-coverage length generalization (2404.00560) is\n   class-relative on the S5 word problem: realizable by GH-product LRNNs,\n   conditionally unrealizable by diagonal/gated SSM learners.\n     L1 = 2404.00560 thm:recursive_markov_dp_solved (IAES2024.tex:347),\n          scan-learner quantification made explicit (BRIDGE S, a definition)\n     L2 = 2411.12537 thm:groups (main.tex:522); 2502.10297 th:groups\n     L3 = 2404.08819 thm:diagonal (SSM-NoStateTracking.tex:496),\n          thm:non-gated (:470), corollary (:575)\n   Verdict: proof-complete, conditional on TC\u2070 \u2260 NC\u00b9.\n   ==================================================================== -/\nnamespace ATLG7\n\n/-- Finite-domain Markov Dynamic Processes (2404.00560's setting). -/\naxiom MDP : Type\n\n/-- The S5 word problem as an MDP: Y = S5 (|Y| = 120), X a generator set,\nrunning group element as state. -/\naxiom s5 : MDP\n\n/-- `FullCoverage M`: the training data attains D = bold-X \u2014 every\ntransition pair appears (2404.00560's possibility-branch hypothesis). -/\naxiom FullCoverage : MDP \u2192 Prop\n\n/-- Combinatorial instance fact (class (a), PROOFS-r2.md \u00a78.4): all\n600 = 120\u00b75 transition pairs of the S5 word problem are exhibited by a\nfinite dataset of length-2 sequences, so full coverage is achievable and we\nwork under it. -/\naxiom s5_full_coverage : FullCoverage s5\n\naxiom NC1hardMDP : MDP \u2192 Prop\n/-- Barrington's theorem, as invoked by 2404.08819. -/\naxiom s5_nc1 : NC1hardMDP s5\naxiom TC0_eq_NC1 : Prop\n\n/-- A learner class, described by the two properties the composition\nconsumes: whether it contains an exact implementation of a given MDP's\ntransition automaton selectable from full-coverage data, and whether all\nits member function families are L-uniform TC\u2070. -/\nstructure LearnerClass where\n  realizesTransition : MDP \u2192 Prop\n  inTC0 : Prop\n\n/-- `LengthGen C M`: some member of C computes M's sequence map \u03c4_f exactly\nat every length (the property of thm:recursive_markov_dp_solved). -/\naxiom LengthGen : LearnerClass \u2192 MDP \u2192 Prop\n\n/-- SOURCE CLAIM L1 (2404.00560 thm:recursive_markov_dp_solved,\nIAES2024.tex:347) with the implicit scan-learner quantification made\nexplicit (BRIDGE S \u2014 a definition, not a lemma; PROOFS-r2.md \u00a78.4): under\nfull coverage, a class realizing the transition automaton\nlength-generalizes, since recursive application of the realized f\u0302 = f is\nexact at every length. -/\naxiom coverage_realize_lg :\n    \u2200 (C : LearnerClass) (M : MDP),\n      FullCoverage M \u2192 C.realizesTransition M \u2192 LengthGen C M\n\n/-- SOURCE CLAIM L3 (2404.08819 corollary, SSM-NoStateTracking.tex:575):\na TC\u2070 learner class length-generalizing on an NC\u00b9-hard MDP would place an\nNC\u00b9-hard family in TC\u2070. -/\naxiom tc0_lg_collapse :\n    \u2200 (C : LearnerClass) (M : MDP),\n      C.inTC0 \u2192 NC1hardMDP M \u2192 LengthGen C M \u2192 TC0_eq_NC1\n\n/-- The two concrete classes. -/\naxiom ghLRNN : LearnerClass\naxiom mambaClass : LearnerClass\n\n/-- SOURCE CLAIM L2 (2411.12537 thm:groups, main.tex:522; DeltaProduct\nconfigurations per 2502.10297 th:groups): a one-layer finite-precision LRNN\nwith generalized-Householder-product transitions implements any group\nautomaton exactly \u2014 S5 qualifies; the transition table full coverage\nsupplies is exactly the data the construction consumes. -/\naxiom gh_realizes_s5 : ghLRNN.realizesTransition s5\n\n/-- SOURCE CLAIM L3 (2404.08819 thm:diagonal :496 / thm:non-gated :470):\ndiagonal/gated linear SSM classes (Mamba/GLA/RetNet-style) are in\nL-uniform TC\u2070. -/\naxiom mamba_tc0 : mambaClass.inTC0\n\n/-- COMPOSED THEOREM AT2-LG-7: from the same full-coverage data, the\nGH-product class length-generalizes on S5 and the diagonal/gated SSM class\ndoes not (unless TC\u2070 = NC\u00b9).  Coverage is determinant only relative to a\nclass expressive enough for the transition monoid. -/\ntheorem coverage_class_relative (h : \u00ac TC0_eq_NC1) :\n    LengthGen ghLRNN s5 \u2227 \u00ac LengthGen mambaClass s5 :=\n  \u27e8coverage_realize_lg ghLRNN s5 s5_full_coverage gh_realizes_s5,\n   fun hlg => h (tc0_lg_collapse mambaClass s5 mamba_tc0 s5_nc1 hlg)\u27e9\n\n/-- Corollary: the naive transfer \"full transition coverage + enough\ntraining \u21d2 length generalization for any sequence model\" is FALSE as a\ncomposition of corpus theorems (conditional on TC\u2070 \u2260 NC\u00b9). -/\ntheorem naive_transfer_false (h : \u00ac TC0_eq_NC1) :\n    \u00ac \u2200 (C : LearnerClass) (M : MDP), FullCoverage M \u2192 LengthGen C M :=\n  fun hall => (coverage_class_relative h).2 (hall mambaClass s5 s5_full_coverage)\n\nend ATLG7\n\n/- ====================================================================\n   F2 (contradictions-r2.md): the transition-matrix-structure discriminator\n   is a genuine trade-off \u2014 regular-language completeness necessarily costs\n   TC\u2070 parallelizability.\n     Completeness side: 2411.12537 thm:regular (main.tex:539);\n                        2502.10297 th:regular (neurips_2024.tex:342)\n     Parallelism side:  2404.08819 thm:diagonal (:496) + corollary (:575)\n     Unconditional route: 2411.12537 thm:parity (main.tex:366)\n   Verdict: proof-complete.\n   ==================================================================== -/\nnamespace F2\n\naxiom Lang : Type\naxiom Regular : Lang \u2192 Prop\naxiom NC1hard : Lang \u2192 Prop\n\n/-- The S5 word-problem language. -/\naxiom s5Lang : Lang\n/-- A finite (group) automaton recognizes it: regular. -/\naxiom s5_regular : Regular s5Lang\n/-- Barrington: NC\u00b9-hard. -/\naxiom s5_nc1 : NC1hard s5Lang\n\n/-- PARITY. -/\naxiom parityLang : Lang\naxiom parity_regular : Regular parityLang\n\n/-- LRNN/SSM architecture classes; opaque. -/\naxiom Cls : Type\naxiom Recognizes : Cls \u2192 Lang \u2192 Prop\n/-- Every member function family is L-uniform TC\u2070 (equivalently: the class\nkeeps O(log)-depth parallel-scan computability). -/\naxiom InTC0 : Cls \u2192 Prop\n/-- Transitions restricted to nonnegative real spectra (the S4/S6/Mamba\nexp(\u2212softplus\u00b7\u0394) parameterization). -/\naxiom NonnegSpec : Cls \u2192 Prop\n\ndef RegularComplete (C : Cls) : Prop := \u2200 L : Lang, Regular L \u2192 Recognizes C L\n\naxiom TC0_eq_NC1 : Prop\n\n/-- SOURCE CLAIM (2404.08819 corollary shape, SSM-NoStateTracking.tex:575):\na TC\u2070 class recognizing an NC\u00b9-hard language collapses NC\u00b9 to TC\u2070. -/\naxiom tc0_recognize_collapse :\n    \u2200 (C : Cls) (L : Lang),\n      InTC0 C \u2192 Recognizes C L \u2192 NC1hard L \u2192 TC0_eq_NC1\n\n/-- SOURCE CLAIM (2411.12537 thm:parity, main.tex:366): finite-precision\nLRNNs with only nonnegative real transition eigenvalues cannot recognize\nPARITY at arbitrary lengths. -/\naxiom nonneg_no_parity :\n    \u2200 C : Cls, NonnegSpec C \u2192 \u00ac Recognizes C parityLang\n\n/-- COMPOSED THEOREM F2 (headline): no class is both regular-language\ncomplete and TC\u2070 \u2014 completeness costs parallelizability, provably, not\nincidentally. -/\ntheorem no_free_lunch (C : Cls) (hcomp : RegularComplete C)\n    (htc0 : InTC0 C) : TC0_eq_NC1 :=\n  tc0_recognize_collapse C s5Lang htc0 (hcomp s5Lang s5_regular) s5_nc1\n\n/-- Contrapositive packaging: conditional on TC\u2070 \u2260 NC\u00b9, every\nregular-language-complete class has left TC\u2070. -/\ntheorem completeness_costs_parallelism (C : Cls)\n    (hcomp : RegularComplete C) (h : \u00ac TC0_eq_NC1) : \u00ac InTC0 C :=\n  fun htc0 => h (no_free_lunch C hcomp htc0)\n\n/-- Unconditional route (no circuit hypothesis): nonneg-real-spectrum\nclasses are already incomplete, via PARITY. -/\ntheorem nonneg_incomplete (C : Cls) (h : NonnegSpec C) :\n    \u00ac RegularComplete C :=\n  fun hcomp => nonneg_no_parity C h (hcomp parityLang parity_regular)\n\n/-- The two concrete endpoints of the discriminator. -/\naxiom ghClass : Cls\n/-- 2411.12537 thm:regular (main.tex:539): GH-product LRNNs recognize any\nregular language (s \u2264 2^{|Q|} layers); 2502.10297 th:regular\n(neurips_2024.tex:342): Gated DeltaProduct likewise. -/\naxiom gh_complete : RegularComplete ghClass\n\naxiom diagClass : Cls\n/-- 2404.08819 thm:diagonal (SSM-NoStateTracking.tex:496): diagonal gated\nSSMs are in L-uniform TC\u2070. -/\naxiom diag_tc0 : InTC0 diagClass\n/-- The Mamba parameterization has nonnegative real spectra. -/\naxiom diag_nonneg : NonnegSpec diagClass\n\n/-- COMPOSED: conditional on TC\u2070 \u2260 NC\u00b9, the GH class has forfeited TC\u2070\nparallel-scan computability. -/\ntheorem gh_not_tc0 (h : \u00ac TC0_eq_NC1) : \u00ac InTC0 ghClass :=\n  completeness_costs_parallelism ghClass gh_complete h\n\n/-- COMPOSED: the diagonal class is incomplete \u2014 twice over: conditionally\nvia circuits, and unconditionally via eigenvalues. -/\ntheorem diag_incomplete_conditional (h : \u00ac TC0_eq_NC1) :\n    \u00ac RegularComplete diagClass :=\n  fun hcomp => completeness_costs_parallelism diagClass hcomp h diag_tc0\n\ntheorem diag_incomplete : \u00ac RegularComplete diagClass :=\n  nonneg_incomplete diagClass diag_nonneg\n\n/-- COMPOSED THEOREM F2 (dichotomy, packaged): each side of the\ntransition-structure discriminator keeps exactly one of the two resources. -/\ntheorem structure_dichotomy (h : \u00ac TC0_eq_NC1) :\n    (InTC0 diagClass \u2227 \u00ac RegularComplete diagClass)\n      \u2227 (RegularComplete ghClass \u2227 \u00ac InTC0 ghClass) :=\n  \u27e8\u27e8diag_tc0, diag_incomplete\u27e9, \u27e8gh_complete, gh_not_tc0 h\u27e9\u27e9\n\nend F2\n"}]