Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The lookup contract

Proved
DetANN.HPIM.lookupTree_spec

by milia · Nov 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

approximate-nearest-neighborcomputational-geometrydata-structures

Let m≥1m\ge1m≥1, let P1,…,Pn∈RmP_1,\dots,P_n\in\mathbb R^mP1​,…,Pn​∈Rm with n≥1n\ge1n≥1, r>0r>0r>0 and δ∈(0,1/2)\delta\in(0,1/2)δ∈(0,1/2). The lookup structure Z=lookupTree(P,r,1+δ/4)Z=\mathrm{lookupTree}(P,r,1+\delta/4)Z=lookupTree(P,r,1+δ/4) (definition DetANN_HPIMTree):

  1. satisfies the near-neighbour contract at radius rrr and factor 1+δ/41+\delta/41+δ/4: an answer iii has ∥q−Pi∥≤(1+δ/4)r\|q-P_i\|\le(1+\delta/4)r∥q−Pi​∥≤(1+δ/4)r, and a null answer means ∥q−Pj∥>r\|q-P_j\|>r∥q−Pj​∥>r for all jjj;
  2. visits at most 5⌊log⁡2(2F)⌋+75\lfloor\log_2(2F)\rfloor+75⌊log2​(2F)⌋+7 nodes at every query, where F=⌈n(212/ε)2m⌉+1F=\lceil n(2^{12}/\varepsilon)^{2m}\rceil+1F=⌈n(212/ε)2m⌉+1 and ε=δ/4\varepsilon=\delta/4ε=δ/4.

This is the interface between the certified BSPs and the HPIM search. The visit bound is O(mlog⁡(n/δ))O(m\log(n/\delta))O(mlog(n/δ)).

Preamble
import Mathlib
import Definitions.Def_DetANN_HPIMTree
Formal statement
namespace DetANN.HPIM

/-- **The lookup contract.** For `m ≥ 1`, `n ≥ 1` points `P_i ∈ ℝ^m`, `r > 0` and `δ ∈ (0, 1/2)`, the
lookup structure `lookupTree P r (1 + δ/4) δ` satisfies the near-neighbour contract at radius `r` and
factor `1 + δ/4`, and visits at most `5 ⌊log₂(2 · bspFuel n m δ)⌋ + 7` nodes at every query. -/
theorem lookupTree_spec {m : ℕ} (hm : 1 ≤ m) {n : ℕ} (hn : 1 ≤ n)
    (P : Fin n → EuclideanSpace ℝ (Fin m)) (r δ : ℝ) (hr : 0 < r) (hδ : 0 < δ) (hδ' : δ < 1 / 2) :
    NearNbrSpec P r (1 + δ / 4) (lookupTree (fun i j => P i j) r (1 + δ / 4) δ) ∧
    ∀ q : Fin m → ℝ, (lookupTree (fun i j => P i j) r (1 + δ / 4) δ).visits q ≤
      5 * Nat.log 2 (2 * bspFuel n m δ) + 7 := by sorry

end DetANN.HPIM
Source
Original, written for the mission 'Deterministic Approximate Nearest Neighbors in High Dimensions' as part of a floor-free proof of DetANN.lemma_3_3 (Feng, Indyk, STOC 2027 submission, Lemma 3.3, p.7). The search tree follows Har-Peled, Indyk, Motwani, Approximate nearest neighbor: towards removing the curse of dimensionality, Theory of Computing 8 (2012), §2, made deterministic and floor-free.

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