Skip to content

κ = 0.4999 (+0.4963, +13,671.13% over #7000): OpenAI's tape multiplier gives log exponent 1/2 + ε for every fixed ε > 0 - #8102

Open
zxv wants to merge 7 commits into
CrocSwap:mainfrom
zxv:research/nov24-retained-kappa-003
Open

zxv wants to merge 7 commits into
CrocSwap:mainfrom
zxv:research/nov24-retained-kappa-003

Conversation

@zxv

@zxv zxv commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

OpenAI’s November 24 theorem gives one deterministic multitape machine that computes the exact product of two $n$-bit integers in linear visited space. For every fixed $\varepsilon>0$, its worst-case time satisfies

$$T(n)=O_\varepsilon\!\left(n(\log n)^{1/2+\varepsilon}\right).$$

Here $\varepsilon$ measures the excess above the square-root logarithmic exponent. The same machine works for every fixed choice, although the implicit constant and threshold may depend on it. The open question is whether the residual factor above $n\sqrt{\log n}$ can be bounded by a constant.

Result in the repository’s κ convention

The repository measures the saving from exponent one. Setting $\varepsilon=1/2-\kappa$ gives $1/2+\varepsilon=1-\kappa$, so the bound covers every fixed $0<\kappa<1/2$. At the proposed witness κ = 0.4999, the target excess is ε = 0.0001 and the logarithmic exponent is 0.5001.

OpenAI supplies the construction and its proof. This PR checks the machine contract, gives an explicit specialization, and proposes the resulting κ record for maintainer review. The local checks cover source integrity and exact parameter arithmetic. Independent compilation of the upstream Lean proof remains open.

Reference point κ Relative increase in κ at the proposed witness
#7000 · selected frontier 0.00363005817 +13,671.13%
#8101 · conditional claim in the November 25 title survey 0.003900866740647 +12,715.10%
This PR · numeric witness 0.4999
Supremum of the family; Weak ETH limit 0.5 not claimed

#7000 is the maintainer-admitted conditional record at the pinned base revision. #8101 was the newest open PR and the largest advertised conditional multiplication saving in a survey of 1,386 open PR titles on November 25, 2026. The survey distinguished claimed savings from ceilings and targets; it did not review the proof. The exponent saving increases by 0.49626994183 over #7000 and by 0.495999133259353 over #8101. The percentages compare κ values, not measured running times.

The November paper changes the overall construction and obtains logarithmic exponent $1/2+o(1)$ on one machine, with no complexity hypothesis. Its separate lower bound, which assumes variable-count Weak ETH, rules out every fixed κ > 1/2 (step 4).

Significance for researchers

The repository asks how much of the logarithmic factor an exact fixed-tape multiplier can save. Its October 9 assembly-domain audit identifies caps for the historical PR186 balanced assembly: $\kappa<1/33\approx0.0303$ from its retained range $a<b<1/32$ and balance $\kappa<a/(1+a)$, and independently $\kappa<1/4$ from its retained Gaussian range. These are limits of that historical parameter domain. The current priorities explicitly say the old conversion does not describe the later nine-row assembly. OpenAI's direct construction gives every fixed $0<\kappa<1/2$ on one machine, independently of those grouped designs. For example, κ = 0.49999 follows from the same theorem as the recorded 0.4999 witness. Assuming variable-count Weak ETH, the fixed-κ question is therefore settled except at κ = 1/2 itself, where the available estimate still allows an unbounded overhead.

The key idea: share the movement as well as the arithmetic

Theorem (One multiplier for all lengths). There is a deterministic multitape Turing machine that computes the full product of two $n$-bit integers in worst-case time at most $n(1+\log n)^{1/2+o(1)}$, visiting $O(n)$ tape cells.

The three ideas below summarize the paper's introduction. They describe OpenAI's construction, not new work.

Sharing the movement. On a power-of-two square array, transposition exchanges the row and column fields of the address. The paper splits each field into $m$ chunks and applies combinations of the $m$ chunk swaps to many independent streams at once. In a basis that diagonalizes every swap, the sign of their product is the parity of the number of $-1$ eigenvalues. A bulk-parity method from the companion Fourier paper computes that parity with a polynomial of degree $O(\sqrt{m\log m})$ and repairs the exceptional streams. This gives about $\sqrt{m\log m}$ stages, each linear in all $m$ swaps. Rectangular grouping lets several queries share a layout change. The resulting shifts take linear time, and the construction bounds the number of smaller interchanges per stream.

Sharing the arithmetic. Many short, pairwise-coprime cyclic factors carry the digit convolution via the Chinese remainder theorem. Rather than padding each factor separately, a short transform borrows occupied coordinates and restores them. All the short transforms can then share one sequence of diagonal phases, address permutations and normalized Walsh transforms. With $O(\log n)$ bits per record, the accumulated error stays below one half. Rounding therefore recovers the exact coefficients before the carry scan. This gives a multiplier for each fixed exponent above 1/2 (Multiplication at a fixed exponent).

One machine. A universal-search-style scheduler turns the family into a single program. It runs effectively generated candidates for target exponents $\theta_j=1/2+1/(j+2)$ on chunks of the operands. Allowances increase in a weighted diagonal order, and every attempt is fenced inside one linear space bound. A schoolbook multiplier is held in reserve. Every completed attempt is correct. For each fixed $j$, a suitable fixed chunk count eventually fits, and the scheduler incurs a constant-factor overhead for that attempt (uniform multiplication proof).

From the theorem to κ

1. Match the machine contract

Repository requirement Upstream statement
One deterministic machine; alphabet, tape count and transitions fixed before $n$ One machine for all lengths, UniformWorstCaseSpec
Two unsigned MSB-first $n$-bit operands, delimiter, leading zeros allowed The same input encoding in the comparator specification
Output is the full product in exactly $2n$ bits The output tape holds a length-$2n$ string equal in value to the product
One head per tape, moving at most one cell per step Same step semantics
Worst case over all inputs at each length Maximum over actual halting traces at each positive width

Section-by-section comparison: PROOF.md § Machine and output.

2. Specialize the quantifiers

Fix $0<\kappa<1/2$ and set $g=1/2-\kappa$. Write the theorem's excess exponent as $\delta(n)\to0$. For all sufficiently large $n$, $\delta(n)\le g/2$, so

$$\tfrac12+\delta(n)\;\le\;\tfrac12+\tfrac g2\;<\;\tfrac12+g\;=\;1-\kappa .$$

At the witness $\kappa=4999/10000$, $g=1/10000$, and the eventual exponent $10001/20000$ is strictly below the target $5001/10000$. The bound holds for one fixed machine, not a family chosen per κ.

3. Change convention and absorb small lengths

Replacing $1+\log n$ by the repository's $\max(1,\lceil\log_2 n\rceil)$ costs a constant factor for each fixed exponent. The finitely many lengths below the threshold have finite worst-case times, so a larger constant covers every $n\ge1$.

4. Leave the endpoint open

An excess exponent that tends to zero can still contribute an unbounded factor, such as a power of $\log\log n$, so the theorem does not give κ = 1/2. The selected record stores the open interval (0, 1/2) with the exact witness 4999/10000. The verifier rejects 1/2 and every value above it.

Every fixed κ with 0.4999 < κ < 0.5 already follows from the same theorem, so there is no largest supported witness. Choosing 0.499999 would instantiate another consequence of the theorem, not a new algorithm. The κ-dependent constants and thresholds do not justify a moving target κ(n) that approaches 1/2 at a prescribed rate.

Above the endpoint, the paper's lower bound requires $\Omega(n\sqrt{\log n})$ worst-case time at every sufficiently large length from every exact deterministic multitape multiplier. That excludes every fixed κ > 1/2. The bound assumes variable-count Weak ETH: no deterministic algorithm decides 3-SAT in time $2^{O(v^{1-\eta})}L^{O(1)}$ for any fixed $0&lt;\eta&lt;1$, where $v$ is the number of variables and $L$ the input length. This is weaker than ordinary ETH, since it permits a $2^{O(v/\log v)}$ algorithm. The upper claim does not use it.

Explicit construction at κ = 0.4999

CONSTRUCTION.md specializes the paper's fixed-candidate construction at the selected witness. The following choices fit that construction and its uniform scheduling framework:

Choice Exact value Meaning
Selected saving κ 4999/10000 Required logarithmic exponent 5001/10000
Candidate index j 19998 θ_j = 1/2 + 1/(j+2)
Candidate exponent θ_j 10001/20000 0.50005, strictly below the target 0.5001
Fourier/interchange exponent ρ 20001/40000 Slack for the fixed logarithmic factors
Intermediate interchange exponent γ 40001/80000 Strictly between 1/2 and ρ
Interchange label prime p 240007 Admissible prime for the label construction

The replay checks that p is prime, the exponent ordering and the exact positive margin:

$$\gamma-\left(\frac12+\frac{3p-1}{p^2}\right) =\frac{1760049}{4608268803920000}>0, \qquad \frac12<\gamma<\rho<\theta_j<1-\kappa.$$

The note follows each stage in turn: digit packing, short cyclic axes, CRT order changes, synchronized Fourier/Walsh layers, certified precision, coefficient rounding and carry output. For each stage it identifies the recurrence, movement and visited-space bounds used. This fixed candidate alone suffices for κ = 0.4999. The paper's single scheduler supplies the stronger simultaneous statement for every fixed κ < 1/2.

These are compatible choices for the paper's effective construction, not constants extracted from an upstream executable. The finite interchange and Walsh templates, precision constants, chunk count and complete transition table have not been generated. Their existence and the all-width bounds come from the cited construction. The new checks establish that the displayed parameters are admissible. They do not execute a multiplier or discharge the remaining template obligations.

What changes in the repository

Area Change
certificates/selected-result.json Selects 4999/10000 with supported_savings = (0, 1/2) and no assumptions; previous_record points to the #7000 checkpoint
certificates/nov24-direct/ Claim with exact construction parameters, source manifest and validation scope
research/nov24-direct-multiplication/ Proof and construction notes; eight unmodified upstream files with Git blob IDs and SHA-256 digests
certificates/checkpoints/frontier7000.json Byte-exact #7000 record, replayable with its original verifier
Status docs, task picker, sparse-baseline helper, Makefile, CI Status and CI navigation updated; direct task-picker routes validated, including sparse omissions; sparse-baseline helper routed to the direct verifier; all required workflow triggers covered; historical replay kept through the checkpoint wrapper

Verification

The branch is based on canonical main at e54523517d0f03e58352e647c403a5af3e525a57 (priority revision 8). It needs only the Python standard library and runs offline.

make nov24-direct-verify                                           # direct corollary
python3 -B scripts/verify_nov24_direct.py --kappa 499999/1000000   # another fixed witness below 1/2
python3 -B scripts/replay_frontier7000_checkpoint.py --check-only  # predecessor record
  • Direct corollary and parameters. The eight archived upstream files match a fresh fetch of commit 92b516ef byte for byte and by Git blob and tree identity. The offline replay checks the retained fingerprints without contacting upstream. It also checks the comparator binding: the comparator names OAI.Computability.NearSquareRoot.uniformIntegerMultiplication in solution module OAI.Computability.NearSquareRoot.Main. The remaining checks cover the candidate index, the strict exponent ordering, the primality of p, the exact label margin, the rational specialization and the empty assumption list.
  • Rejection controls. From a clean export of the committed direct source closure, the verifier rejects κ = 1/2, κ = 5001/10000 and a one-byte change to the archived Main.lean. It accepts 4999/10000 and 499999/1000000.
  • Predecessor. In an isolated tree, the #7000 checkpoint passes its original verifier, PASS_FRONTIER7000_BINDINGS_AND_RECORDED_EVIDENCE. This check confirms the bindings and recorded evidence. It is not a new scientific replay.
  • Repository checks. check_selected_ci_inputs.py --require-triggers passes with 22 required paths and no uncovered push or pull-request inputs. git diff --check and four test modules pass: test_nov24_direct.py (9 tests), test_research_baseline_sparse.py (12), test_research_priority_context.py (13) and test_research_current_status.py (6). The new tests reject composite label parameters, inconsistent candidates, zero slack, source tampering, unsupported endpoints and false execution claims. The picker tests cover missing and sparse direct entry points.
  • Earlier broad-suite review. Before this rebase, a review of the earlier local head de3319005 recorded 764 discovered tests, 23 of them skipped. Its remaining failures came from one unchanged fixture absent from the partial checkout; restoring its committed bytes gave a passing 14-test rerun. These are prior-revision results. Fresh verification of this revision is the focused coverage above. Neither a complete all-green run nor a hosted CI run is claimed.
  • Not run. The upstream Lean dependency graph was not built, the comparator was not executed, the finite templates were not generated and no multiplier was run. The complete historical #7000 scientific replay was not rerun. The local replay covers source integrity, scalar construction parameters and the corollary. It does not independently re-establish the theorem.

Where to start reading

Scope

  • Construction and attribution. This is an explicit κ claim obtained by specializing OpenAI's multiplication construction. This PR contributes the construction specialization and dependency account, contract comparison, exact parameter checks, selection record and integration. The underlying algorithm and upstream proof remain attributed to OpenAI.
  • Unconditional upper bound. The upper theorem uses no Weak ETH or other complexity hypothesis, so the record lists no assumptions. Only the paper's separate lower bound depends on Weak ETH.
  • Not independently formalized. Upstream provides a Lean proof and comparator configuration. Neither was built or run here.
  • Endpoint not claimed. κ = 1/2 is outside the claim and is rejected by the verifier.
  • Changes the selected frontier. Merging requires maintainer authorization. The #7000 record and its replay stay available as a checkpoint.

Open next questions

  • The endpoint. Can one fixed-tape machine reach $O(n\sqrt{\log n})$? Deriving that from the present estimate needs $(1+\log n)^{\delta(n)}=O(1)$; $\delta(n)\to0$ alone does not suffice. A different construction could settle the endpoint independently.
  • Materialize the construction. Generate the finite templates and their exact child bills. Then compile their movement, precision, restoration and scheduling operations faithfully into the tape model. The construction note lists these remaining tasks.
  • Independent formal replay. Build the upper comparator at 92b516ef and record its accepted declarations and actual axioms, following the upstream comparator instructions.
  • Repository direction. The proposed witness lies exactly 10⁻⁴ below 1/2. The task catalogue should weigh endpoint, formal-replay and lower-bound work against further grouped-assembly refinements.

None of these questions is used to justify the selected claim.

Literature

  1. OpenAI (2026). “The logarithmic exponent of integer multiplication on tapes.” Preprint, November 24, 2026. release 92b516ef

    The entire scientific input. The uniform multiplication theorem supplies the selected claim. The upper estimate leaves endpoint attainment open. Under variable-count Weak ETH, the multiplication lower bound also excludes every fixed saving above 1/2. The paper also gives one-machine, linear-space upper bounds of the same form for exact division with remainder and the floor integer square root, each with a conditional $\Omega(n\sqrt{\log n})$ lower bound. Those corollaries are outside this certificate, and upstream lists them as unformalized. Paper corollaries · Formalization scope

  2. OpenAI (2026). Lean formalization OAI.Computability.NearSquareRoot and comparator challenge NearSquareRootMultiplication. proof entry · specification

    Used to compare the machine contract field by field and to bind the theorem name. It was archived and hashed here but not built.

  3. David Harvey and Joris van der Hoeven (2025). “Integer multiplication is at least as hard as matrix transposition.” arXiv:2503.22848. arXiv

    The paper's lower bound transfers transposition hardness to multiplication through this reduction. It is context for the endpoint and is not used in the upper claim.

  4. Leonid A. Levin (1973). “Universal sequential search problems.” Problems of Information Transmission 9(3). Math-Net.Ru

    The paper's single machine schedules its candidates as in universal search. That is why one program covers every κ below 1/2.

Attribution

Source Contributor Used here
openai/math 92b516ef OpenAI The algorithm, the upper theorem and its Lean proof
#7000 Jerry Chen Previous selected record; comparison point; retained as a checkpoint
#8101 Chris R Comparison point (open conditional claim)

The grouped-assembly lineage behind #7000 is credited in the #7000 checkpoint and its source packages.

Prepared with substantial AI assistance from OpenAI Codex, GPT-6.2 Astra, Opus 5.5 and ChatGPT Pro. OpenAI supplied the upstream construction and proof. New contribution material is licensed under Apache-2.0.

zxv and others added 5 commits November 25, 2026 06:51
The direct selection no longer carries the separate conditional 0.030
supplier transfer. State the grouped assembly's scoped caps (kappa < 1/33
from b < 1/32 and the layer balance; kappa < 1/4 from the Gaussian range)
from the audit on main, and repin PROOF.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The October 9 audit concerns the PR186 balanced model. Current priorities explicitly exclude its conversion from the later nine-row assembly. Narrow the background claim, pin both citations and refresh the proof digests.
@ahrazzle

