AFTD Auto-Formalizing Theoretical Domains

sweep_query

def

For natural numbers M, N, r, and j, sweep_query M N r j is the finite subset (Finset (Fin M × Fin N)) of vertices p in Fin M × Fin N such that (p.1.val = r ∧ j ≤ p.2.val) ∨ (p.1.val = r + 1 ∧ p.2.val ≤ j).

Statement

def sweep_query (M N : ℕ) (r j : ℕ) : Finset (Fin M × Fin N)
Defined in
arXiv:2611.01281 Section 5, Eq. 4
Verified
04 Nov 2026
Axioms
none listed
Used by 2
  • sweep_query_cardFor all natural numbers M, N, r, and j with r + 1 < M and j < N, the cardinality of the sweep query satisfies (sweep_query M N r j).card =…
  • moving_target_grid_accuracy_le_minFor all M, N ≥ 1, on the M × N rectangular grid (vertices Fin M × Fin N, adjacent when they differ by one in exactly one coordinate) there…

Read back from the Lean

Given natural numbers M, N, r, and j, sweep_query M N r j is defined as the finite subset of Fin M × Fin N consisting of all pairs p such that either: 1. p.1.val = r and j ≤ p.2.val, or 2. p.1.val = r + 1 and p.2.val ≤ j.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The diagonal sweep query T_{r,j} on an M-by-N grid. -/
def sweep_query (M N : ℕ) (r j : ℕ) : Finset (Fin M × Fin N) :=
  Finset.univ.filter fun p => (p.1.val = r ∧ j ≤ p.2.val) ∨ (p.1.val = r + 1 ∧ p.2.val ≤ j)
See it in the graphDiscuss this resultChallenge it