Index of theproofnetwork/open-problems@860a535/Prove2Me/Definitions/Def_QED_E095.lean
qedmarket’s copy of theproofnetwork/open-problems@860a535, 30 Nov 2026original source ↗
/-From Prove2Me, definition `QED_E095` (https://prove2.me/definitions/55416c8e-be5a-4dc7-ae41-8c283b328456). Apache-2.0 per Prove2Me's terms.-/import Mathlib /-! QED-E095: First-order convergence law for random Latin squaresPick a Latin square of order n uniformly at random and read it as a multiplication table x∘y on nsymbols. Does every first-order sentence about this quasigroup have a limiting probability as n → ∞?(A zero-one law fails: the number of idempotents x∘x = x has mean exactly 1 and is conjecturallyPoisson(1).)Informal statement: Let L_n be uniform among Latin squares on [n] and Q_n = ([n], ∘) withx∘y = L_n(x,y). Prove or disprove: for every first-order sentence φ in the language {∘, =},lim_{n→∞} Pr[Q_n ⊨ φ] exists.Formalization notes: The language `qLang` has a single binary function symbol and no relationsymbols; equality is built into Mathlib's first-order logic (`FirstOrder.Language.Sentence`). A Latinsquare of order n is a map L : Fin n → Fin n → Fin n whose rows and columns are bijections. Thestructure `QG n L` is `Fin n` with `x ∘ y := L x y`. `satProb n φ` is the fraction of Latin squares oforder n satisfying φ (computed with `Set.ncard` on finite sets of functions; for n = 0 there is oneempty Latin square). `Claim` says every sentence has a real limit probability. Proving `¬ Claim`means exhibiting a sentence whose satisfaction probability does not converge.-/namespace OpenProblems.QEDE095 open FirstOrder FirstOrder.Language /-- Function symbols: one binary operation. -/inductive QFunc : ℕ → Type | mul : QFunc 2 /-- The language `{∘}` of quasigroup multiplication tables (equality is built in). -/def qLang : FirstOrder.Language where Functions := QFunc Relations := fun _ => Empty /-- `L` is a Latin square: every row and every column is a bijection. -/def IsLatin {n : ℕ} (L : Fin n → Fin n → Fin n) : Prop := (∀ x : Fin n, Function.Bijective (L x)) ∧ (∀ y : Fin n, Function.Bijective (fun x => L x y)) /-- Carrier of the quasigroup given by the table `L` (a type synonym for `Fin n`). -/def QG (n : ℕ) (_L : Fin n → Fin n → Fin n) : Type := Fin n /-- Interpretation of the function symbols. -/def QFunc.interp {n : ℕ} (L : Fin n → Fin n → Fin n) : {k : ℕ} → QFunc k → (Fin k → Fin n) → Fin n | _, QFunc.mul, xs => L (xs 0) (xs 1) instance qgStructure (n : ℕ) (L : Fin n → Fin n → Fin n) : qLang.Structure (QG n L) where funMap := fun f xs => QFunc.interp L f xs RelMap := fun r _ => Empty.elim r /-- Probability that a uniformly random Latin square of order `n` satisfies `φ`. -/noncomputable def satProb (n : ℕ) (φ : qLang.Sentence) : ℝ := (Set.ncard {L : Fin n → Fin n → Fin n | IsLatin L ∧ φ.Realize (QG n L)} : ℝ) / (Set.ncard {L : Fin n → Fin n → Fin n | IsLatin L} : ℝ) def Claim : Prop := ∀ φ : qLang.Sentence, ∃ ℓ : ℝ, Filter.Tendsto (fun n : ℕ => satProb n φ) Filter.atTop (nhds ℓ) end OpenProblems.QEDE095