AFTD Auto-Formalizing Theoretical Domains

reduced_latin_square_to_perfect_set

def

For a function R : Fin n → Fin n → Fin n with n ≠ 0, reduced_latin_square_to_perfect_set R is the finite set of permutations of Fin n obtained as the image of {r : Fin n | r ≠ 0} under the mapping that sends each r to the permutation given by R r if R r is bijective, and to the identity permutation 1 otherwise.

Statement

noncomputable def reduced_latin_square_to_perfect_set {n : ℕ} [NeZero n]
    (R : Fin n → Fin n → Fin n) : Finset (Equiv.Perm (Fin n))
Defined in
arXiv:2611.07118, Perfect Partitions of Regular Bipartite Graphs, Lemma 1.3
Verified
06 Nov 2026
Axioms
none listed

Read back from the Lean

Given a positive natural number n (with instance [NeZero n]) and a function R : Fin n → Fin n → Fin n, reduced_latin_square_to_perfect_set is defined as the finite set of permutations of Fin n obtained by taking the image of all non-zero elements r ∈ Fin n (i.e., Finset.univ.erase 0) under the map that sends r to the permutation of Fin n induced by R r if R r is bijective, and to the identity permutation 1 otherwise.

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

/-- Extract the set of non-zero row permutations of an n × n matrix. -/
noncomputable def reduced_latin_square_to_perfect_set {n : ℕ} [NeZero n]
    (R : Fin n → Fin n → Fin n) : Finset (Equiv.Perm (Fin n)) := (Finset.univ.erase 0).image fun r =>
    if h : Function.Bijective (R r) then Equiv.ofBijective (R r) h else 1
See it in the graphDiscuss this resultChallenge it