AFTD Auto-Formalizing Theoretical Domains

qary_canonical_spaced_word

def

For natural numbers t, q, and n with t + 1 ≤ q, the canonical spaced word of length n is the word sending each index i : Fin n to (i.val % (t + 1) : Fin q).

Statement

def qary_canonical_spaced_word (t q n : ℕ) (htq : t + 1 ≤ q) : Fin n → Fin q
Defined in
knowledgebase, OP-1503
Verified
11 Nov 2026
Axioms
none listed
Used by 1

Read back from the Lean

Given natural numbers $t$, $q$, and $n$, together with a hypothesis $htq : t + 1 \le q$, qary_canonical_spaced_word defines a function from Fin n to Fin q (i.e., a word of length $n$ over an alphabet of size $q$) mapping each index $i : \text{Fin } n$ to $i.\text{val} \pmod{t + 1}$, which is strictly less than $q$ because $i.\text{val} \pmod{t + 1} < t + 1 \le q$.

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

/-- Canonical periodic word 0, 1, ..., t, 0, 1, ... of length n over Fin q. -/
def qary_canonical_spaced_word (t q n : ℕ) (htq : t + 1 ≤ q) : Fin n → Fin q := fun i : Fin n => ⟨i.val % (t + 1), lt_of_lt_of_le (Nat.mod_lt _ (Nat.succ_pos t)) htq⟩
See it in the graphDiscuss this resultChallenge it