Documentation

Atlas.ProbabilisticMethodsInCombinatorics.code.Chapter6.LatinSquares

structure LatinSquares.IsLatinSquare {n : } (L : Fin nFin nFin n) :

An $n \times n$ array $L : \text{Fin}\ n \to \text{Fin}\ n \to \text{Fin}\ n$ is a Latin square if every row and every column is a permutation of $\{0,1,\dots,n-1\}$, equivalently if every row map and every column map is injective.

Instances For
    def LatinSquares.HasLatinTransversal {n : } (L : Fin nFin nFin n) :

    An $n \times n$ array $L$ has a Latin transversal if there exists a permutation $\sigma$ of $\text{Fin}\ n$ such that the diagonal entries $L_{i,\sigma(i)}$ are all distinct.

    Instances For
      theorem ryser_conjecture {n : } (hn : Odd n) (L : Fin nFin nFin n) (hL : LatinSquares.IsLatinSquare L) :

      Ryser's conjecture: every $n \times n$ Latin square with $n$ odd has a Latin transversal.

      noncomputable def LatinSquares.transversalSymbols {n : } (L : Fin nFin nFin n) (σ : Equiv.Perm (Fin n)) :

      The set of symbols appearing on the diagonal selected by the permutation $\sigma$, i.e. $\{L_{i,\sigma(i)} : i \in \text{Fin}\ n\}$.

      Instances For
        theorem ryser_brualdi_stein_conjecture {n : } {L : Fin nFin nFin n} (hL : LatinSquares.IsLatinSquare L) (hn : Even n) :

        Ryser–Brualdi–Stein conjecture: every $n \times n$ Latin square with $n$ even admits a permutation $\sigma$ such that the diagonal $\{L_{i,\sigma(i)}\}$ contains at least $n-1$ distinct symbols (a near-transversal).

        def ErdosSpencer.symbolCount {n : } {α : Type u_1} [DecidableEq α] (L : Fin nFin nα) (c : α) :

        The number of cells of the array $L$ whose entry equals the symbol $c$, i.e. $|\{(i,j) : L_{i,j} = c\}|$.

        Instances For
          def ErdosSpencer.HasLatinTransversalGen {n : } {α : Type u_1} (L : Fin nFin nα) :

          Generalised notion of a Latin transversal for an array with entries in an arbitrary type $\alpha$: a permutation $\sigma$ such that the selected diagonal entries $L_{i,\sigma(i)}$ are all distinct.

          Instances For
            def ErdosSpencer.goodPerms {n : } {α : Type u_1} [DecidableEq α] (L : Fin nFin nα) :

            The finite set of permutations $\sigma$ that yield a Latin transversal of $L$: distinct rows pick distinct symbols.

            Instances For
              theorem ErdosSpencer.mem_goodPerms_iff {n : } {α : Type u_1} [DecidableEq α] (L : Fin nFin nα) (σ : Equiv.Perm (Fin n)) :
              σ goodPerms L Function.Injective fun (i : Fin n) => L i (σ i)

              Membership in goodPerms L is equivalent to the diagonal map $i \mapsto L_{i,\sigma(i)}$ being injective.

              theorem ErdosSpencer.lll_latin_transversal_nonempty {n : } {α : Type u_1} [DecidableEq α] (hn : 2 n) (L : Fin nFin nα) (hL : ∀ (c : α), (symbolCount L c) n / (4 * Real.exp 1)) :

              Lopsided LLL application underlying Erdős–Spencer: for $n \ge 2$, if every symbol of the $n \times n$ array $L$ appears at most $n/(4e)$ times, then the set of permutations producing a Latin transversal is nonempty.

              theorem ErdosSpencer.erdos_spencer_latin_transversal {n : } {α : Type u_1} [DecidableEq α] (hn : 0 < n) (L : Fin nFin nα) (hL : ∀ (c : α), (symbolCount L c) n / (4 * Real.exp 1)) :

              Erdős–Spencer 1991 (Theorem 6.5.11): if $L$ is an $n \times n$ array (with $n \ge 1$) in which every symbol appears at most $n/(4e)$ times, then $L$ has a Latin transversal.