Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

C(d)log⁡nC(d)\log nC(d)logn queries locate x∗x^*x∗ relative to all nnn hyperplanes in Rd\mathbb{R}^dRd

Proved
MegiddoLP.FixedDim.log_queries_all

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

multidimensional-searchp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1prune-and-searchquery-complexity

Let d≥1d\ge1d≥1. There is a constant C=C(d)C=C(d)C=C(d), independent of nnn, with the following property. For every n≥2n\ge2n≥2 and all hyperplanes Hi={x∈Rd:aiTx=bi}H_i=\{x\in\mathbb{R}^d: a_i^Tx=b_i\}Hi​={x∈Rd:aiT​x=bi​} (i=1,…,n)(i=1,\dots,n)(i=1,…,n) with ai≠0a_i\neq0ai​=0, there is a query strategy TTT which, for every unknown point x∈Rdx\in\mathbb{R}^dx∈Rd, outputs the positions of xxx relative to all nnn hyperplanes and makes

qT(x)≤C⋅log⁡nq_T(x)\le C\cdot\log nqT​(x)≤C⋅logn

queries.

This is the paper's multidimensional search theorem. Linear programming uses it through the oracle of §4, which answers each query by solving linear programs in one dimension fewer.

Formalization Note CCC is chosen before nnn and the data. log⁡\loglog is the natural logarithm, and another base changes only CCC. The restriction n≥2n\ge2n≥2 is needed because Clog⁡1=0C\log1=0Clog1=0 while one hyperplane in general needs one query. The output is the full vector of positions (Fin n → Ordering), and it must be correct for every xxx.

Preamble
import Mathlib
import Definitions.Def_MegiddoLP_FixedDim_QueryTree
Formal statement
/-!
Megiddo, J. ACM 31 (1984), §3.1–§3.2 p. 118: for every dimension `d` there is a constant
`C = C(d)`, independent of `n`, such that `C · log n` queries suffice to determine the
position of `x*` relative to all `n` given hyperplanes in `ℝ^d`.
-/

namespace MegiddoLP.FixedDim

/-- **Multidimensional search with `C(d) log n` queries.** For `d ≥ 1` there is a constant `C`
such that for every `n ≥ 2` and all hyperplanes `{aᵢ ⬝ᵥ x = bᵢ}` (`i < n`) in `ℝ^d` with
`aᵢ ≠ 0`, some strategy determines, for every unknown point `x`, the positions of `x` relative
to all `n` hyperplanes using at most `C log n` queries (natural logarithm). -/
theorem log_queries_all (d : ℕ) (hd : 1 ≤ d) :
    ∃ C : ℝ, ∀ n : ℕ, 2 ≤ n → ∀ (a : Fin n → Fin d → ℝ) (b : Fin n → ℝ), (∀ i, a i ≠ 0) →
      ∃ T : QTree d (Fin n → Ordering), ∀ x : Fin d → ℝ,
        T.eval x = (fun i => compare (a i ⬝ᵥ x) (b i)) ∧
        (T.numQueries x : ℝ) ≤ C * Real.log n := by sorry

end MegiddoLP.FixedDim
Source
Megiddo, Linear Programming in Linear Time When the Dimension Is Fixed, J. ACM 31(1) (1984) 114–127, §3.1 and §3.2, p. 118 (C(d)·log n queries suffice)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting. Let d∈Nd \in \mathbb{N}d∈N with d≥1d \ge 1d≥1.

Claim. There exists a real constant CCC, chosen depending only on ddd, with the following property. For every natural number n≥2n \ge 2n≥2, and all vectors a0,…,an−1∈Rda_0,\dots,a_{n-1} \in \mathbb{R}^da0​,…,an−1​∈Rd and reals b0,…,bn−1b_0,\dots,b_{n-1}b0​,…,bn−1​ with every ai≠0a_i \ne 0ai​=0, there exists a query tree TTT in Rd\mathbb{R}^dRd whose leaves carry functions assigning to each iii a value in {<,=,>}\{<,=,>\}{<,=,>}. For every x∈Rdx \in \mathbb{R}^dx∈Rd:

  1. Complete and correct: for all iii, T(x)T(x)T(x) assigns to iii exactly the relation of ai⋅xa_i\cdot xai​⋅x to bib_ibi​.
  2. Query bound:
NT(x)≤Cln⁡n,N_T(x) \le C \ln n,NT​(x)≤Clnn,

where NT(x)N_T(x)NT​(x) is the number of queries on the path of xxx and ln⁡\lnln is the natural logarithm.

Degenerate cases.

  • n∈{0,1}n \in \{0,1\}n∈{0,1}. Excluded by the hypothesis n≥2n \ge 2n≥2.
  • For n≥2n \ge 2n≥2, ln⁡n>0\ln n > 0lnn>0, so no default value of the logarithm arises.
  • d=0d = 0d=0. Excluded by hypothesis.
  • The constant CCC is an arbitrary real a priori. Its existence is asserted uniformly over all n≥2n \ge 2n≥2 and all admissible data.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me