Documentation

FormalConjecturesForMathlib.Combinatorics.LatinSquare

structure LatinSquare (n : ) :

A latin square of order n is an n × n matrix with entries in Fin n such that each symbol appears exactly once in every row and exactly once in every column.

Instances For

    There are finitely many latin squares of order n, since each is determined by a matrix in the finite type Matrix (Fin n) (Fin n) (Fin n). This is useful for defining the maximum number of transversals over all latin squares of order n.

    Equations
    • One or more equations did not get rendered due to their size.
    @[reducible, inline]
    abbrev IsTransversal {n : } (L : LatinSquare n) (σ : Fin nFin n) :

    A transversal of a latin square L is a selection of one cell per row, given by a column-selector σ, such that the selected columns are all distinct and the symbols at the selected cells are all distinct.

    Equations
    Instances For
      @[reducible, inline]
      abbrev IsNearTransversal {n : } (L : LatinSquare n) (ρ σ : Fin (n - 1)Fin n) :

      A near-transversal of a latin square L of order n is a selection of n - 1 cells, given by a row-selector ρ and a column-selector σ (both Fin (n - 1) → Fin n), such that the selected rows are all distinct, the selected columns are all distinct, and the symbols at the selected cells are all distinct.

      Equations
      Instances For
        def numTransversals {n : } (L : LatinSquare n) :

        The number of transversals of a latin square L, defined as the cardinality of the type of column-selectors σ : Fin n → Fin n satisfying IsTransversal L σ.

        Equations
        Instances For