AFTD Auto-Formalizing Theoretical Domains

triangle_region

def

For a point $r \in \mathbb{R}^2$ and finite set $P \subset \mathbb{R}^2$, $A_0(r) = \{q \in P : r_x < q_x\}$, $A_1(r) = \{q \in P : r_y < q_y\}$, and $A_2(r) = \{q \in P : q_x + q_y < r_x + r_y\}$.

Statement

noncomputable def triangle_region (P : Finset (ℝ × ℝ)) (r : ℝ × ℝ) (i : Fin 3) : Finset (ℝ × ℝ)
Defined in
arXiv:2611.08835 Section 4, eq. (24)
Verified
09 Nov 2026
Axioms
none listed
Used by 2

Read back from the Lean

The definition triangle_region takes a finite set of points in the plane $P \subseteq \mathbb{R} \times \mathbb{R}$, a reference point $r = (r_1, r_2) \in \mathbb{R} \times \mathbb{R}$, and an index $i \in \{0, 1, 2\}$ (of type Fin 3), and returns the finite subset of $P$ consisting of: - those points $q = (q_1, q_2) \in P$ such that $r_1 < q_1$, if $i = 0$; - those points $q = (q_1, q_2) \in P$ such that $r_2 < q_2$, if $i = 1$; - those points $q = (q_1, q_2) \in P$ such that $q_1 + q_2 < r_1 + r_2$, otherwise (i.e., if $i = 2$).

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 three regions A₀(r), A₁(r), A₂(r) in P defined by coordinates relative to r. -/
noncomputable def triangle_region (P : Finset (ℝ × ℝ)) (r : ℝ × ℝ) (i : Fin 3) : Finset (ℝ × ℝ) := if i = 0 then P.filter (fun q : ℝ × ℝ => r.1 < q.1)
  else if i = 1 then P.filter (fun q : ℝ × ℝ => r.2 < q.2)
  else P.filter (fun q : ℝ × ℝ => q.1 + q.2 < r.1 + r.2)
See it in the graphDiscuss this resultChallenge it