Documentation

CslibFrontier.Computability.PolyTime.LinearAlgebra.ReplacementDesignBuilder

Polynomial-time replacement design builder (Lemma 4.7) #

Executable neutral-singleton scope augmentation (withNeutralScopesList) and deterministic polynomial-time Lemma 4.7 replacement-design construction (buildReplacementDesignData) from §4.6 (Lemma 4.7, pp. 33–34) and §§5.3, 5.5 (pp. 37–38) of OpenAI, The Exponential Time Hypothesis is False. Plain @[fun_prop] Turing.MultiTapeTM.ComputableInPolyTime certificates cover the tape-encoded routines (withNeutralScopesList, scopeIncidencesList, normalizeVarSchedules, normalizeScopeSchedules, incidenceLabelsList, buildReplacementDesignData, ReplacementDesignData projections, and ReplacementDesignData.lookupReplacementRow, with encUnary on (n_free, D_cap, Q, A₀, R), r in encUnary for buildReplacementDesignData and in binary encNat for normalizeVarSchedules, normalizeScopeSchedules and incidenceLabelsList, and binary/list encodings on scopes, schedules, the lookup indices (f, v), and ReplacementDesignData), while listScopeFamily, withNeutralScopesIndexEquiv, finToScopeIncidence, scopeIncidenceEquivFin, varAssignOfList, factorAssignOfList, BalancedSchedule, placeFinOfBalanced, constructedReplacementDesign, and ReplacementDesignData.Refines serve as unencoded semantic specification bridges. All executable routines are total: scopes ignore variable indices ≥ n_free; schedule words truncate/pad with 0 to length Q modulo max r 1 with missing rows and empty in-range scopes normalized to List.replicate Q 0; auxiliary tables cap at min D_cap (r ^ (2 * Q)) (copyCount = 0 when r = 0 and Q > 0); and for data produced by the builder, lookupReplacementRow returns [] when (f, v) is absent.

Main definitions #

Main results #

References #

1. Executable neutral-singleton scope augmentation (withNeutralScopesList) #

Executable neutral-padding scope augmentation appending [0], …, [n_free - 1] to scopes ([OAI26k], §§5.3, 5.5, pp. 37–38).

@[simp]
theorem Cslib.LinearAlgebra.length_withNeutralScopesList (scopes : List (List ℕ)) (n_free : ℕ) :
(withNeutralScopesList scopes n_free).length = scopes.length + n_free
def Cslib.LinearAlgebra.listScopeFamily (n_free : ℕ) (scopes : List (List ℕ)) (f : Fin scopes.length) :
Finset (Fin n_free)

Semantic Fin-indexed scope family induced by scopes : List (List ℕ).

@[simp]
theorem Cslib.LinearAlgebra.mem_listScopeFamily {n_free : ℕ} {scopes : List (List ℕ)} {f : Fin scopes.length} {v : Fin n_free} :
v ∈ listScopeFamily n_free scopes f ↔ ↑v ∈ scopes[f]
theorem Cslib.LinearAlgebra.card_listScopeFamily_le (n_free : ℕ) (scopes : List (List ℕ)) (f : Fin scopes.length) :
(listScopeFamily n_free scopes f).card ≤ scopes[f].length

Every semantic scope listScopeFamily n_free scopes f has size at most scopes[f].length.

Factor-index equivalence Fin scopes.length ⊕ Fin n_free ≃ Fin augScopes.length.

@[simp]
theorem Cslib.LinearAlgebra.val_withNeutralScopesIndexEquiv_inl (scopes : List (List ℕ)) (n_free : ℕ) (f : Fin scopes.length) :
↑((withNeutralScopesIndexEquiv scopes n_free) (Sum.inl f)) = ↑f
@[simp]
theorem Cslib.LinearAlgebra.val_withNeutralScopesIndexEquiv_inr (scopes : List (List ℕ)) (n_free : ℕ) (v : Fin n_free) :
↑((withNeutralScopesIndexEquiv scopes n_free) (Sum.inr v)) = scopes.length + ↑v

Variable incidence increases by 1 at every free variable under withNeutralScopesList.

2. Canonical scope incidences and Lemma 4.5 schedule balance #

Sorted duplicate-free list of variable indices < n_free belonging to s : List ℕ.

@[simp]
theorem Cslib.LinearAlgebra.mem_canonicalScopeVars {n_free v : ℕ} {s : List ℕ} :
v ∈ canonicalScopeVars n_free s ↔ v < n_free ∧ v ∈ s
theorem Cslib.LinearAlgebra.canonicalScopeVars_isEmpty_iff (n_free : ℕ) (scopes : List (List ℕ)) (f : Fin scopes.length) :
(canonicalScopeVars n_free (scopes.getD ↑f [])).isEmpty = true ↔ listScopeFamily n_free scopes f = ∅

