3-uniform hypergraphs, colourings, and monochromatic fraction
DefinitionFourToOneGames_HypergraphA 3-uniform hypergraph on the vertex set is a finite collection of edges, each of which is a set of exactly three vertices.
An edge is monochromatic under a colouring if all its vertices receive the same colour; is a proper -colouring if no edge is monochromatic, and is -colourable if a proper -colouring exists. The monochromatic fraction of is the fraction of edges of that are monochromatic under , and has the property when every -colouring of leaves at least an fraction of the edges monochromatic.
A hypergraph is encoded in binary by the number of vertices in unary followed by one bit per ordered triple of vertices saying whether that triple is an edge.
import Mathlib
/-!
# 3-uniform hypergraphs and their colourings
Objects used in the approximate hypergraph colouring hardness result (Theorem 3.1 of
Fei–Minzer–Wang, *On the Hardness of 4-to-1 Games with Perfect Completeness*, ECCC TR26-179)
and in the outer PCP of that paper.
-/
namespace FourToOneGames
/-- A finite 3-uniform hypergraph on the vertex set `Fin n`: a finite collection of edges,
each of which is a set of exactly three vertices. -/
structure Hypergraph3 where
/-- Number of vertices. -/
n : ℕ
/-- The edges, each of cardinality three. -/
edges : Finset (Finset (Fin n))
/-- Every edge has exactly three vertices. -/
card_edge : ∀ e ∈ edges, e.card = 3
namespace Hypergraph3
/-- An edge `e` is monochromatic under the colouring `χ` if all its vertices get the same
colour. -/
def Monochromatic {c : ℕ} (H : Hypergraph3) (χ : Fin H.n → Fin c) (e : Finset (Fin H.n)) :
Prop := ∀ u ∈ e, ∀ v ∈ e, χ u = χ v
/-- `χ` is a proper `c`-colouring of `H`: no edge is monochromatic. -/
def IsProperColoring {c : ℕ} (H : Hypergraph3) (χ : Fin H.n → Fin c) : Prop :=
∀ e ∈ H.edges, ¬ H.Monochromatic χ e
/-- `H` is `c`-colourable. -/
def Colorable (H : Hypergraph3) (c : ℕ) : Prop := ∃ χ : Fin H.n → Fin c, H.IsProperColoring χ
/-- The fraction of edges of `H` that are monochromatic under the colouring `χ`. -/
noncomputable def monoFraction {c : ℕ} (H : Hypergraph3) (χ : Fin H.n → Fin c) : ℝ :=
letI := Classical.decPred fun e : Finset (Fin H.n) => H.Monochromatic χ e
((H.edges.filter fun e => H.Monochromatic χ e).card : ℝ) / (H.edges.card : ℝ)
/-- Every `c`-colouring of `H` leaves at least an `ε` fraction of the edges monochromatic. -/
def AllColoringsMono (H : Hypergraph3) (c : ℕ) (ε : ℝ) : Prop :=
∀ χ : Fin H.n → Fin c, ε ≤ H.monoFraction χ
end Hypergraph3
/-- A binary encoding of a 3-uniform hypergraph: the number of vertices in unary, followed by
one bit for each triple of vertices (in lexicographic order) telling whether it is an edge. -/
def encodeHypergraph3 (H : Hypergraph3) : List Bool :=
List.replicate H.n true ++ [false] ++
((List.finRange H.n).flatMap fun u =>
(List.finRange H.n).flatMap fun v =>
(List.finRange H.n).map fun w => decide (({u, v, w} : Finset (Fin H.n)) ∈ H.edges))
end FourToOneGamesRead-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - NON-BLIND self-audit by the drafting agent
Disclosure — this read-back is NOT blind and NOT independent. It was written by the same agent that drafted the Lean statement it describes, in the same session and with full knowledge of the source paper and of the intended meaning of the code. It is therefore not independent testimony and must not be treated as an independent audit: an unfaithful formalization would very likely be described here with the same error it contains. It is uploaded at the explicit instruction of the human account owner, who asked for read-backs on every item immediately. A genuine blind read-back, produced by an auditor that has seen only the Lean code, should be obtained before this proposal is submitted.
This bundle declares the following objects.
A record type of hypergraphs. A hypergraph consists of a number of vertices , a finite set of edges each of which is a finite subset of , and a proof that every edge has exactly three elements. The edge set may be empty, and may be (in which case there are no edges).
Monochromatic edges. For a colouring , an edge is monochromatic iff for all .
Proper colourings. is proper iff no edge of is monochromatic, and is -colourable iff some into a palette of colours is proper. If and , no colouring exists, so is not -colourable; if , the empty colouring is proper, so is -colourable for every .
Monochromatic fraction. For a colouring ,
with the convention when has no edges.
The no-case predicate. asserts for every colouring . If and there are no such colourings and the predicate holds vacuously; if has no edges the predicate holds exactly when .
Encoding. A hypergraph is encoded as copies of true, one false, and then, for each
ordered triple of vertices in lexicographic order, one bit recording whether the set
is an edge of .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.