Definition of mutually orthogonal Latin squares
DefinitionMOLSA pair of Latin squares over the same symbol set are mutually orthogonal if, when superimposed, the pairs of symbols in each cell are distinct.
Definition code
import Mathlib.Data.Fintype.Prod /-- Structure holding a pair of mutually orthogonal Latin squares. -/ @[ext] structure MOLS (n : ℕ) where /-- The pair of Latin squares as a function from coordinates to symbol pairs -/ f : Fin n × Fin n → Fin n × Fin n /-- No two symbol pairs repeat -/ f_inj : f.Injective /-- No two symbols repeat in a row for the first square -/ r₁_inj (r) : (fun c ↦ (f (r, c)).1).Injective /-- No two symbols repeat in a row for the second square -/ r₂_inj (r) : (fun c ↦ (f (r, c)).2).Injective /-- No two symbols repeat in a column for the first square -/ c₁_inj (c) : (fun r ↦ (f (r, c)).1).Injective /-- No two symbols repeat in a column for the second square -/ c₂_inj (c) : (fun r ↦ (f (r, c)).2).Injective deriving DecidableEq
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.