Canonical ordered list of factor–variable incidences (f, v).

@[simp]
theorem Cslib.LinearAlgebra.mem_scopeIncidencesList {n_free : ℕ} {scopes : List (List ℕ)} {p : ℕ × ℕ} :
p ∈ scopeIncidencesList n_free scopes ↔ p.1 < scopes.length ∧ p.2 < n_free ∧ p.2 ∈ scopes.getD p.1 []

Map an index in Fin (scopeIncidencesList n_free scopes).length to ScopeIncidence.

Canonical bijection ScopeIncidence (listScopeFamily n_free scopes) ≃ Fin M.

@[simp]
theorem Cslib.LinearAlgebra.scopeIncidenceEquivFin_finToScopeIncidence (n_free : ℕ) (scopes : List (List ℕ)) (i : Fin (scopeIncidencesList n_free scopes).length) :
(scopeIncidenceEquivFin n_free scopes) (finToScopeIncidence n_free scopes i) = i
theorem Cslib.LinearAlgebra.length_scopeIncidencesList (n_free : ℕ) (scopes : List (List ℕ)) :
(scopeIncidencesList n_free scopes).length = ∑ f : Fin scopes.length, (listScopeFamily n_free scopes f).card

Normalize a schedule word w : List ℕ to length Q with entries < max r 1.

def Cslib.LinearAlgebra.normalizeVarSchedules (n_free Q r : ℕ) (schedVar : List (List ℕ)) :

Normalize schedVar to n_free length-Q words over {0, …, max r 1 - 1}.

@[simp]
theorem Cslib.LinearAlgebra.length_normalizeVarSchedules (n_free Q r : ℕ) (schedVar : List (List ℕ)) :
(normalizeVarSchedules n_free Q r schedVar).length = n_free
def Cslib.LinearAlgebra.normalizeScopeSchedules (n_free Q r : ℕ) (scopes schedScope : List (List ℕ)) :

Normalize schedScope to scopes.length length-Q words, mapping empty in-range scopes to List.replicate Q 0 ([OAI26k], §4.1 & Lemma 4.5, pp. 27, 30–31).

