AFTD Auto-Formalizing Theoretical Domains

view_obstruction_ray_dist_abs

theoremverifiedformalization

For every integer vector v in ℤ^n with no zero coordinate, the view-obstruction distance d_n(|v|) equals d_n(v).

Statement

theorem view_obstruction_ray_dist_abs
    (n : ℕ) (v : Fin n → ℤ) (hnz : ∀ i, v i ≠ 0) :
    view_obstruction_ray_dist n (fun i => |v i|) = view_obstruction_ray_dist n v
Formalizes
arXiv:2610.37711 Lemma 2.3(a)
Verified
08 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • view_obstruction_ray_distThe view-obstruction squared distance d_n(v) for an integer direction vector v, defined as the infimum over t ∈ ℝ of the squared distance…
  • int_to_euclideanThe canonical embedding of an integer vector z ∈ ℤ^n into the Euclidean space ℝ^n.
  • view_obstruction_centerThe center point c = (1/2, ..., 1/2) of the shifted lattice in Euclidean space ℝ^n.

Read back from the Lean

For every natural number n, every integer vector v : Fin n → ℤ, and assuming every component of v is nonzero (∀ i, v i ≠ 0), the view_obstruction_ray_dist of the componentwise absolute value vector fun i => |v i| is equal to the view_obstruction_ray_dist of v.

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

The proof, explained