Copy link
Copy Markdown
Contributor

bravo

@HalitZiyaKARTAL

Copy link
Copy Markdown

is it better idea to use logn^(0.5+K) this time, since its no longer at the format of 1-K using --K looks weird too so focusing to reducing new K instead until we get below √logn then it can be better to use logn^(0.5-K) again

@zxv zxv changed the title κ = 0.4999 (+0.4963, +13,671.13% over #7000): OpenAI's November tape multiplier gives every fixed κ < 1/2 κ = 0.4999 (+0.4963, +13,671.13% over #7000): OpenAI's tape multiplier gives log exponent 1/2 + ε for every fixed ε > 0 Nov 25, 2026
@VibesCode

Copy link
Copy Markdown

An independent build of the Lean proof cited for κ = 0.4999

We built and checked the Lean proof this PR cites (openai/math at 92b516ef8e2abf66c3db7aa31438d3010bc7956f, theorem
OAI.Computability.NearSquareRoot.uniformIntegerMultiplication : UniformWorstCaseSpec). Results:

  • Build: lake build OAI.Computability.NearSquareRoot.Main succeeds (Lean v4.34.1, Mathlib d13f23b, 12,182 jobs, 1 h 33 m on 4 cores).
  • #print axioms for uniformIntegerMultiplication, uniformMultiplication and sub_nlogn_integer_multiplication:
    propext, Classical.choice, Quot.sound only.
  • Comparator (leanprover/comparator v4.34.0, lean4export v4.34.0, landrun 0.2.0) on
    ComparatorChallenges/NearSquareRootMultiplication.json: "Lean default kernel accepts the solution".
    A second run from a copy with no build outputs for the proof's own files, as a non-root user, with the comparator doing the build, gave the same result.
    Caveat: comparator v4.34.0 is the version before lake comparator; the repository pins Lean 4.34.1, so the newer tool was not used.
  • Statement review: we read UniformWorstCaseSpec and the machine model it uses (finite alphabet, states and tapes; one-cell head
    moves; exact 2n-bit output with all other cells blank; worst case over all inputs at every n ≥ 1; one machine for all n). It matches
    the model in thm:main of this repository's introduction.

The step from δ(n) → 0 to κ = 0.4999, formalized. The PR lists this corollary as open. We proved in Lean, from the comparator's
statement, that for every κ < 1/2 there is one constant C with W(n) ≤ C · n · (lg n)^(1−κ) for every n ≥ 1
(lg n = max(⌈log₂ n⌉, 1)), and in particular for κ = 0.4999. Axioms: propext, Classical.choice, Quot.sound.
File: Corollary.lean (sha256 ffd137e4516928910ba52186df6ecdb21c612a9f60b27aed5a70d6fe856874d9), the comparator file ComparatorChallenges/NearSquareRootMultiplication.lean with its two sorry theorems removed, plus the corollary; checked with lake env lean inside the built project.

Corollary.lean
import Mathlib

/-! # Near-square-root logarithmic overhead for uniform integer multiplication

This independent statement uses the original P192 one-dimensional tape model.
The machine writes the full product, blanks the rest of its output tape, and
counts every distinct tape/address pair seen between initialization and halt.
-/

namespace OAI
namespace Computability

namespace IntegerMultiplication

/-- Exact n steps of a partial deterministic machine before consulting the next step. -/
inductive Trace {X : Type*} (step : X → Option X) : X → ℕ → X → Prop
  | nil (x) : Trace step x 0 x
  | cons {x y z n} : step x = some y → Trace step y n z → Trace step x (1+n) z

namespace TM

inductive Move
  | left
  | stay
  | right

namespace Move
def shift : Move → ℤ
  | left => -1
  | stay => 0
  | right => 1
end Move

/-- Tape seen relative to its head: position i is `pos + i` in absolute coordinates. -/
structure Tape (A : Type*) where
  pos : ℤ
  view : ℤ → A

namespace Tape
variable {A : Type*}

/-- Compute write followed by a move. -/
def apply (op : A × Move) (T : Tape A) : Tape A :=
  ⟨T.pos + op.2.shift,
    fun i => if i + op.2.shift = 0 then op.1 else T.view (i + op.2.shift)⟩

def absolute (T : Tape A) (i : ℤ) : A := T.view (i - T.pos)

def loaded (blank : A) (s : List A) : Tape A :=
  ⟨0, fun i => match i with
    | .ofNat n => s[n]?.getD blank
    | .negSucc _ => blank⟩

end Tape

variable {A Q I : Type}

structure Config (A Q I : Type) where
  pc : Q
  tape : I → Tape A

abbrev Rule (A Q I : Type) := Q → (I → A) → Option (Q × (I → A × Move))

def advance (m : Rule A Q I) (x : Config A Q I) : Option (Config A Q I) :=
  (m x.pc (fun i => (x.tape i).view 0)).map fun (q, o) =>
    ⟨q, fun i => (x.tape i).apply (o i)⟩

/-- Absolute tape contents after writing exactly s and otherwise blank (independent of
current head position). -/
def whole (blank : A) (s : List A) (T : Tape A) : Prop :=
  T.absolute = (Tape.loaded blank s).absolute

end TM

end IntegerMultiplication

namespace IntegerMultiplication
def bitValue (s : List Bool) : ℕ := s.foldl (fun v b => 2*v + b.toNat) 0

end IntegerMultiplication

namespace NearSquareRoot

open IntegerMultiplication Filter
open scoped Topology

noncomputable def initialConfig {A Q I : Type} (start : Q) (inp : I) (bit : Bool → A)
    (sep blank : A) (x y : List Bool) : TM.Config A Q I := by
  classical
  exact ⟨start, fun i => TM.Tape.loaded blank
    (if i = inp then x.map bit ++ [sep] ++ y.map bit else [])⟩

def VisitsAtMost {A Q I : Type} (m : TM.Rule A Q I) (init : TM.Config A Q I)
    (steps cells : ℕ) : Prop :=
  ∃ visited : Finset (I × ℤ), visited.card ≤ cells ∧
    ∀ u : ℕ, u ≤ steps → ∀ c : TM.Config A Q I,
      Trace (TM.advance m) init u c → ∀ i : I, (i, (c.tape i).pos) ∈ visited

def haltingTimes {A Q I : Type} (m : TM.Rule A Q I)
    (load : List Bool → List Bool → TM.Config A Q I) (n : ℕ) : Set ℕ :=
  {t | ∃ x y, x.length = n ∧ y.length = n ∧ ∃ c,
    Trace (TM.advance m) (load x y) t c ∧ TM.advance m c = none}

/-- The maximum is over the actual halting times for all input pairs of length
`n`. A single excess exponent tends to zero for the same machine. -/
def UniformWorstCaseSpec : Prop :=
  ∃ (A Q I : Type) (_ : Finite A) (_ : Finite Q) (_ : Finite I)
    (bit : Bool → A) (sep blank : A) (inp out : I) (start : Q)
    (m : TM.Rule A Q I) (W : ℕ → ℕ) (S : ℕ),
    Function.Injective bit ∧ (∀ b, bit b ≠ sep ∧ bit b ≠ blank) ∧ sep ≠ blank ∧
    (∃ δ : ℕ → ℝ, Tendsto δ atTop (𝓝 0) ∧
      ∀ᶠ n in atTop, (W n : ℝ) ≤ n*(1+Real.log n)^((1 : ℝ) / (2 : ℕ) + δ n)) ∧
    (∀ n : ℕ, 0 < n → IsGreatest
      (haltingTimes m (initialConfig start inp bit sep blank) n) (W n)) ∧
    ∀ n : ℕ, 0 < n → ∀ x y : List Bool, x.length = n → y.length = n →
      let init := initialConfig start inp bit sep blank x y
      ∃ (t : ℕ) (finish : TM.Config A Q I) (z : List Bool),
        Trace (TM.advance m) init t finish ∧ TM.advance m finish = none ∧
        TM.whole blank (z.map bit) (finish.tape out) ∧ z.length = 2*n ∧
        bitValue z = bitValue x*bitValue y ∧ VisitsAtMost m init t (S*n)


end NearSquareRoot

namespace IntegerMultiplication

def Goal : Prop :=
  ∃ (A Q I : Type) (_ : Finite A) (_ : Finite Q) (_ : Finite I)
    (bit : Bool → A) (sep blank : A) (inp out : I)
    (start : Q) (m : TM.Rule A Q I)
    (C : ℕ),
    Function.Injective bit ∧ (∀ b, bit b ≠ blank ∧ bit b ≠ sep) ∧ sep ≠ blank ∧
    ∀ (n : ℕ), 0 < n → ∀ (x y : List Bool), x.length = n → y.length = n →
      ∃ (finish : TM.Config A Q I) (t : ℕ) (z : List Bool),
        (∃ initTape : I → TM.Tape A,
          initTape inp = TM.Tape.loaded blank (x.map bit ++ [sep] ++ y.map bit) ∧
          (∀ i, i ≠ inp → initTape i = TM.Tape.loaded blank []) ∧
          Trace (TM.advance m) { pc := start, tape := initTape } t finish) ∧
        TM.advance m finish = none ∧
        TM.whole blank (z.map bit) (finish.tape out) ∧
        z.length = 2*n ∧ bitValue z = bitValue x * bitValue y ∧
        (t : ℝ) ≤ C * (n : ℝ) *
          ((max 1 (Nat.clog 2 n) : ℕ) : ℝ) ^ ((1 : ℝ) - (2 : ℝ)⁻¹ ^ (182 : ℕ))

end IntegerMultiplication


/-! ## Corollary checked here (not part of the upstream comparator file)

Everything above this point is copied verbatim from
`lean/ComparatorChallenges/NearSquareRootMultiplication.lean` at openai/math commit
`92b516ef8e2abf66c3db7aa31438d3010bc7956f`, with its two `sorry` theorems removed.

The CrocSwap/integer-mult-bounds contract (`upstream/build/sections/00-introduction.tex`,
`thm:main`) reads: "There is one deterministic Turing machine A, with a fixed finite alphabet
and a fixed finite number of one-dimensional tapes, that computes this exact product for every
n ≥ 1 and every pair of n-bit inputs. Its worst-case running time satisfies
T_A(n) = O(n (lg n)^(1-κ))", with lg n = max{⌈log₂ n⌉, 1}, input x#y, output bin_2n(val x · val y).
`Goal` above is upstream's own formal reading of that contract at κ = 2^-182. `GoalK κ` is the
same statement with κ left free; `goalK_two_pow` checks that it is literally `Goal` at 2^-182.
The bound must hold for every n ≥ 1 (not only eventually), with one constant `C`. -/

namespace Corollary

open IntegerMultiplication NearSquareRoot Filter
open scoped Topology

/-- The CrocSwap contract with saving `κ`: one machine, every `n ≥ 1`, every input pair,
time at most `C * n * (lg n)^(1-κ)`. -/
def GoalK (κ : ℝ) : Prop :=
  ∃ (A Q I : Type) (_ : Finite A) (_ : Finite Q) (_ : Finite I)
    (bit : Bool → A) (sep blank : A) (inp out : I)
    (start : Q) (m : TM.Rule A Q I)
    (C : ℕ),
    Function.Injective bit ∧ (∀ b, bit b ≠ blank ∧ bit b ≠ sep) ∧ sep ≠ blank ∧
    ∀ (n : ℕ), 0 < n → ∀ (x y : List Bool), x.length = n → y.length = n →
      ∃ (finish : TM.Config A Q I) (t : ℕ) (z : List Bool),
        (∃ initTape : I → TM.Tape A,
          initTape inp = TM.Tape.loaded blank (x.map bit ++ [sep] ++ y.map bit) ∧
          (∀ i, i ≠ inp → initTape i = TM.Tape.loaded blank []) ∧
          Trace (TM.advance m) { pc := start, tape := initTape } t finish) ∧
        TM.advance m finish = none ∧
        TM.whole blank (z.map bit) (finish.tape out) ∧
        z.length = 2*n ∧ bitValue z = bitValue x * bitValue y ∧
        (t : ℝ) ≤ C * (n : ℝ) *
          ((max 1 (Nat.clog 2 n) : ℕ) : ℝ) ^ ((1 : ℝ) - κ)

/-- Sanity check: at κ = 2^-182 this is exactly upstream's `Goal`. -/
theorem goalK_two_pow : GoalK ((2 : ℝ)⁻¹ ^ (182 : ℕ)) ↔ Goal := Iff.rfl

/-- `1 + ln n ≤ 2 · lg n` for `n ≥ 1`. -/
theorem one_add_log_le (n : ℕ) (hn : 0 < n) :
    1 + Real.log n ≤ 2 * ((max 1 (Nat.clog 2 n) : ℕ) : ℝ) := by
  have h1 : (n : ℝ) ≤ (2 : ℝ) ^ (Nat.clog 2 n) := by
    exact_mod_cast Nat.le_pow_clog (by norm_num) n
  have hpos : (0 : ℝ) < n := by exact_mod_cast hn
  have h2 : Real.log n ≤ (Nat.clog 2 n : ℝ) * Real.log 2 := by
    calc Real.log n ≤ Real.log ((2 : ℝ) ^ Nat.clog 2 n) := Real.log_le_log hpos h1
      _ = _ := by rw [Real.log_pow]
  have hl2 : Real.log 2 < 1 := by
    have := Real.log_two_lt_d9; linarith
  have hc : (0 : ℝ) ≤ Nat.clog 2 n := Nat.cast_nonneg _
  have h3 : (Nat.clog 2 n : ℝ) * Real.log 2 ≤ Nat.clog 2 n := by nlinarith
  have h4 : ((Nat.clog 2 n : ℕ) : ℝ) ≤ ((max 1 (Nat.clog 2 n) : ℕ) : ℝ) := by
    exact_mod_cast le_max_right _ _
  have h5 : (1 : ℝ) ≤ ((max 1 (Nat.clog 2 n) : ℕ) : ℝ) := by
    exact_mod_cast le_max_left _ _
  linarith

/-- View V1: the start configuration carries nothing but the two inputs. The input tape holds
`x # y` and every other tape is blank; no argument depends on `n` except through `x` and `y`,
and `start inp bit sep blank` are fixed by the outer `∃` before `n` is chosen. -/
theorem initialConfig_inp {A Q I : Type} (start : Q) (inp : I) (bit : Bool → A) (sep blank : A)
    (x y : List Bool) :
    (initialConfig start inp bit sep blank x y).tape inp =
      TM.Tape.loaded blank (x.map bit ++ [sep] ++ y.map bit) := by
  simp [initialConfig]

theorem initialConfig_other {A Q I : Type} (start : Q) (inp : I) (bit : Bool → A) (sep blank : A)
    (x y : List Bool) (i : I) (hi : i ≠ inp) :
    (initialConfig start inp bit sep blank x y).tape i = TM.Tape.loaded blank [] := by
  simp [initialConfig, hi]

theorem initialConfig_pc {A Q I : Type} (start : Q) (inp : I) (bit : Bool → A) (sep blank : A)
    (x y : List Bool) : (initialConfig start inp bit sep blank x y).pc = start := rfl

/-- The step PR 8102 uses: the uniform theorem gives the CrocSwap contract for every κ < 1/2,
with the same machine. -/
theorem goalK_of_uniform (h : UniformWorstCaseSpec) (κ : ℝ) (hκ : κ < 1 / 2) : GoalK κ := by
  obtain ⟨A, Q, I, hA, hQ, hI, bit, sep, blank, inp, out, start, m, W, S, hinj, hbit, hsep,
    ⟨δ, hδ, hev⟩, hW, hrun⟩ := h
  have he0 : (0 : ℝ) ≤ 1 - κ := by linarith
  have hδev : ∀ᶠ n in atTop, δ n ≤ 1 / 2 - κ :=
    (hδ.eventually (gt_mem_nhds (by linarith))).mono fun _ h => h.le
  obtain ⟨N, hN⟩ := Filter.eventually_atTop.mp (hev.and hδev)
  let M : ℕ := ∑ k ∈ Finset.range N, W k
  let C : ℕ := ⌈(2 : ℝ) ^ (1 - κ)⌉₊ + M
  refine ⟨A, Q, I, hA, hQ, hI, bit, sep, blank, inp, out, start, m, C, hinj,
    fun b => ⟨(hbit b).2, (hbit b).1⟩, hsep, ?_⟩
  intro n hn x y hx hy
  have hr := hrun n hn x y hx hy
  dsimp only at hr
  obtain ⟨t, finish, z, htr, hhalt, hwhole, hlen, hval, -⟩ := hr
  have htW : t ≤ W n := (hW n hn).2 ⟨x, y, hx, hy, finish, htr, hhalt⟩
  refine ⟨finish, t, z, ⟨(initialConfig start inp bit sep blank x y).tape, ?_, ?_, htr⟩,
    hhalt, hwhole, hlen, hval, ?_⟩
  · simp [initialConfig]
  · intro i hi
    simp [initialConfig, hi]
  -- the time bound
  set lg : ℝ := ((max 1 (Nat.clog 2 n) : ℕ) : ℝ) with hlg
  have hlg1 : (1 : ℝ) ≤ lg := by rw [hlg]; exact_mod_cast le_max_left _ _
  have hpow1 : (1 : ℝ) ≤ lg ^ (1 - κ) := Real.one_le_rpow hlg1 he0
  have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn
  have hC0 : (0 : ℝ) ≤ C := Nat.cast_nonneg _
  have hMC : (M : ℝ) ≤ C := by
    simp only [C, Nat.cast_add]; linarith [Nat.cast_nonneg (α := ℝ) ⌈(2 : ℝ) ^ (1 - κ)⌉₊]
  have h2C : (2 : ℝ) ^ (1 - κ) ≤ C := by
    simp only [C, Nat.cast_add]
    linarith [Nat.le_ceil ((2 : ℝ) ^ (1 - κ)), Nat.cast_nonneg (α := ℝ) M]
  have htW' : (t : ℝ) ≤ W n := by exact_mod_cast htW
  have hone : (1 : ℝ) ≤ (n : ℝ) * lg ^ (1 - κ) := by nlinarith
  by_cases hnN : N ≤ n
  · obtain ⟨hWn, hδn⟩ := hN n hnN
    have hlog0 : (0 : ℝ) ≤ Real.log n := Real.log_nonneg hn1
    have hb1 : (1 : ℝ) ≤ 1 + Real.log n := by linarith
    have hexp : (1 : ℝ) / ((2 : ℕ) : ℝ) + δ n ≤ 1 - κ := by
      push_cast; linarith
    have step1 : (1 + Real.log n) ^ ((1 : ℝ) / ((2 : ℕ) : ℝ) + δ n) ≤ (1 + Real.log n) ^ (1 - κ) :=
      Real.rpow_le_rpow_of_exponent_le hb1 hexp
    have step2 : (1 + Real.log n) ^ (1 - κ) ≤ (2 * lg) ^ (1 - κ) :=
      Real.rpow_le_rpow (by linarith) (by rw [hlg]; exact one_add_log_le n hn) he0
    have step3 : (2 * lg) ^ (1 - κ) = (2 : ℝ) ^ (1 - κ) * lg ^ (1 - κ) :=
      Real.mul_rpow (by norm_num) (by linarith)
    have hp0 : (0 : ℝ) ≤ lg ^ (1 - κ) := by linarith
    have hn0 : (0 : ℝ) ≤ n := by linarith
    calc (t : ℝ) ≤ W n := htW'
      _ ≤ n * (1 + Real.log n) ^ ((1 : ℝ) / ((2 : ℕ) : ℝ) + δ n) := hWn
      _ ≤ n * ((2 : ℝ) ^ (1 - κ) * lg ^ (1 - κ)) := by
          rw [← step3]; exact mul_le_mul_of_nonneg_left (step1.trans step2) hn0
      _ ≤ n * (C * lg ^ (1 - κ)) :=
          mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right h2C hp0) hn0
      _ = C * n * lg ^ (1 - κ) := by ring
  · have hlt : n < N := Nat.lt_of_not_le hnN
    have hWM : W n ≤ M := Finset.single_le_sum (fun k _ => Nat.zero_le (W k))
      (Finset.mem_range.mpr hlt)
    have hWM' : (W n : ℝ) ≤ M := by exact_mod_cast hWM
    calc (t : ℝ) ≤ C := by linarith
      _ = C * 1 := by ring
      _ ≤ C * ((n : ℝ) * lg ^ (1 - κ)) := mul_le_mul_of_nonneg_left hone hC0
      _ = C * n * lg ^ (1 - κ) := by ring

