/-Copyright (c) 2026 Carles MarΓn. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles MarΓn, Claude (AI assistant)-/module public import Formalizations.GroupTheory.GroupAction.DistinguishingNumberpublic import Mathlib.SetTheory.Cardinal.Finite /-!# The order of the Fano collineation group The collineation group `TotD.fanoGroup` of the Fano plane (the stabilizer of its seven lines in`Equiv.Perm (Fin 7)`) has order `168`. The map `g β¦ (g 0, g 1, g 3)` is a bijection onto the triplesof non-collinear points. It is injective because a collineation fixing three non-collinear pointsfixes every point (each remaining point is the third point of a line through two fixed ones). It issurjective because, reading the points as the nonzero vectors of `FβΒ³`, the linear map sending`eβ, eβ, eβ` to a given triple maps lines to lines; this is checked by `decide` over the 168triples, never over all of `Equiv.Perm (Fin 7)`. ## Main results * `TotD.fanoGroup_card`: Nat.card fanoGroup = 168 ## References * C. MarΓn, *When Separation Fails, a Canon Appears: One counting identity behind separation, synchronization, and symmetry-breaking in permutation groups, formalized in Lean 4 (Part I)*, Zenodo (2026), doi:10.5281/zenodo.21419285, `fano-order`.-/ @[expose] public section set_option maxRecDepth 10000set_option synthInstance.maxSize 2000set_option synthInstance.maxHeartbeats 200000 open MulAction Pointwise namespace TotD /-- Triples `(a,b,c)` of distinct points with `c` not on the line `ab` (point `i` is the vector `i+1`). -/private def Tset : Finset (Fin 7 Γ Fin 7 Γ Fin 7) := Finset.univ.filter fun t => t.1 β t.2.1 β§ t.2.2 β t.1 β§ t.2.2 β t.2.1 β§ (t.1.val + 1) ^^^ (t.2.1.val + 1) β t.2.2.val + 1 private theorem Tset_card : Tset.card = 168 := by decide +kernel private theorem mem_Tset {t : Fin 7 Γ Fin 7 Γ Fin 7} : t β Tset β (t.1 β t.2.1 β§ t.2.2 β t.1 β§ t.2.2 β t.2.1 β§ (t.1.val + 1) ^^^ (t.2.1.val + 1) β t.2.2.val + 1) := by simp [Tset] /-- The linear map of `FβΒ³` sending `eβ,eβ,eβ` (points 0,1,3) to the triple. -/private def phi (t : Fin 7 Γ Fin 7 Γ Fin 7) (i : Fin 7) : Fin 7 := β¨(((if (i.val + 1) &&& 1 β 0 then t.1.val + 1 else 0) ^^^ (if (i.val + 1) &&& 2 β 0 then t.2.1.val + 1 else 0) ^^^ (if (i.val + 1) &&& 4 β 0 then t.2.2.val + 1 else 0)) + 6) % 7, Nat.mod_lt _ (by decide)β© private theorem phi_spec : β t β Tset, Function.Injective (phi t) β§ fanoLines.image (fun L => L.image (phi t)) = fanoLines β§ phi t 0 = t.1 β§ phi t 1 = t.2.1 β§ phi t 3 = t.2.2 := by decide +kernel private theorem line_unique : β L β fanoLines, β M β fanoLines, β x y : Fin 7, x β y β x β L β y β L β x β M β y β M β L = M := by decide +kernel private theorem third : β L β fanoLines, β a b z : Fin 7, a β L β b β L β z β L β a β b β z β a β z β b β (a.val + 1) ^^^ (b.val + 1) = z.val + 1 := by decide +kernel private theorem fill : β L β fanoLines, β x y z w : Fin 7, x β y β x β z β y β z β x β L β y β L β z β L β w β L β w β x β w β y β w = z := by decide +kernel private theorem hline {g : Equiv.Perm (Fin 7)} (hg : g β fanoGroup) (L : Finset (Fin 7)) (hL : L β fanoLines) : g β’ L β fanoLines := by have hstab : g β’ fanoLines = fanoLines := MulAction.mem_stabilizer_iff.mp hg rw [β hstab]; exact Finset.smul_mem_smul_finset hL private theorem happ (g : Equiv.Perm (Fin 7)) (L : Finset (Fin 7)) (y : Fin 7) (hy : y β L) : g y β g β’ L := by have := Finset.smul_mem_smul_finset (a := g) hy rwa [Equiv.Perm.smul_def] at this private theorem pin {g : Equiv.Perm (Fin 7)} (hg : g β fanoGroup) {L : Finset (Fin 7)} (hL : L β fanoLines) {x y z : Fin 7} (hxy : x β y) (hxz : x β z) (hyz : y β z) (hx : x β L) (hy : y β L) (hz : z β L) (gx : g x = x) (gy : g y = y) : g z = z := by have hgL : g β’ L β fanoLines := hline hg L hL have mx : x β g β’ L := by have h := happ g L x hx; rwa [gx] at h have my : y β g β’ L := by have h := happ g L y hy; rwa [gy] at h have heq : g β’ L = L := line_unique _ hgL L hL x y hxy mx my hx hy have mz : g z β L := by have h := happ g L z hz; rwa [heq] at h have h1 : g z β x := fun h => hxz (g.injective (h.trans gx.symm)).symm have h2 : g z β y := fun h => hyz (g.injective (h.trans gy.symm)).symm exact fill L hL x y z (g z) hxy hxz hyz hx hy hz mz h1 h2 private theorem dec7' (y : Fin 7) : y = 0 β¨ y = 1 β¨ y = 2 β¨ y = 3 β¨ y = 4 β¨ y = 5 β¨ y = 6 := by revert y; decide private theorem eq_one_of_fix3 {k : Equiv.Perm (Fin 7)} (hk : k β fanoGroup) (h0 : k 0 = 0) (h1 : k 1 = 1) (h3 : k 3 = 3) : k = 1 := by have h2 : k 2 = 2 := pin hk (L := {0, 1, 2}) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) h0 h1 have h4 : k 4 = 4 := pin hk (L := {0, 3, 4}) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) h0 h3 have h5 : k 5 = 5 := pin hk (L := {1, 3, 5}) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) h1 h3 have h6 : k 6 = 6 := pin hk (L := {0, 5, 6}) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) h0 h5 refine Equiv.ext fun x => ?_ rcases dec7' x with rfl | rfl | rfl | rfl | rfl | rfl | rfl exacts [h0, h1, h2, h3, h4, h5, h6] private theorem eval_mem {p : Equiv.Perm (Fin 7)} (hp : p β fanoGroup) : (p 0, p 1, p 3) β Tset := by rw [mem_Tset] have hL : p β’ ({0, 1, 2} : Finset (Fin 7)) β fanoLines := hline hp _ (by decide) have m0 : p 0 β p β’ ({0, 1, 2} : Finset (Fin 7)) := happ p _ 0 (by decide) have m1 : p 1 β p β’ ({0, 1, 2} : Finset (Fin 7)) := happ p _ 1 (by decide) have m2 : p 2 β p β’ ({0, 1, 2} : Finset (Fin 7)) := happ p _ 2 (by decide) have a01 : p 0 β p 1 := fun h => absurd (p.injective h) (by decide) have a20 : p 2 β p 0 := fun h => absurd (p.injective h) (by decide) have a21 : p 2 β p 1 := fun h => absurd (p.injective h) (by decide) have a30 : p 3 β p 0 := fun h => absurd (p.injective h) (by decide) have a31 : p 3 β p 1 := fun h => absurd (p.injective h) (by decide) have a32 : p 3 β p 2 := fun h => absurd (p.injective h) (by decide) have h3 := third _ hL (p 0) (p 1) (p 2) m0 m1 m2 a01 a20 a21 refine β¨a01, a30, a31, fun h => a32 (Fin.ext ?_)β© have := h3.symm.trans h simp only at this omega private def evalT (g : fanoGroup) : Tset := β¨((g : Equiv.Perm (Fin 7)) 0, (g : Equiv.Perm (Fin 7)) 1, (g : Equiv.Perm (Fin 7)) 3), eval_mem g.2β© private theorem evalT_inj : Function.Injective evalT := by intro g h hgh have e := congrArg Subtype.val hgh simp only [evalT, Prod.mk.injEq] at e obtain β¨e0, e1, e3β© := e have hk : (g : Equiv.Perm (Fin 7))β»ΒΉ * h β fanoGroup := fanoGroup.mul_mem (fanoGroup.inv_mem g.2) h.2 have := eq_one_of_fix3 hk (by rw [Equiv.Perm.mul_apply, β e0]; simp) (by rw [Equiv.Perm.mul_apply, β e1]; simp) (by rw [Equiv.Perm.mul_apply, β e3]; simp) exact Subtype.ext (inv_mul_eq_one.mp this) private theorem evalT_surj : Function.Surjective evalT := by rintro β¨t, htβ© obtain β¨hinj, himg, p0, p1, p3β© := phi_spec t ht let g : Equiv.Perm (Fin 7) := Equiv.ofBijective (phi t) (Finite.injective_iff_bijective.mp hinj) have hgc : β i, g i = phi t i := fun i => rfl have hmem : g β fanoGroup := by rw [fanoGroup, MulAction.mem_stabilizer_iff, Finset.smul_finset_def] have : (fun L : Finset (Fin 7) => g β’ L) = fun L => L.image (phi t) := by funext L rw [Finset.smul_finset_def] simp only [Equiv.Perm.smul_def, hgc] rw [this] exact himg refine β¨β¨g, hmemβ©, Subtype.ext ?_β© simp only [evalT] rw [hgc, hgc, hgc, p0, p1, p3] /-- The collineation group of the Fano plane has order `168`: `g β¦ (g 0, g 1, g 3)` is a bijectiononto the triples of non-collinear points (`7 Β· 6 Β· 4`). -/theorem fanoGroup_card : Nat.card fanoGroup = 168 := by have e : fanoGroup β β₯Tset := Equiv.ofBijective evalT β¨evalT_inj, evalT_surjβ© rw [Nat.card_congr e, Nat.card_eq_fintype_card, Fintype.card_coe] exact Tset_card end TotD