AFTD Auto-Formalizing Theoretical Domains

signed_relation

def

For a dimension n : ℕ, an index j : ℕ, and a vector x : Fin n → ℝ, signed_relation n j x is the real number (∑ t ∈ Finset.range p, coord (j + t)) - coord (j - 1) - ∑ k ∈ Finset.range (p - 1), coord (n - triangular_number k), where m = n - j + 1, p = dual_cert_p m, and coord i is defined as x ⟨i - 1, by omega⟩ if 1 ≤ i ≤ n and 0 otherwise.

Statement

def signed_relation (n : ℕ) (j : ℕ) (x : Fin n → ℝ) : ℝ
Defined in
arXiv:2611.17360 Definition 3.1
Verified
16 Nov 2026
Axioms
none listed
Built on 2
  • triangular_numberFor any natural number k, the k-th triangular number is defined as k(k+1)/2.
  • dual_cert_pFor each natural number m, p(m) is the largest integer p >= 2 such that p + (p-2)(p-1)/2 < m, or 1 if no such integer exists.
Used by 1
  • sign_chamberFor any natural number n, sign_chamber n is the set of vectors x : Fin n → ℝ such that 1 ≤ signed_relation n (j.val + 1) x for all j : Fin…

Read back from the Lean

Definition of a function signed_relation (n : ℕ) (j : ℕ) (x : Fin n → ℝ) : ℝ, which computes a real number from natural numbers n and j and an n-dimensional real vector x (indexed by Fin n). Let: 1. m = (n - j) + 1 (using natural number subtraction). 2. p = dual_cert_p m, which is the maximum integer $p \in \{2, \dots, m\}$ satisfying $p + \text{triangular\_number}(p - 2) < m$, or $1$ if no such $p$ exists. 3. coord : ℕ → ℝ be the 1-indexed extension of x, mapping $i \in \mathbb{N}$ to $x_{i-1}$ if $1 \le i \le n$, and to $0$ otherwise. The function evaluates to: $$\left( \sum_{t=0}^{p-1} \text{coord}(j + t) \right) - \text{coord}(j - 1) - \sum_{k=0}^{p-2} \text{coord}(n - \text{triangular\_number}(k))$$ where the second sum is over $k \in \{0, \dots, p - 2\}$ (which is empty if $p = 1$), and subtraction on natural number indices is truncating.

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 j-th signed linear relation on a vector x : Fin n → ℝ. -/
def signed_relation (n : ℕ) (j : ℕ) (x : Fin n → ℝ) : ℝ :=
  let m := n - j + 1
  let p := dual_cert_p m
  let coord : ℕ → ℝ := fun i => if h : 0 < i ∧ i ≤ n then x ⟨i - 1, by omega⟩ else 0
  (∑ t ∈ Finset.range p, coord (j + t)) - coord (j - 1) - ∑ k ∈ Finset.range (p - 1), coord (n - triangular_number k)
See it in the graphDiscuss this resultChallenge it