One query settles half of hyperplanes in : ,
ProvedMegiddoLP.FixedDim.one_query_halvesLet and let be nonzero reals and reals, defining the "hyperplanes" of the line. Then there is a query strategy (a hyperplane-query decision tree built from the data) such that for every unknown point :
- makes at most one query on ;
- every position that reports for is correct: if reports "", "" or "" for , then , or respectively;
- reports a position for at least half of the hyperplanes:
This is the one-dimensional base of Megiddo's multidimensional search. A query at the median of the points settles every point on the far side of the median. In the paper's notation, query suffices for a fraction of the hyperplanes.
Formalization Note Points are Fin 1 → ℝ, and each is a nonzero vector in . The strategy's output assigns to each either nothing or a position (Option Ordering). "Half" is stated as settled, which for odd means at least .
import Mathlib import Definitions.Def_MegiddoLP_FixedDim_QueryTree
/-!
Megiddo, J. ACM 31 (1984), §3.1 p. 117 and §3.2 p. 118: in dimension one a single query
(at the median) settles the position of `x*` relative to at least half of `n` given
hyperplanes, i.e. `A(1) = 1`, `B(1) = 1/2`.
-/
namespace MegiddoLP.FixedDim
/-- **`A(1) = 1`, `B(1) = 1/2`.** For `n` hyperplanes `{x ∈ ℝ | aᵢ x = bᵢ}` with `aᵢ ≠ 0`
there is a strategy making at most one query which, for every unknown point `x`, reports
correct positions (`lt`/`eq`/`gt` of `aᵢ x` against `bᵢ`) for at least half of the hyperplanes
(`n ≤ 2 · #settled`). -/
theorem one_query_halves (n : ℕ) (a : Fin n → Fin 1 → ℝ) (b : Fin n → ℝ)
(ha : ∀ i, a i ≠ 0) :
∃ T : QTree 1 (Fin n → Option Ordering), ∀ x : Fin 1 → ℝ,
T.numQueries x ≤ 1 ∧
(∀ i o, T.eval x i = some o → compare (a i ⬝ᵥ x) (b i) = o) ∧
n ≤ 2 * (Finset.univ.filter fun i => (T.eval x i).isSome).card := by sorry
end MegiddoLP.FixedDim
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let . For each index let , viewed as a real number, and . The only hypothesis is that each .
Claim. There exists a query tree , as in the QueryTree definition: a finite ternary tree of hyperplane queries in . Its leaves carry functions assigning to each index either "no report" or a report . For every point , with the resulting assignment and the number of queries on the path followed by :
- At most one query: .
- Correctness: for every and every , if reports for index , then stands in relation to . That is, , , or respectively.
- Coverage:
Equivalently, at least indices receive a report.
The tree is chosen once, depending on , and , and must then work for every . Its reports depend on only through the answer to the at most one query.
Degenerate cases.
- . The claim holds with a single leaf that reports nothing.
- . Coverage forces the single index to be reported, correctly, for every , using at most one query.
- The hypothesis is satisfiable for every .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.