AFTD Auto-Formalizing Theoretical Domains

HeapCode

def

The 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 from 0 to n - 2.

Statement

def HeapCode (n : ℕ) : Type
Defined in
arXiv:2611.05397 Section 2.3
Verified
08 Nov 2026
Axioms
none listed
Used by 2
  • heapCodeIndexThe 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)!.
  • heapUnrankThe Heap permutation unranking map heapUnrank assigns to each dimension n : ℕ and factorial-base code d : HeapCode n a permutation of Fin…

Read back from the Lean

Given a natural number n, HeapCode n is the type of dependent functions mapping each index i : Fin (n - 1) to an element of Fin (i.val + 2).

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 factorial-base code space for permutations of order n. -/
def HeapCode (n : ℕ) : Type := (i : Fin (n - 1)) → Fin (i.val + 2)
See it in the graphDiscuss this resultChallenge it