/-- PR 8102's witness κ = 0.4999, and upstream's own κ = 2^-182, both follow. -/
theorem goalK_4999 (h : UniformWorstCaseSpec) : GoalK (4999 / 10000) :=
  goalK_of_uniform h _ (by norm_num)

theorem goal_of_uniform (h : UniformWorstCaseSpec) : Goal :=
  (goalK_two_pow).mp (goalK_of_uniform h _ (by norm_num))

end Corollary

end Computability
end OAI

What the proof depends on. Walking the constants used by the proof term in the built environment, the main theorem uses
OAI.Erdos970.WeightedTorusJets.dirichlet_real_zero_bound, the uniform bound c ≤ (1 − β) log q for real zeros of real primitive
Dirichlet L-functions (OpenAI preprint "Uniform exclusion of Landau–Siegel zeros", Oct 1 2026; see also Banks, arXiv:2610.15483,
and Kerr, arXiv:2610.21099). The route is a Siegel–Walfisz type count for primes in progressions with moduli up to
exp(c (log X)^{1/3}) (large_modulus_siegel_walfisz), used to choose coprime moduli (CoprimeBox.eventually_valid).
So the κ = 0.4999 entry rests on that result as well. Its Lean proof is inside the same build and passed the same kernel check.

What this does not give. The theorem is asymptotic: the Lean proof does not produce an explicit threshold beyond which the
(lg n)^(1−κ) bound holds with a stated constant.

We did not complete the build of the Weak-ETH lower bound (optimal_exponent_of_weakETH): one file needed more than the 15 GB of memory we had.

Measured cost: build 1 h 33 m on 4 cores; comparator 17 m. Tokens: about 199k for lookups; the rest not recorded.
AI-generated using Claude models, directed by VibesCode.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants