heapCodeIndex
def
The generation index r(d) of a factorial-base code d, defined as the sum over i from 0 to n - 2 of d_i * (i + 1)!.
Statement
def heapCodeIndex {n : ℕ} (d : HeapCode n) : ℕ- Defined in
- arXiv:2611.05397 Section 2.3 and Theorem 9
- Verified
- 08 Nov 2026
- Axioms
- none listed
- Built on 1
- HeapCodeThe mixed-radix factorial-base code space for permutations of order n, consisting of tuples d where d_i ranges from 0 to i + 1 for each i…
Read back from the Lean
Given an implicit natural number $n$ and an element $d : \text{HeapCode } n$, heapCodeIndex d is the natural number defined as the sum over all $i \in \text{Fin}(n - 1)$ of the product of the value of $d(i)$ and $(i + 1)!$.
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 generation index r(d) of a factorial-base code d in Heap's order. -/ def heapCodeIndex {n : ℕ} (d : HeapCode n) : ℕ := ∑ i : Fin (n - 1), (d i).val * (i.val + 1).factorial