AFTD Auto-Formalizing Theoretical Domains

perfect_set_to_reduced_latin_square

def

For a positive natural number n, a finite set S of permutations of Fin n, and two elements r, j : Fin n, perfect_set_to_reduced_latin_square S r j equals j if r = 0; if r ≠ 0 and there exists a permutation σ ∈ S such that σ 0 = r, it equals σ j for a chosen such σ; and if no such permutation exists in S, it equals j.

Statement

noncomputable def perfect_set_to_reduced_latin_square {n : ℕ} [NeZero n]
    (S : Finset (Equiv.Perm (Fin n))) (r j : Fin n) : 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, a finite set S of permutations of Fin n, and two elements r, j ∈ Fin n, perfect_set_to_reduced_latin_square S r j defines an element of Fin n by: - if r = 0, returning j; - otherwise, if there exists a permutation σ ∈ S such that σ(0) = r, returning σ(j) for an arbitrarily chosen such permutation σ (via Classical.choose); - otherwise, returning j.

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

/-- Reconstruct a reduced Latin square from a perfect set of permutations. -/
noncomputable def perfect_set_to_reduced_latin_square {n : ℕ} [NeZero n]
    (S : Finset (Equiv.Perm (Fin n))) (r j : Fin n) : Fin n := if r = 0 then j
  else if h : ∃ σ ∈ S, σ 0 = r then (Classical.choose h) j
  else j
See it in the graphDiscuss this resultChallenge it