To prove that the view-obstruction ray distance is invariant under coordinatewise absolute values |v|, the distance is expressed as an infimum over scaling parameters t ∈ ℝ and lattice points z ∈ ℤ^n of the squared Euclidean distance to the shifted cube center. The central observation is that reflection around 1/2 maps z ↦ -z - 1, which is an involution on ℤ satisfying (t v_i - (1/2 + (-z_i - 1)))^2 = (t |v_i| - (1/2 + z_i))^2 whenever v_i < 0. Applying this reflection coordinatewise where v_i < 0 defines an involution (hence a bijection) on the integer lattice ℤ^n. Re-indexing the infimum over z ∈ ℤ^n by this bijection preserves the infimum and equates the squared coordinate sums term by term.

  1. The coordinate-flip map is an involution on ℤ.

    For a boolean flag neg ∈ {false, true}, the map sending z ∈ ℤ to -z - 1 if neg is true and to z otherwise is its own inverse, verified by splitting into the two boolean cases.

    lines 1–7

    def view_obstruction_ray_dist_abs_flip_coord (neg : Bool) (z : ℤ) : ℤ :=
      if neg then -z - 1 else z
    
    lemma view_obstruction_ray_dist_abs_flip_coord_involutive (neg : Bool) (z : ℤ) :
        view_obstruction_ray_dist_abs_flip_coord neg (view_obstruction_ray_dist_abs_flip_coord neg z) = z := by
      cases neg <;> simp [view_obstruction_ray_dist_abs_flip_coord]
    
  2. Coordinate-wise reflection defines a bijection (equivalence) of the integer lattice ℤ^n.

    Applying the coordinate flip independently to each coordinate according to a vector of boolean flags produces an equivalence on ℤ^n, since the map is an involution in each coordinate.

    lines 8–13

    uses view_obstruction_ray_dist_abs_flip_coord_involutive

    def view_obstruction_ray_dist_abs_flip_equiv {n : ℕ} (neg : Fin n → Bool) : (Fin n → ℤ) ≃ (Fin n → ℤ) where
      toFun z i := view_obstruction_ray_dist_abs_flip_coord (neg i) (z i)
      invFun z i := view_obstruction_ray_dist_abs_flip_coord (neg i) (z i)
      left_inv z := by ext i; apply view_obstruction_ray_dist_abs_flip_coord_involutive
      right_inv z := by ext i; apply view_obstruction_ray_dist_abs_flip_coord_involutive
    
  3. When v < 0, the squared coordinate distance for v using the reflected integer -z - 1 equals that for |v| using z.

    When v < 0, we have |v| = -v. Unfolding the coordinate flip, t * v - (1/2 + (-z - 1)) equals -(t * (-v) - (1/2 + z)). Squaring both sides eliminates the negative sign, yielding the equality.

    lines 14–27

    uses decide_eq_true_iff, abs_of_neg

    lemma view_obstruction_ray_dist_abs_coord_sq_eq (t : ℝ) (v z : ℤ) :
        (t * (v : ℝ) - (1/2 + (view_obstruction_ray_dist_abs_flip_coord (decide (v < 0)) z : ℝ)))^2 =
        (t * ((|v| : ℤ) : ℝ) - (1/2 + (z : ℝ)))^2 := by
      dsimp [view_obstruction_ray_dist_abs_flip_coord]
      split_ifs with h
      · rw [decide_eq_true_iff] at h
        have hv : ((|v| : ℤ) : ℝ) = - (v : ℝ) := by
          push_cast
          exact_mod_cast abs_of_neg h
        rw [hv]
        have : t * (v : ℝ) - (1/2 + ((-z - 1 : ℤ) : ℝ)) = - (t * - (v : ℝ) - (1/2 + (z : ℝ))) := by
          push_cast; ring
        rw [this]
        ring
  4. When v ≥ 0, the squared coordinate distance for v using z equals that for |v| using z.

    When v is not strictly negative, 0 ≤ v, so |v| = v and the coordinate reflection is the identity, making the two squared terms trivially identical.

    lines 28–34

    uses decide_eq_true_iff, not_lt.mp, abs_of_nonneg

      · rw [decide_eq_true_iff] at h
        have hv : ((|v| : ℤ) : ℝ) = (v : ℝ) := by
          have : 0 ≤ v := not_lt.mp h
          push_cast
          exact_mod_cast abs_of_nonneg this
        rw [hv]
    
  5. The squared Euclidean distance from t • v to the shifted center c + z is the sum of coordinate squared differences.

    By definition of the Euclidean norm on ℝ^n, the squared norm ‖t • v - (c + z)‖^2 expands into the sum over all coordinates i of (t v_i - (1/2 + z_i))^2.

    lines 35–40

    uses EuclideanSpace.real_norm_sq_eq

    lemma view_obstruction_ray_dist_abs_norm_sq_eq_sum (n : ℕ) (t : ℝ) (v z : Fin n → ℤ) :
        ‖t • int_to_euclidean n v - (view_obstruction_center n + int_to_euclidean n z)‖ ^ 2 =
        ∑ i, (t * (v i : ℝ) - (1/2 + (z i : ℝ))) ^ 2 := by
      rw [EuclideanSpace.real_norm_sq_eq]
      rfl
    
  6. It suffices to show that for every scaling parameter t ∈ ℝ, the infima over z ∈ ℤ^n for |v| and v coincide.

    Unfolding the definition of the view-obstruction ray distance as an infimum over t ∈ ℝ followed by an infimum over z ∈ ℤ^n, stripping the outer infimum reduces the goal to proving equality of the inner infima for an arbitrary fixed t.

    lines 41–48

    /-- Lemma 2.3(a): View-obstruction distance is invariant under coordinatewise absolute values. -/
    theorem view_obstruction_ray_dist_abs
        (n : ℕ) (v : Fin n → ℤ) (hnz : ∀ i, v i ≠ 0) :
        view_obstruction_ray_dist n (fun i => |v i|) = view_obstruction_ray_dist n v := by
      have _ := hnz
      dsimp [view_obstruction_ray_dist]
      congr 1
      ext t
  7. Re-indexing by the coordinate-flip bijection reduces the equality of infima over z ∈ ℤ^n to pointwise equality at each lattice point z.

    Let e be the equivalence on ℤ^n that flips coordinate i whenever v_i < 0. Because e is a bijection, precomposing by e does not change the infimum over ℤ^n. Stripping the infimum reduces the goal to equality of the squared norms for |v| at z and for v at e(z).

    lines 49–52

    uses Equiv.iInf_comp

      let e := view_obstruction_ray_dist_abs_flip_equiv (n := n) (fun i => decide (v i < 0))
      conv_rhs => rw [← Equiv.iInf_comp e]
      congr 1
      ext z
  8. The squared Euclidean distance for |v| at z equals that for v at e(z).

    Rewriting both squared Euclidean norms as coordinate sums using view_obstruction_ray_dist_abs_norm_sq_eq_sum, the goal reduces to coordinate-wise equality. At each index i, the terms match by view_obstruction_ray_dist_abs_coord_sq_eq.

    lines 53–57

    uses view_obstruction_ray_dist_abs_norm_sq_eq_sum, view_obstruction_ray_dist_abs_coord_sq_eq

      rw [view_obstruction_ray_dist_abs_norm_sq_eq_sum, view_obstruction_ray_dist_abs_norm_sq_eq_sum]
      congr 1
      ext i
      dsimp [e, view_obstruction_ray_dist_abs_flip_equiv]
      exact (view_obstruction_ray_dist_abs_coord_sq_eq t (v i) (z i)).symm
