Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Approach I: 2d−12^{d-1}2d−1 queries settle at least ⌊21−2dn⌋\lfloor 2^{1-2^d}n\rfloor⌊21−2dn⌋ of nnn hyperplanes in Rd\mathbb{R}^dRd

Proved
MegiddoLP.FixedDim.approachI_fraction

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, and let 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,…,ni=1,\dots,ni=1,…,n, be hyperplanes with ai≠0a_i\ne0ai​=0. Then there is a query strategy TTT such that for every unknown point x∈Rdx\in\mathbb{R}^dx∈Rd:

  1. TTT makes at most A(d)=2d−1A(d)=2^{d-1}A(d)=2d−1 queries;
  2. every position that TTT reports is correct;
  3. TTT reports the position of xxx for at least ⌊B(d) n⌋\lfloor B(d)\,n\rfloor⌊B(d)n⌋ of the hyperplanes, where B(d)=21−2dB(d)=2^{1-2^d}B(d)=21−2d:
#{i: T reports the position of x relative to Hi} ≥ ⌊n22d−1⌋.\#\{i:\ T\text{ reports the position of }x\text{ relative to }H_i\}\ \ge\ \Big\lfloor \frac{n}{2^{2^d-1}}\Big\rfloor.#{i: T reports the position of x relative to Hi​} ≥ ⌊22d−1n​⌋.

The constants solve the paper's recursion A(d)=2A(d−1)A(d)=2A(d-1)A(d)=2A(d−1), B(d)=12B(d−1)2B(d)=\tfrac12B(d-1)^2B(d)=21​B(d−1)2 with A(1)=1A(1)=1A(1)=1, B(1)=12B(1)=\tfrac12B(1)=21​. Repeating such a round and discarding the settled hyperplanes is what yields the O(log⁡n)O(\log n)O(logn) query bound and, in linear programming, the linear-time pruning.

Formalization Note The page's "at least BnBnBn hyperplanes" is read as ⌊Bn⌋\lfloor Bn\rfloor⌊Bn⌋ (natural-number division). The page does not say how the non-integer count BnBnBn is rounded. The floor is exactly what the paper's pairing recursion yields: ⌊n/2⌋\lfloor n/2\rfloor⌊n/2⌋ pairs, and ⌊⌊m/2j⌋/2j⌋=⌊m/22j⌋\lfloor\lfloor m/2^j\rfloor/2^j\rfloor=\lfloor m/2^{2j}\rfloor⌊⌊m/2j⌋/2j⌋=⌊m/22j⌋. It coincides with the page whenever 22d−12^{2^d-1}22d−1 divides nnn.

Preamble
import Mathlib
import Definitions.Def_MegiddoLP_FixedDim_QueryTree
Formal statement
/-!
Megiddo, J. ACM 31 (1984), §3.2 pp. 118 and 121 (Approach I): `A(d) = 2^{d-1}` queries
suffice to determine the position of `x*` relative to at least `B(d)·n` of `n` given
hyperplanes in `ℝ^d`, where `B(d) = 2^{1-2^d}`. The count `B(d)·n` is read as
`⌊n / 2^{2^d - 1}⌋`.
-/

namespace MegiddoLP.FixedDim

/-- **Approach I: `A(d) = 2^{d-1}`, `B(d) = 2^{1-2^d}`.** For `d ≥ 1` and `n` hyperplanes
`{aᵢ ⬝ᵥ x = bᵢ}` in `ℝ^d` with `aᵢ ≠ 0`, there is a strategy which, for every unknown point `x`,
makes at most `2^{d-1}` queries and reports correct positions for at least
`⌊n / 2^{2^d - 1}⌋` of the hyperplanes. -/
theorem approachI_fraction (d n : ℕ) (hd : 1 ≤ d) (a : Fin n → Fin d → ℝ) (b : Fin n → ℝ)
    (ha : ∀ i, a i ≠ 0) :
    ∃ T : QTree d (Fin n → Option Ordering), ∀ x : Fin d → ℝ,
      T.numQueries x ≤ 2 ^ (d - 1) ∧
      (∀ i o, T.eval x i = some o → compare (a i ⬝ᵥ x) (b i) = o) ∧
      n / 2 ^ (2 ^ d - 1) ≤ (Finset.univ.filter fun i => (T.eval x i).isSome).card := 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.2, p. 118 (definition of A(d), B(d)) and p. 121 (Approach I, A(d) = 2^{d-1}, B(d) = 2^{1-2^d})
Read-back

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

Setting. Let d,n∈Nd, n \in \mathbb{N}d,n∈N with d≥1d \ge 1d≥1. For each i∈{0,…,n−1}i \in \{0,\dots,n-1\}i∈{0,…,n−1} let ai∈Rda_i \in \mathbb{R}^dai​∈Rd and bi∈Rb_i \in \mathbb{R}bi​∈R. The hypothesis is that every ai≠0a_i \ne 0ai​=0.

Claim. There exists a query tree TTT in Rd\mathbb{R}^dRd, as in the QueryTree definition. Its leaves carry functions assigning to each index iii either no report or a report in {<,=,>}\{<,=,>\}{<,=,>}. For every x∈Rdx \in \mathbb{R}^dx∈Rd:

  1. Query bound: the number of queries on the path of xxx is at most 2d−12^{d-1}2d−1.
  2. Correctness: whenever T(x)T(x)T(x) reports ooo for index iii, ai⋅xa_i\cdot xai​⋅x stands in relation ooo to bib_ibi​.
  3. Coverage: the number of indices receiving a report is at least
⌊n2 2d−1⌋,\left\lfloor \frac{n}{2^{\,2^d - 1}} \right\rfloor,⌊22d−1n​⌋,

using natural-number division, which rounds down.

The tree TTT depends only on ddd, nnn, aaa and bbb.

Degenerate cases.

  • The exponents d−1d-1d−1 and 2d−12^d-12d−1 involve no truncated subtraction, because d≥1d \ge 1d≥1.
  • d=1d = 1d=1. The bounds are 111 query and ⌊n/2⌋\lfloor n/2\rfloor⌊n/2⌋ reports.
  • n<22d−1n < 2^{2^d-1}n<22d−1, including n=0n = 0n=0. The coverage bound is 000. The claim is then met by a single leaf that reports nothing.
  • d=0d = 0d=0. Excluded by hypothesis.
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