Definitions bundle OAIQ9Tr001 of the split of OpenAI, Quantitative lower bounds for trace reconstruction
DefinitionOAIQ9Tr001A definitions bundle of the split of OpenAI's proof of OAI.TraceReconstruction.quantitative_sample_lower_bound, OAI.TraceReconstruction.superpolynomial_one_trace and OAI.TraceReconstruction.superpolynomial_sample_complexity, carved from OpenAI's openai/math development (OpenAI, Quantitative lower bounds for trace reconstruction, OpenAI Math Release, September 24, 2026, result family 122, github.com/openai/math at commit adc7f12, Apache License 2.0) and ported to Lean 4.33.1 and Mathlib 0df444a. The declarations and their proofs are OpenAI's.
Contents. It holds 15 declarations of OpenAI's Lean: 7 definitions, 4 instances and 4 theorems. The definitions and types are OAI.TraceReconstruction.sourceDepth, OAI.TraceReconstruction.sourceFitTail, OAI.TraceReconstruction.sourceGapFloor, OAI.TraceReconstruction.sourceInitialOffset, OAI.TraceReconstruction.sourceInitialWeight, OAI.TraceReconstruction.sourceScaleInverseEnvelope, OAI.TraceReconstruction.workingDeletion.
Sources. They come from these modules of lean/OAI/Probability/TraceReconstruction, in whole or in part: TraceReconstruction_ErrorRates, TraceReconstruction_InitialRates, TraceReconstruction_Metadata, TraceReconstruction_Propagation, TraceReconstruction_Scales.
Imports. It imports no bundle or statement, only Mathlib.
Imported by (directly, in this split): the bundle OAIQ9Tr002; the statement OAI.TraceReconstruction.source_all_levels_eventually.
import Mathlib
section
-- module Solutions.OAIQ9_TR.Compat
namespace OAI
/-! Compatibility with the newer Lean core OpenAI's code was written against: lemmas it uses by
names this environment (Lean 4.33.1, Mathlib 0df444a) does not have yet. Each is the
corresponding `if_pos` / `if_neg` / `dif_pos` / `dif_neg`. The `dite` forms are stated as
`dite p a b`, not with the `if hp : p then …` notation: its eta-expanded lambdas form is a higher-order pattern
that `rw` cannot find (DepthThree, PeriodicTiling 2026-10-25). -/
section OAICompat434
/-- Mathlib's newer `TensorProduct.inductionOn` (no `zero` case: it is the `tmul` case at
`0 ⊗ₜ 0`); ours has only `TensorProduct.induction_on`, which asks for one. Not named
`TensorProduct.inductionOn`: inside `namespace OAI` that would make `open TensorProduct` open
`OAI.TensorProduct` instead of Mathlib's. -/
@[elab_as_elim]
theorem tensorInductionOn {R M N : Type*} [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N]
[Module R M] [Module R N] {motive : TensorProduct R M N → Prop} (z : TensorProduct R M N)
(tmul : ∀ x y, motive (TensorProduct.tmul R x y))
(add : ∀ x y, motive x → motive y → motive (x + y)) : motive z :=
TensorProduct.induction_on z (by simpa using tmul 0 0) tmul add
/-- Mathlib's newer case names for `FreeGroup.induction_on` (`one`, where ours says `C1`). -/
@[elab_as_elim]
theorem freeGroupInductionOn {α : Type*} {C : FreeGroup α → Prop} (z : FreeGroup α) (one : C 1)
(of : ∀ x, C (FreeGroup.of x)) (inv_of : ∀ x, C (FreeGroup.of x) → C (FreeGroup.of x)⁻¹)
(mul : ∀ x y, C x → C y → C (x * y)) : C z :=
FreeGroup.induction_on z one of inv_of mul
/-- The first projection of a probability measure on a product: found by instance search in d13f23b
(total `Measure.map`), here a measurable map. -/
instance isProbabilityMeasure_map_fst {α β : Type*} [MeasurableSpace α] [MeasurableSpace β]
{μ : MeasureTheory.Measure (α × β)} [MeasureTheory.IsProbabilityMeasure μ] :
MeasureTheory.IsProbabilityMeasure (μ.map Prod.fst) :=
MeasureTheory.Measure.isProbabilityMeasure_map measurable_fst.aemeasurable
instance isProbabilityMeasure_map_snd {α β : Type*} [MeasurableSpace α] [MeasurableSpace β]
{μ : MeasureTheory.Measure (α × β)} [MeasureTheory.IsProbabilityMeasure μ] :
MeasureTheory.IsProbabilityMeasure (μ.map Prod.snd) :=
MeasureTheory.Measure.isProbabilityMeasure_map measurable_snd.aemeasurable
instance isProbabilityMeasure_map_subtype_val {α : Type*} [MeasurableSpace α] {p : α → Prop}
{μ : MeasureTheory.Measure {a // p a}} [MeasureTheory.IsProbabilityMeasure μ] :
MeasureTheory.IsProbabilityMeasure (μ.map Subtype.val) :=
MeasureTheory.Measure.isProbabilityMeasure_map measurable_subtype_coe.aemeasurable
/-- Mathlib d13f23b's `YoungDiagram.card_transpose`. -/
@[simp]
theorem _root_.YoungDiagram.card_transpose (μ : YoungDiagram) : μ.transpose.card = μ.card := by
unfold YoungDiagram.card
apply Finset.card_bij (fun c _ => c.swap)
· intro c hc
have : c ∈ μ.transpose := hc
rw [YoungDiagram.mem_transpose] at this
exact this
· intro a _ b _ h
simpa using h
· intro b hb
refine ⟨b.swap, ?_, by simp⟩
show b.swap ∈ μ.transpose
rw [YoungDiagram.mem_transpose]
simpa using hb
/-- For a measurable equivalence `e`, `IsProbabilityMeasure (μ.map e)` is found by instance search
(Mathlib d13f23b finds it for every map `f`: there `Measure.map` of a non-measurable map is a Dirac
mass, here it is `0`, so only the measurable case can be shimmed). -/
instance isProbabilityMeasure_map_measurableEquiv {α β : Type*} [MeasurableSpace α]
[MeasurableSpace β] {μ : MeasureTheory.Measure α} [MeasureTheory.IsProbabilityMeasure μ]
(e : α ≃ᵐ β) : MeasureTheory.IsProbabilityMeasure (μ.map e) :=
MeasureTheory.Measure.isProbabilityMeasure_map e.measurable.aemeasurable
end OAICompat434
end OAI
end
section
-- module Solutions.OAIQ9_TR.TraceReconstruction_Scales
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false
namespace OAI
/-!
# Scales
Exact block exponents, deletion reduction, induction depth, backward target scales, and uniform power absorption.
-/
open scoped ENNReal
noncomputable section
open Filter
open scoped Topology
open Filter
open scoped Topology
namespace TraceReconstruction
def workingDeletion (q : ℝ) : ℝ := min q (1/2)
def sourceDepth (B : ℕ) (ζ H : ℝ) : ℕ := ⌊(1-ζ)*Real.log H/((B:ℝ)*Real.log 2)⌋₊
end TraceReconstruction
open Filter
open scoped Topology
end
end OAI
end
section
-- module Solutions.OAIQ9_TR.TraceReconstruction_Metadata
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false
namespace OAI
/-!
# Metadata
Hidden metadata, fair jitter, heterogeneous emissions, independent window trials, concentration, and fit.
-/
open scoped ENNReal
noncomputable section
open Filter
open scoped Topology
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
namespace TraceReconstruction
open scoped Classical
/-- Explicit finite tree union bound. The source's scale estimates will make
this number exponentially small; no independence of sibling shifts is used. -/
def sourceFitTail (T n : ℕ → ℕ) : ℕ → ℝ
| 0 => 0
| 1 => 0
| b+2 => (T (b+1):ℝ)*(2*Real.exp (-2*((T b:ℝ)/8)^2/(((T (b+1):ℝ)+1)*(n b:ℝ)))+
sourceFitTail T n (b+1))
end TraceReconstruction
end
end
end
end
end
end
end
end OAI
end
section
-- module Solutions.OAIQ9_TR.TraceReconstruction_InitialRates
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false
namespace OAI
/-!
# InitialRates
Initial geometric parameters, moment depths, error and overlap rates, and production of the base induction pair.
-/
open scoped ENNReal
noncomputable section
open Filter
open scoped Topology
noncomputable section
noncomputable section
noncomputable section
namespace TraceReconstruction
open Filter
open scoped Topology Classical
/-- The manuscript's one-based middle defect, translated to a list index. -/
def sourceInitialOffset (m : ℕ) (hm : 4 ≤ m) : Fin m :=
⟨m/2-1,by omega⟩
theorem sourceInitialOffset_interior (m : ℕ) (hm : 4 ≤ m) :
1 ≤ (sourceInitialOffset m hm).val ∧ (sourceInitialOffset m hm).val+1 < m := by
simp only [sourceInitialOffset]; omega
end TraceReconstruction
noncomputable section
noncomputable section
noncomputable section
namespace TraceReconstruction
open Filter
open scoped Topology Classical
/-- Actual primitive-score weight at the base scale. -/
def sourceInitialWeight (q : ℝ) (k : ℕ) : ℝ := (6*(2*k:ℕ):ℝ)*(2/q)
end TraceReconstruction
end
end
end
end
end
end
end
end OAI
end
section
-- module Solutions.OAIQ9_TR.TraceReconstruction_ErrorRates
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false
namespace OAI
/-!
# ErrorRates
Realization of block caps, sparse scales, sharp and smoothing budgets, tree tails, fit errors, and uniform polynomial/exponential bounds.
-/
open scoped ENNReal
noncomputable section
open Filter
open scoped Topology
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
noncomputable section
namespace TraceReconstruction
open Filter
open scoped Topology Classical
def sourceScaleInverseEnvelope (B D : ℕ) : ℝ := 2*(2:ℝ)^(B*D)
end TraceReconstruction
end
end
end
end
end
end
end
end
end
end
end
end
end OAI
end
section
-- module Solutions.OAIQ9_TR.TraceReconstruction_Propagation
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false
namespace OAI
/-!
# Propagation
Moment restriction, scale margins, sharp budget closure, clipping and error propagation, and dense/warmup overlap.
-/
open scoped ENNReal
noncomputable section
open Filter
open scoped Topology
noncomputable section
noncomputable section
namespace TraceReconstruction
open scoped Classical
def sourceGapFloor (B : ℕ) : ℝ := 1/(128*(2:ℝ)^(2*B))
end TraceReconstruction
end
end
end
end OAI
end