view_obstruction_ray_dist_abs_flip_coord_involutive
The coordinate-flip map z ↦ -z - 1 is an involution on ℤ, meaning applying it twice yields z.
decide_eq_true_iff
A decidable proposition p evaluates to true under decide if and only if p holds.
abs_of_neg
If an element a of an ordered additive group satisfies a < 0, then its absolute value |a| equals -a.
not_lt.mp
In a linear order, if a is not strictly less than b, then b ≤ a.
abs_of_nonneg
If an element a of an ordered additive group satisfies 0 ≤ a, then its absolute value |a| equals a.
EuclideanSpace.real_norm_sq_eq
The squared Euclidean norm of a vector in Euclidean space is the sum of the squares of its coordinates.
Equiv.iInf_comp
Precomposing an indexed family with an equivalence (bijection) of the index set preserves the infimum.
view_obstruction_ray_dist_abs_norm_sq_eq_sum
The squared Euclidean distance ‖t v - (c + z)‖^2 equals the sum over coordinates i of (t v_i - (1/2 + z_i))^2.
view_obstruction_ray_dist_abs_coord_sq_eq
For any coordinate, (t v - (1/2 + flip(v < 0, z)))^2 = (t |v| - (1/2 + z))^2.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

def view_obstruction_ray_dist_abs_flip_coord (neg : Bool) (z : ℤ) : ℤ :=  if neg then -z - 1 else zlemma view_obstruction_ray_dist_abs_flip_coord_involutive (neg : Bool) (z : ℤ) :    view_obstruction_ray_dist_abs_flip_coord neg (view_obstruction_ray_dist_abs_flip_coord neg z) = z := by  cases neg <;> simp [view_obstruction_ray_dist_abs_flip_coord]def view_obstruction_ray_dist_abs_flip_equiv {n : ℕ} (neg : Fin n → Bool) : (Fin n → ℤ) ≃ (Fin n → ℤ) where  toFun z i := view_obstruction_ray_dist_abs_flip_coord (neg i) (z i)  invFun z i := view_obstruction_ray_dist_abs_flip_coord (neg i) (z i)  left_inv z := by ext i; apply view_obstruction_ray_dist_abs_flip_coord_involutive  right_inv z := by ext i; apply view_obstruction_ray_dist_abs_flip_coord_involutivelemma view_obstruction_ray_dist_abs_coord_sq_eq (t : ℝ) (v z : ℤ) :    (t * (v : ℝ) - (1/2 + (view_obstruction_ray_dist_abs_flip_coord (decide (v < 0)) z : ℝ)))^2 =    (t * ((|v| : ℤ) : ℝ) - (1/2 + (z : ℝ)))^2 := by  dsimp [view_obstruction_ray_dist_abs_flip_coord]  split_ifs with h  · rw [decide_eq_true_iff] at h    have hv : ((|v| : ℤ) : ℝ) = - (v : ℝ) := by      push_cast      exact_mod_cast abs_of_neg h    rw [hv]    have : t * (v : ℝ) - (1/2 + ((-z - 1 : ℤ) : ℝ)) = - (t * - (v : ℝ) - (1/2 + (z : ℝ))) := by      push_cast; ring    rw [this]    ring  · rw [decide_eq_true_iff] at h    have hv : ((|v| : ℤ) : ℝ) = (v : ℝ) := by      have : 0 ≤ v := not_lt.mp h      push_cast      exact_mod_cast abs_of_nonneg this    rw [hv]lemma view_obstruction_ray_dist_abs_norm_sq_eq_sum (n : ℕ) (t : ℝ) (v z : Fin n → ℤ) :    ‖t • int_to_euclidean n v - (view_obstruction_center n + int_to_euclidean n z)‖ ^ 2 =    ∑ i, (t * (v i : ℝ) - (1/2 + (z i : ℝ))) ^ 2 := by  rw [EuclideanSpace.real_norm_sq_eq]  rfl/-- Lemma 2.3(a): View-obstruction distance is invariant under coordinatewise absolute values. -/theorem view_obstruction_ray_dist_abs    (n : ℕ) (v : Fin n → ℤ) (hnz : ∀ i, v i ≠ 0) :    view_obstruction_ray_dist n (fun i => |v i|) = view_obstruction_ray_dist n v := by  have _ := hnz  dsimp [view_obstruction_ray_dist]  congr 1  ext t  let e := view_obstruction_ray_dist_abs_flip_equiv (n := n) (fun i => decide (v i < 0))  conv_rhs => rw [← Equiv.iInf_comp e]  congr 1  ext z  rw [view_obstruction_ray_dist_abs_norm_sq_eq_sum, view_obstruction_ray_dist_abs_norm_sq_eq_sum]  congr 1  ext i  dsimp [e, view_obstruction_ray_dist_abs_flip_equiv]  exact (view_obstruction_ray_dist_abs_coord_sq_eq t (v i) (z i)).symm
See it in the graphDiscuss this resultChallenge it