@[simp]
theorem Cslib.LinearAlgebra.length_normalizeScopeSchedules (n_free Q r : ℕ) (scopes schedScope : List (List ℕ)) :
(normalizeScopeSchedules n_free Q r scopes schedScope).length = scopes.length
def Cslib.LinearAlgebra.varAssignOfList {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (schedVar : List (List ℕ)) (v : Fin n_free) (t : Fin Q) :
Fin r

Typed variable group schedule Fin n_free → Fin Q → Fin r extracted from schedVar.

def Cslib.LinearAlgebra.factorAssignOfList {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedScope : List (List ℕ)) (f : Fin scopes.length) (t : Fin Q) :
Fin r

Typed factor group schedule Fin scopes.length → Fin Q → Fin r extracted from schedScope.

@[simp]
theorem Cslib.LinearAlgebra.val_varAssignOfList {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (schedVar : List (List ℕ)) (v : Fin n_free) (t : Fin Q) :
↑(varAssignOfList hr n_free Q schedVar v t) = ((normalizeVarSchedules n_free Q r schedVar).getD ↑v []).getD (↑t) 0
@[simp]
theorem Cslib.LinearAlgebra.val_factorAssignOfList {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedScope : List (List ℕ)) (f : Fin scopes.length) (t : Fin Q) :
↑(factorAssignOfList hr n_free Q scopes schedScope f t) = ((normalizeScopeSchedules n_free Q r scopes schedScope).getD ↑f []).getD (↑t) 0
theorem Cslib.LinearAlgebra.factorAssignOfList_of_empty {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedScope : List (List ℕ)) {f : Fin scopes.length} (hf : listScopeFamily n_free scopes f = ∅) (t : Fin Q) :
↑(factorAssignOfList hr n_free Q scopes schedScope f t) = 0
def Cslib.LinearAlgebra.incidenceLabelsList (n_free Q r : ℕ) (scopes schedVar schedScope : List (List ℕ)) :

Executable list of packed auxiliary incidence labels u_{f,v} < r ^ (2 * Q).

@[simp]
theorem Cslib.LinearAlgebra.length_incidenceLabelsList (n_free Q r : ℕ) (scopes schedVar schedScope : List (List ℕ)) :
(incidenceLabelsList n_free Q r scopes schedVar schedScope).length = (scopeIncidencesList n_free scopes).length
theorem Cslib.LinearAlgebra.incidenceLabelsList_eq_ofFn {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedVar schedScope : List (List ℕ)) :
incidenceLabelsList n_free Q r scopes schedVar schedScope = List.ofFn fun (i : Fin (scopeIncidencesList n_free scopes).length) => encodeAuxLabel (BalancedSchedules.incidenceLabel (BalancedSchedules.scopeVarOf (listScopeFamily n_free scopes)) (BalancedSchedules.scopeFactorOf (listScopeFamily n_free scopes)) (varAssignOfList hr n_free Q schedVar) (factorAssignOfList hr n_free Q scopes schedScope) (finToScopeIncidence n_free scopes i))

incidenceLabelsList equals List.ofFn of encodeAuxLabel ∘ u ∘ finToScopeIncidence.

def Cslib.LinearAlgebra.BalancedSchedule {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedVar schedScope : List (List ℕ)) :

Lemma 4.5 balance predicate on executable schedule lists (schedVar, schedScope) ([OAI26k], Lemma 4.5 & Lemma 4.7, pp. 30–31, 33–34).

theorem Cslib.LinearAlgebra.balancedSchedule_iff_exec {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedVar schedScope : List (List ℕ)) :
BalancedSchedule hr n_free Q scopes schedVar schedScope ↔ (∀ idx < r ^ (2 * Q), List.count idx (incidenceLabelsList n_free Q r scopes schedVar schedScope) * r ^ (2 * Q) ≤ 2 * (scopeIncidencesList n_free scopes).length) ∧ ∀ t < Q, ∀ g < r, (CopyPlacement.varGroupList (normalizeVarSchedules n_free Q r schedVar) t g).length * r ≤ 2 * n_free

Pure executable list characterization of BalancedSchedule, enabling decide verification.

theorem Cslib.LinearAlgebra.exists_balancedSchedule_of_scopes {n_free Q r b w : ℕ} (scopes : List (List ℕ)) (hn : 1 ≤ n_free) (hr : 1 ≤ r) (hQ : 1 ≤ Q) (hbw : 0 < b + w) (hb : ∀ (v : Fin n_free), {f : Fin scopes.length | v ∈ listScopeFamily n_free scopes f}.card ≤ b) (hw : ∀ (f : Fin scopes.length), (listScopeFamily n_free scopes f).card ≤ w) (hincidenceSize : 2 * (b + w) * (r ^ (2 * Q)) ^ 2 ≤ ∑ f : Fin scopes.length, (listScopeFamily n_free scopes f).card) (hgroupSize : 2 * Q * r ^ 2 ≤ n_free) :
∃ (schedVar : List (List ℕ)) (schedScope : List (List ℕ)), schedVar.length = n_free ∧ schedScope.length = scopes.length ∧ BalancedSchedule hr n_free Q scopes schedVar schedScope

Lemma 4.5 schedule existence on executable scope lists: under Lemma 4.7's size hypotheses, there exist executable schedule lists (schedVar, schedScope) satisfying BalancedSchedule.

3. Bundled Lemma 4.7 design data and executable constructor #

Bundled executable Lemma 4.7 replacement-design arrays ([OAI26k], Lemma 4.7).

  • varGroups : List (List (List ℕ))

    Step-and-group variable partitions V_0, …, V_{r - 1} for t < Q.

  • factorGroups : List (List ℕ)

    Normalized factor group schedules σ_f ∈ {0, …, r - 1}^Q for f < scopes.length.

  • incidences : List (ℕ × ℕ)

    Canonical ordered list of factor–variable incidences (f, v).

  • copyCount : ℕ

    Copy count h = 2 * incidences.length / r ^ (2 * Q).

  • placements : List (ℕ × ℕ)

    Injective incidence copy placements (c_e, u_e) for e < incidences.length.

  • measurementMatrix : List (List ℤ)

    Pulled-back (copyCount * c_B) × n_free integer measurement matrix Ĉ = C̃ ι.

  • groupMeasurementMatrices : List (List (List (List ℤ)))

    Step-and-group restricted integer measurement matrices C_{t,g} = Ĉ|_{S_{t,g}}.

  • denom : ℤ

    Cleared common denominator d_den = (R - 1)! * Q! as an integer.

  • replacementRows : List (List (List ℤ))

    Per-incidence n_free × R cleared replacement-row coefficient tables d_den · P⃗_e(T).

Instances For
    @[reducible, inline]

    Underlying nested product representation of ReplacementDesignData for tape encoding.

    @[reducible, inline]

    Lists of variable sets with indices in binary, such as factor scopes or the groups of a partition: the concatenation of the framed sets, each set the concatenation of its framed variable indices, each encoded by encNat. This is the layout encList (encList encNat) of encSchedules and Cslib.Complexity.encSparseEquation; the name records the role.

    def Cslib.LinearAlgebra.buildReplacementDesignData (n_free D_cap Q r A₀ R : ℕ) (scopes schedVar schedScope : List (List ℕ)) :

    Executable Lemma 4.7 replacement-design constructor assembling ExchangeReplacement and CopyPlacement over (schedVar, schedScope) ([OAI26k], §4.6, Lemma 4.7, pp. 33–34).

    Look up the n_free × R cleared replacement-row coefficient table for (f, v).

    4. Plain polynomial-time certificates (ComputableInPolyTime) #

    Compositional plain polynomial-time certificate for withNeutralScopesList.

    Lemma 4.7 polynomial-time certificate (buildReplacementDesignData): buildReplacementDesignData is computable in polynomial time from unary parameters (n_free, D_cap, Q, r, A₀, R) and list-encoded (scopes, schedVar, schedScope).

    5. Semantic bridge from buildReplacementDesignData to ReplacementDesign #

    theorem Cslib.LinearAlgebra.fiberBound_of_balancedSchedule {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedVar schedScope : List (List ℕ)) (hbal : BalancedSchedule hr n_free Q scopes schedVar schedScope) :
    let scope := listScopeFamily n_free scopes; have u := BalancedSchedules.incidenceLabel (BalancedSchedules.scopeVarOf scope) (BalancedSchedules.scopeFactorOf scope) (varAssignOfList hr n_free Q schedVar) (factorAssignOfList hr n_free Q scopes schedScope); let M := (scopeIncidencesList n_free scopes).length; ∀ (y : AuxLabel Q r), {i : Fin M | u (finToScopeIncidence n_free scopes i) = y}.card ≤ 2 * M / r ^ (2 * Q)
    noncomputable def Cslib.LinearAlgebra.placeFinOfBalanced {r : ℕ} (hr : 1 ≤ r) (n_free Q : ℕ) (scopes schedVar schedScope : List (List ℕ)) (hbal : BalancedSchedule hr n_free Q scopes schedVar schedScope) :
    have M := (scopeIncidencesList n_free scopes).length; Fin M → Fin (2 * M / r ^ (2 * Q)) × AuxLabel Q r

    Concrete Fin M-indexed placement Fin M → Fin h × AuxLabel Q r from BalancedSchedule.

    noncomputable def Cslib.LinearAlgebra.constructedReplacementDesign {n_free Q r A₀ R b : ℕ} {τ : ℚ} (scopes schedVar schedScope : List (List ℕ)) (hr : 1 ≤ r) (hQ : 1 ≤ Q) (hb_pos : 1 ≤ b) (hτ : 0 ≤ τ) (hI : ∀ a < R - 1, A₀ + a ≤ Q) (hM_le : ∑ f : Fin scopes.length, (listScopeFamily n_free scopes f).card ≤ b * n_free) (htail : binomTailProb Q r A₀ R ≤ τ / (↑r * ↑b)) (hbal : BalancedSchedule hr n_free Q scopes schedVar schedScope) :
    ReplacementDesign (listScopeFamily n_free scopes) Q r A₀ R τ

    Concrete ReplacementDesign induced by BalancedSchedule (Lemma 4.7, pp. 33–34): constructs ReplacementDesign (listScopeFamily n_free scopes) Q r A₀ R τ from balanced schedules (schedVar, schedScope) and Lemma 4.7's numerical and binomial-tail hypotheses.

    def Cslib.LinearAlgebra.ReplacementDesignData.Refines {n_free Q r A₀ R : ℕ} {τ : ℚ} (scopes : List (List ℕ)) (data : ReplacementDesignData) (D : ReplacementDesign (listScopeFamily n_free scopes) Q r A₀ R τ) :

    Refinement predicate relating data : ReplacementDesignData to D : ReplacementDesign (listScopeFamily n_free scopes) Q r A₀ R τ. It asserts that the copy count is D.h and the denominator is commonDenom Q R; that each variable group list is duplicate-free, has length at most 2 * n_free / r, and contains an index below n_free exactly when it lies in varGroup D.varAssign t g; that the factor group entries are those of D.factorAssign; that each incidence's looked-up replacement table is the one at its canonical index, has n_free rows of length R, and has the coefficients of varReplacementRowScaledInt; that the rows of data.measurementMatrix have the same ℚ-kernel as varMeasurementMatrix; and that a vector supported on a group and annihilated by the rows of its group matrix C_{t,g} is annihilated by the off-group replacement forms at nodePoint t. It bounds neither the number nor the ℓ₁-norms of the rows of data.measurementMatrix and data.groupMeasurementMatrices (the bounds ReplacementDesign.total_measurement_rows_le and ReplacementDesign.sum_abs_measurement_row_le are about D), and does not constrain data.placements.

    theorem Cslib.LinearAlgebra.buildReplacementDesignData_spec {n_free D_cap Q r A₀ R b : ℕ} {τ : ℚ} (scopes schedVar schedScope : List (List ℕ)) (hD_cap : r ^ (2 * Q) ≤ D_cap) (hr : 1 ≤ r) (hR : 1 ≤ R) (hQ : 1 ≤ Q) (hb_pos : 1 ≤ b) (hτ : 0 ≤ τ) (hI : ∀ a < R - 1, A₀ + a ≤ Q) (htail : binomTailProb Q r A₀ R ≤ τ / (↑r * ↑b)) (hM_le : ∑ f : Fin scopes.length, (listScopeFamily n_free scopes f).card ≤ b * n_free) (hbal : BalancedSchedule hr n_free Q scopes schedVar schedScope) :
    ReplacementDesignData.Refines scopes (buildReplacementDesignData n_free D_cap Q r A₀ R scopes schedVar schedScope) (constructedReplacementDesign scopes schedVar schedScope hr hQ hb_pos hτ hI hM_le htail hbal)

    Main Lemma 4.7 semantic specification (buildReplacementDesignData_spec): under Lemma 4.7's cap, interval, binomial-tail, and BalancedSchedule hypotheses, buildReplacementDesignData refines constructedReplacementDesign.

    theorem Cslib.LinearAlgebra.exists_replacementDesign_of_buildReplacementDesignData {n_free D_cap Q r A₀ R b : ℕ} {τ : ℚ} (scopes schedVar schedScope : List (List ℕ)) (hD_cap : r ^ (2 * Q) ≤ D_cap) (hr : 1 ≤ r) (hR : 1 ≤ R) (hQ : 1 ≤ Q) (hb_pos : 1 ≤ b) (hτ : 0 ≤ τ) (hI : ∀ a < R - 1, A₀ + a ≤ Q) (htail : binomTailProb Q r A₀ R ≤ τ / (↑r * ↑b)) (hM_le : ∑ f : Fin scopes.length, (listScopeFamily n_free scopes f).card ≤ b * n_free) (hbal : BalancedSchedule hr n_free Q scopes schedVar schedScope) :
    ∃ (D : ReplacementDesign (listScopeFamily n_free scopes) Q r A₀ R τ), ReplacementDesignData.Refines scopes (buildReplacementDesignData n_free D_cap Q r A₀ R scopes schedVar schedScope) D

    Bundled existential packaging of buildReplacementDesignData_spec.

    theorem Cslib.LinearAlgebra.exists_replacementDesign_withNeutralScopesList {n_free D_cap Q r A₀ R b₀ : ℕ} {τ : ℚ} (scopes schedVar schedScope : List (List ℕ)) (hD_cap : r ^ (2 * Q) ≤ D_cap) (hr : 1 ≤ r) (hR : 1 ≤ R) (hQ : 1 ≤ Q) (hτ : 0 ≤ τ) (hI : ∀ a < R - 1, A₀ + a ≤ Q) (hb₀ : ∀ (v : Fin n_free), BitString.varIncidence Finset.univ (listScopeFamily n_free scopes) v ≤ b₀) (htail : binomTailProb Q r A₀ R ≤ τ / (↑r * ↑(b₀ + 1))) (hbal : BalancedSchedule hr n_free Q (withNeutralScopesList scopes n_free) schedVar schedScope) :
    have augScopes := withNeutralScopesList scopes n_free; ∃ (D : ReplacementDesign (listScopeFamily n_free augScopes) Q r A₀ R τ), ReplacementDesignData.Refines augScopes (buildReplacementDesignData n_free D_cap Q r A₀ R augScopes schedVar schedScope) D

    Neutral-padded Lemma 4.7 specialization (exists_replacementDesign_withNeutralScopesList): when each free variable belongs to at most b₀ scopes of scopes and (schedVar, schedScope) satisfies BalancedSchedule on withNeutralScopesList scopes n_free, buildReplacementDesignData refines a concrete ReplacementDesign on the augmented scope family with occurrence bound b = b₀ + 1.