Positions relative to and determine the position relative to or
ProvedMegiddoLP.FixedDim.pair_opposite_slopesLet , let have nonnegative slope and nonpositive slope in the plane, and assume
Let and be the paired hyperplanes. Then there is a rule , depending only on , that takes the two oracle answers (the position of relative to and relative to ) and returns one of the two hyperplanes , together with a position. For every point the returned position is the true position of relative to the returned hyperplane.
This is the claim of p. 119 that "if we know the position of relative to both of these hyperplanes, then we can readily tell the position of relative to one of either or ". Because the slopes have opposite signs, each pair of queries settles one member of each pair of hyperplanes.
Formalization Note The dimension is in Lean and are the indices 0, 1. The hypothesis is the one the page's argument uses ("depending on the sign of "). The page's own hypothesis, "the defining equations of and are linearly independent", does not imply : and are independent, both have slope , and . Under the section's standing normalisation (p. 119: a basis in which for all ), opposite slopes are nonzero and distinct, so ; the hypothesis therefore holds in the setting where the page applies the claim. The page's displayed inequalities print where is meant, and the Lean uses . The rule returns a flag (true for , false for ) and an Ordering.
import Mathlib import Definitions.Def_MegiddoLP_FixedDim_Pairing
/-!
Megiddo, J. ACM 31 (1984), §3.2 pp. 119–120 (Figure 1): if `Hᵢ` has nonnegative slope and
`H_k` nonpositive slope, then the positions of `x*` relative to `H⁽¹⁾_ik` and `H⁽²⁾_ik`
determine its position relative to one of `Hᵢ`, `H_k`. The paper's `x₁, x₂` are the indices
`0, 1` of `Fin (d + 2)`.
-/
namespace MegiddoLP.FixedDim
/-- **The pairing claim.** Let `Hᵢ = {aᵢ ⬝ᵥ x = bᵢ}` have nonnegative slope and
`H_k = {a_k ⬝ᵥ x = b_k}` nonpositive slope in the `(x₁, x₂)` plane, with
`a_k1 a_i2 - a_k2 a_i1 ≠ 0`. There is a rule `F`, depending only on the data, which maps the
oracle's answers for `H⁽¹⁾_ik` and `H⁽²⁾_ik` to a choice of `Hᵢ` (`true`) or `H_k` (`false`)
together with the correct position of `x` relative to the chosen hyperplane, for every `x`. -/
theorem pair_opposite_slopes {d : ℕ} (ai ak : Fin (d + 2) → ℝ) (bi bk : ℝ)
(hi : HasNonnegSlope ai) (hk : HasNonposSlope ak)
(hdet : ak 0 * ai 1 - ak 1 * ai 0 ≠ 0) :
∃ F : Ordering → Ordering → Bool × Ordering, ∀ x : Fin (d + 2) → ℝ,
let r := F (compare (pairNormal1 ai ak ⬝ᵥ x) (pairRhs1 ai ak bi bk))
(compare (pairNormal2 ai ak ⬝ᵥ x) (pairRhs2 ai ak bi bk))
(r.1 = true → compare (ai ⬝ᵥ x) bi = r.2) ∧
(r.1 = false → compare (ak ⬝ᵥ x) bk = r.2) := by sorry
end MegiddoLP.FixedDim
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let , let , and let . Write for the first two coordinates of a vector (positions and in the code).
Hypotheses.
- has nonnegative slope: , or .
- has nonpositive slope: and .
- The determinant condition:
Derived hyperplanes. Define, for every coordinate ,
Claim. There exists a single function with two inputs, each in . Its output is a pair , where is true or false and . The function is chosen depending only on .
For every , let be the relation of to , and the relation of to . Put . Then:
- if is true, stands in relation to ;
- if is false, stands in relation to .
Which of the two original hyperplanes gets reported may vary with the pair of answers.
Degenerate cases.
- . Everything is in .
- The determinant hypothesis excludes , so cannot vanish in both of its first two coordinates.
- No division by zero affects the hypotheses:
- in the nonnegative-slope disjunction, the division occurs only in the branch where may be nonzero;
- the nonpositive slope requires .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.