AFTD Auto-Formalizing Theoretical Domains

pyranim_seq_first_empty

def

pyranim_seq_first_empty n l is the least j with 0 < j < n+1 and l(j) = j+2, that is the first column after the first one that is empty; it is 0 if no such index exists.

Statement

noncomputable def pyranim_seq_first_empty (n : ℕ) (l : Fin (n + 1) → Fin (n + 3)) : ℕ
Source
step towards pyranim_card_stable_positions
Verified
13 Nov 2026
Axioms
none listed
Built on 1
  • pyranim_fin_lookupFor l : Fin m → Fin (m+2), pyranim_fin_lookup m l j is the ℕ-th value of l when j < m, and the default m+2 otherwise, so that sequences…

Lean source view module on GitHub

/-- The least index at which the sequence has an empty column (value j+2), or 0 if there is none. -/
noncomputable def pyranim_seq_first_empty (n : ℕ) (l : Fin (n + 1) → Fin (n + 3)) : ℕ := by
  classical
  exact if h : ∃ j, 0 < j ∧ j < n + 1 ∧ pyranim_fin_lookup (n + 1) l j = j + 2 then Nat.find h else 0
See it in the graphDiscuss this resultChallenge it