Steiner triple systems on points and role colourings
DefinitionRolesForceSeven_stsFix and take the points . A Steiner triple system on is a finite family of subsets of , called lines, such that
- every line has exactly points, and
- every two distinct points lie together on exactly one line.
A role colouring of such a system is a function assigning to each point and each line a role , such that
- the three points of each line receive three different roles;
- completeness: for every point and every role there is a line with ;
- minimality: two different lines through the same point give different roles.
Formalization Note Points are Fin n and lines are Finset (Fin n). The role function has type Fin n → Finset (Fin n) → Fin 3; only its values with a line and are constrained. No condition is placed on , so the empty system (, no lines) is allowed.
import Mathlib
namespace RolesForceSeven
/-- A Steiner triple system on the points `Fin n`: every line has three points,
and every pair of distinct points lies on exactly one line. -/
structure STS (n : ℕ) where
lines : Finset (Finset (Fin n))
card_three : ∀ l ∈ lines, l.card = 3
pair_unique : ∀ x y : Fin n, x ≠ y → ∃! l, l ∈ lines ∧ x ∈ l ∧ y ∈ l
/-- A role colouring (C1 Definition 3.5). `role x l` is the role of point `x` on
line `l`; only its values for `x ∈ l ∈ lines` matter. -/
def RoleColouring {n : ℕ} (S : STS n) (role : Fin n → Finset (Fin n) → Fin 3) :
Prop :=
-- the three points of a line get different roles
(∀ l ∈ S.lines, ∀ x ∈ l, ∀ y ∈ l, role x l = role y l → x = y) ∧
-- completeness: every point takes every role at least once
(∀ x : Fin n, ∀ ρ : Fin 3, ∃ l ∈ S.lines, x ∈ l ∧ role x l = ρ) ∧
-- minimality: every point takes every role at most once
(∀ x : Fin n, ∀ l ∈ S.lines, ∀ l' ∈ S.lines, x ∈ l → x ∈ l' →
role x l = role x l' → l = l')
end RolesForceSeven
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Structure STS n (a "Steiner triple system" on points). For a natural number (any , with no congruence or size condition imposed), let be the point set. An object of type consists of:
- a finite family of subsets of , called lines;
- a proof that every line has exactly three elements: ;
- a proof that every two distinct points lie together in exactly one line:
Here ranges over all subsets of , but because membership is part of the condition, it says exactly: there is one and only one line of containing both and .
Nothing else is required: may be empty, and no condition on is stated. Degenerate cases: for and there are no pairs of distinct points, so the pair condition is vacuous and the empty family gives a valid (for it is the only one; for it is also the only one, since a line would need 3 points). For no exists (the two points would need a common 3-element line inside a 2-element set). The two proof fields carry no data, so an is determined by its family of lines.
Definition RoleColouring S role. Let , let be an with line family , and let
be an arbitrary function assigning a "role" in to every point and every subset — not only to lines, and not only to pairs with . The values of at pairs where or are never mentioned below and are completely unconstrained. The proposition " is a role colouring of " is the conjunction of the following three conditions:
- Distinct roles within a line. For every line and all : if then . That is, is injective on ; since , the three points of each line receive the three roles bijectively.
- Every point plays every role. For every point and every role there exists a line with and .
- Distinct roles at a point. For every point and all lines with and : if then . That is, for fixed , the map is injective on the lines through .
Conditions 2 and 3 together say that, for each point , the map is a bijection from the set of lines through onto ; in particular every point lies on exactly three lines. Degenerate cases: for all three conditions are vacuous, so every (there is only one function on an empty domain) is a role colouring of the (empty) . For the only has no lines, so condition 2 fails for the single point and no role colouring exists. More generally, for , in an each point lies on exactly lines (by the pair condition and ), so the requirement "exactly three lines through each point" can only be met when ; for every other the predicate is unsatisfiable.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.