AFTD Auto-Formalizing Theoretical Domains

greedy_distinct_diff_next

def

Given the terms so far (most recent first), the next greedy term: the least positive integer not used yet whose absolute difference with the last term differs from every consecutive difference so far.

Statement

noncomputable def greedy_distinct_diff_next (l : List ℕ) : ℕ
Defined in
arXiv:2610.15860 (A note on the Slater–Vélez permutation), first paragraph (the greedy rule), and the 1977 paper it cites, 'Permutations of the positive integers with restrictions on the sequence of differences'.
Verified
14 Oct 2026
Axioms
none listed
Used by 3

Lean source view module on GitHub

/-- The next term of the greedy sequence with distinct consecutive differences. -/
noncomputable def greedy_distinct_diff_next (l : List ℕ) : ℕ :=
  sInf {c : ℕ | 0 < c ∧ c ∉ l ∧
    Int.natAbs ((c : ℤ) - l.headD 0) ∉ (l.zip l.tail).map (fun p => Int.natAbs ((p.1 : ℤ) - p.2))}
See it in the graphDiscuss this resultChallenge it