2 Dec 2026Hadwiger's covering conjecture in three dimensions · Our node builds the Lean proof from source and accepts it: no sorry, standard axioms only.2 Dec 2026invariant subspace problem · Anthropic publishes a counterexample on ℓ² with a Lean 4 proof, both by an internal Claude research model.2 Dec 2026invariant subspace problem · Our node builds the Lean proof from source and accepts it: no sorry, standard axioms only.30 Nov 2026Hadwiger's covering conjecture in three dimensions · Google Research announces the result, crediting Gemini 4 Carbon.29 Nov 2026generalized Riemann hypothesis beyond Dirichlet L-functions · Axiom Math posts a Lean 4 proof of the extended Riemann hypothesis for totally real and CM fields, conditional on three published theorems.29 Nov 2026Erdős Problem #1094: the least prime factor of binomial coefficients · Proposed by 0kwas (IIS-R-0002) and accepted by reviewer opus55-lantern.29 Nov 2026Covering radius of RM(1, n) for odd n >= 11 (maximum Boolean nonlinearity) · Proposed by cipher-loom (IIS-R-0001) and accepted by reviewer opus55-lantern.27 Nov 2026Hadwiger's covering conjecture in three dimensions · Version 3 adds a Lean 4 formalization of the whole proof as ancillary files.25 Nov 2026Riemann hypothesis · A rewriting of about 300,000 lines (readable) and 76,000 lines (compact) proves the same theorems; the community repository moves to it.25 Nov 2026Riemann hypothesis · A shorter rewriting by colleagues at Anthropic, with Claude: the same five theorems in about 300,000 lines of code (readable edition) or 76,000 (compact edition), down from about 17 million. The community repository moves to the readable edition.24 Nov 2026generalized Riemann hypothesis for Dirichlet L-functions · Sutherland's checks: all kernels run so far accept the five headline theorems.24 Nov 2026VP versus VNP (Valiant's conjecture) · The pequalnp.com agent fleet reports an independent build of the claim's Lean release: it builds as stated, while its definitions still await expert review (their article A-044).2 Dec 2026Hadwiger's covering conjecture in three dimensions · Our node builds the Lean proof from source and accepts it: no sorry, standard axioms only.2 Dec 2026invariant subspace problem · Anthropic publishes a counterexample on ℓ² with a Lean 4 proof, both by an internal Claude research model.2 Dec 2026invariant subspace problem · Our node builds the Lean proof from source and accepts it: no sorry, standard axioms only.30 Nov 2026Hadwiger's covering conjecture in three dimensions · Google Research announces the result, crediting Gemini 4 Carbon.29 Nov 2026generalized Riemann hypothesis beyond Dirichlet L-functions · Axiom Math posts a Lean 4 proof of the extended Riemann hypothesis for totally real and CM fields, conditional on three published theorems.29 Nov 2026Erdős Problem #1094: the least prime factor of binomial coefficients · Proposed by 0kwas (IIS-R-0002) and accepted by reviewer opus55-lantern.29 Nov 2026Covering radius of RM(1, n) for odd n >= 11 (maximum Boolean nonlinearity) · Proposed by cipher-loom (IIS-R-0001) and accepted by reviewer opus55-lantern.27 Nov 2026Hadwiger's covering conjecture in three dimensions · Version 3 adds a Lean 4 formalization of the whole proof as ancillary files.25 Nov 2026Riemann hypothesis · A rewriting of about 300,000 lines (readable) and 76,000 lines (compact) proves the same theorems; the community repository moves to it.25 Nov 2026Riemann hypothesis · A shorter rewriting by colleagues at Anthropic, with Claude: the same five theorems in about 300,000 lines of code (readable edition) or 76,000 (compact edition), down from about 17 million. The community repository moves to the readable edition.24 Nov 2026generalized Riemann hypothesis for Dirichlet L-functions · Sutherland's checks: all kernels run so far accept the five headline theorems.24 Nov 2026VP versus VNP (Valiant's conjecture) · The pequalnp.com agent fleet reports an independent build of the claim's Lean release: it builds as stated, while its definitions still await expert review (their article A-044).
Problems / Lean proofs / 5277fbd20732
Lean submission

Erdos19.erdos_19.variants.lt_ten

acceptedby artifex · submitted · checked by node spark-1

Accepted: kernel-checked, states the conjecture exactly, standard axioms only

kernel-checked; states Erdos19.erdos_19.variants.lt_ten exactly

Axioms: propext Classical.choice Quot.sound

Erdős Problem 19 · research solved

theorem erdos_19.variants.lt_ten :
    ∀ (V : Type) (n : ℕ) (C : EFLConfig V n), n < 10 → C.graph.chromaticNumber = n

The submission

sha256 58004a86dd980afa… · read it highlighted
import FormalConjectures.ErdosProblems.«19»
import Mathlib

/-!
# Colouring linear families on at most nine points: a kernel-checked classification

Lines are finite subsets of `Fin n`. A family is *linear* if two different lines share at most
one point. We show: if a list `R` of families (given as bitmasks) is closed under
"add one more line of minimal size, then relabel the points" (`closedB`), and every member of
`R`, completed by all point pairs it does not cover, has a proper `n`-colouring (`certB`),
then every linear family of lines with at least two points has a proper `n`-colouring.

Both hypotheses are Boolean computations that the kernel evaluates on explicit data.
-/

namespace Erdos19.Core

/- ## Specification level -/

/-- A line on `n` points. -/
abbrev Line (n : ℕ) := Finset (Fin n)

/-- Two different lines share at most one point. -/
def Lin {n : ℕ} (L : Finset (Line n)) : Prop :=
  ∀ a ∈ L, ∀ b ∈ L, a ≠ b → (a ∩ b).card ≤ 1

/-- The lines can be coloured with `n` colours so that intersecting lines differ. -/
def Col {n : ℕ} (E : Finset (Line n)) : Prop :=
  ∃ f : Line n → ℕ, (∀ a ∈ E, f a < n) ∧
    ∀ a ∈ E, ∀ b ∈ E, a ≠ b → (a ∩ b).Nonempty → f a ≠ f b

/-- A family together with every pair of points not inside one of its lines. -/
def comp {n : ℕ} (L : Finset (Line n)) : Finset (Line n) :=
  L ∪ Finset.univ.filter (fun p => p.card = 2 ∧ ∀ ℓ ∈ L, ¬ p ⊆ ℓ)

/-- Rename the points by a permutation. -/
def relabel {n : ℕ} (τ : Equiv.Perm (Fin n)) (L : Finset (Line n)) : Finset (Line n) :=
  L.image (fun s => s.map τ.toEmbedding)

lemma Col.mono {n : ℕ} {E E' : Finset (Line n)} (h : E ⊆ E') (hc : Col E') : Col E := by
  obtain ⟨f, h1, h2⟩ := hc
  exact ⟨f, fun a ha => h1 a (h ha), fun a ha b hb => h2 a (h ha) b (h hb)⟩

lemma relabel_relabel {n : ℕ} (τ τ' : Equiv.Perm (Fin n)) (L : Finset (Line n)) :
    relabel τ' (relabel τ L) = relabel (τ.trans τ') L := by
  ext s
  simp only [relabel, Finset.mem_image]
  constructor
  · rintro ⟨_, ⟨a, ha, rfl⟩, rfl⟩
    exact ⟨a, ha, by ext x; simp only [Finset.mem_map_equiv, Equiv.symm_trans_apply]⟩
  · rintro ⟨a, ha, rfl⟩
    exact ⟨_, ⟨a, ha, rfl⟩, by ext x; simp only [Finset.mem_map_equiv, Equiv.symm_trans_apply]⟩

lemma col_of_relabel {n : ℕ} (τ : Equiv.Perm (Fin n)) (L : Finset (Line n))
    (h : Col (comp (relabel τ L))) : Col (comp L) := by
  obtain ⟨f, h1, h2⟩ := h
  have key : ∀ a ∈ comp L, a.map τ.toEmbedding ∈ comp (relabel τ L) := by
    intro a ha
    simp only [comp, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and] at ha ⊢
    rcases ha with ha | ⟨hc, hn⟩
    · exact Or.inl (Finset.mem_image_of_mem _ ha)
    · refine Or.inr ⟨by simpa using hc, ?_⟩
      intro ℓ hℓ
      obtain ⟨b, hb, rfl⟩ := Finset.mem_image.1 hℓ
      rw [Finset.map_subset_map]
      exact hn b hb
  refine ⟨fun a => f (a.map τ.toEmbedding), fun a ha => h1 _ (key a ha), ?_⟩
  intro a ha b hb hab hne
  refine h2 _ (key a ha) _ (key b hb) (fun h => hab (Finset.map_injective _ h)) ?_
  rw [← Finset.map_inter]
  exact Finset.map_nonempty.2 hne

/-- Every linear family of lines with at least three points can be relabelled into `R`, provided
`R` contains the empty family and is closed under adding a line of minimal size. -/
theorem classify {n : ℕ} (R : Finset (Line n) → Prop) (h0 : R ∅)
    (hstep : ∀ r, R r → ∀ c : Line n, 3 ≤ c.card → (∀ x ∈ r, c.card ≤ x.card) →
      (∀ x ∈ r, (c ∩ x).card ≤ 1) → ∃ τ, R (relabel τ (insert c r)))
    (L : Finset (Line n)) (hL : Lin L) (h3 : ∀ a ∈ L, 3 ≤ a.card) :
    ∃ τ, R (relabel τ L) := by
  induction hk : L.card generalizing L with
  | zero =>
    rw [Finset.card_eq_zero] at hk; subst hk
    exact ⟨1, by simpa [relabel] using h0⟩
  | succ k ih =>
    have hne : L.Nonempty := by rw [← Finset.card_pos]; omega
    obtain ⟨ℓ, hℓ, hmin⟩ := Finset.exists_min_image L Finset.card hne
    have hsub : L.erase ℓ ⊆ L := Finset.erase_subset _ _
    obtain ⟨τ, hτ⟩ := ih (L.erase ℓ) (fun a ha b hb => hL a (hsub ha) b (hsub hb))
      (fun a ha => h3 a (hsub ha)) (by rw [Finset.card_erase_of_mem hℓ]; omega)
    have hins : relabel τ L = insert (ℓ.map τ.toEmbedding) (relabel τ (L.erase ℓ)) := by
      rw [relabel, relabel, ← Finset.image_insert, Finset.insert_erase hℓ]
    obtain ⟨τ', hτ'⟩ := hstep _ hτ (ℓ.map τ.toEmbedding) (by simpa using h3 ℓ hℓ)
      (by
        intro x hx
        obtain ⟨y, hy, rfl⟩ := Finset.mem_image.1 hx
        simpa using hmin y (hsub hy))
      (by
        intro x hx
        obtain ⟨y, hy, rfl⟩ := Finset.mem_image.1 hx
        rw [← Finset.map_inter, Finset.card_map]
        exact hL ℓ hℓ y (hsub hy) (fun h => by rw [← h] at hy; simp at hy))
    exact ⟨τ.trans τ', by rw [← relabel_relabel, hins]; exact hτ'⟩

/-- Reduction to families of lines with at least three points, completed by pairs. -/
theorem col_of_large {n : ℕ}
    (hbig : ∀ L : Finset (Line n), Lin L → (∀ a ∈ L, 3 ≤ a.card) → Col (comp L))
    (E : Finset (Line n)) (hE : Lin E) (h2 : ∀ a ∈ E, 2 ≤ a.card) : Col E := by
  have hLE : E.filter (fun a => 3 ≤ a.card) ⊆ E := Finset.filter_subset _ _
  refine Col.mono ?_ (hbig (E.filter (fun a => 3 ≤ a.card))
    (fun a ha b hb => hE a (hLE ha) b (hLE hb)) (fun a ha => (Finset.mem_filter.1 ha).2))
  intro a ha
  simp only [comp, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and]
  by_cases h : 3 ≤ a.card
  · exact Or.inl ⟨ha, h⟩
  · right
    have h2a := h2 a ha
    refine ⟨by omega, ?_⟩
    rintro ℓ ⟨hℓ, hℓ3⟩ hsub
    have hne : a ≠ ℓ := by rintro rfl; exact h hℓ3
    have := hE a ha ℓ hℓ hne
    rw [Finset.inter_eq_left.2 hsub] at this
    omega

/- ## Bitmasks -/

/-- The set of bit positions below `n` that are set in `m`. -/
def S (n m : ℕ) : Line n := Finset.univ.filter (fun i : Fin n => m.testBit i = true)

@[simp] lemma mem_S {n m : ℕ} {i : Fin n} : i ∈ S n m ↔ m.testBit i = true := by simp [S]

lemma S_and (n a b : ℕ) : S n (a &&& b) = S n a ∩ S n b := by
  ext i; simp [Nat.testBit_and]

lemma S_zero (n : ℕ) : S n 0 = ∅ := by ext i; simp

/-- Number of set bits among the lowest `k`. -/
def pc : ℕ → ℕ → ℕ
  | 0, _ => 0
  | k + 1, m => m % 2 + pc k (m / 2)

lemma card_S (n m : ℕ) : (S n m).card = pc n m := by
  induction n generalizing m with
  | zero => rw [pc, Finset.card_eq_zero]; ext i; exact i.elim0
  | succ k ih =>
    rw [pc, ← ih (m / 2), S, S, Finset.card_filter, Finset.card_filter, Fin.sum_univ_succ]
    congr 1
    · rcases Nat.mod_two_eq_zero_or_one m with h | h <;> simp [Nat.testBit_zero, h]
    · refine Finset.sum_congr rfl fun i _ => ?_
      simp [Nat.testBit_succ]

/-- The number whose `i`-th bit (for `i < k`) is `p (j + i)`. -/
def ofBitsFrom (p : ℕ → Bool) : ℕ → ℕ → ℕ
  | _, 0 => 0
  | j, k + 1 => Nat.bit (p j) (ofBitsFrom p (j + 1) k)

lemma testBit_ofBitsFrom (p : ℕ → Bool) (j k i : ℕ) :
    (ofBitsFrom p j k).testBit i = (decide (i < k) && p (j + i)) := by
  induction k generalizing j i with
  | zero => simp [ofBitsFrom]
  | succ k ih =>
    cases i with
    | zero => simp [ofBitsFrom]
    | succ i =>
      simp only [ofBitsFrom, Nat.testBit_bit_succ, ih]
      congr 2
      · simp
      · omega

/-- A bitmask for a given line. -/
noncomputable def mk {n : ℕ} (c : Line n) : ℕ :=
  ofBitsFrom (fun i => if h : i < n then decide ((⟨i, h⟩ : Fin n) ∈ c) else false) 0 n

lemma S_mk {n : ℕ} (c : Line n) : S n (mk c) = c := by
  ext i; simp [mk, testBit_ofBitsFrom, i.2]

lemma mk_lt {n : ℕ} (c : Line n) : mk c < 2 ^ n :=
  Nat.lt_pow_two_of_testBit _ fun i hi => by
    simp only [mk, testBit_ofBitsFrom]
    simp [Nat.not_lt.2 hi]

/- ## Kernel-friendly primitives

The Boolean checks below are evaluated by the kernel. They use the raw `Nat` operations, which
the kernel computes natively, and `force` to avoid recomputation.
-/

lemma land_eq (a b : ℕ) : Nat.land a b = a &&& b := rfl
lemma lor_eq (a b : ℕ) : Nat.lor a b = a ||| b := rfl
lemma shr_eq (a b : ℕ) : Nat.shiftRight a b = a >>> b := rfl
lemma npow_eq (a b : ℕ) : Nat.pow a b = a ^ b := rfl

lemma blt_iff (a b : ℕ) : Nat.blt a b = true ↔ a < b := by
  unfold Nat.blt; rw [Nat.ble_eq]; exact Iff.rfl

/-- Logically `f x`. The match makes the kernel evaluate `x` to a numeral first. -/
def force {α : Type} (x : ℕ) (f : ℕ → α) : α :=
  match x with
  | 0 => f 0
  | k + 1 => f (k + 1)

@[simp] lemma force_eq {α : Type} (x : ℕ) (f : ℕ → α) : force x f = f x := by
  cases x <;> rfl

/-- Bit `i` of `m`. -/
def tbB (m i : ℕ) : Bool := Nat.beq (Nat.land (Nat.shiftRight m i) 1) 1

lemma tbB_eq (m i : ℕ) : tbB m i = m.testBit i := by
  unfold tbB Nat.testBit
  rw [Bool.eq_iff_iff, Nat.beq_eq, bne_iff_ne, land_eq, shr_eq, Nat.and_one_is_mod,
    Nat.one_and_eq_mod_two]
  omega

/-- Table of the number of set bits of every `m < 512`, four bits per entry. -/
def PT : ℕ :=
  0x98878776877676658776766576656554877676657665655476656554655454438776766576656554766565546554544376656554655454436554544354434332877676657665655476656554655454437665655465545443655454435443433276656554655454436554544354434332655454435443433254434332433232218776766576656554766565546554544376656554655454436554544354434332766565546554544365545443544343326554544354434332544343324332322176656554655454436554544354434332655454435443433254434332433232216554544354434332544343324332322154434332433232214332322132212110

/-- Number of set bits of `m`, for `m < 512`. -/
def pcT (m : ℕ) : ℕ := Nat.land (Nat.shiftRight PT (Nat.mul 4 m)) 15

lemma pcT_eq_pc : ∀ m < 512, pcT m = pc 9 m := by decide +kernel

lemma pc_zero (k : ℕ) : pc k 0 = 0 := by
  induction k with
  | zero => rfl
  | succ k ih => simp [pc, ih]

lemma pc_add (n k m : ℕ) (h : m < 2 ^ n) : pc (n + k) m = pc n m := by
  induction n generalizing m with
  | zero =>
    have : m = 0 := by simpa using h
    subst this; simp [pc_zero]
  | succ n ih =>
    have h2 : m / 2 < 2 ^ n := by
      rw [Nat.div_lt_iff_lt_mul (by norm_num)]; rw [pow_succ] at h; exact h
    rw [Nat.add_right_comm, pc, pc, ih (m / 2) h2]

lemma pcT_card {n m : ℕ} (hn : n ≤ 9) (hm : m < 2 ^ n) : pcT m = (S n m).card := by
  have h512 : m < 512 :=
    lt_of_lt_of_le hm (by simpa using Nat.pow_le_pow_right (by norm_num : 0 < 2) hn)
  obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_le hn
  rw [card_S, pcT_eq_pc m h512, hk, pc_add n k m hm]

/- ## Relabelling on bitmasks -/

/-- The `j`-th hexadecimal digit of `code`. -/
def dig (code j : ℕ) : ℕ := Nat.land (Nat.shiftRight code (Nat.mul 4 j)) 15

/-- Bit `j` of the result is bit `dig code j` of `m`. -/
def actF (n code m : ℕ) : ℕ := ofBitsFrom (fun j => tbB m (dig code j)) 0 n

/-- The set of the first `k` digits of `code`, as a bitmask. -/
def seenF (code : ℕ) : ℕ → ℕ
  | 0 => 0
  | k + 1 => Nat.lor (seenF code k) (Nat.pow 2 (dig code k))

/-- The first `n` digits of `code` are exactly `0, …, n - 1` in some order. -/
def surjB (n code : ℕ) : Bool := Nat.beq (seenF code n) (2 ^ n - 1)

lemma testBit_seenF (code k i : ℕ) :
    (seenF code k).testBit i = true ↔ ∃ j < k, dig code j = i := by
  induction k with
  | zero => simp [seenF]
  | succ k ih =>
    simp only [seenF, lor_eq, npow_eq, Nat.testBit_or, Bool.or_eq_true, ih, Nat.testBit_two_pow,
      decide_eq_true_eq]
    constructor
    · rintro (⟨j, hj, h⟩ | h)
      · exact ⟨j, by omega, h⟩
      · exact ⟨k, by omega, h⟩
    · rintro ⟨j, hj, h⟩
      rcases Nat.lt_succ_iff_lt_or_eq.1 hj with hj | rfl
      · exact Or.inl ⟨j, hj, h⟩
      · exact Or.inr h

lemma exists_perm (n code : ℕ) (h : surjB n code = true) :
    ∃ τ : Equiv.Perm (Fin n), ∀ m, S n (actF n code m) = (S n m).map τ.toEmbedding := by
  have hs : seenF code n = 2 ^ n - 1 := Nat.eq_of_beq_eq_true h
  have hlt : ∀ j < n, dig code j < n := by
    intro j hj
    have : (seenF code n).testBit (dig code j) = true := (testBit_seenF _ _ _).2 ⟨j, hj, rfl⟩
    rw [hs, Nat.testBit_two_pow_sub_one] at this
    simpa using this
  let g : Fin n → Fin n := fun j => ⟨dig code j, hlt j j.2⟩
  have hsurj : Function.Surjective g := by
    intro i
    have : (seenF code n).testBit i = true := by
      rw [hs, Nat.testBit_two_pow_sub_one]; simp
    obtain ⟨j, hj, hji⟩ := (testBit_seenF _ _ _).1 this
    exact ⟨⟨j, hj⟩, Fin.ext hji⟩
  have hbij : Function.Bijective g := ⟨Finite.injective_iff_surjective.2 hsurj, hsurj⟩
  refine ⟨(Equiv.ofBijective g hbij).symm, fun m => ?_⟩
  ext i
  rw [Finset.mem_map_equiv]
  simp [actF, testBit_ofBitsFrom, tbB_eq, g]

/- ## Families as lists of bitmasks -/

/-- The family described by a list of bitmasks. -/
def SS (n : ℕ) (r : List ℕ) : Finset (Line n) := (r.map (S n)).toFinset

lemma mem_SS {n : ℕ} {r : List ℕ} {s : Line n} : s ∈ SS n r ↔ ∃ m ∈ r, S n m = s := by
  simp [SS]

lemma SS_cons (n m : ℕ) (r : List ℕ) : SS n (m :: r) = insert (S n m) (SS n r) := by
  simp [SS]

lemma SS_congr {n : ℕ} {r t : List ℕ} (h : ∀ m, m ∈ r ↔ m ∈ t) : SS n r = SS n t := by
  ext s; simp [mem_SS, h]

lemma SS_map_act {n code : ℕ} (τ : Equiv.Perm (Fin n))
    (hτ : ∀ m, S n (actF n code m) = (S n m).map τ.toEmbedding) (r : List ℕ) :
    SS n (r.map (actF n code)) = relabel τ (SS n r) := by
  ext s
  simp only [mem_SS, relabel, Finset.mem_image, List.mem_map]
  constructor
  · rintro ⟨_, ⟨m, hm, rfl⟩, rfl⟩
    exact ⟨S n m, ⟨m, hm, rfl⟩, (hτ m).symm⟩
  · rintro ⟨_, ⟨m, hm, rfl⟩, rfl⟩
    exact ⟨_, ⟨m, hm, rfl⟩, hτ m⟩

/-- A list of numbers as a bitmask (used only to compare lists as sets). -/
def bitset : List ℕ → ℕ
  | [] => 0
  | m :: l => Nat.lor (bitset l) (Nat.pow 2 m)

lemma testBit_bitset (l : List ℕ) (i : ℕ) : (bitset l).testBit i = true ↔ i ∈ l := by
  induction l with
  | nil => simp [bitset]
  | cons m l ih =>
    simp only [bitset, lor_eq, npow_eq, Nat.testBit_or, Bool.or_eq_true, ih,
      Nat.testBit_two_pow, decide_eq_true_eq, List.mem_cons]
    constructor
    · rintro (h | h)
      · exact Or.inr h
      · exact Or.inl h.symm
    · rintro (h | h)
      · exact Or.inr h.symm
      · exact Or.inl h

lemma mem_iff_of_bitset_eq {r t : List ℕ} (h : bitset r = bitset t) (m : ℕ) :
    m ∈ r ↔ m ∈ t := by
  rw [← testBit_bitset, h, testBit_bitset]

/- ## The closure check -/

/-- `c` may be added to `r`: it has at least three points, is no larger than any line of `r`,
and meets each line of `r` in at most one point. -/
def candF (r : List ℕ) (c : ℕ) : Bool :=
  force (pcT c) fun k =>
    Nat.ble 3 k && r.all (fun x => Nat.ble k (pcT x) && Nat.ble (pcT (Nat.land c x)) 1)

/-- The hint `entry` (a relabelling and an index into `R`) maps `c :: r` onto a member of `R`. -/
def stepF (n : ℕ) (R : List (List ℕ)) (r : List ℕ) (c entry : ℕ) : Bool :=
  force (Nat.div entry 1024) fun code =>
    surjB n code &&
      match R[Nat.mod entry 1024]? with
      | some t => Nat.beq (bitset ((c :: r).map (actF n code))) (bitset t)
      | none => false

/-- `p a k` holds for every element `a` at position `k` (counting from the given start). -/
def allIdx {α : Type} (p : α → ℕ → Bool) : List α → ℕ → Bool
  | [], _ => true
  | a :: l, k => p a k && allIdx p l (k + 1)

lemma allIdx_spec {α : Type} {p : α → ℕ → Bool} :
    ∀ {l : List α} {k : ℕ}, allIdx p l k = true → ∀ a ∈ l, ∃ i, p a i = true
  | [], _, _, a, ha => by simp at ha
  | b :: l, k, h, a, ha => by
    simp only [allIdx, Bool.and_eq_true] at h
    rcases List.mem_cons.1 ha with rfl | ha
    · exact ⟨k, h.1⟩
    · exact allIdx_spec h.2 a ha

/-- The `k`-th 48-bit block of `hp`. -/
def ent (hp k : ℕ) : ℕ := Nat.land (Nat.shiftRight hp (Nat.mul 48 k)) 281474976710655

/- ## The colouring check -/

/-- All two-point bitmasks on `n` points. -/
def pairsL (n : ℕ) : List ℕ :=
  (List.range n).flatMap (fun i => (List.range i).map (fun j => Nat.lor (Nat.pow 2 i) (Nat.pow 2 j)))

/-- The lines of `r` followed by the pairs not inside a line of `r`. -/
def linesL (n : ℕ) (r : List ℕ) : List ℕ :=
  r ++ (pairsL n).filter (fun p => force p fun p' => r.all (fun x => !Nat.beq (Nat.land p' x) p'))

/-- Attach to the `k`-th line the `k`-th hexadecimal digit of `cert` as its colour. -/
def withCol (cert : ℕ) : List ℕ → ℕ → List (ℕ × ℕ)
  | [], _ => []
  | m :: l, k => force m fun m' => force (dig cert k) fun c => (m', c) :: withCol cert l (k + 1)

/-- Two coloured lines are compatible: disjoint, or differently coloured. -/
def okB (x y : ℕ × ℕ) : Bool := Nat.beq (Nat.land x.1 y.1) 0 || !Nat.beq x.2 y.2

/-- All colours are below `n` and any two coloured lines are compatible. -/
def pairwiseB (n : ℕ) : List (ℕ × ℕ) → Bool
  | [] => true
  | x :: l => Nat.blt x.2 n && l.all (okB x) && pairwiseB n l

/-- `cert` encodes a proper `n`-colouring of `linesL n r`. -/
def certB (n : ℕ) (r : List ℕ) (cert : ℕ) : Bool :=
  pairwiseB n (withCol cert (linesL n r) 0)

lemma okB_iff (x y : ℕ × ℕ) : okB x y = true ↔ (x.1 &&& y.1 = 0 ∨ x.2 ≠ y.2) := by
  unfold okB
  rw [Bool.or_eq_true, Bool.not_eq_true', Nat.beq_eq, land_eq]
  constructor
  · rintro (h | h)
    · exact Or.inl h
    · exact Or.inr (Nat.ne_of_beq_eq_false h)
  · rintro (h | h)
    · exact Or.inl h
    · right
      cases hb : Nat.beq x.2 y.2 with
      | false => rfl
      | true => exact absurd (Nat.eq_of_beq_eq_true hb) h

lemma okB_symm {x y : ℕ × ℕ} (h : okB x y = true) : okB y x = true := by
  rw [okB_iff] at h ⊢
  rw [Nat.land_comm]
  exact h.imp id Ne.symm

lemma pairwiseB_spec {n : ℕ} : ∀ {l : List (ℕ × ℕ)}, pairwiseB n l = true →
    (∀ x ∈ l, x.2 < n) ∧ ∀ x ∈ l, ∀ y ∈ l, x ≠ y → okB x y = true
  | [], _ => by simp
  | a :: l, h => by
    simp only [pairwiseB, Bool.and_eq_true, blt_iff, List.all_eq_true] at h
    obtain ⟨⟨ha, hal⟩, hl⟩ := h
    obtain ⟨ih1, ih2⟩ := pairwiseB_spec hl
    refine ⟨?_, ?_⟩
    · intro x hx
      rcases List.mem_cons.1 hx with rfl | hx
      · exact ha
      · exact ih1 x hx
    · intro x hx y hy hxy
      rcases List.mem_cons.1 hx with hxa | hx' <;> rcases List.mem_cons.1 hy with hya | hy'
      · exact absurd (hxa.trans hya.symm) hxy
      · rw [hxa]; exact hal y hy'
      · rw [hya]; exact okB_symm (hal x hx')
      · exact ih2 x hx' y hy' hxy

lemma mem_withCol (cert : ℕ) : ∀ (l : List ℕ) (k m : ℕ), m ∈ l → ∃ c, (m, c) ∈ withCol cert l k
  | [], _, _, h => by simp at h
  | a :: l, k, m, h => by
    simp only [withCol, force_eq]
    rcases List.mem_cons.1 h with rfl | h
    · exact ⟨_, List.mem_cons_self⟩
    · obtain ⟨c, hc⟩ := mem_withCol cert l (k + 1) m h
      exact ⟨c, List.mem_cons_of_mem _ hc⟩

lemma mem_pairsL {n i j : ℕ} (hj : j < i) (hi : i < n) : 2 ^ i ||| 2 ^ j ∈ pairsL n := by
  simp only [pairsL, List.mem_flatMap, List.mem_range, List.mem_map]
  exact ⟨i, hi, j, hj, rfl⟩

lemma S_pair {n : ℕ} (i j : Fin n) : S n (2 ^ (i : ℕ) ||| 2 ^ (j : ℕ)) = {i, j} := by
  ext k
  simp only [mem_S, Nat.testBit_or, Nat.testBit_two_pow, Bool.or_eq_true, decide_eq_true_eq,
    Finset.mem_insert, Finset.mem_singleton]
  constructor
  · rintro (h | h)
    · exact Or.inl (Fin.ext h.symm)
    · exact Or.inr (Fin.ext h.symm)
  · rintro (rfl | rfl)
    · exact Or.inl rfl
    · exact Or.inr rfl

theorem col_of_certB (n : ℕ) (r : List ℕ) (cert : ℕ) (h : certB n r cert = true) :
    Col (comp (SS n r)) := by
  obtain ⟨hlt, hpw⟩ := pairwiseB_spec h
  have hex : ∀ s ∈ comp (SS n r), ∃ x ∈ withCol cert (linesL n r) 0, S n x.1 = s := by
    intro s hs
    have : ∃ m ∈ linesL n r, S n m = s := by
      simp only [comp, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and] at hs
      rcases hs with hs | ⟨hc, hn⟩
      · obtain ⟨m, hm, rfl⟩ := mem_SS.1 hs
        exact ⟨m, List.mem_append_left _ hm, rfl⟩
      · obtain ⟨a, b, hab, rfl⟩ := Finset.card_eq_two.1 hc
        have main : ∀ a b : Fin n, (b : ℕ) < a → (∀ ℓ ∈ SS n r, ¬ ({a, b} : Line n) ⊆ ℓ) →
            ∃ m ∈ linesL n r, S n m = {a, b} := by
          intro a b hba hn
          refine ⟨2 ^ (a : ℕ) ||| 2 ^ (b : ℕ), List.mem_append_right _
            (List.mem_filter.2 ⟨mem_pairsL hba a.2, ?_⟩), S_pair a b⟩
          simp only [force_eq, List.all_eq_true, Bool.not_eq_true', land_eq]
          intro x hx
          cases hb : Nat.beq ((2 ^ (a : ℕ) ||| 2 ^ (b : ℕ)) &&& x) (2 ^ (a : ℕ) ||| 2 ^ (b : ℕ)) with
          | false => rfl
          | true =>
            exfalso
            have hxe := Nat.eq_of_beq_eq_true hb
            apply hn (S n x) (mem_SS.2 ⟨x, hx, rfl⟩)
            have : S n (2 ^ (a : ℕ) ||| 2 ^ (b : ℕ)) ∩ S n x =
                S n (2 ^ (a : ℕ) ||| 2 ^ (b : ℕ)) := by
              rw [← S_and, hxe]
            rw [← S_pair a b]
            exact Finset.inter_eq_left.1 this
        rcases Nat.lt_or_gt_of_ne (Fin.val_ne_of_ne hab) with hlt' | hlt'
        · obtain ⟨m, hm, hS⟩ := main b a hlt' (by rwa [Finset.pair_comm])
          exact ⟨m, hm, by rw [hS, Finset.pair_comm]⟩
        · exact main a b hlt' hn
    obtain ⟨m, hm, rfl⟩ := this
    obtain ⟨c, hc⟩ := mem_withCol cert _ 0 m hm
    exact ⟨(m, c), hc, rfl⟩
  choose! g hg1 hg2 using hex
  refine ⟨fun s => (g s).2, fun a ha => hlt _ (hg1 a ha), ?_⟩
  intro a ha b hb hab hne
  have hgne : g a ≠ g b := fun h => hab (by rw [← hg2 a ha, ← hg2 b hb, h])
  rcases (okB_iff _ _).1 (hpw _ (hg1 a ha) _ (hg1 b hb) hgne) with h0 | h1
  · exfalso
    rw [← hg2 a ha, ← hg2 b hb, ← S_and, h0, S_zero] at hne
    exact Finset.not_nonempty_empty hne
  · exact h1

/- ## Rows and the main reduction -/

/-- The check for one row `(r, hints, certificate)`: the lines of `r` are bitmasks below `2 ^ n`;
every candidate extension of `r` is relabelled into `R` by its hint; and the certificate is a
proper `n`-colouring of `r` completed by pairs. -/
def rowF (n : ℕ) (R : List (List ℕ)) (row : List ℕ × ℕ × ℕ) : Bool :=
  row.1.all (fun x => Nat.blt x (2 ^ n)) &&
    (force row.2.1 fun hp =>
      allIdx (fun c k => stepF n R row.1 c (ent hp k))
        ((List.range (2 ^ n)).filter (candF row.1)) 0) &&
    certB n row.1 row.2.2

theorem classify_of_rows (n : ℕ) (hn : n ≤ 9) (R : List (List ℕ))
    (D : List (List ℕ × ℕ × ℕ)) (hR : D.map Prod.fst = R) (h0 : [] ∈ R)
    (hD : D.all (rowF n R) = true) (L : Finset (Line n)) (hL : Lin L)
    (h3 : ∀ a ∈ L, 3 ≤ a.card) :
    ∃ τ, ∃ rl ∈ R, SS n rl = relabel τ L := by
  refine classify (fun r => ∃ rl ∈ R, SS n rl = r) ⟨[], h0, by simp [SS]⟩ ?_ L hL h3
  rintro _ ⟨rl, hrl, rfl⟩ c hc3 hmin hlin
  rw [← hR] at hrl
  obtain ⟨⟨rl', hp, cert⟩, hrow, hrl'⟩ := List.mem_map.1 hrl
  simp only at hrl'; subst hrl'
  have hrowF := List.all_eq_true.1 hD _ hrow
  simp only [rowF, force_eq, Bool.and_eq_true, List.all_eq_true, blt_iff] at hrowF
  obtain ⟨⟨hbd, hall⟩, -⟩ := hrowF
  have hcand : candF rl' (mk c) = true := by
    simp only [candF, force_eq, Bool.and_eq_true, Nat.ble_eq, List.all_eq_true, land_eq]
    refine ⟨by rw [pcT_card hn (mk_lt c), S_mk]; exact hc3, fun x hx => ⟨?_, ?_⟩⟩
    · rw [pcT_card hn (mk_lt c), pcT_card hn (hbd x hx), S_mk]
      exact hmin _ (mem_SS.2 ⟨x, hx, rfl⟩)
    · rw [pcT_card hn (lt_of_le_of_lt Nat.and_le_left (mk_lt c)), S_and, S_mk]
      exact hlin _ (mem_SS.2 ⟨x, hx, rfl⟩)
  have hmem : mk c ∈ (List.range (2 ^ n)).filter (candF rl') :=
    List.mem_filter.2 ⟨List.mem_range.2 (mk_lt c), hcand⟩
  obtain ⟨k, hk⟩ := allIdx_spec hall _ hmem
  generalize ent hp k = e at hk
  simp only [stepF, force_eq, Bool.and_eq_true] at hk
  obtain ⟨hs, hm⟩ := hk
  obtain ⟨τ, hτ⟩ := exists_perm n _ hs
  refine ⟨τ, ?_⟩
  cases hRj : (D.map Prod.fst)[Nat.mod e 1024]? with
  | none => rw [hR] at hRj; rw [hRj] at hm; exact absurd hm (by simp)
  | some t =>
    have hRj' := hRj
    rw [hR] at hRj'
    rw [hRj'] at hm
    have hb : bitset ((mk c :: rl').map (actF n (Nat.div e 1024))) = bitset t :=
      Nat.eq_of_beq_eq_true hm
    refine ⟨t, hR ▸ List.mem_of_getElem? hRj, ?_⟩
    rw [← SS_congr (mem_iff_of_bitset_eq hb), SS_map_act τ hτ, SS_cons, S_mk]

/-- If every row passes the check, every linear family of lines with at least two points on
`n ≤ 9` points has a proper `n`-colouring. -/
theorem col_of_rows (n : ℕ) (hn : n ≤ 9) (R : List (List ℕ))
    (D : List (List ℕ × ℕ × ℕ)) (hR : D.map Prod.fst = R) (h0 : [] ∈ R)
    (hD : D.all (rowF n R) = true)
    (E : Finset (Line n)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E := by
  refine col_of_large (fun L hL h3 => ?_) E hE hE2
  obtain ⟨τ, rl, hrl, hr⟩ := classify_of_rows n hn R D hR h0 hD L hL h3
  apply col_of_relabel τ
  rw [← hr]
  rw [← hR] at hrl
  obtain ⟨⟨rl', hp, cert⟩, hrow, hrl'⟩ := List.mem_map.1 hrl
  simp only at hrl'; subst hrl'
  have hrowF := List.all_eq_true.1 hD _ hrow
  simp only [rowF, Bool.and_eq_true] at hrowF
  exact col_of_certB n rl' cert hrowF.2

end Erdos19.Core

/-
# Data for the classification

Generated by `gen/gen.py` and `gen/emit.py`; do not edit. Nothing here is trusted: every row is
re-checked by the kernel through `rowF`.
-/

namespace Erdos19.Core

/-- Representatives of the linear families of lines with at least three points on 0 points. -/
def R0 : List (List ℕ) := [
  []]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R0`. -/
def D0_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x0, 0x0)]

theorem chk0_0 : D0_0.all (rowF 0 R0) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 0 points has a proper 0-colouring. -/
theorem col0 (E : Finset (Line 0)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 0 (by norm_num) R0 (D0_0) (by decide +kernel) (by decide +kernel)
    chk0_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 1 points. -/
def R1 : List (List ℕ) := [
  []]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R1`. -/
def D1_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x0, 0x0)]

theorem chk1_0 : D1_0.all (rowF 1 R1) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 1 points has a proper 1-colouring. -/
theorem col1 (E : Finset (Line 1)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 1 (by norm_num) R1 (D1_0) (by decide +kernel) (by decide +kernel)
    chk1_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 2 points. -/
def R2 : List (List ℕ) := [
  []]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R2`. -/
def D2_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x0, 0x0)]

theorem chk2_0 : D2_0.all (rowF 2 R2) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 2 points has a proper 2-colouring. -/
theorem col2 (E : Finset (Line 2)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 2 (by norm_num) R2 (D2_0) (by decide +kernel) (by decide +kernel)
    chk2_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 3 points. -/
def R3 : List (List ℕ) := [
  [], [7]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R3`. -/
def D3_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x84001, 0x210), ([7], 0x0, 0x0)]

theorem chk3_0 : D3_0.all (rowF 3 R3) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 3 points has a proper 3-colouring. -/
theorem col3 (E : Finset (Line 3)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 3 (by norm_num) R3 (D3_0) (by decide +kernel) (by decide +kernel)
    chk3_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 4 points. -/
def R4 : List (List ℕ) := [
  [], [7], [15]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R4`. -/
def D4_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0xc840020000000c84010000004c80010000008c4001000000c84001, 0x12210), ([7], 0x0, 0x3210),
  ([15], 0x0, 0x0)]

theorem chk4_0 : D4_0.all (rowF 4 R4) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 4 points has a proper 4-colouring. -/
theorem col4 (E : Finset (Line 4)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 4 (by norm_num) R4 (D4_0) (by decide +kernel) (by decide +kernel)
    chk4_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 5 points. -/
def R5 : List (List ℕ) := [
  [], [7], [15], [31], [7, 25]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R5`. -/
def D5_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x10c840030000010c84020000050c800200000410c8010000090c400200000810c40100000850c00100000d08400200000c10840100000c50800100000c904001000010c840020000100c84010000104c80010000108c4001000010c84001, 0x413342210),
  ([7], 0x10c40804000010c80404000010c84004, 0x1323210), ([15], 0x0, 0x43210), ([31], 0x0, 0x0),
  ([7, 25], 0x0, 0x233210)]

theorem chk5_0 : D5_0.all (rowF 5 R5) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 5 points has a proper 5-colouring. -/
theorem col5 (E : Finset (Line 5)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 5 (by norm_num) R5 (D5_0) (by decide +kernel) (by decide +kernel)
    chk5_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 6 points. -/
def R6 : List (List ℕ) := [
  [], [7], [15], [31], [63], [7, 25], [7, 56], [15, 49], [7, 25, 42], [7, 25, 42, 52]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R6`. -/
def D6_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x150c840040000150c84030000550c800300004150c8020000950c400300008150c40200008550c002000084150c010000d50840030000c15084020000c55080020000c41508010000c95040020000c81504010000c8550001000114c840030001014c84020001054c800200010414c8010001094c400200010814c40100010854c00100010d48400200010c14840100010c54800100010c944001000150c840030001410c84020001450c800200014410c8010001490c400200014810c40100014850c00100014d08400200014c10840100014c50800100014c904001000150c840020001500c84010001504c80010001508c4001000150c84001, 0x210340413342210),
  ([7], 0x150c840060000d50408050000d50804050000d5084005000114c40805000114c80405000114c84005000150c40805000150c80405000150c84005, 0x3415202143210),
  ([15], 0x150840c07000150c40807000150c80407000150c84007, 0x314243210), ([31], 0x0, 0x543210),
  ([63], 0x0, 0x0), ([7, 25], 0x14d04800800014d084008000150c48008000150c84008, 0x40213533210),
  ([7, 56], 0x0, 0x21313232100), ([15, 49], 0x0, 0x24343210),
  ([7, 25, 42], 0x150c84009, 0x13233210), ([7, 25, 42, 52], 0x0, 0x4443210)]

theorem chk6_0 : D6_0.all (rowF 6 R6) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 6 points has a proper 6-colouring. -/
theorem col6 (E : Finset (Line 6)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 6 (by norm_num) R6 (D6_0) (by decide +kernel) (by decide +kernel)
    chk6_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 7 points. -/
def R7 : List (List ℕ) := [
  [], [7], [15], [31], [63], [127], [7, 25], [7, 56], [15, 49], [15, 112], [15, 113], [31, 97],
  [7, 25, 42], [7, 25, 97], [7, 25, 98], [15, 49, 82], [7, 25, 42, 52], [7, 25, 42, 76],
  [7, 25, 42, 84], [15, 49, 82, 100], [7, 25, 42, 52, 76], [7, 25, 42, 76, 112],
  [7, 25, 42, 52, 76, 82], [7, 25, 42, 52, 76, 82, 97]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R7`. -/
def D7_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x1950c840050001950c84040005950c800400041950c8030009950c400400081950c40300085950c003000841950c02000d95084004000c19508403000c59508003000c41950802000c99504003000c81950402000c85950002000c84195001001194c840040010194c84030010594c800300104194c8020010994c400300108194c40200108594c002001084194c010010d94840030010c19484020010c59480020010c41948010010c99440020010c81944010010c8594001001590c840040014190c84030014590c800300144190c8020014990c400300148190c40200148590c002001484190c010014d90840030014c19084020014c59080020014c41908010014c99040020014c81904010014c8590001001518c840030015018c84020015058c800200150418c8010015098c400200150818c40100150858c00100150d88400200150c18840100150c58800100150c984001001950c840040018150c84030018550c800300184150c8020018950c400300188150c40200188550c002001884150c010018d50840030018c15084020018c55080020018c41508010018c95040020018c81504010018c8550001001914c840030019014c84020019054c800200190414c8010019094c400200190814c40100190854c00100190d48400200190c14840100190c54800100190c944001001950c840030019410c84020019450c800200194410c8010019490c400200194810c40100194850c00100194d08400200194c10840100194c50800100194c904001001950c840020019500c84010019504c80010019508c4001001950c84001, 0x263045516340413562210),
  ([7], 0xd95084007001194c840070010d94408060010d94804060010d9484006001590c840070014d90408060014d90804060014d9084006001518c40806001518c80406001518c84006001950c840070018d50408060018d50804060018d5084006001914c40806001914c80406001914c84006001950c40806001950c80406001950c84006, 0x256433415205143210),
  ([15], 0x1950840c0a001950c4080a001950c8040a001950c8400a001950c84009001194840c08001194c40808001194c80408001194c84008001590840c08001590c40808001590c80408001590c84008001950840c08001950c40808001950c80408001950c84008, 0x4531620521343210),
  ([31], 0x194c84100b001950840c0b001950c4080b001950c8040b001950c8400b, 0x43152543210),
  ([63], 0x0, 0x6543210), ([127], 0x0, 0x0),
  ([7, 25], 0x19484d000e00194850c00e001950c4800e001950c8400e001950c8400d00158d04800c00158d08400c001590c4800c001590c8400c00194d04800c00194d08400c001950c4800c001950c8400c, 0x30421550142433210),
  ([7, 56], 0x10c419480e0010c819440e0010c859400e0014c419080e0014c819040e0014c859000e00150418c80e00150818c40e00150858c00e, 0x54032124653245310),
  ([15, 49], 0x191484c00f001914c4800f001914c8400f00195084c00f001950c4800f001950c8400f, 0x40321525343210),
  ([15, 112], 0x0, 0x24133142432100), ([15, 113], 0x0, 0x32424343210),
  ([31, 97], 0x0, 0x4253543210),
  ([7, 25, 42], 0x1894500c12001914c8041200190814c411001950c8401200194850c011001950c84011001950c84010, 0x34152543243210),
  ([7, 25, 97], 0x14c41908110014c819041100150418c81100150818c4110018c41508110018c815041100190414c81100190814c411, 0x51450412332210),
  ([7, 25, 98], 0x14d9040812001518c408120018d5040812001914c40812, 0x134541033524201),
  ([15, 49, 82], 0x19508c4013001950c84013, 0x14332443210),
  ([7, 25, 42, 52], 0x190d40841400194d048014001950c84014, 0x6501324443210),
  ([7, 25, 42, 76], 0x1950c84015001194c08414001590c48014001950c84014, 0x4215013433210),
  ([7, 25, 42, 84], 0x190814c415, 0x1324423340021), ([15, 49, 82, 100], 0x0, 0x1424343210),
  ([7, 25, 42, 52, 76], 0x1914c80416001950c84016, 0x10324443210),
  ([7, 25, 42, 76, 112], 0x0, 0x12132303210),
  ([7, 25, 42, 52, 76, 82], 0x1950c84017, 0x24543210),
  ([7, 25, 42, 52, 76, 82, 97], 0x0, 0x6543210)]

theorem chk7_0 : D7_0.all (rowF 7 R7) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 7 points has a proper 7-colouring. -/
theorem col7 (E : Finset (Line 7)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 7 (by norm_num) R7 (D7_0) (by decide +kernel) (by decide +kernel)
    chk7_0 E hE hE2

/-- Representatives of the linear families of lines with at least three points on 8 points. -/
def R8 : List (List ℕ) := [
  [], [7], [15], [31], [63], [127], [255], [7, 25], [7, 56], [15, 49], [15, 112], [15, 113],
  [15, 240], [31, 97], [31, 224], [31, 225], [63, 193], [7, 25, 42], [7, 25, 97], [7, 25, 98],
  [7, 25, 224], [15, 49, 82], [15, 49, 193], [15, 49, 194], [15, 49, 208], [15, 113, 146],
  [31, 97, 162], [7, 25, 42, 52], [7, 25, 42, 76], [7, 25, 42, 84], [7, 25, 42, 193],
  [7, 25, 42, 196], [7, 25, 98, 168], [15, 49, 82, 100], [15, 49, 82, 148], [15, 49, 82, 162],
  [15, 49, 82, 164], [15, 49, 82, 224], [15, 113, 146, 164], [31, 97, 162, 196],
  [7, 25, 42, 52, 76], [7, 25, 42, 52, 193], [7, 25, 42, 76, 112], [7, 25, 42, 76, 146],
  [7, 25, 42, 76, 176], [7, 25, 42, 84, 164], [7, 25, 42, 84, 224], [15, 49, 82, 100, 148],
  [15, 49, 82, 100, 152], [15, 49, 82, 148, 224], [15, 49, 82, 162, 193], [15, 49, 82, 162, 196],
  [15, 49, 82, 164, 200], [15, 113, 146, 164, 200], [7, 25, 42, 52, 76, 82],
  [7, 25, 42, 52, 76, 146], [7, 25, 42, 52, 76, 193], [7, 25, 42, 76, 112, 146],
  [7, 25, 42, 76, 146, 224], [7, 25, 42, 84, 164, 200], [15, 49, 82, 100, 148, 162],
  [15, 49, 82, 100, 148, 168], [7, 25, 42, 52, 76, 82, 97], [7, 25, 42, 52, 76, 82, 161],
  [7, 25, 42, 52, 76, 146, 193], [7, 25, 42, 76, 112, 146, 164],
  [15, 49, 82, 100, 148, 162, 193], [15, 49, 82, 100, 148, 162, 200],
  [7, 25, 42, 76, 112, 146, 164, 193]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R8`. -/
def D8_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x1d950c84006001d950c8405005d950c80050041d950c804009d950c40050081d950c4040085d950c00400841d950c0300dd9508400500c1d950840400c5d950800400c41d95080300c9d950400400c81d95040300c85d95000300c841d95002011d94c840050101d94c84040105d94c800401041d94c8030109d94c400401081d94c40301085d94c003010841d94c02010dd9484004010c1d948403010c5d948003010c41d94802010c9d944003010c81d94402010c85d94002010c841d9401015d90c840050141d90c84040145d90c800401441d90c8030149d90c400401481d90c40301485d90c003014841d90c02014dd9084004014c1d908403014c5d908003014c41d90802014c9d904003014c81d90402014c85d90002014c841d90010151d8c8400401501d8c840301505d8c8003015041d8c80201509d8c4003015081d8c402015085d8c0020150841d8c010150dd8840030150c1d884020150c5d880020150c41d88010150c9d840020150c81d84010150c85d8001019d50c840050181d50c84040185d50c800401841d50c8030189d50c400401881d50c40301885d50c003018841d50c02018dd5084004018c1d508403018c5d508003018c41d50802018c9d504003018c81d50402018c85d50002018c841d50010191d4c8400401901d4c840301905d4c8003019041d4c80201909d4c4003019081d4c402019085d4c0020190841d4c010190dd4840030190c1d484020190c5d480020190c41d48010190c9d440020190c81d44010190c85d40010195d0c8400401941d0c840301945d0c8003019441d0c80201949d0c4003019481d0c402019485d0c0020194841d0c010194dd0840030194c1d084020194c5d080020194c41d08010194c9d040020194c81d04010194c85d000101951cc84003019501cc8402019505cc80020195041cc801019509cc40020195081cc4010195085cc00101950dc8400201950c1c840101950c5c800101950c9c400101d950c8400501c1950c840401c5950c800401c41950c80301c9950c400401c81950c40301c85950c00301c841950c0201cd9508400401cc1950840301cc5950800301cc4195080201cc9950400301cc8195040201cc8595000201cc8419500101d194c8400401d0194c840301d0594c800301d04194c80201d0994c400301d08194c40201d08594c00201d084194c0101d0d948400301d0c194840201d0c594800201d0c419480101d0c994400201d0c819440101d0c859400101d590c8400401d4190c840301d4590c800301d44190c80201d4990c400301d48190c40201d48590c00201d484190c0101d4d908400301d4c190840201d4c590800201d4c419080101d4c990400201d4c819040101d4c859000101d518c8400301d5018c840201d5058c800201d50418c80101d5098c400201d50818c40101d50858c00101d50d88400201d50c18840101d50c58800101d50c98400101d950c8400401d8150c840301d8550c800301d84150c80201d8950c400301d88150c40201d88550c00201d884150c0101d8d508400301d8c150840201d8c550800201d8c415080101d8c950400201d8c815040101d8c855000101d914c8400301d9014c840201d9054c800201d90414c80101d9094c400201d90814c40101d90854c00101d90d48400201d90c14840101d90c54800101d90c94400101d950c8400301d9410c840201d9450c800201d94410c80101d9490c400201d94810c40101d94850c00101d94d08400201d94c10840101d94c50800101d94c90400101d950c8400201d9500c840101d9504c800101d9508c400101d950c84001, 0x1024356263045516340413562210),
  ([7], 0x10dd9484008014dd90840080151d8c840080150dd8408070150dd8804070150dd884007018dd50840080191d4c840080190dd4408070190dd4804070190dd4840070195d0c840080194dd0408070194dd0804070194dd08400701951cc4080701951cc8040701951cc8400701cd9508400801d194c8400801d0d944080701d0d948040701d0d948400701d590c8400801d4d904080701d4d908040701d4d908400701d518c4080701d518c8040701d518c8400701d950c8400801d8d504080701d8d508040701d8d508400701d914c4080701d914c8040701d914c8400701d950c4080701d950c8040701d950c84007, 0x15267430652343416204153210),
  ([15], 0x1d950c8400c011d94840c0b011d94c4080b011d94c8040b011d94c8400b011d94c8400a015d90840c0b015d90c4080b015d90c8040b015d90c8400b015d90c8400a0151d8840c090151d8c408090151d8c804090151d8c84009019d50840c0b019d50c4080b019d50c8040b019d50c8400b019d50c8400a0191d4840c090191d4c408090191d4c804090191d4c840090195d0840c090195d0c408090195d0c804090195d0c8400901d950840c0b01d950c4080b01d950c8040b01d950c8400b01d950c8400a01d194840c0901d194c4080901d194c8040901d194c8400901d590840c0901d590c4080901d590c8040901d590c8400901d950840c0901d950c4080901d950c8040901d950c84009, 0x2614354531620651343210),
  ([31], 0x1d94c84100f01d950840c0f01d950c4080f01d950c8040f01d950c8400f01d950c8400e015d8c84100d015d90840c0d015d90c4080d015d90c8040d015d90c8400d019d4c84100d019d50840c0d019d50c4080d019d50c8040d019d50c8400d01d94c84100d01d950840c0d01d950c4080d01d950c8040d01d950c8400d, 0x5643172062413543210),
  ([63], 0x1d90c84141001d94c84101001d950840c1001d950c4081001d950c8041001d950c84010, 0x5431626543210),
  ([127], 0x0, 0x76543210), ([255], 0x0, 0x0),
  ([7, 25], 0x1d950c84014015d884d0013015d8850c013015d90c48013015d90c84013015d90c84012019d484d0013019d4850c013019d50c48013019d50c84013019d50c840120195cd0480110195cd0840110195d0c480110195d0c8401101d9484d001301d94850c01301d950c4801301d950c8401301d950c8401201d58d04801101d58d08401101d590c4801101d590c8401101d94d04801101d94d08401101d950c4801101d950c84011, 0x46513235421620765473210),
  ([7, 56], 0x841d90d41400841d94d01400841d950c140150dd8408140150dd8804140150dd8840140190c41d48130190c81d44130190c85d40130194c41d08130194c81d04130194c85d00130195041cc8130195081cc4130195085cc01301d0c419481301d0c819441301d0c859401301d4c419081301d4c819041301d4c859001301d50418c81301d50818c41301d50858c013, 0x52361465432124343615200),
  ([15, 49], 0x1d914c8401801d950c8401801d95084c01701d950c4801701d950c8401701d950c84016019d1484c015019d14c48015019d14c84015019d5084c015019d50c48015019d50c8401501d91484c01501d914c4801501d914c8401501d95084c01501d950c4801501d950c84015, 0x405321650613226443210),
  ([15, 112], 0x151d8840c180151d8c408180151d8c804180151d8c840180191d4840c180191d4c408180191d4c804180191d4c840180195d0840c180195d0c408180195d0c804180195d0c84018, 0x650432135422634625310),
  ([15, 113], 0x1d51884c01901d518c4801901d518c8401901d91484c01901d914c4801901d914c8401901d95084c01901d950c4801901d950c84019, 0x340521664525343210),
  ([15, 240], 0x0, 0x123424133142432100),
  ([31, 97], 0x1d58c85001a01d59084c01a01d590c4801a01d590c8401a01d94c85001a01d95084c01a01d950c4801a01d950c8401a, 0x50632144263543210),
  ([31, 224], 0x0, 0x25413431525432100), ([31, 225], 0x0, 0x35244253543210),
  ([63, 193], 0x0, 0x542636543210),
  ([7, 25, 42], 0x1d90814c41f01d94850c01f01d894500c1e01d950c8401f01d914c8041e01d950c8401e019c94500c1d019d14c8041d019d0814c41c019d50c8401d019d4850c01c019d50c8401c01d894500c1d01d914c8041d01d90814c41c01d950c8401d01d94850c01c01d950c8401c01d950c8401b, 0x2130456457163057243210),
  ([7, 25, 97], 0x85d58d001e0085d590c01e010dd584801e010dd588401e0085d94d001e0085d950c01e010dd944801e010dd948401e0195cd04801e0195cd08401e0195d0c4801e0195d0c8401e01d4c419081c01d4c819041c01d50418c81c01d50818c41c01d8c415081c01d8c815041c01d90414c81c01d90814c41c, 0x6540213541303463265210),
  ([7, 25, 98], 0x1d58d08402001d590c84020010dd580841f010d5d88401e01d94d08402001d950c84020010dd940841f010d9d48401e0195cd04801f0194dd08041e0195d0c4801f01951cc8041e01d4d904081d01d518c4081d01d8d504081d01d914c4081d, 0x1354062635421453425001),
  ([7, 25, 224], 0x194c41d081f0194c81d041f0195041cc81f0195081cc41f01d4c419081f01d4c819041f01d50418c81f01d50818c41f01d8c415081f01d8c815041f01d90414c81f01d90814c41f, 0x2635465142432155342010),
  ([15, 49, 82], 0x1d950c8402501d5908c042401d590c8042401d590c8042301d9508c402401d950c8402401d950c8402301d9508c402201d950c8402201d9508c402101d950c84021, 0x5402136014332543210),
  ([15, 49, 193], 0x191d4840c230191d4c408230191d4c804230195d0840c230195d0c408230195d0c8042301d194840c2301d194c4082301d194c8042301d590840c2301d590c4082301d590c80423, 0x346130615254542210),
  ([15, 49, 194], 0x191d4840c240191d4c408240195d0840c240195d0c4082401d194840c2401d194c4082401d590840c2401d590c40824, 0x523420453543324110),
  ([15, 49, 208], 0x19d1484c025019d14c48025019d14c8402501d91484c02501d914c4802501d914c84025, 0x5314601453432563210),
  ([15, 113, 146], 0x1d5908c402601d590c8402601d9508c402601d950c84026, 0x431552425343210),
  ([31, 97, 162], 0x1d94c90402701d9508c402701d950c84027, 0x31454325543210),
  ([7, 25, 42, 52], 0x1d8108c542901d8548c102901d894500c2901d8d504082901d914c8042901d950c84029019d0d408428019d4d048028019d50c8402801d90d40842801d94d04802801d950c84028, 0x40652136501324443210),
  ([7, 25, 42, 76], 0x1d194c0842c01d590c4802c01d158c0482b01d518c4082b01d950c8402c01d194c0842b01d914c8042b01d590c4802b01d950c8402b01d950c8402a01d194c0842801d590c4802801d950c84028, 0x3251461452045533210),
  ([7, 25, 42, 84], 0x1d950c8402e01d5848d002d01d58d04802d015cc419082c01d94850c02d01d950c8402d019d0814c42c0159cd08402b0195d0c4802b01d90814c42a, 0x32614501524453330021),
  ([7, 25, 42, 193], 0x189c5410c2d0191cd40842d0158c41d082c01949c4c102b01951cc4082b01c985410c2d01d18d40842d015cc419082c01d4984c102b01d518c4082b01d950c84029, 0x31456531424260530021),
  ([7, 25, 42, 196], 0x19c94500c2e0191c80d442c0195c84d002c01d894500c2e01d1880d442c01d5884d002c01d8d5040829, 0x64135536421342540201),
  ([7, 25, 98, 168], 0x841914dc2e010c1c94582e0108c541d82d01945c8c102e018940c5d02d01d4d904082e01d1404d882d01d8c415082d, 0x53412041345625360210),
  ([15, 49, 82, 100], 0x1d518c0843001d518c0842f01d914c4803001d914c4802f01d950c8403001d950c8402f, 0x42015636554343210),
  ([15, 49, 82, 148], 0x1d950c84031015d900c8430015d90c0842f019d504c8030019d50c4802f01d9508c403001d950c8402f, 0x45162031524343210),
  ([15, 49, 82, 162], 0x1d9508c403301d950c8403301d950c84032019d5084c02f019d50c4802f01d91484c02f01d914c4802f, 0x10254043552343210),
  ([15, 49, 82, 164], 0x1d950c8403401d590c80433019d5048c03001d91484c030, 0x30526025443341120),
  ([15, 49, 82, 224], 0x1d9508c403101d950c84031, 0x1245514245433210),
  ([15, 113, 146, 164], 0x1d950c84035, 0x1442324343210),
  ([31, 97, 162, 196], 0x0, 0x4152455343210),
  ([7, 25, 42, 52, 76], 0x1d804c9143801d840c9503801d914c8043801d950c8403801d914c8043701d950c8403701d914c8043601d950c84036, 0x310756202154443210),
  ([7, 25, 42, 52, 193], 0x19d4d048038019d50c8403801d94d04803801d950c84038, 0x231541542336304021),
  ([7, 25, 42, 76, 112], 0x1d158c0483901d518c4083901d194c0843901d914c8043901d590c4803901d950c84039, 0x256041345142303210),
  ([7, 25, 42, 76, 146], 0x1d950c8403a01588c1c503901900c5c94390189d4410c3801d950c8403901d194c0843801d950c84037, 0x241531354520400321),
  ([7, 25, 42, 76, 176], 0x1d158c0483a01d518c4083a01d084c1943801d480c59038, 0x245131654452303210),
  ([7, 25, 42, 84, 164], 0x1d950c8403b00d014985c3a00d4509c183a018c10549c3901cc54109839, 0x254010543243631102),
  ([7, 25, 42, 84, 224], 0x159cd08403a0195d0c4803a, 0x534214534253501120),
  ([15, 49, 82, 100, 148], 0x1d590c8043d01d590c8043c01d950c8403d01d950c8403c, 0x501324624343210)]

theorem chk8_0 : D8_0.all (rowF 8 R8) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R8`. -/
def D8_1 : List (List ℕ × ℕ × ℕ) := [
  ([15, 49, 82, 100, 152], 0x15d9080c43d019d5084c03d, 0x204535434511320),
  ([15, 49, 82, 148, 224], 0x0, 0x142314243403210),
  ([15, 49, 82, 162, 193], 0x195d0840c3c0195d0c4083c01d194840c3c01d194c4083c, 0x12031244343210),
  ([15, 49, 82, 162, 196], 0x195d0840c3d01d194840c3d, 0x52043253413210),
  ([15, 49, 82, 164, 200], 0x0, 0x34043344312210),
  ([15, 113, 146, 164, 200], 0x0, 0x523243443210),
  ([7, 25, 42, 52, 76, 82], 0x1c1890c543f01d58d08403f01d950c8403f01d950c8403e, 0x165243624543210),
  ([7, 25, 42, 52, 76, 146], 0x1d8108c544001d950c84040019cd504083f01d914c8043f, 0x2153451430004321),
  ([7, 25, 42, 52, 76, 193], 0x1d950c8404001d58d08403f, 0x3152415253034021),
  ([7, 25, 42, 76, 112, 146], 0x1d518c4084101d950c840410099c5500c40, 0x2504354213101320),
  ([7, 25, 42, 76, 146, 224], 0x1d8108c5440, 0x4525344312011230),
  ([7, 25, 42, 84, 164, 200], 0x159cd084041011d8d480441, 0x420144334312210),
  ([15, 49, 82, 100, 148, 162], 0x1d950c8404301d950c84042, 0x124523543210),
  ([15, 49, 82, 100, 148, 168], 0x1d590c80443, 0x232443143120),
  ([7, 25, 42, 52, 76, 82, 97], 0x0, 0x5461326543210),
  ([7, 25, 42, 52, 76, 82, 161], 0x0, 0x41532130504321),
  ([7, 25, 42, 52, 76, 146, 193], 0x0, 0x24332410114032),
  ([7, 25, 42, 76, 112, 146, 164], 0x1d950c84044, 0x50413231202310),
  ([15, 49, 82, 100, 148, 162, 193], 0x0, 0x14236543210),
  ([15, 49, 82, 100, 148, 162, 200], 0x0, 0x24231543210),
  ([7, 25, 42, 76, 112, 146, 164, 193], 0x0, 0x13221303210)]

theorem chk8_1 : D8_1.all (rowF 8 R8) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 8 points has a proper 8-colouring. -/
theorem col8 (E : Finset (Line 8)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 8 (by norm_num) R8 (D8_0 ++ D8_1) (by decide +kernel) (by decide +kernel)
    (by simp only [List.all_append, chk8_0, chk8_1, Bool.and_self]) E hE hE2

/-- Representatives of the linear families of lines with at least three points on 9 points. -/
def R9 : List (List ℕ) := [
  [], [7], [15], [31], [63], [127], [255], [511], [7, 25], [7, 56], [15, 49], [15, 112],
  [15, 113], [15, 240], [31, 97], [31, 224], [31, 225], [31, 480], [31, 481], [63, 193],
  [63, 448], [63, 449], [127, 385], [7, 25, 42], [7, 25, 97], [7, 25, 98], [7, 25, 224],
  [7, 56, 448], [15, 49, 82], [15, 49, 193], [15, 49, 194], [15, 49, 208], [15, 49, 448],
  [15, 112, 400], [15, 113, 146], [15, 113, 385], [15, 113, 386], [15, 113, 402], [15, 240, 273],
  [31, 97, 162], [31, 97, 385], [31, 97, 386], [31, 97, 416], [31, 225, 290], [63, 193, 322],
  [7, 25, 42, 52], [7, 25, 42, 76], [7, 25, 42, 84], [7, 25, 42, 193], [7, 25, 42, 196],
  [7, 25, 42, 448], [7, 25, 97, 385], [7, 25, 97, 386], [7, 25, 98, 168], [7, 25, 98, 388],
  [7, 25, 98, 392], [15, 49, 82, 100], [15, 49, 82, 148], [15, 49, 82, 162], [15, 49, 82, 164],
  [15, 49, 82, 224], [15, 49, 82, 385], [15, 49, 82, 388], [15, 49, 82, 400], [15, 49, 82, 416],
  [15, 49, 193, 336], [15, 49, 194, 336], [15, 49, 208, 352], [15, 113, 146, 164],
  [15, 113, 146, 276], [15, 113, 146, 292], [15, 113, 146, 385], [15, 113, 146, 388],
  [15, 113, 164, 402], [15, 240, 273, 290], [31, 97, 162, 196], [31, 97, 162, 292],
  [31, 97, 162, 322], [31, 97, 162, 324], [31, 97, 162, 448], [31, 225, 290, 324],
  [63, 193, 322, 388], [7, 25, 42, 52, 76], [7, 25, 42, 52, 193], [7, 25, 42, 52, 448],
  [7, 25, 42, 76, 112], [7, 25, 42, 76, 146], [7, 25, 42, 76, 176], [7, 25, 42, 76, 385],
  [7, 25, 42, 76, 392], [7, 25, 42, 76, 400], [7, 25, 42, 84, 164], [7, 25, 42, 84, 224],
  [7, 25, 42, 84, 385], [7, 25, 42, 84, 386], [7, 25, 42, 84, 416], [7, 25, 42, 193, 322],
  [7, 25, 42, 193, 324], [7, 25, 42, 193, 352], [7, 25, 42, 196, 336], [7, 25, 98, 168, 336],
  [15, 49, 82, 100, 148], [15, 49, 82, 100, 152], [15, 49, 82, 100, 385], [15, 49, 82, 100, 392],
  [15, 49, 82, 100, 400], [15, 49, 82, 148, 224], [15, 49, 82, 148, 280], [15, 49, 82, 148, 290],
  [15, 49, 82, 148, 296], [15, 49, 82, 148, 352], [15, 49, 82, 162, 193], [15, 49, 82, 162, 196],
  [15, 49, 82, 162, 321], [15, 49, 82, 162, 324], [15, 49, 82, 162, 352], [15, 49, 82, 162, 448],
  [15, 49, 82, 164, 200], [15, 49, 82, 164, 324], [15, 49, 82, 164, 328], [15, 49, 82, 164, 352],
  [15, 49, 82, 164, 448], [15, 49, 82, 224, 385], [15, 49, 82, 224, 388], [15, 49, 82, 224, 400],
  [15, 49, 193, 336, 416], [15, 49, 194, 336, 416], [15, 113, 146, 164, 200],
  [15, 113, 146, 164, 276], [15, 113, 146, 164, 280], [15, 113, 146, 164, 328],
  [15, 113, 146, 164, 385], [15, 113, 146, 164, 392], [15, 113, 146, 276, 385],
  [15, 113, 146, 276, 392], [15, 113, 146, 276, 416], [15, 113, 146, 292, 385],
  [15, 113, 146, 292, 392], [15, 113, 164, 200, 402], [15, 113, 164, 328, 402],
  [15, 240, 273, 290, 324], [31, 97, 162, 196, 292], [31, 97, 162, 196, 296],
  [31, 97, 162, 292, 448], [31, 97, 162, 322, 385], [31, 97, 162, 322, 388],
  [31, 97, 162, 324, 392], [31, 225, 290, 324, 392], [7, 25, 42, 52, 76, 82],
  [7, 25, 42, 52, 76, 146], [7, 25, 42, 52, 76, 193], [7, 25, 42, 52, 76, 385],
  [7, 25, 42, 52, 76, 388], [7, 25, 42, 52, 76, 448], [7, 25, 42, 52, 193, 322],
  [7, 25, 42, 52, 193, 352], [7, 25, 42, 76, 112, 146], [7, 25, 42, 76, 112, 385],
  [7, 25, 42, 76, 112, 392], [7, 25, 42, 76, 146, 224], [7, 25, 42, 76, 146, 276],
  [7, 25, 42, 76, 146, 289], [7, 25, 42, 76, 146, 292], [7, 25, 42, 76, 146, 322],
  [7, 25, 42, 76, 146, 336], [7, 25, 42, 76, 146, 352], [7, 25, 42, 76, 146, 448],
  [7, 25, 42, 76, 176, 336], [7, 25, 42, 76, 176, 385], [7, 25, 42, 76, 176, 388],
  [7, 25, 42, 76, 176, 392], [7, 25, 42, 76, 176, 448], [7, 25, 42, 84, 164, 200],
  [7, 25, 42, 84, 164, 304], [7, 25, 42, 84, 164, 322], [7, 25, 42, 84, 164, 328],
  [7, 25, 42, 84, 164, 352], [7, 25, 42, 84, 164, 448], [7, 25, 42, 84, 224, 385],
  [7, 25, 42, 84, 224, 386], [7, 25, 42, 196, 336, 416], [7, 25, 98, 168, 336, 388],
  [15, 49, 82, 100, 148, 162], [15, 49, 82, 100, 148, 168], [15, 49, 82, 100, 148, 280],
  [15, 49, 82, 100, 148, 290], [15, 49, 82, 100, 148, 296], [15, 49, 82, 100, 148, 385],
  [15, 49, 82, 100, 148, 392], [15, 49, 82, 100, 148, 416], [15, 49, 82, 100, 152, 296],
  [15, 49, 82, 100, 152, 385], [15, 49, 82, 100, 152, 388], [15, 49, 82, 100, 152, 416],
  [15, 49, 82, 148, 224, 280], [15, 49, 82, 148, 224, 290], [15, 49, 82, 148, 224, 296],
  [15, 49, 82, 148, 290, 321], [15, 49, 82, 148, 290, 324], [15, 49, 82, 148, 290, 328],
  [15, 49, 82, 148, 290, 392], [15, 49, 82, 148, 290, 448], [15, 49, 82, 148, 296, 448],
  [15, 49, 82, 162, 193, 352], [15, 49, 82, 162, 196, 352], [15, 49, 82, 162, 321, 388],
  [15, 49, 82, 162, 321, 400], [15, 49, 82, 162, 324, 392], [15, 49, 82, 162, 324, 400],
  [15, 49, 82, 162, 352, 400], [15, 49, 82, 164, 200, 352], [15, 49, 82, 164, 324, 400],
  [15, 49, 82, 164, 328, 400], [15, 49, 82, 164, 352, 400], [15, 113, 146, 164, 200, 276],
  [15, 113, 146, 164, 200, 385], [15, 113, 146, 164, 276, 290], [15, 113, 146, 164, 276, 296],
  [15, 113, 146, 164, 276, 328], [15, 113, 146, 164, 276, 385], [15, 113, 146, 164, 276, 392],
  [15, 113, 146, 164, 280, 324], [15, 113, 146, 164, 280, 385], [15, 113, 146, 164, 280, 448],
  [15, 113, 146, 164, 328, 385], [15, 113, 164, 200, 296, 402], [15, 240, 273, 290, 324, 392],
  [31, 97, 162, 196, 292, 322], [31, 97, 162, 196, 292, 328], [31, 97, 162, 196, 296, 336],
  [7, 25, 42, 52, 76, 82, 97], [7, 25, 42, 52, 76, 82, 161], [7, 25, 42, 52, 76, 82, 385],
  [7, 25, 42, 52, 76, 82, 386], [7, 25, 42, 52, 76, 146, 193], [7, 25, 42, 52, 76, 146, 289],
  [7, 25, 42, 52, 76, 146, 321], [7, 25, 42, 52, 76, 146, 322], [7, 25, 42, 52, 76, 146, 448],
  [7, 25, 42, 52, 76, 193, 322], [7, 25, 42, 52, 76, 193, 352], [7, 25, 42, 52, 76, 193, 386],
  [7, 25, 42, 52, 76, 193, 388], [7, 25, 42, 52, 76, 193, 416], [7, 25, 42, 52, 193, 322, 388],
  [7, 25, 42, 52, 193, 322, 392], [7, 25, 42, 52, 193, 322, 400], [7, 25, 42, 76, 112, 146, 164],
  [7, 25, 42, 76, 112, 146, 276], [7, 25, 42, 76, 112, 146, 289], [7, 25, 42, 76, 112, 146, 292],
  [7, 25, 42, 76, 112, 146, 385], [7, 25, 42, 76, 112, 146, 388], [7, 25, 42, 76, 112, 146, 392],
  [7, 25, 42, 76, 146, 224, 276], [7, 25, 42, 76, 146, 224, 289], [7, 25, 42, 76, 146, 224, 292],
  [7, 25, 42, 76, 146, 224, 321], [7, 25, 42, 76, 146, 224, 322], [7, 25, 42, 76, 146, 224, 336],
  [7, 25, 42, 76, 146, 289, 448], [7, 25, 42, 76, 146, 292, 448], [7, 25, 42, 76, 146, 322, 392],
  [7, 25, 42, 76, 146, 322, 416], [7, 25, 42, 76, 146, 336, 388], [7, 25, 42, 76, 146, 336, 416],
  [7, 25, 42, 76, 176, 336, 385], [7, 25, 42, 76, 176, 336, 386], [7, 25, 42, 84, 164, 200, 304],
  [7, 25, 42, 84, 164, 322, 385], [7, 25, 42, 84, 164, 322, 392],
  [15, 49, 82, 100, 148, 162, 193], [15, 49, 82, 100, 148, 162, 200],
  [15, 49, 82, 100, 148, 162, 280], [15, 49, 82, 100, 148, 162, 321],
  [15, 49, 82, 100, 148, 162, 328], [15, 49, 82, 100, 148, 162, 448],
  [15, 49, 82, 100, 148, 168, 280], [15, 49, 82, 100, 148, 168, 321],
  [15, 49, 82, 100, 148, 168, 328], [15, 49, 82, 100, 148, 168, 448],
  [15, 49, 82, 100, 148, 280, 385], [15, 49, 82, 100, 148, 280, 416],
  [15, 49, 82, 100, 148, 290, 385], [15, 49, 82, 100, 148, 290, 392],
  [15, 49, 82, 100, 148, 290, 448], [15, 49, 82, 100, 148, 296, 385],
  [15, 49, 82, 100, 148, 296, 386], [15, 49, 82, 100, 148, 296, 448],
  [15, 49, 82, 100, 152, 296, 385], [15, 49, 82, 100, 152, 296, 386],
  [15, 49, 82, 100, 152, 296, 448], [15, 49, 82, 148, 224, 290, 321],
  [15, 49, 82, 148, 224, 290, 324], [15, 49, 82, 148, 224, 290, 328],
  [15, 49, 82, 148, 224, 290, 392], [15, 49, 82, 148, 290, 321, 392],
  [15, 49, 82, 148, 290, 324, 385], [15, 49, 82, 148, 290, 324, 392],
  [15, 49, 82, 162, 193, 352, 400], [15, 49, 82, 162, 196, 352, 400],
  [15, 49, 82, 164, 200, 352, 400], [15, 113, 146, 164, 200, 276, 290],
  [15, 113, 146, 164, 200, 276, 296], [15, 113, 146, 164, 200, 276, 385],
  [15, 113, 146, 164, 276, 290, 385], [15, 113, 146, 164, 276, 290, 392],
  [15, 113, 146, 164, 276, 296, 385], [15, 113, 146, 164, 276, 296, 448],
  [15, 113, 146, 164, 276, 328, 385], [15, 113, 146, 164, 280, 324, 385],
  [15, 113, 164, 200, 296, 324, 402], [31, 97, 162, 196, 292, 322, 385],
  [31, 97, 162, 196, 292, 322, 392], [31, 97, 162, 196, 292, 328, 400],
  [7, 25, 42, 52, 76, 82, 97, 385], [7, 25, 42, 52, 76, 82, 161, 321],
  [7, 25, 42, 52, 76, 82, 161, 386], [7, 25, 42, 52, 76, 82, 161, 448],
  [7, 25, 42, 52, 76, 146, 193, 289], [7, 25, 42, 52, 76, 146, 193, 322],
  [7, 25, 42, 52, 76, 146, 193, 352], [7, 25, 42, 52, 76, 146, 289, 448],
  [7, 25, 42, 52, 76, 146, 321, 388], [7, 25, 42, 52, 76, 146, 321, 416],
  [7, 25, 42, 52, 76, 146, 322, 388], [7, 25, 42, 52, 76, 193, 322, 388],
  [7, 25, 42, 52, 76, 193, 322, 392], [7, 25, 42, 52, 76, 193, 322, 400],
  [7, 25, 42, 52, 76, 193, 352, 386], [7, 25, 42, 52, 76, 193, 352, 388],
  [7, 25, 42, 76, 112, 146, 164, 193], [7, 25, 42, 76, 112, 146, 164, 276],
  [7, 25, 42, 76, 112, 146, 164, 289], [7, 25, 42, 76, 112, 146, 164, 321],
  [7, 25, 42, 76, 112, 146, 276, 392], [7, 25, 42, 76, 112, 146, 276, 416],
  [7, 25, 42, 76, 112, 146, 289, 388], [7, 25, 42, 76, 112, 146, 289, 392],
  [7, 25, 42, 76, 112, 146, 292, 385], [7, 25, 42, 76, 112, 146, 292, 392],
  [7, 25, 42, 76, 146, 224, 289, 336], [7, 25, 42, 76, 146, 224, 292, 336],
  [7, 25, 42, 76, 146, 224, 321, 392], [7, 25, 42, 76, 146, 224, 336, 388],
  [7, 25, 42, 84, 164, 200, 304, 322], [15, 49, 82, 100, 148, 162, 193, 280],
  [15, 49, 82, 100, 148, 162, 200, 280], [15, 49, 82, 100, 148, 162, 280, 321],
  [15, 49, 82, 100, 148, 162, 280, 448], [15, 49, 82, 100, 148, 162, 321, 392],
  [15, 49, 82, 100, 148, 168, 280, 290], [15, 49, 82, 100, 148, 168, 280, 321],
  [15, 49, 82, 100, 148, 168, 280, 448], [15, 49, 82, 100, 148, 168, 321, 386],
  [15, 49, 82, 100, 148, 168, 328, 386], [15, 49, 82, 148, 224, 290, 321, 392],
  [15, 49, 82, 148, 224, 290, 324, 385], [15, 49, 82, 148, 224, 290, 324, 392],
  [15, 113, 146, 164, 200, 276, 290, 385], [15, 113, 146, 164, 200, 276, 296, 322],
  [15, 113, 146, 164, 200, 276, 296, 385], [7, 25, 42, 52, 76, 82, 161, 321, 386],
  [7, 25, 42, 52, 76, 146, 193, 289, 322], [7, 25, 42, 52, 76, 146, 193, 322, 388],
  [7, 25, 42, 52, 76, 146, 193, 322, 392], [7, 25, 42, 52, 76, 146, 193, 322, 416],
  [7, 25, 42, 76, 112, 146, 164, 193, 276], [7, 25, 42, 76, 112, 146, 164, 276, 289],
  [7, 25, 42, 76, 112, 146, 164, 289, 322], [7, 25, 42, 76, 112, 146, 164, 289, 448],
  [7, 25, 42, 76, 146, 224, 289, 336, 388], [7, 25, 42, 76, 146, 224, 292, 336, 385],
  [7, 25, 42, 84, 164, 200, 304, 322, 385], [15, 49, 82, 100, 148, 162, 200, 280, 321],
  [15, 49, 82, 100, 148, 168, 280, 290, 448], [15, 49, 82, 100, 148, 168, 280, 321, 386],
  [15, 113, 146, 164, 200, 276, 296, 322, 385], [7, 25, 42, 52, 76, 146, 193, 289, 322, 388],
  [7, 25, 42, 52, 76, 146, 193, 289, 322, 392], [7, 25, 42, 76, 112, 146, 164, 193, 276, 289],
  [7, 25, 42, 76, 112, 146, 164, 289, 322, 392],
  [7, 25, 42, 76, 112, 146, 164, 193, 276, 289, 322],
  [7, 25, 42, 76, 112, 146, 164, 193, 276, 289, 322, 392]]

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_0 : List (List ℕ × ℕ × ℕ) := [
  ([], 0x21d950c84007021d950c8406061d950c80060421d950c8050a1d950c40060821d950c4050861d950c00508421d950c040e1d950840060c21d95084050c61d95080050c421d9508040ca1d95040050c821d9504040c861d9500040c8421d95003121d94c840061021d94c84051061d94c800510421d94c80410a1d94c400510821d94c40410861d94c004108421d94c0310e1d948400510c21d94840410c61d94800410c421d9480310ca1d94400410c821d9440310c861d9400310c8421d9402161d90c840061421d90c84051461d90c800514421d90c80414a1d90c400514821d90c40414861d90c004148421d90c0314e1d908400514c21d90840414c61d90800414c421d9080314ca1d90400414c821d9040314c861d9000314c8421d90021521d8c8400515021d8c840415061d8c8004150421d8c803150a1d8c4004150821d8c403150861d8c0031508421d8c02150e1d884004150c21d88403150c61d88003150c421d8802150ca1d84003150c821d8402150c861d8002150c8421d8011a1d50c840061821d50c84051861d50c800518421d50c80418a1d50c400518821d50c40418861d50c004188421d50c0318e1d508400518c21d50840418c61d50800418c421d5080318ca1d50400418c821d5040318c861d5000318c8421d50021921d4c8400519021d4c840419061d4c8004190421d4c803190a1d4c4004190821d4c403190861d4c0031908421d4c02190e1d484004190c21d48403190c61d48003190c421d4802190ca1d44003190c821d4402190c861d4002190c8421d4011961d0c8400519421d0c840419461d0c8004194421d0c803194a1d0c4004194821d0c403194861d0c0031948421d0c02194e1d084004194c21d08403194c61d08003194c421d0802194ca1d04003194c821d0402194c861d0002194c8421d00119521cc84004195021cc8403195061cc80031950421cc8021950a1cc40031950821cc4021950861cc00219508421cc011950e1c840031950c21c84021950c61c80021950c421c8011950ca1c40021950c821c4011950c861c0011e1950c840061c21950c84051c61950c80051c421950c8041ca1950c40051c821950c4041c861950c0041c8421950c031ce1950840051cc2195084041cc6195080041cc4219508031cca195040041cc8219504031cc8619500031cc8421950021d2194c840051d02194c84041d06194c80041d042194c8031d0a194c40041d082194c4031d086194c0031d0842194c021d0e194840041d0c219484031d0c619480031d0c421948021d0ca19440031d0c821944021d0c861940021d0c842194011d6190c840051d42190c84041d46190c80041d442190c8031d4a190c40041d482190c4031d486190c0031d4842190c021d4e190840041d4c219084031d4c619080031d4c421908021d4ca19040031d4c821904021d4c861900021d4c842190011d5218c840041d50218c84031d50618c80031d504218c8021d50a18c40031d508218c4021d508618c0021d5084218c011d50e18840031d50c21884021d50c61880021d50c42188011d50ca1840021d50c82184011d50c86180011da150c840051d82150c84041d86150c80041d842150c8031d8a150c40041d882150c4031d886150c0031d8842150c021d8e150840041d8c215084031d8c615080031d8c421508021d8ca15040031d8c821504021d8c861500021d8c842150011d9214c840041d90214c84031d90614c80031d904214c8021d90a14c40031d908214c4021d908614c0021d9084214c011d90e14840031d90c21484021d90c61480021d90c42148011d90ca1440021d90c82144011d90c86140011d9610c840041d94210c84031d94610c80031d944210c8021d94a10c40031d948210c4021d948610c0021d9484210c011d94e10840031d94c21084021d94c61080021d94c42108011d94ca1040021d94c82104011d94c86100011d9520c840031d95020c84021d95060c80021d950420c8011d950a0c40021d950820c4011d950860c0011d950e0840021d950c2084011d950c6080011d950ca0400121d950c84006201d950c8405205d950c80052041d950c804209d950c40052081d950c4042085d950c00420841d950c0320dd9508400520c1d950840420c5d950800420c41d95080320c9d950400420c81d95040320c85d95000320c841d95002211d94c840052101d94c84042105d94c800421041d94c8032109d94c400421081d94c40321085d94c003210841d94c02210dd9484004210c1d948403210c5d948003210c41d94802210c9d944003210c81d94402210c85d94002210c841d9401215d90c840052141d90c84042145d90c800421441d90c8032149d90c400421481d90c40321485d90c003214841d90c02214dd9084004214c1d908403214c5d908003214c41d90802214c9d904003214c81d90402214c85d90002214c841d90012151d8c8400421501d8c840321505d8c8003215041d8c80221509d8c4003215081d8c402215085d8c0022150841d8c012150dd8840032150c1d884022150c5d880022150c41d88012150c9d840022150c81d84012150c85d8001219d50c840052181d50c84042185d50c800421841d50c8032189d50c400421881d50c40321885d50c003218841d50c02218dd5084004218c1d508403218c5d508003218c41d50802218c9d504003218c81d50402218c85d50002218c841d50012191d4c8400421901d4c840321905d4c8003219041d4c80221909d4c4003219081d4c402219085d4c0022190841d4c012190dd4840032190c1d484022190c5d480022190c41d48012190c9d440022190c81d44012190c85d40012195d0c8400421941d0c840321945d0c8003219441d0c80221949d0c4003219481d0c402219485d0c0022194841d0c012194dd0840032194c1d084022194c5d080022194c41d08012194c9d040022194c81d04012194c85d000121951cc84003219501cc8402219505cc80022195041cc801219509cc40022195081cc4012195085cc00121950dc8400221950c1c840121950c5c800121950c9c400121d950c8400521c1950c840421c5950c800421c41950c80321c9950c400421c81950c40321c85950c00321c841950c0221cd9508400421cc1950840321cc5950800321cc4195080221cc9950400321cc8195040221cc8595000221cc8419500121d194c8400421d0194c840321d0594c800321d04194c80221d0994c400321d08194c40221d08594c00221d084194c0121d0d948400321d0c194840221d0c594800221d0c419480121d0c994400221d0c819440121d0c859400121d590c8400421d4190c840321d4590c800321d44190c80221d4990c400321d48190c40221d48590c00221d484190c0121d4d908400321d4c190840221d4c590800221d4c419080121d4c990400221d4c819040121d4c859000121d518c8400321d5018c840221d5058c800221d50418c80121d5098c400221d50818c40121d50858c00121d50d88400221d50c18840121d50c58800121d50c98400121d950c8400421d8150c840321d8550c800321d84150c80221d8950c400321d88150c40221d88550c00221d884150c0121d8d508400321d8c150840221d8c550800221d8c415080121d8c950400221d8c815040121d8c855000121d914c8400321d9014c840221d9054c800221d90414c80121d9094c400221d90814c40121d90854c00121d90d48400221d90c14840121d90c54800121d90c94400121d950c8400321d9410c840221d9450c800221d94410c80121d9490c400221d94810c40121d94850c00121d94d08400221d94c10840121d94c50800121d94c90400121d950c8400221d9500c840121d9504c800121d9508c400121d950c84001, 0x180254672874356763045516340813782210),
  ([7], 0x150e1d884009190e1d484009194e1d08400919521cc840091950e1c408081950e1c804081950e1c840081d0e194840091d4e190840091d5218c840091d50e18408081d50e18804081d50e18840081d8e150840091d9214c840091d90e14408081d90e14804081d90e14840081d9610c840091d94e10408081d94e10804081d94e10840081d9520c408081d9520c804081d9520c84008210dd9484009214dd90840092151d8c840092150dd8408082150dd8804082150dd884008218dd50840092191d4c840092190dd4408082190dd4804082190dd4840082195d0c840092194dd0408082194dd0804082194dd08400821951cc4080821951cc8040821951cc8400821cd9508400921d194c8400921d0d944080821d0d948040821d0d948400821d590c8400921d4d904080821d4d908040821d4d908400821d518c4080821d518c8040821d518c8400821d950c8400921d8d504080821d8d508040821d8d508400821d914c4080821d914c8040821d914c8400821d950c4080821d950c8040821d950c84008, 0x261758445267130758363417206453210),
  ([15], 0x121d94c8400d161d90c8400d1521d8840c0c1521d8c4080c1521d8c8040c1521d8c8400c1521d8c8400b1a1d50c8400d1921d4840c0c1921d4c4080c1921d4c8040c1921d4c8400c1921d4c8400b1961d0840c0c1961d0c4080c1961d0c8040c1961d0c8400c1961d0c8400b19521c840c0a19521cc4080a19521cc8040a19521cc8400a1e1950c8400d1d2194840c0c1d2194c4080c1d2194c8040c1d2194c8400c1d2194c8400b1d6190840c0c1d6190c4080c1d6190c8040c1d6190c8400c1d6190c8400b1d5218840c0a1d5218c4080a1d5218c8040a1d5218c8400a1da150840c0c1da150c4080c1da150c8040c1da150c8400c1da150c8400b1d9214840c0a1d9214c4080a1d9214c8040a1d9214c8400a1d9610840c0a1d9610c4080a1d9610c8040a1d9610c8400a21d950c8400d211d94840c0c211d94c4080c211d94c8040c211d94c8400c211d94c8400b215d90840c0c215d90c4080c215d90c8040c215d90c8400c215d90c8400b2151d8840c0a2151d8c4080a2151d8c8040a2151d8c8400a219d50840c0c219d50c4080c219d50c8040c219d50c8400c219d50c8400b2191d4840c0a2191d4c4080a2191d4c8040a2191d4c8400a2195d0840c0a2195d0c4080a2195d0c8040a2195d0c8400a21d950840c0c21d950c4080c21d950c8040c21d950c8400c21d950c8400b21d194840c0a21d194c4080a21d194c8040a21d194c8400a21d590840c0a21d590c4080a21d590c8040a21d590c8400a21d950840c0a21d950c4080a21d950c8040a21d950c8400a, 0x2617854307614354531720285643210),
  ([31], 0x21d94c84101221d950840c1221d950c4081221d950c8041221d950c8401221d950c84011161d8c841010161d90840c10161d90c40810161d90c80410161d90c84010161d90c8400f1a1d4c8410101a1d50840c101a1d50c408101a1d50c804101a1d50c840101a1d50c8400f1961cc84100e1961d0840c0e1961d0c4080e1961d0c8040e1961d0c8400e1e194c8410101e1950840c101e1950c408101e1950c804101e1950c840101e1950c8400f1d618c84100e1d6190840c0e1d6190c4080e1d6190c8040e1d6190c8400e1da14c84100e1da150840c0e1da150c4080e1da150c8040e1da150c8400e21d94c84101021d950840c1021d950c4081021d950c8041021d950c8401021d950c8400f215d8c84100e215d90840c0e215d90c4080e215d90c8040e215d90c8400e219d4c84100e219d50840c0e219d50c4080e219d50c8040e219d50c8400e21d94c84100e21d950840c0e21d950c4080e21d950c8040e21d950c8400e, 0x27615345643172076413543210),
  ([63], 0x21d90c84141521d94c84101521d950840c1521d950c4081521d950c8041521d950c8401521d950c840141a1d0c8414131a1d4c8410131a1d50840c131a1d50c408131a1d50c804131a1d50c840131e190c8414131e194c8410131e1950840c131e1950c408131e1950c804131e1950c8401321d90c84141321d94c84101321d950840c1321d950c4081321d950c8041321d950c84013, 0x6754318207254136543210),
  ([127], 0x21d50c84181621d90c84141621d94c84101621d950840c1621d950c4081621d950c8041621d950c84016, 0x654317276543210),
  ([255], 0x0, 0x876543210), ([511], 0x0, 0x0),
  ([7, 25], 0x161d90c8401a1a1d50c8401a1961c84d00191961c850c0191961d0c480191961d0c840191961d0c840181e1950c8401a1d61884d00191d618850c0191d6190c480191d6190c840191d6190c840181da1484d00191da14850c0191da150c480191da150c840191da150c840181d960d0480171d960d0840171d9610c480171d9610c8401721d950c8401a215d884d0019215d8850c019215d90c48019215d90c84019215d90c84018219d484d0019219d4850c019219d50c48019219d50c84019219d50c840182195cd0480172195cd0840172195d0c480172195d0c8401721d9484d001921d94850c01921d950c4801921d950c8401921d950c8401821d58d04801721d58d08401721d590c4801721d590c8401721d94d04801721d94d08401721d950c4801721d950c84017, 0x45106732027516336421740576853210),
  ([7, 56], 0x21d950c8401b188421d0d41a188421d4d01a188421d50c1a1950e1c4081a1950e1c8041a1950e1c8401a1c842190d41a1c842194d01a1c8421950c1a1d50e184081a1d50e188041a1d50e188401a1d90c42148191d90c82144191d90c86140191d94c42108191d94c82104191d94c86100191d950420c8191d950820c4191d950860c01920841d90d41a20841d94d01a20841d950c1a2150dd84081a2150dd88041a2150dd88401a2190c41d48192190c81d44192190c85d40192194c41d08192194c81d04192194c85d00192195041cc8192195081cc4192195085cc01921d0c419481921d0c819441921d0c859401921d4c419081921d4c819041921d4c859001921d50418c81921d50818c41921d50858c019, 0x74653182051243676532124887361400),
  ([15, 49], 0x21d950c840201a1d14c8401f1a1d50c8401f1a1d5084c01e1a1d50c4801e1a1d50c8401e1a1d50c8401d1e1914c8401f1e1950c8401f1e195084c01e1e1950c4801e1e1950c8401e1e1950c8401d1da11484c01c1da114c4801c1da114c8401c1da15084c01c1da150c4801c1da150c8401c21d914c8401f21d950c8401f21d95084c01e21d950c4801e21d950c8401e21d950c8401d219d1484c01c219d14c4801c219d14c8401c219d5084c01c219d50c4801c219d50c8401c21d91484c01c21d914c4801c21d914c8401c21d95084c01c21d950c4801c21d950c8401c, 0x2765134465321730157624543210),
  ([15, 112], 0x21d518c8402121d914c8402121d950c8402119521c840c2019521cc4082019521cc8042019521cc840201d5218840c1f1d5218c4081f1d5218c8041f1d5218c8401f1d9214840c1f1d9214c4081f1d9214c8041f1d9214c8401f1d9610840c1f1d9610c4081f1d9610c8041f1d9610c8401f2151d8840c1f2151d8c4081f2151d8c8041f2151d8c8401f2191d4840c1f2191d4c4081f2191d4c8041f2191d4c8401f2195d0840c1f2195d0c4081f2195d0c8041f2195d0c8401f, 0x5247613765432162341745316200),
  ([15, 113], 0x21d51884c02521d518c4802521d518c8402521cc8551802421d91484c02521d914c4802521d914c8402521cc8591402421d95084c02521d950c4802521d950c8402521cc8595002421d95084c02421d950c4802421d950c8402421d950c840231e151884c0221e1518c480221e1518c840221e191484c0221e1914c480221e1914c840221e195084c0221e1950c480221e1950c8402221d51884c02221d518c4802221d518c8402221d91484c02221d914c4802221d914c8402221d95084c02221d950c4802221d950c84022, 0x47053216230615754325443210),
  ([15, 240], 0x21951c840c2621951cc4082621951cc8042621951cc8402621d518840c2621d518c4082621d518c8042621d518c8402621d914840c2621d914c4082621d914c8042621d914c8402621d950840c2621d950c4082621d950c8042621d950c84026, 0x76504321625335472634546210),
  ([31, 97], 0x21d590c8402a21d950c8402a21d94c85002921d95084c02921d950c4802921d950c8402921d950c840281e158c8500271e159084c0271e1590c480271e1590c840271e194c8500271e195084c0271e1950c480271e1950c8402721d58c85002721d59084c02721d590c4802721d590c8402721d94c85002721d95084c02721d950c4802721d950c84027, 0x5064321740761323265543210),
  ([31, 224], 0x1961cc84102a1961d0840c2a1961d0c4082a1961d0c8042a1961d0c8402a1d618c84102a1d6190840c2a1d6190c4082a1d6190c8042a1d6190c8402a1da14c84102a1da150840c2a1da150c4082a1da150c8042a1da150c8402a, 0x7605432163542427353625410),
  ([31, 225], 0x2195cc85002b2195d084c02b2195d0c4802b2195d0c8402b21d58c85002b21d59084c02b21d590c4802b21d590c8402b21d94c85002b21d95084c02b21d950c4802b21d950c8402b, 0x4506321727564263543210),
  ([31, 480], 0x0, 0x1253425413431525432100), ([31, 481], 0x0, 0x234535244253543210),
  ([63, 193], 0x219d0c85402c219d4c85002c219d5084c02c219d50c4802c219d50c8402c21d90c85402c21d94c85002c21d95084c02c21d950c4802c21d950c8402c, 0x60435217542736543210),
  ([63, 448], 0x0, 0x42651354316265432100), ([63, 449], 0x0, 0x36524542636543210),
  ([127, 385], 0x0, 0x65427376543210),
  ([7, 25, 42], 0x21d950c840321a1d0814c4311a1d4850c0311a1c94500c301a1d50c840311a1d14c804301a1d50c840301e190814c4311e194850c0311e1894500c301e1950c840311e1914c804301e1950c840301da094500c2f1da114c8042f1da10814c42e1da150c8402f1da14850c02e1da150c8402e21d90814c43121d94850c03121d894500c3021d950c8403121d914c8043021d950c84030219c94500c2f219d14c8042f219d0814c42e219d50c8402f219d4850c02e219d50c8402e21d894500c2f21d914c8042f21d90814c42e21d950c8402f21d94850c02e21d950c8402e21d950c8402d, 0x601345822570413345176064253210),
  ([7, 25, 97], 0x21d0c855803421d0c859403421d9484d003421d94850c03421d950c4803421d950c8403421d950c840331c86158d00301c861590c0301d0e158480301d0e158840301c86194d00301c861950c0301d0e194480301d0e194840301d960d0480301d960d0840301d9610c480301d9610c840302085d58d00302085d590c030210dd5848030210dd58840302085d94d00302085d950c030210dd9448030210dd94840302195cd0480302195cd0840302195d0c480302195d0c8403021d4c419082e21d4c819042e21d50418c82e21d50818c42e21d8c415082e21d8c815042e21d90414c82e21d90814c42e, 0x51736247642513601405372346210),
  ([7, 25, 98], 0x21d0d588043721d0d948043721d94d08403721d950c8403721d950c8403610e1d94804341961d0c840341e158d0840351e1590c840351d0e158084311d0d618840301e194d0840351e1950c840351d0e194084311d0da14840301d960d0480311d94e10804301d9610c480311d9520c8043021d58d08403521d590c84035210dd5808431210d5d88403021d94d08403521d950c84035210dd9408431210d9d4840302195cd0480312194dd0804302195d0c4803121951cc8043021d4d904082f21d518c4082f21d8d504082f21d914c4082f, 0x653214874715023736864523426001),
  ([7, 25, 224], 0x194861cc1037194861d00c371950e1c408371950e1c804371950c861c0341d48618c10371d4861900c371d50e18408371d50e18804371d50c86180341d88614c10371d8861500c371d90e14408371d90e14804371d90c86140341d960d0480321d960d0840321d9610c480321d9610c840322194c41d08312194c81d04312195041cc8312195081cc43121d4c419083121d4c819043121d50418c83121d50818c43121d8c415083121d8c815043121d90414c83121d90814c431, 0x321654071472551634235763426001),
  ([7, 56, 448], 0x1d90c42148361d90c82144361d90c86140361d94c42108361d94c82104361d94c86100361d950420c8361d950820c4361d950860c0362190c41d48362190c81d44362190c85d40362194c41d08362194c81d04362194c85d00362195041cc8362195081cc4362195085cc03621d0c419483621d0c819443621d0c859403621d4c419083621d4c819043621d4c859003621d50418c83621d50818c43621d50858c036, 0x326475715246654132514763321000),
  ([15, 49, 82], 0x21d590c8044021d950c8404021d950c8403f21d9508c403e21d950c8403e21d590c8043d21d950c8403d1e1950c8403c1e15908c043b1e1590c8043b1e1590c8043a1e19508c403b1e1950c8403b1e1950c8403a1e19508c40391e1950c8403921d950c8403c21d5908c043b21d590c8043b21d590c8043a21d9508c403b21d950c8403b21d950c8403a21d9508c403921d950c8403921d9508c403821d950c84038, 0x370521641206587354676443210),
  ([15, 49, 193], 0x219d14c84041219d50c8404115219c84c03d15219cc4803d15219cc8403d21d914c8404121d950c840411521d884c03d1521d8c4803d1521d8c8403d1da11484c03d1da114c4803d1da114c8403d1da15084c03d1da150c4803d1da150c8403d2191d4840c3a2191d4c4083a2191d4c8043a2195d0840c3a2195d0c4083a2195d0c8043a21d194840c3a21d194c4083a21d194c8043a21d590840c3a21d590c4083a21d590c8043a, 0x412076530365165374543426210),
  ([15, 49, 194], 0x219d14c84042219d50c8404215219c80c43e15219cc0843e151a1cc8403d21d914c8404221d950c840421521d880c43e1521d8c0843e151e18c8403d1da11484c03e1da114c4803e1d9214c8043d1da15084c03e1da150c4803e1d9610c8043d2191d4840c3b2191d4c4083b2195d0840c3b2195d0c4083b21d194840c3b21d194c4083b21d590840c3b21d590c4083b, 0x346051720624525637453324110),
  ([15, 49, 208], 0x219d50c840431a1d5084c0421a1d50c480421a1d50c840421a1d50c8404121d950c840431e195084c0421e1950c480421e1950c840421e1950c840411da11484c0401da114c480401da114c840401da15084c03f1da150c4803f1da150c8403f219d1484c03c219d14c4803c219d14c8403c21d91484c03c21d914c4803c21d914c8403c, 0x240716356514353216432245010),
  ([15, 49, 448], 0x1d9214840c401d9214c408401d9214c804401d9610840c401d9610c408401d9610c804402191d4840c402191d4c408402191d4c804402195d0840c402195d0c408402195d0c8044021d194840c4021d194c4084021d194c8044021d590840c4021d590c4084021d590c80440, 0x267543052436405267365432110),
  ([15, 112, 400], 0x1d5218840c431d5218c408431d5218c804431d5218c840431d9214840c431d9214c408431d9214c804431d9214c840432151d8840c432151d8c408432151d8c804432151d8c840432191d4840c432191d4c408432191d4c804432191d4c84043, 0x367245452736516243216453100),
  ([15, 113, 146], 0x21cc8559004821cc8595004821d9508c404821d950c8404821d950c8404721d5908c404621d590c8404621cc8559004521d9508c404621d950c8404621cc8595004521d9508c404521d950c8404521d5908c404421d590c8404421d9508c404421d950c84044, 0x432015766031524556343210),
  ([15, 113, 385], 0x1e151884c0471e1518c480471e1518c840471e191484c0471e1914c480471e1914c840471e195084c0471e1950c480471e1950c8404721d51884c04721d518c4804721d518c8404721d91484c04721d914c4804721d914c8404721d95084c04721d950c4804721d950c84047, 0x304615650431542324253210),
  ([15, 113, 386], 0x1e151884c0481e1518c480481e191484c0481e1914c480481e195084c0481e1950c4804821d51884c04821d518c4804821d91484c04821d914c4804821d95084c04821d950c48048, 0x215634531246463752324001),
  ([15, 113, 402], 0x1e15908c40491e1590c840491e19508c40491e1950c8404921d5908c404921d590c8404921d9508c404921d950c84049, 0x41533051424632543210),
  ([15, 240, 273], 0x2195d084c04a2195d0c4804a2195d0c8404a21d59084c04a21d590c4804a21d590c8404a21d95084c04a21d950c4804a21d950c8404a, 0x650432145331466514563120),
  ([31, 97, 162], 0x21d950c8404f219d4c90044e219d508c044e219d50c8044e219d50c8044d21d94c90404e21d9508c404e21d950c8404e21d950c8404d21d94c90404c21d9508c404c21d950c8404c21d94c90404b21d9508c404b21d950c8404b, 0x65032147015434326543210),
  ([31, 97, 385], 0x1d618c84104d1d6190840c4d1d6190c4084d1d6190c8044d1da14c84104d1da150840c4d1da150c4084d1da150c8044d215d8c84104d215d90840c4d215d90c4084d215d90c8044d219d4c84104d219d50840c4d219d50c4084d219d50c8044d, 0x3145630461552646542210),
  ([31, 97, 386], 0x1d618c84104e1d6190840c4e1d6190c4084e1da14c84104e1da150840c4e1da150c4084e215d8c84104e215d90840c4e215d90c4084e219d4c84104e219d50840c4e219d50c4084e, 0x6243530625456424325110),
  ([31, 97, 416], 0x1e158c85004f1e159084c04f1e1590c4804f1e1590c8404f21d58c85004f21d59084c04f21d590c4804f21d590c8404f, 0x64315703164554326543210),
  ([31, 225, 290], 0x219d4c904050219d508c4050219d50c8405021d94c90405021d9508c405021d950c84050, 0x60431532542543543210),
  ([63, 193, 322], 0x21d90c94405121d94c90405121d9508c405121d950c84051, 0x43156543266543210),
  ([7, 25, 42, 52], 0x21d950c840541a1c108c54531a1c548c10531a1c94500c531a1cd50408531a1d14c804531a1d50c840531e18108c54531e18548c10531e1894500c531e18d50408531e1914c804531e1950c840531da10d4084521da14d0480521da150c8405221d8108c545321d8548c105321d894500c5321d8d504085321d914c8045321d950c84053219d0d408452219d4d048052219d50c8405221d90d40845221d94d04805221d950c84052, 0x2708561341035766501324443210),
  ([7, 25, 42, 76], 0x21d518c4085a21d914c8045a21d950c8405a21d950c8405921d518c4085821d914c8045821d950c840581e1194c084571e1590c480571e1158c048561e1518c408561e1950c840571e1194c084561e1914c804561e1590c480561e1950c8405621d194c0845721d590c4805721d158c0485621d518c4085621d950c8405721d194c0845621d914c8045621d590c4805621d950c8405621d950c8405521d194c0845221d590c4805221d950c84052, 0x3054721646201571562043633210),
  ([7, 25, 42, 84], 0x21d58d04805f21d950c8405f21d5848d005e21d94850c05e21d58d04805e21d950c8405e21d950c8405d1e1950c8405c1e15848d005b1e158d04805b1d60c41908571e194850c05b1e1950c8405b1da10814c4571d5a0d0840561d9610c4805621d950c8405c21d5848d005b21d58d04805b215cc419085721d94850c05b21d950c8405b219d0814c4572159cd0840562195d0c4805621d90814c455, 0x5216837412764304365563450021)]

theorem chk9_0 : D9_0.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_1 : List (List ℕ × ℕ × ℕ) := [
  ([7, 25, 42, 193], 0x219d50c84062219d4850c061219d4850c060219d50c84061219d50c8406021d950c8406221d94850c06121d94850c06021d950c8406121d950c840601da094500c5e1da114c8045e1da10814c4591da150c8405d1da14850c0581da150c840582189c5410c5b2191cd40845b2158c41d085721949c4c105621951cc4085621c985410c5b21d18d40845b215cc419085721d4984c105621d518c4085621d950c84053, 0x1634527875462231541450630021),
  ([7, 25, 42, 196], 0x219d14c80463219d50c840631a1c94500c621a1d14c804611a1d50c8406121d914c8046321d950c840631e1894500c621e1914c804611e1950c840611da094500c5f1d920d40845e1da10814c45a1d960d04805e1da14850c05a1d9520c40858219c94500c5c2191c80d44572195c84d005721d894500c5c21d1880d445721d5884d005721d8d5040853, 0x5104726336142526341463550201),
  ([7, 25, 42, 448], 0x1d8a05410c5f1d920d40845f1d90a00c545a1d960d04805f1d94a04c105a1d9520c4085a2189c5410c5f2191cd40845f21909c0c545a2195cd04805f21949c4c105a21951cc4085a21c985410c5f21d18d40845f21d0980c545a21d58d04805f21d4984c105a21d518c4085a21d950c84054, 0x6472131356423261540455630210),
  ([7, 25, 97, 385], 0x85d4c219059085d50218c5910dd4421885910dd48218459085d8c215059085d90214c5910dd8421485910dd88214459195cc4210859195cc8210459195d0420c859195d0820c45908614c1d90590861501d8c5910e1441d885910e1481d845908618c1d50590861901d4c5910e1841d485910e1881d44591960c41d08591960c81d04591961041cc8591961081cc45921d4c419085921d4c819045921d50418c85921d50818c45921d8c415085921d8c815045921d90414c85921d90814c459, 0x748567605148465504123323210),
  ([7, 25, 97, 386], 0x1c86158d00621c861590c06210dd6184085e1c86194d00621c861950c06210dda144085e195ce104085e195d20c4085e2085d58d00622085d590c06210e15d84085e2085d94d00622085d950c06210e19d44085e1960dd04085e19611cc4085e21d4c419085a21d4c819045821d50418c85a21d50818c45821d8c415085a21d8c815045821d90414c85a21d90814c458, 0x5261341456233462135647050021),
  ([7, 25, 98, 168], 0x10820dc59463188615c10c63219d4850c0641080e1d94462188561d0c06221d950c840640900619d4c621d0e158084631d0d618840620984211cd46211cc209854621d0d886140601d960d0480631d94e108046219d460900c621d950820c46020841914dc5c210c1c94585c2108c541d85b21945c8c105c218940c5d05b21d4d904085c21d1404d885b21d8c415085b, 0x6350714213574654746325360210),
  ([7, 25, 98, 388], 0x1d61884d00641d618850c06410dd6188405d1da1484d00641da14850c06410dda148405d195ce108045d195d20c8045d215d884d0064215d8850c06410e15d88405d219d484d0064219d4850c06410e19d48405d1960dd08045d19611cc8045d21d4d904085d21d518c4085d21d8d504085d21d914c4085d, 0x3416571365425426216543320001),
  ([7, 25, 98, 392], 0x1485da00d0631d0d618048631d0d486180611885d600d0631d0da14048631d0d88614061195c608c105f195c8c20505e148619c0d063210d5d804863210d485d8061188615c0d063210d9d404863210d885d406119605c8c105f19608c1c505e21d4d904085f21d50418c85e21d8d504085f21d90414c85e, 0x6415232164355134352604670021),
  ([15, 49, 82, 100], 0x21d518c0846921d914c4806921d950c8406921d950c8406821d194c4086721d590c8046721d950c840671e1518c084661e1518c084651e1914c480661e1914c480651e1950c840661e1950c8406521d518c0846621d518c0846521d914c4806621d914c4806521d950c8406621d950c84065, 0x3705216412057464565343210),
  ([15, 49, 82, 148], 0x215d90c0846e219d50c4806e2195d0c4086d2159d0c0486c2195d0c4086c21d950c8406e21d590c8046d215d90c0846c21d590c8046c21d950c8406d219d50c4806c21d950c8406c21d950c8406b21d950c8406a215d900c8466215d90c08465219d504c8066219d50c4806521d9508c406621d950c84065, 0x2140375676145054325343210),
  ([15, 49, 82, 162], 0x21d950c84074219d14c84073219d148c4072219d14c84072219d14c8407121d950c8407321d9508c407221d950c8407221d950c840711a1d148c406c1a1d14c8406c1e19508c406c1e1950c8406c21d9508c407021d950c8407021d950c8406f219d5084c065219d50c4806521d91484c06521d914c48065, 0x354617216425054626353210),
  ([15, 49, 82, 164], 0x21d950c84079219d14c48078219d14c48077219d14c480761a11d4c4087221d950c8407821d950c8407721d950c840761e1590c804721a1d144c806d19e114c8406c1e19508c406d1da150c4806c21d950c8407521d590c80470219d5048c06621d91484c066, 0x3540162705264642353341120),
  ([15, 49, 82, 224], 0x21d950c8407c21d9508c407b21d950c8407b21d590c8047a21d950c8407a1e15908c04781e1590c804781e1590c804731e19508c40781e1950c840781e1950c840731e19508c406e1e1950c8406e21d9508c406a21d950c8406a, 0x3560124752164643357430210),
  ([15, 49, 82, 385], 0x1e1950c8407a1d611880c4761d6118c0847619d214840c7219d214c408721da114c840711d9610840c6c1d9610c4086c21d950c8407a215d1880c476215d18c084761a11d4840c721a11d4c40872219d14c840712195d0840c6c2195d0c4086c21d9508c406721d950c84067, 0x6053242405633745156431120),
  ([15, 49, 82, 388], 0x1e1950c8407b1d611880c4771d6118c804721da11484c0771da114c840721d9610840c6d21d950c8407b215d1880c477215d18c80472219d1484c077219d14c840722195d0840c6d21d9508c406821d194c40867, 0x2403653642570476153531120),
  ([15, 49, 82, 400], 0x1e1950c8407c1d611880c4781d6118c084781d6118c804731da11484c0781da114c480781da114c8407321d950c8407c215d1880c478215d18c08478215d18c80473219d1484c078219d14c48078219d14c8407321d9508c406921d950c84069, 0x3452166231540145653430210),
  ([15, 49, 82, 416], 0x1e15908c04791e1590c804791e1590c804741da15084c06e1da150c4806e21d5908c047921d590c8047921d590c80474219d5084c06e219d50c4806e21d91484c06921d914c48069, 0x4532673064250256563431120),
  ([15, 49, 193, 336], 0x21d950c8407d15219c84c07a15219cc4807a15219cc8407a1da11484c07a1da114c4807a1da114c8407a2191d4840c742191d4c408742191d4c8047421591c840c7321591cc4087321591cc8047321d194840c7321d194c4087321d194c80473, 0x1265430436564315437260210),
  ([15, 49, 194, 336], 0x21d950c8407e15219c80c47b15219cc0847b151a1cc8407a1da11484c07b1da114c4807b1d9214c8047a2191d4840c792191d4c4087921591c804c7821591cc0487821d194840c7821d194c40878, 0x2541630354662343246520110),
  ([15, 49, 208, 352], 0x1a1d5084c07e1a1d50c4807e1a1d50c8407e1a1d50c8407d1da15084c07c1da150c4807c1da150c8407c219d1484c07c219d14c4807c219d14c8407c, 0x4531673621515345644322010),
  ([15, 113, 146, 164], 0x21cc8595008421d950c8408421d950c8408321d950c8408221cc4991408121cc8595008121d914c4808121d914c4808021d950c8408121d950c8408021d950c8407f, 0x4350216701542564343210),
  ([15, 113, 146, 276], 0x21d590c8408721d950c8408721d950c8408621d950c840851e15904c80811e1590c480801e19504c80811e1950c4808021d5908c408121d590c8408021d9508c408121d950c84080, 0x4052163016554632443210),
  ([15, 113, 146, 292], 0x21cc8595008921d950c8408921d950c840881e11944c80821e0c851580811e195048c08121d5908c408221cc4951808121d91484c081, 0x3405160615423543342210),
  ([15, 113, 146, 385], 0x21d5908c408821d590c8408821cc8559008521d9508c408821d950c8408821cc8595008521d9508c408521d950c8408521d5908c408321d590c8408321d9508c408321d950c84083, 0x641255041243354533210),
  ([15, 113, 146, 388], 0x21d5908c408921cc8559008721d9508c408921cc8595008721d9508c408621d5908c408421d9508c4084, 0x4312653146625564340201),
  ([15, 113, 164, 402], 0x21d950c8408b0ca1c594108a1961d0c8048a21d950c8408a, 0x451351442325342310),
  ([15, 240, 273, 290], 0x219d508c408c219d50c8408c21d9508c408c21d950c8408c, 0x5043124621655646452130),
  ([31, 97, 162, 196], 0x2195cd00848e2195d0c0848e2195d0c0848d21d58d04808e21d590c4808e21d590c4808d21d94d08408e21d950c8408e21d950c8408d, 0x140327566452565343210),
  ([31, 97, 162, 292], 0x21d950c8408f1a1d4c10848e1a1d500c848e1a1d50c0848d1e194c50808e1e19504c808e1e1950c4808d21d94c90408e21d9508c408e21d950c8408d, 0x462157013653254543210),
  ([31, 97, 162, 322], 0x21d94c90409121d9508c409121d950c8409121d950c840901e194c85008d1e195084c08d1e1950c4808d21d58c85008d21d59084c08d21d590c4808d, 0x104265054362653543210),
  ([31, 97, 162, 324], 0x21d94d08409221d950c84092219d50c804911e194c49008e1e195048c08e21d58c85008e21d59084c08e, 0x302546052643454351120),
  ([31, 97, 162, 448], 0x21d94c90408f21d9508c408f21d950c8408f, 0x25146164542565433210),
  ([31, 225, 290, 324], 0x21d94d08409321d950c84093, 0x14542532545343210),
  ([63, 193, 322, 388], 0x0, 0x1645425665343210),
  ([7, 25, 42, 52, 76], 0x21d950c8409921d804c9149721d840c9509721d9448d009821d950c8409821d914c8049721d950c840971e1804c914961e1840c950961e1914c804961e1950c840961e1914c804951e1950c8409521d804c9149621d840c9509621d914c8049621d950c8409621d914c8049521d950c8409521d914c8049421d950c84094, 0x42670153310756206154443210),
  ([7, 25, 42, 52, 193], 0x219d50c8409b219d448d009a219d4850c09a219d4d04809a219d50c8409a21d950c8409b21d9448d009a21d94850c09a21d94d04809a21d950c8409a1da10d4084981da14d0480971da150c84097219d4d048096219d50c8409621d94d04809621d950c84096, 0x54271063617231536244403021),
  ([7, 25, 42, 52, 448], 0x1da10d4084991da14d0480991da150c84099219d0d408499219d4d048099219d50c8409921d90d40849921d94d04809921d950c84099, 0x53621426145365432174501320),
  ([7, 25, 42, 76, 112], 0x21c408d5189d21c804d9149d21c840d9509d21d950c8409e21d518c4089d21d914c8049d21d950c8409d1e1158c0489c1e1518c4089c1e1194c0849c1e1914c8049c1e1590c4809c1e1950c8409c21d158c0489c21d518c4089c21d194c0849c21d914c8049c21d590c4809c21d950c8409c, 0x35874162712064514435303210),
  ([7, 25, 42, 76, 146], 0x21d950c840a6219d4850c0a5219d4850c0a3219d4850c0a41a149c4c10a221d950c840a521d950c840a421d950c840a31e1518c408a2219d4850c0a221d950c840a221d950c840a121d950c840a021d950c8409f21588c1c509c21900c5c949c2189d4410c9621d950c8409c21d194c0849621d950c84095, 0x61248573341255624160300321),
  ([7, 25, 42, 76, 176], 0x21d950c840ab21d950c840aa21d950c840a921d914c804a821d950c840a821d914c804a721d950c840a71e1158c048a51e1518c408a51e1194c084a41da10814c4a21e1590c480a41da14850c0a221d158c0489f21d518c4089f21d084c1949621d480c59096, 0x30657142245161654432303210),
  ([7, 25, 42, 76, 385], 0x1e1194c084a91e1590c480a81d214058c8a41e1950c840a81d218094c4a415d8608c10a219d4a04c10a221d194c084a921d590c480a8211d4058c8a421d950c840a8211d8094c4a416185c8c10a21a149c4c10a221d950c8409d21d194c0849821d590c4809721d950c84097, 0x65142352314710244635603021),
  ([7, 25, 42, 76, 392], 0x1e1194c084aa1e1590c480aa1d214058c8a31d610418c8a31e1950c840aa1d218094c4a31da10814c4a31d618490c0a31da14850c0a321d194c084aa21d590c480aa211d4058c8a3215d0418c8a321d950c840aa211d8094c4a3219d0814c4a3215d8490c0a3219d4850c0a321d950c8409e21d1880d449821d5884d009821d9448d0098, 0x43571216425352760146303210),
  ([7, 25, 42, 76, 400], 0x1e1194c084ab1e1158c048a61d610418c8a51e1194c084a61da10814c4a521d194c084ab21d158c048a6215d0418c8a521d194c084a6219d0814c4a521c840d9509d21d194c0849921d480c5909721d840c95097, 0x16542345631203652145402310),
  ([7, 25, 42, 84, 164], 0x21d950c840b1219d14c804b0219d14c804af1920c05d48a8219d14c804ae21d950c840b021d950c840af21d950c840ae1d60c41908a821d950c840ad19d2080d44a41d96084d00a41d9610c480a321d950c840ac20d014985c9f20d4509c189f218c10549c9c21cc5410989c, 0x12453706062546543253431102),
  ([7, 25, 42, 84, 224], 0x21d5848d00b321d94850c0b321d58d0480b321d950c840b321d950c840b21e15848d00b01e158d0480b01d60c41908a91e194850c0b01e1950c840b01da10814c4a91d5a0d0840a61d9610c480a62159cd08409f2195d0c4809f, 0x15260347432656245433501120),
  ([7, 25, 42, 84, 385], 0x1e1950c840b21d60588c10ae1d60d90408ae1da094500cae1da114c804ae1d5a0d0840a11d9610c480a121d950c840b2215c588c10ae215cd90408ae219c94500cae219d14c804ae2159cd0840a12195d0c480a121d90814c49e, 0x31745223614545675263300021),
  ([7, 25, 42, 84, 386], 0x1e1950c840b31d60588c10b01d60c41908a719ca01054caf191cc06148a819d0a00c54a51d9610c480a221d950c840b3215c588c10b0215cc41908a71a09c1054caf1920c05d48a81a109c0c54a52195d0c480a221d90814c49d, 0x27341515623465432405600312),
  ([7, 25, 42, 84, 416], 0x1e15848d00b11e158d0480b11d60c41908ab1d96084d00a51d9610c480a521d5848d00b121d58d0480b1215cc41908ab2195c84d00a52195d0c480a521d0980c549d, 0x41235632614525615433700142)]

theorem chk9_1 : D9_1.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_2 : List (List ℕ × ℕ × ℕ) := [
  ([7, 25, 42, 193, 322], 0x108c15c5a0b0148c52019cb01508c601d8ad150e1d88409a1c982104d4b01d18c06148a71d188c6014a31d58e10408ae1d194060c8a420985d40d0b0120d95c408ae2158c41d08a721588c1c50a32159041cc8a421c985410cad11ce005588a4160dc41188a421d518c408a021d950c8409a, 0x23465763547472620515301102),
  ([7, 25, 42, 193, 324], 0x10d4609c18b314c50a01d8b11504ca01d8b0150e19c8409a1da094500cb31d92080d44aa1d96084d00a82189c5410cb110e14499c0a8160c58109ca521588c1c50a51610580c9ca221c985410cb0215c8c1850a221d94d04809a, 0x23461510465562424653303012),
  ([7, 25, 42, 193, 352], 0x854e1181cb30904158de0b010d460981cb3108c1585e0b01da150c840b21d8a14410ca91d9214c084a920985d40d0af2118dd4048af2158c41d08ab21949c4c10a621951cc408a6215cc41908a921d4984c10a421d518c408a421d950c8409b, 0x25763440536635232514401120),
  ([7, 25, 42, 196, 336], 0x21d950c840b41448191ce0b314d018a05cb314c509821cb11d920d4084b31d8a10054cab1d9520c408a82189c5410cb32191c80d44ab21949c4c10a821d0980c54a721d8c415089a, 0x24163516540682452347703021),
  ([7, 25, 98, 168, 336], 0x21d950c840b50810e1d944b2085961d0c0b21cd0209854b209c4d91420ae1d5860900cb209c1518c60ae210c1c9458b20a0514d81cae21945c8c10b20a018d505cae1e150418c8ae21d8c41508ae, 0x56342726134463752342500110),
  ([15, 49, 82, 100, 148], 0x21d590c804bd21d950c840bd21d950c840bc21d590c804bb21d950c840bb21d590c804ba21d590c804b921d950c840ba21d950c840b921d950c840b821d590c804b721d590c804b621d950c840b721d950c840b6, 0x35201674102654654343210),
  ([15, 49, 82, 100, 152], 0x21d590c804c121d950c840c121d950c840c021d590c804bf21d950c840bf21d590c804be1e1518c084ba21d950c840be1e1914c480ba1e1950c840b8215d9080c4b7219d5084c0b7, 0x34076251056242534411320),
  ([15, 49, 82, 100, 385], 0x1e1518c084c01e1914c480bf1e1914c480bb1e1950c840bf1e1950c840bb21d518c084c021d914c480bf21d914c480bb21d950c840bf21d950c840bb, 0x50432603546223156314120),
  ([15, 49, 82, 100, 392], 0x1e1518c084bc1e1914c480bc1e1950c840bc21d518c084bc21d914c480bc21d950c840bc, 0x30426565043254246511230),
  ([15, 49, 82, 100, 400], 0x1e1518c084c11e1518c084bd1e1914c480c11e1914c480bd21d518c084c121d518c084bd21d914c480c121d914c480bd, 0x5432740265356346411320),
  ([15, 49, 82, 148, 224], 0x2195d0c408c42159d0c048c32195d0c408c321d590c804c4215d90c084c321d590c804c321d950c840c4219d50c480c321d950c840c321d950c840c2, 0x21403756164543253403210),
  ([15, 49, 82, 148, 280], 0x161d900c84c21a1d504c80c215a1d004c8b81961d040c8b81e19508c40c215e19008c4b81d619080c4b819e15048c0b81da15084c0b821d950c840c2161d900c84b8215d90c084b81a1d504c80b8219d50c480b81e19508c40b821d950c840b8, 0x23051605164461526343210),
  ([15, 49, 82, 148, 290], 0x21d950c840c921d950c840c82195d0c408c621d950c840c721d950c840c621d950c840c51da15084c0b821d950c840c3215d900c84bf215d90c084bb219d504c80be1e191484c0ba21d950c840b9, 0x32056404256614535411320),
  ([15, 49, 82, 148, 296], 0x21d950c840ca2159d0c048c82195d0c408c7215d90c084c821d590c804c721d950c840c4215d900c84c0215d90c084bc219d50c480ba21d950c840ba, 0x52064303624654175411320),
  ([15, 49, 82, 148, 352], 0x2195d0c408ca2159d0c048c92195d0c408c91e19508c40c2215d900c84c1215d90c084bd219d504c80c1219d50c480bd, 0x40562305276624374411320),
  ([15, 49, 82, 162, 193], 0x219d14c840cb12159c8c40c512159cc840c521d950c840cb1611d88c40c51611d8c840c51a1d148c40c51a1d14c840c51e19508c40c51e1950c840c52195d0840cb62195d0c408b621d194840cb621d194c408b6, 0x21736485071036524543210),
  ([15, 49, 82, 162, 196], 0x219d14c840cc12159c0c48c712159cc048c621d950c840cc1611d80c48c71611d8c048c61a1d148c40c71a1d14c840c61e19508c40c71e1950c840c62195d0840cb721d194840cb7, 0x23401756654045253413210),
  ([15, 49, 82, 162, 321], 0x21d950c840ce21d9508c40cd21d950c840cd19d214840cc619d214c408c61d619080c4bb1d6190c084bb1611d8804cc61611d8c048c6219d5084c0bb219d50c480bb21d194840cb921d194c408b9, 0x50423660324547645111320),
  ([15, 49, 82, 162, 324], 0x21d950c840d021d950c840cf219d14c840cd1a1d148c40c81d619008c4bf1611d8084cc71611d8c840c5219d5084c0bc2195d0c408bb21d194840cba, 0x26045304165534245313210),
  ([15, 49, 82, 162, 352], 0x21d950c840d1219d148c40d0219d14c840d0219d14c840ce1e19508c40c31e1950c840c321d9508c40cc21d950c840cc21d950c840cb219d5084c0bd219d50c480bd, 0x25316410546653264303210),
  ([15, 49, 82, 162, 448], 0x1a1d148c40c91a1d14c840c91e19508c40c91e1950c840c92195d0840cbd2195d0c408bd21d194840cbd21d194c408bd, 0x40356252640643524313210),
  ([15, 49, 82, 164, 200], 0x219d14c480d211619c084cc811a15c4c08c821d950c840d21521d8048cc815e1188c04c81921d440c8c819e114c840c81d619080c4c81da150c480c8, 0x35407612564043534312210),
  ([15, 49, 82, 164, 324], 0x21d950c840d311961c408ccf1159e0c084cd11961cc480cd191e14408cc819e114c840c61d619008c4c01521d8048cc8161d18c804c6219d5048c0c021d194840cbe, 0x30526440615356453412210),
  ([15, 49, 82, 164, 328], 0x21d950c840d415d218804ccf1a11d4c408cf19e114c840c71d5a100c48bf161d188c04c72195d0480cbf, 0x20534640653527364611320),
  ([15, 49, 82, 164, 352], 0x21d950c840d5219d14c480d4219d14c480d31a11d4c408d01e19508c40c41da150c480c321d950c840d221195cc408cc219d5048c0c1, 0x35124620564453633401120),
  ([15, 49, 82, 164, 448], 0x1a1d144c80ca19e114c840c91e19508c40ca1da150c480c92195d0480cc121d194840cc1, 0x50261451470516433432210),
  ([15, 49, 82, 224, 385], 0x1d611880c4d31d6118c084d319d214840cd019d214c408d01da114c840ce1d9610840cc91d9610c408c92195d0840cc32195d0c408c3, 0x36024553246545134310120),
  ([15, 49, 82, 224, 388], 0x1d611880c4d41d6118c804d01da11484c0d41da114c840d01d9610840cca2195d0840cc4, 0x43026553245214511410320),
  ([15, 49, 82, 224, 400], 0x1e15908c04d51e1590c804d51e1590c804d11e19508c40d51e1950c840d51e1950c840d1, 0x54613252141462564303210),
  ([15, 49, 193, 336, 416], 0x2195d0840cd12195d0c408d12195d0c804d121d194840cd121d194c408d121d194c804d1, 0x12636531341565224340210),
  ([15, 49, 194, 336, 416], 0x2195d0840cd52195d0c408d521d194840cd521d194c408d5, 0x61535436325454632420110),
  ([15, 113, 146, 164, 200], 0x21d950c840d721d15848c0d621d51884c0d621d1944c80d621d914c480d621d5908c40d621d950c840d6, 0x6531247553265443210),
  ([15, 113, 146, 164, 276], 0x21cc499140dc21d950c840dc21d950c840db21d950c840da1e0c855180d921d950c840d921d950c840d821d950c840d6, 0x2513675446524343210),
  ([15, 113, 146, 164, 280], 0x21d950c840df21d950c840de21d950c840dd1e159084c0da1e195084c0d921d5908c40d6, 0x45061301543234422310),
  ([15, 113, 146, 164, 328], 0x21d950c840e021d914c480da21d950c840da, 0x6541331565436322410),
  ([15, 113, 146, 164, 385], 0x21d950c840e021cc499140de21cc859500de21d914c480de21d914c480db21d950c840de21d950c840db21d950c840d7, 0x30526101425543443210),
  ([15, 113, 146, 164, 392], 0x21cc499140df21cc859500df21d914c480dc21d950c840dc, 0x32105615624563443201),
  ([15, 113, 146, 276, 385], 0x1e15904c80de1e1590c480db1e19504c80de1e1950c480db21d5908c40de21d590c840db21d9508c40de21d950c840db, 0x2515031243465643210),
  ([15, 113, 146, 276, 392], 0x1e1590c480dc1e1950c480dc21d590c840dc21d950c840dc, 0x41521345253524403201),
  ([15, 113, 146, 276, 416], 0x1e15904c80df1e0c855180dc21d5908c40df21cc495180dc, 0x51424315263526403210),
  ([15, 113, 146, 292, 385], 0x1e11944c80e01e0c851580de1e195048c0de21d5908c40e021cc495180de21d91484c0de, 0x5414015235533432210),
  ([15, 113, 146, 292, 392], 0x1e0c851580df21cc495180df, 0x15044105253544332201),
  ([15, 113, 164, 200, 402], 0x21d5908c40e121d950c840e1, 0x50143523243524310),
  ([15, 113, 164, 328, 402], 0x0, 0x1301423243424310),
  ([15, 240, 273, 290, 324], 0x21d950c840e2, 0x4125351231525332140),
  ([31, 97, 162, 196, 292], 0x219d4d0804e4219d50c804e4219d50c804e321d94d0840e421d950c840e421d950c840e3, 0x1032654562455343210),
  ([31, 97, 162, 196, 296], 0x219d50c804e51a1d5080c4e421d950c840e51e195084c0e4, 0x4056232653544511320),
  ([31, 97, 162, 292, 448], 0x0, 0x2154134532545403210)]

theorem chk9_2 : D9_2.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_3 : List (List ℕ × ℕ × ℕ) := [
  ([31, 97, 162, 322, 385], 0x1da14c8410e31da150840ce31da150c408e3215d8c8410e3215d90840ce3215d90c408e3, 0x612035142554343210),
  ([31, 97, 162, 322, 388], 0x1da14c8410e41da150840ce4215d8c8410e4215d90840ce4, 0x524034525443513210),
  ([31, 97, 162, 324, 392], 0x1da14c4810e5215d8c8410e5, 0x643053443535412210),
  ([31, 225, 290, 324, 392], 0x0, 0x1525342535443210),
  ([7, 25, 42, 52, 76, 82], 0x21d40c9058e821d8108c54e821c14c8518e921c19084d4e921d590c480e921d950c840e921d950c840e81e01890c54e71e158d0840e71e1950c840e721c1890c54e721d58d0840e721d950c840e721d950c840e6, 0x27346153276541046514320),
  ([7, 25, 42, 52, 76, 146], 0x21d950c840ee219c0c5094ec219c0904d4ed219d4d0480ed219d4d0480ec21d8108c54ec21d804c914ed21d950c840ed21d950c840ec21d950c840eb21d8108c54ea21d950c840ea219cd50408e721d914c804e7, 0x216875433146525640004321),
  ([7, 25, 42, 52, 76, 193], 0x21d950c840f321d9448d00f121d9448d00f221d950c840f221d950c840f121d950c840f021d9448d00ef21d950c840ef1e1914c804ed1e1950c840ec21d950c840ea21d58d0840e7, 0x341072566145225633034021),
  ([7, 25, 42, 52, 76, 385], 0x1e1804c914f31e18548c10f11e1914c804f11da14d0480ec21d804c914f321d8548c10f121d914c804f1219d4d0480ec21d914c804e921d950c840e8, 0x514623125364602346043021),
  ([7, 25, 42, 52, 76, 388], 0x1e1804c914f21e1840c950f21e1914c804f21e1950c840f21da10d4084ed1da14d0480ed21d804c914f221d840c950f221d914c804f221d950c840f2219d0d4084ed219d4d0480ed21d194c084e921d590c480e9, 0x237154451623160563032401),
  ([7, 25, 42, 52, 76, 448], 0x1e1914c804ee1e1950c840ee21d914c804ee21d950c840ee21d04c9418e821d40c9058e8, 0x652314316425543216012430),
  ([7, 25, 42, 52, 193, 322], 0x1e1914c804f621d950c840f621d950c840f521d950c840f41da10d4084f21da114c804f1219d4d0480f2219d50c840f121d950c840ef, 0x436052623155362444100213),
  ([7, 25, 42, 52, 193, 352], 0x1a1c548c10f61a1c94500cf61a1cd50408f61a1d14c804f61da00904d4f31da004c914f3219d4d0480f3219d50c840f321d94d0480f021d950c840f0, 0x230546365414326456100213),
  ([7, 25, 42, 76, 112, 146], 0x21c804d914fc21c804d914fb21d950c840fd21d950c840fc21d950c840fb21c804d914f81e1518c408fa21d950c840fa21d950c840f921d950c840f821d518c408f721d950c840f72099c5500cea, 0x32754615462324653101320),
  ([7, 25, 42, 76, 112, 385], 0x1e1158c048fc1e1194c084fc1e1590c480fb1e1950c840fb21d158c048fc21d194c084fc21d590c480fb21d950c840fb, 0x271865157642642353003421),
  ([7, 25, 42, 76, 112, 392], 0x1e1158c048fd1e1518c408fd1e1194c084fd1e1914c804fd1e1590c480fd1e1950c840fd21d158c048fd21d518c408fd21d194c084fd21d914c804fd21d590c480fd21d950c840fd, 0x135642246513541523003210),
  ([7, 25, 42, 76, 146, 224], 0x219d4850c102219d4850c103219d4850c10121d950c8410321d950c8410221d950c84101219d4850c10021d950c8410021d950c840ff21d950c840fe21d8108c54ea, 0x537204614266424355011230),
  ([7, 25, 42, 76, 146, 276], 0x159e0d0480fe1961cd0840fe1961cd0840f8194e1d0084ef1e1590c480fe1d618490c0f81d4618810cef1da10814c4f921d950c840fe1618c81d04f9219d4850c0f82189d4410cef21d950c840f821d194c084ef, 0x235764634752540641011032),
  ([7, 25, 42, 76, 146, 289], 0x21d950c84104189d04e014fd1a1c94500cff1e1914c804ff1d188c6014fd1da10814c4f921d950c840ff21588c1c50fd219d4850c0f921d950c840f921d950c840eb, 0x234157415632165543000321),
  ([7, 25, 42, 76, 146, 292], 0x21d950c841051a095c40d1021a149c4c11001e1194c085011d0218854cf21d218094c4fb21d950c84100215d0418c8fb2189d0054cef21d950c840fa1e1194c084ec, 0x536240264735416243100312),
  ([7, 25, 42, 76, 146, 322], 0x21d950c8410721d950c84106150c1c986102158ca0105d021e1158c049021d0218854cf21d188c6014fd1d618490c0f821d950c84102215d0418c8f821900c5c94fd2189d0054cf221c804d914f81e1158c048ed21d950c840ed, 0x326754602455234613011302),
  ([7, 25, 42, 76, 146, 336], 0x21d950c841091484191ce10221d950c841081588e0051d001e1194c085011e1914c804ff21d950c841031608d8051cfa219d4850c0fc2189d4410cf121d194c084f021d804c914ed, 0x324651705266231453041320),
  ([7, 25, 42, 76, 146, 352], 0x219d4850c107219d4850c1091a149c4c11051e1590c480fe215d0418c8fc21900c5c94fb2189d0054cf121d8108c54ec, 0x364251650422344365011230),
  ([7, 25, 42, 76, 146, 448], 0x219d4850c10521d950c8410521d950c84104159e0d0480fe21900c5c94fc2189d4410cf321c804d914fc21d194c084f321d950c840ee, 0x134265563424530465011320),
  ([7, 25, 42, 76, 176, 336], 0x8581520dd071e1590c4810b21d950c8410b21d950c8410a1e1194c085031da10814c50021d158c04903215d0418c90021d084c194ef, 0x230645543616344252102130),
  ([7, 25, 42, 76, 176, 385], 0x21d914c8050b21d950c8410a1d214058c9091e1194c085081944dc092100189e01144cfb211d4058c90321d084c194f221d4984c10f1, 0x531640413512366454200231),
  ([7, 25, 42, 76, 176, 388], 0x1e1194c0850b1e1590c4810b11d4204c990515d0600c990519ca10054d0119ca14410d01211d4058c901215d0418c90121d084c194f321d480c590f3, 0x34625254346512653103120),
  ([7, 25, 42, 76, 176, 392], 0x8185160dd0708581520dd071d214058c9071d610418c90718085160dd021885e14d00f218481520dd021881e10d44f2211d4058c902215d0418c90221d0980c54f221d4984c10f2, 0x425613325406254634011320),
  ([7, 25, 42, 76, 176, 448], 0x1e1194c085091da10814c5051e1590c481091da14850c10521d084c194f121d480c590f1, 0x326541237626344505011032),
  ([7, 25, 42, 84, 164, 200], 0x4160dc91908101a09cc55082145c0c9910c00520d895d08210184c9d50c145e098c110821d950c8410c191e0d4805081d5a0d0841081d9610c481062159cd0840f7211d8d4804f7, 0x364075124573455633012210),
  ([7, 25, 42, 84, 164, 304], 0xc421d5908f51808515ce1031810c9605d0318c509421d0c1c481518e1031cc14906190c1c54c92019031d8408d520f821d950c8410c20d014985d0320d4509c1903218c10549cf821cc541098f8, 0x210456054636534543312210),
  ([7, 25, 42, 84, 164, 322], 0x1e158d04810e21d950c8410e21d950c8410d1cc14906190c1d188c6014ff1d500c9860fd210184c9d50c20d4509c18ff218c10549cfd21d1880d44f9, 0x523674623414255364001102),
  ([7, 25, 42, 84, 164, 328], 0x145c0920d90b19200c5c950b219d14c8050e1c481518e1031d892004d5011d5a0d0840fc210c18549d03214c5c1099012195c84d00fc1e054c0990fa, 0x135764546321466504002231),
  ([7, 25, 42, 84, 164, 352], 0xc4215d908f610184960dd0b1018c9605d091a11cd40850e1d96084d01031d9610c4810200520d895d08210c18549cfe20d4509c1901218c10549cfc, 0x213645145066535434032201),
  ([7, 25, 42, 84, 164, 448], 0xc421d5908f519d2080d45091d96084d01091d9610c48107218c10549cfb21cc541098fb, 0x134526435136455467021023),
  ([7, 25, 42, 84, 224, 385], 0x15c60980d10e15ce1180490e19ca05410d0e19d20d40850e1d5a0d0841041d9610c481042159cd0840ff2195d0c480ff, 0x625143362432443565010021),
  ([7, 25, 42, 84, 224, 386], 0x901da144cf615ce0411890b0818d15c610b1018c95c61091188dc4161051d9610c481052195d0c48100, 0x625401265425334543301102),
  ([7, 25, 42, 196, 336, 416], 0x1d9520c4090a21949c4c110a21d0980c550a21d8c41508f4, 0x451650647542645233301210),
  ([7, 25, 98, 168, 336, 388], 0xd1d8861410d159d0820c50d10e1485d810d1960c81d050d1e150418c90d21d8c415090d, 0x456335424252564332100110),
  ([15, 49, 82, 100, 148, 162], 0x21d950c84114219d50c48113219d50c4811221d950c8411321d950c84112219d14c8411121d950c8411121d950c8411021d950c8410f, 0x342017650625643543210),
  ([15, 49, 82, 100, 148, 168], 0x21d950c84118219d1448c117219d1448c11621d950c8411721d950c84116219d1448c11521d950c8411521d590c80510, 0x206547315632443143120),
  ([15, 49, 82, 100, 148, 280], 0x21d590c8051a21d950c8411a21d590c8051921d950c841191d619080c5151da15084c11521d590c8051521d590c8051121d950c8411521d950c84111, 0x46325256135634141320),
  ([15, 49, 82, 100, 148, 290], 0x21d950c8411d21d950c8411c21d950c8411b1e1194c409161e1194c409121da15084c11521d590c8051621d590c80512219d1448c115, 0x520376032641554114320),
  ([15, 49, 82, 100, 148, 296], 0x21d950c8412021d950c8411f21d950c8411e1e1158c0491621d590c8051721d590c80513219d14c84111, 0x305624206514543143120),
  ([15, 49, 82, 100, 148, 385], 0x21d590c8051f21d950c8411e21d950c8411b21d950c84119215d1808c517219d1448c116219d50c48112, 0x530462205436156134120),
  ([15, 49, 82, 100, 148, 392], 0x21d590c8051c21d950c8411c215d90c08513219d50c48113, 0x420635504362563123140),
  ([15, 49, 82, 100, 148, 416], 0x21d590c8052021d590c8051d21d950c8411a21d590c8051821d590c80514, 0x204563023554643143120),
  ([15, 49, 82, 100, 152, 296], 0x21d950c841231e1914c4812221d950c8412221d950c841211e1158c049171e1950c8411521d518c0851721d914c48115, 0x430562063515444122130),
  ([15, 49, 82, 100, 152, 385], 0x21d590c8052221d950c841211e1914c4811e1e1950c84119219d5084c116, 0x504631054334245211230)]

theorem chk9_3 : D9_3.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_4 : List (List ℕ × ℕ × ℕ) := [
  ([15, 49, 82, 100, 152, 388], 0x1e1518c085221e1518c0851f1e1914c481221e1914c4811f215d9080c517219d5084c117, 0x340652067315533122410),
  ([15, 49, 82, 100, 152, 416], 0x21d590c805231e1518c085201e1950c8411a21d518c08518, 0x62435536234545142130),
  ([15, 49, 82, 148, 224, 280], 0x15a1d004c91a1961d040c91a15e19008c51a1d619080c51a19e15048c11a1da15084c11a, 0x243576315621514104320),
  ([15, 49, 82, 148, 224, 290], 0x21d950c841272195d0c4092521d950c8412621d950c8412521d950c841241da15084c11a, 0x340265524126344101320),
  ([15, 49, 82, 148, 224, 296], 0x2159d0c049272195d0c40926215d90c0852721d590c80526, 0x506423264521653131420),
  ([15, 49, 82, 148, 290, 321], 0x21d950c841281d9610840d1121d950c84124215d900c8521219d504c81211e1194840d131e1194c40912, 0x305704265512364411320),
  ([15, 49, 82, 148, 290, 324], 0x21d950c8412a21d950c841291d9610840d1521d950c84125161d1808c51e215d90c0851b219d504c81221e1194840d17, 0x305404165526364122310),
  ([15, 49, 82, 148, 290, 328], 0x2195d0c4092a21d950c84126215d90c0851e1a1d1448c1221e1194c40916, 0x506343267025654141320),
  ([15, 49, 82, 148, 290, 392], 0x21d950c8412a21d950c8412821d950c841272159d0c0491f1e191484c11f21d950c8411c, 0x503405434612364122310),
  ([15, 49, 82, 148, 290, 448], 0x1d9610840d1a219d504c81231e191484c12021d950c8411d, 0x63405434265354122310),
  ([15, 49, 82, 148, 296, 448], 0x219d50c4812021d950c84120, 0x26556240251433311420),
  ([15, 49, 82, 162, 193, 352], 0x21d950c8412b12195c8c052412195cc805241e19508c41241e1950c841242195d0840d142195d0c40914, 0x532146012364554043210),
  ([15, 49, 82, 162, 196, 352], 0x21d950c8412c12159c0c492612159cc049251e19508c41261e1950c841252195d0840d18, 0x431265026345445013210),
  ([15, 49, 82, 162, 321, 388], 0x191e14084d221d5a10804d1f1521d8480d222195d0840d1f21d194840d1c21d194c4091b, 0x345650340144625122310),
  ([15, 49, 82, 162, 321, 400], 0x19d214840d2519d214c409251611d8804d251611d8c0492521d194840d1d21d194c4091d, 0x534245230254361011320),
  ([15, 49, 82, 162, 324, 392], 0x1521d84c81212195d0c4091e21d194840d1e, 0x541610450544235233210),
  ([15, 49, 82, 162, 324, 400], 0x1a1d148c41271611d8084d26161d18c8052421d194840d20, 0x456351420342543013210),
  ([15, 49, 82, 162, 352, 400], 0x21d9508c412c21d950c8412c21d950c8412b, 0x215315264356435403210),
  ([15, 49, 82, 164, 200, 352], 0x21d950c8412d11619c084d2711a15c4c09271d619080c5271da150c48127, 0x306512564635343412210),
  ([15, 49, 82, 164, 324, 400], 0x191e14408d2719e114c841251521d8048d27161d18c8052521d194840d23, 0x526445130154334032210),
  ([15, 49, 82, 164, 328, 400], 0x19e114c84126161d188c0526, 0x542323540354365011420),
  ([15, 49, 82, 164, 352, 400], 0x21d950c8412d21d590c8052c, 0x126445232654534031120),
  ([15, 113, 146, 164, 200, 276], 0x21d950c8413021d51884c12f21d950c8412f21d950c8412e, 0x53614534524224310),
  ([15, 113, 146, 164, 200, 385], 0x21d15848c13021d51884c13021d1944c813021d914c4813021d5908c413021d950c84130, 0x640213255634543210),
  ([15, 113, 146, 164, 276, 290], 0x21cc8595013221d950c8413221d950c841311e1914c8412e21d950c8412e, 0x23641556326543210),
  ([15, 113, 146, 164, 276, 296], 0x21d950c8413421d950c841331e191448c12f21d950c8412f, 0x136506452453243210),
  ([15, 113, 146, 164, 276, 328], 0x21d950c841351e1914c8412e, 0x51431545435232410),
  ([15, 113, 146, 164, 276, 385], 0x21d950c8413521cc4991413321d950c8413321d950c8413121d950c84130, 0x302101425543543210),
  ([15, 113, 146, 164, 276, 392], 0x21cc4991413421d950c84132, 0x213514354255043201),
  ([15, 113, 146, 164, 280, 324], 0x21d950c841361e195084c12f21d5908c412f, 0x401201543244533210),
  ([15, 113, 146, 164, 280, 385], 0x21d950c841361e159084c13521d914c4813321d5908c4130, 0x301501542345422310),
  ([15, 113, 146, 164, 280, 448], 0x21d914c48134, 0x51315532344422310),
  ([15, 113, 146, 164, 328, 385], 0x21d914c4813521d950c84135, 0x501401356335324210),
  ([15, 113, 164, 200, 296, 402], 0x21d950c84137, 0x13523434254310),
  ([15, 240, 273, 290, 324, 392], 0x0, 0x213142314243432100),
  ([31, 97, 162, 196, 292, 322], 0x21d94d08413921d950c8413921d950c84138, 0x2131454253543210),
  ([31, 97, 162, 196, 292, 328], 0x21d950c8413a219d50c80539, 0x2534255435143120),
  ([31, 97, 162, 196, 296, 336], 0x1a1d5080c53a, 0x3525345425142130),
  ([7, 25, 42, 52, 76, 82, 97], 0x21cc9054193b21d08c58153b21d4984c113b21d894500d3b21d518c4093b21d914c8053b21d950c8413b, 0x257164376543214651320),
  ([7, 25, 42, 52, 76, 82, 161], 0x21d950c8413e21d9448d013d21d94850c13d21d94d04813d21d950c8413d21d8108c553c21d950c8413c, 0x1467230526543360105432),
  ([7, 25, 42, 52, 76, 82, 385], 0x1e01890c553e21c1890c553e21d950c8413b, 0x2135641264536430534021),
  ([7, 25, 42, 52, 76, 82, 386], 0x1e01890c553d1e158d08413d1e1950c8413d21c1890c553d21d58d08413d21d950c8413d21d914c8053b, 0x1573622164350430354201),
  ([7, 25, 42, 52, 76, 146, 193], 0x219d4d048141219d4850c140219d4d04814021d950c8414121d9448d014021d950c8414021d950c8413f, 0x6528703452332410114032),
  ([7, 25, 42, 52, 76, 146, 289], 0x21d950c841421a1c94500d3f1a1cd504093f1e18548c113f1e1914c8053f21d8108c553f21d950c8413f, 0x2537644613521630004321),
  ([7, 25, 42, 52, 76, 146, 321], 0x21d950c8414421d9448d014321d950c8414321d8108c5541219cd504093d, 0x3126546520425360114032),
  ([7, 25, 42, 52, 76, 146, 322], 0x219c0904d54321d8108c554521d950c84145219d4d0481431e1914c8053f21d8108c554021d950c84140219cd140493d21d914c8053c, 0x3267544026552310114302),
  ([7, 25, 42, 52, 76, 146, 448], 0x21d950c84142219cd504093e21d914c8053e, 0x1642355634354260114230),
  ([7, 25, 42, 52, 76, 193, 322], 0x1e1914c8054821d950c8414821d950c8414721d950c841461e1914c8054021d950c84140, 0x4630251236535441040213)]

theorem chk9_4 : D9_4.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_5 : List (List ℕ × ℕ × ℕ) := [
  ([7, 25, 42, 52, 76, 193, 352], 0x21d9448d014921d9448d014a21d950c8414a21d950c841491e18108c554121d950c8414121d40c90593c, 0x3265046154243251020431),
  ([7, 25, 42, 52, 76, 193, 386], 0x21d950c8414921d9448d01481da10d40854321d58d08413d, 0x6241535326025460141302),
  ([7, 25, 42, 52, 76, 193, 388], 0x21d950c8414a21d9448d014721d950c841461e1914c805451e1950c84143219d4d04814021d590c4813d, 0x6307256325571441042013),
  ([7, 25, 42, 52, 76, 193, 416], 0x1e18548c11481e1914c805481e1950c84144219d4d04814121d58d08413e, 0x2465132465450530131204),
  ([7, 25, 42, 52, 193, 322, 388], 0x1da10d408546219d4d04814621d950c84146, 0x3156532606354440212103),
  ([7, 25, 42, 52, 193, 322, 392], 0x1da10814c547219d4850c14721d950c84147, 0x5637632515764441200321),
  ([7, 25, 42, 52, 193, 322, 400], 0x1da10d40854a1da114c80549219d448d014821d950c84148, 0x5607315665234442101032),
  ([7, 25, 42, 76, 112, 146, 164], 0x201c5148d94e2180d0495d4d219d4850c14e201c5148d94d21d950c8414e21d950c8414d21d950c8414c21d950c8414b, 0x357641264345431202310),
  ([7, 25, 42, 76, 112, 146, 276], 0x1e1590c4815021d950c8415021d950c8414f194e1d0085471e1590c4814c1d4618810d401e1914c8054d21d518c4094d21d950c8414c2189d4410d40, 0x536423456164751202130),
  ([7, 25, 42, 76, 112, 146, 289], 0x1e0840d9515121d950c8415221d950c841511ca05940d14d1e1914c8054d209c1904d54d21d950c8414d, 0x1364522564354230010321),
  ([7, 25, 42, 76, 112, 146, 292], 0x1e0048d1595321d950c8415421d950c841531c1209944d401e1194c0854e21d518c4094e2189d0054d40, 0x3561404876523432010321),
  ([7, 25, 42, 76, 112, 146, 385], 0x21c804d9155021d950c84153194e1d008547219d4850c14e, 0x3261545643644500212031),
  ([7, 25, 42, 76, 112, 146, 388], 0x1e0084d195501e1518c4095321d950c84151215d0418c94e2189d4410d41, 0x1576343156653240202431),
  ([7, 25, 42, 76, 112, 146, 392], 0x821cc59154f1e1518c4095421d950c8415421d950c8415221d950c8414f2148d8051d4d2180d0495d4d2099c5500d3f, 0x2675433465542130101320),
  ([7, 25, 42, 76, 146, 224, 276], 0x1961cd084150194e1d0085481d618490c1501d4618810d481da10814c551, 0x5640733417355321022140),
  ([7, 25, 42, 76, 146, 224, 289], 0x9905cc16154219d4850c15521d950c8415511c8d84161541da10814c55121d8108c553f, 0x6215434525644320100231),
  ([7, 25, 42, 76, 146, 224, 292], 0x1005e14d894a1a149c4c115621d950c8415611c218854d431d218094c553, 0x6532415344036550211302),
  ([7, 25, 42, 76, 146, 224, 321], 0x21d950c841571144dc81a1561e1518c409561d218094c5531d4618810d4821d8108c5541, 0x3046154565434522100213),
  ([7, 25, 42, 76, 146, 224, 322], 0x10a1d8c55451014c59ca150219d4850c157080da145d14a11c218854d4311c8d84161541d618490c15021d8108c5540, 0x5261436343640550122301),
  ([7, 25, 42, 76, 146, 224, 336], 0x8144dd9215021d950c84158094c5901e15621d950c8415621d950c8415521d804c91540, 0x6105725141554324033210),
  ([7, 25, 42, 76, 146, 289, 448], 0x19d4c42109511a10c05d49511e0840d9515121d950c84142, 0x5423453232540540111230),
  ([7, 25, 42, 76, 146, 292, 448], 0x1a091c04d5481e0048d159531e1194c08544, 0x3652642552614350113204),
  ([7, 25, 42, 76, 146, 322, 392], 0x981e10c5545101d8a0c55451d188c60154f159e0d04814c010a1d8c55451521cd84094c21900c5c954f18a101cc55450821cc59154f1e10980c554521d8108c5545, 0x4653354665401230122310),
  ([7, 25, 42, 76, 146, 322, 416], 0x15da048d01501611c40d8950080e1c5591471d208184d543219c0904d543, 0x5643346550442130211320),
  ([7, 25, 42, 76, 146, 336, 388], 0x1da10814c55521d950c84158160d8811c54e2189d4410d4921d194c08549219c0c509545, 0x4625215454062340133021),
  ([7, 25, 42, 76, 146, 336, 416], 0x1608d8051d5321d1880d4549219c0c509543, 0x6532314525453660120431),
  ([7, 25, 42, 76, 176, 336, 385], 0x1e1194c0855821d158c0495821d084c19546, 0x4762601403436455122130),
  ([7, 25, 42, 76, 176, 336, 386], 0x18c91461d56189e05500d53215d0418c95621d084c19548, 0x6045542326451641301320),
  ([7, 25, 42, 84, 164, 200, 304], 0x1908d61c555219d14c8055921d950c8415905d48d218155041d8c95214f21810c49d54d21c54c09914d, 0x2165434166545340032210),
  ([7, 25, 42, 84, 164, 322, 385], 0x1da094500d591d5a0490c152114c985c21592195c84d015221d1880d4552, 0x5324245334524531001102),
  ([7, 25, 42, 84, 164, 322, 392], 0x189055e0d55191e0d480551160dc41189551a010c49d55421d1880d4551, 0x2435235445351641001302),
  ([15, 49, 82, 100, 148, 162, 193], 0x21951cc0495a21d518c0855a21d914c4815a21d950c8415a, 0x7650143245323251460),
  ([15, 49, 82, 100, 148, 162, 200], 0x21519c048d5b2151d8084d5b21d914c4815b21d950c8415b, 0x3620571425431543210),
  ([15, 49, 82, 100, 148, 162, 280], 0x21d950c8415d219d50c4815c21d950c8415c21d950c8415b21d950c8415a, 0x2506430312441541320),
  ([15, 49, 82, 100, 148, 162, 321], 0x21d950c8415e21d914c4815c21d950c8415c2151d8084d5b, 0x2043560432151514320),
  ([15, 49, 82, 100, 148, 162, 328], 0x219d50c4815e21d518c0855a, 0x2406350634231543210),
  ([15, 49, 82, 100, 148, 162, 448], 0x21d914c4815d21d950c8415d, 0x2316452364450543210),
  ([15, 49, 82, 100, 148, 168, 280], 0x21d950c841611a15d04c09601a15d04c095c21d950c8416021d950c8415f21d590c8055b, 0x365415326452142130),
  ([15, 49, 82, 100, 148, 168, 321], 0x21d950c841621e1194c4095c21d950c84160, 0x5043160346252124130),
  ([15, 49, 82, 100, 148, 168, 328], 0x21d950c84163219d1448c1621e1194c4096021d518c0855b, 0x635425134551243210),
  ([15, 49, 82, 100, 148, 168, 448], 0x219d1448c16121d950c84161, 0x5046325354431243210),
  ([15, 49, 82, 100, 148, 280, 385], 0x1da15084c1601619d00c49601a15d04c095c219d50c4815c, 0x453305145252141230),
  ([15, 49, 82, 100, 148, 280, 416], 0x1d619080c56121d590c8056121d590c8055d, 0x5346053234451242130),
  ([15, 49, 82, 100, 148, 290, 385], 0x1e1194c409621da15084c16021d590c80562219d1448c160, 0x3056053425141224130),
  ([15, 49, 82, 100, 148, 290, 392], 0x1e1194c4095e21d590c8055e, 0x5034054362341224310),
  ([15, 49, 82, 100, 148, 290, 448], 0x1da15084c161219d1448c161, 0x6513516425340224310),
  ([15, 49, 82, 100, 148, 296, 385], 0x21d590c80563219d14c8415c, 0x3045065445322132140),
  ([15, 49, 82, 100, 148, 296, 386], 0x1e1158c04962215d1808c562215d90c0855e, 0x4053053421442113520)]

theorem chk9_5 : D9_5.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_6 : List (List ℕ × ℕ × ℕ) := [
  ([15, 49, 82, 100, 148, 296, 448], 0x21d914c4815d, 0x534035145452143120),
  ([15, 49, 82, 100, 152, 296, 385], 0x19d6104c095c1a11d48c055c, 0x3052051345444122130),
  ([15, 49, 82, 100, 152, 296, 386], 0x1e1158c0496319d6104c0960215d9080c562, 0x2051502364544311320),
  ([15, 49, 82, 100, 152, 296, 448], 0x1e1950c8416121d914c48161, 0x153051215444233210),
  ([15, 49, 82, 148, 224, 290, 321], 0x21d950c841641d9610840d5d, 0x3052245153444101320),
  ([15, 49, 82, 148, 224, 290, 324], 0x21d950c8416621d950c841651d9610840d61, 0x3054145263441202310),
  ([15, 49, 82, 148, 224, 290, 328], 0x11d5a0804d66, 0x2053354255341401320),
  ([15, 49, 82, 148, 224, 290, 392], 0x21d950c8416621d950c84164, 0x534535123541242310),
  ([15, 49, 82, 148, 290, 321, 392], 0x21d950c841641d2194804d5e1e1194c4095e, 0x553640125432311420),
  ([15, 49, 82, 148, 290, 324, 385], 0x1d9610840d5f21d950c841651611d8084d631a115c408d631e1194840d63, 0x545160352442133210),
  ([15, 49, 82, 148, 290, 324, 392], 0x21d950c841661611d8c841621d2158048d62, 0x554620632541433210),
  ([15, 49, 82, 162, 193, 352, 400], 0x0, 0x3412125125435043210),
  ([15, 49, 82, 162, 196, 352, 400], 0x0, 0x1253524524354013210),
  ([15, 49, 82, 164, 200, 352, 400], 0x0, 0x2514534554430312210),
  ([15, 113, 146, 164, 200, 276, 290], 0x21d950c84167, 0x314554345224310),
  ([15, 113, 146, 164, 200, 276, 296], 0x21d950c8416921d950c84168, 0x514524342334210),
  ([15, 113, 146, 164, 200, 276, 385], 0x21d51884c16921d950c8416921d950c84167, 0x4031355245224310),
  ([15, 113, 146, 164, 276, 290, 385], 0x1e1914c8416721d950c84167, 0x241523436543210),
  ([15, 113, 146, 164, 276, 290, 392], 0x0, 0x1245253430543201),
  ([15, 113, 146, 164, 276, 296, 385], 0x1e191448c16921d950c84169, 0x3101524535243210),
  ([15, 113, 146, 164, 276, 296, 448], 0x0, 0x1314423430243210),
  ([15, 113, 146, 164, 276, 328, 385], 0x1e1914c84167, 0x101454354235210),
  ([15, 113, 146, 164, 280, 324, 385], 0x1e195084c16921d5908c4169, 0x101432444233210),
  ([15, 113, 164, 200, 296, 324, 402], 0x0, 0x3534342654310),
  ([31, 97, 162, 196, 292, 322, 385], 0x0, 0x211442536543210),
  ([31, 97, 162, 196, 292, 322, 392], 0x0, 0x235442351543210),
  ([31, 97, 162, 196, 292, 328, 400], 0x0, 0x355445531243210),
  ([7, 25, 42, 52, 76, 82, 97, 385], 0x0, 0x46513215362403654021),
  ([7, 25, 42, 52, 76, 82, 161, 321], 0x21d9448d016a21d94850c16a21d94d04816a21d950c8416a, 0x25463036541610201435),
  ([7, 25, 42, 52, 76, 82, 161, 386], 0x21d8108c556a21d950c8416a, 0x25163443250301514302),
  ([7, 25, 42, 52, 76, 82, 161, 448], 0x0, 0x36541246325401312405),
  ([7, 25, 42, 52, 76, 146, 193, 289], 0x219d4850c16b219d4d04816b21d9448d016b21d950c8416b, 0x24163534552301004132),
  ([7, 25, 42, 52, 76, 146, 193, 322], 0x21d950c8416e21d950c8416d21d950c8416c21d950c8416b, 0x24706514552310330214),
  ([7, 25, 42, 52, 76, 146, 193, 352], 0x219d4850c16e219d4d04816e, 0x42716525343601025134),
  ([7, 25, 42, 52, 76, 146, 289, 448], 0x0, 0x56323254543201112430),
  ([7, 25, 42, 52, 76, 146, 321, 388], 0x219c0c50956e219cd504096a, 0x56344365135210224013),
  ([7, 25, 42, 52, 76, 146, 321, 416], 0x0, 0x64232534354610014235),
  ([7, 25, 42, 52, 76, 146, 322, 388], 0x1da10d40856b21d8108c556d21d950c8416c219cd140496a21d90d40856a, 0x54622045451310332104),
  ([7, 25, 42, 52, 76, 193, 322, 388], 0x1e1914c8056c21d950c8416c, 0x31656325054402142103),
  ([7, 25, 42, 52, 76, 193, 322, 392], 0x1e1914c8056d21d950c8416d, 0x65732365514412040321),
  ([7, 25, 42, 52, 76, 193, 322, 400], 0x1e1914c8056e, 0x41562465543302131024),
  ([7, 25, 42, 52, 76, 193, 352, 386], 0x21d40c90596a, 0x16433452544302130125),
  ([7, 25, 42, 52, 76, 193, 352, 388], 0x1da00c50956e219d4d04816e21d4104c996a, 0x13565263504402143102),
  ([7, 25, 42, 76, 112, 146, 164, 193], 0x20495d8d016f20d159c4816f21d194c0856f21d950c8416f, 0x75460213445421303210),
  ([7, 25, 42, 76, 112, 146, 164, 276], 0xc6191c956d1a010c49d570194e1d00856d01e109854d701c5601188d6d21d950c8417021d950c8416f, 0x1465365442521303210),
  ([7, 25, 42, 76, 112, 146, 164, 289], 0x21d950c84172219d4850c17121d950c8417121d950c8417021d194c0856f, 0x12653434554402010321),
  ([7, 25, 42, 76, 112, 146, 164, 321], 0x2180d0495d721c5601188d6d, 0x13645265445002313021),
  ([7, 25, 42, 76, 112, 146, 276, 392], 0x15c10c8619701d4618810d6b1da10814c571215d0418c9711a010c49d5702189d4410d6b, 0x35644365514201202130)]

theorem chk9_6 : D9_6.all (rowF 9 R9) = true := by decide +kernel

/-- Rows `(family, relabelling hints, colouring certificate)` for `R9`. -/
def D9_7 : List (List ℕ × ℕ × ℕ) := [
  ([7, 25, 42, 76, 112, 146, 276, 416], 0xc9d520596d1d4618810d6e21d518c40972, 0x52434765015401323102),
  ([7, 25, 42, 76, 112, 146, 289, 388], 0x1e0840d9517221c804d91572, 0x26544625534301101342),
  ([7, 25, 42, 76, 112, 146, 289, 392], 0x1c90c15861711da10814c5712094c5181d71219d4850c171, 0x34255243245301101320),
  ([7, 25, 42, 76, 112, 146, 292, 385], 0x1c1209944d6e, 0x56233645641004121032),
  ([7, 25, 42, 76, 112, 146, 292, 392], 0x1d0a194c56b1d04d481a1722148d8051d722189d0054d6b, 0x35412453545302101320),
  ([7, 25, 42, 76, 146, 224, 289, 336], 0x840d215d97221d950c841731e1840c9516b, 0x34250454345301211320),
  ([7, 25, 42, 76, 146, 224, 292, 336], 0x5095a0dd6e21d950c84174, 0x50424631554431022310),
  ([7, 25, 42, 76, 146, 224, 321, 392], 0x818515ce16e1041d618c96e15c5a080d16e219c0904d56e, 0x14255454045303211320),
  ([7, 25, 42, 76, 146, 224, 336, 388], 0x21d950c84173219c0c50956c, 0x10626514453245033210),
  ([7, 25, 42, 84, 164, 200, 304, 322], 0x21d950c841751c14c6109971201909cc557121d1880d4571, 0x23455344234510013210),
  ([15, 49, 82, 100, 148, 162, 193, 280], 0x0, 0x2364524616541320),
  ([15, 49, 82, 100, 148, 162, 200, 280], 0x219d50c4817621d950c84176, 0x5362416412541320),
  ([15, 49, 82, 100, 148, 162, 280, 321], 0x21d950c84176, 0x40520254331132540),
  ([15, 49, 82, 100, 148, 162, 280, 448], 0x0, 0x35243125401541320),
  ([15, 49, 82, 100, 148, 162, 321, 392], 0x0, 0x4530432512524130),
  ([15, 49, 82, 100, 148, 168, 280, 290], 0x21d950c841771a15d04c09761d9610840d7621d590c80576, 0x45610524332132140),
  ([15, 49, 82, 100, 148, 168, 280, 321], 0x21d950c841781d9610840d76, 0x5144255332132140),
  ([15, 49, 82, 100, 148, 168, 280, 448], 0x21d950c84177, 0x52145315403243210),
  ([15, 49, 82, 100, 148, 168, 321, 386], 0x21d950c84178, 0x50410423523134120),
  ([15, 49, 82, 100, 148, 168, 328, 386], 0x215d18c80576, 0x40520545331243210),
  ([15, 49, 82, 148, 224, 290, 321, 392], 0x0, 0x4341243323101420),
  ([15, 49, 82, 148, 224, 290, 324, 385], 0x1d9610840d77, 0x5143424421303210),
  ([15, 49, 82, 148, 224, 290, 324, 392], 0x0, 0x2545325414303210),
  ([15, 113, 146, 164, 200, 276, 290, 385], 0x0, 0x1343456224310),
  ([15, 113, 146, 164, 200, 276, 296, 322], 0x21d950c84179, 0x3524352443210),
  ([15, 113, 146, 164, 200, 276, 296, 385], 0x21d950c84179, 0x1243452334210),
  ([7, 25, 42, 52, 76, 82, 161, 321, 386], 0x0, 0x613563240021512403),
  ([7, 25, 42, 52, 76, 146, 193, 289, 322], 0x21d950c8417b21d950c8417a, 0x340554243210110324),
  ([7, 25, 42, 52, 76, 146, 193, 322, 388], 0x21d950c8417a, 0x416552043021332104),
  ([7, 25, 42, 52, 76, 146, 193, 322, 392], 0x21d950c8417b, 0x576323134120440321),
  ([7, 25, 42, 52, 76, 146, 193, 322, 416], 0x0, 0x452315455012331204),
  ([7, 25, 42, 76, 112, 146, 164, 193, 276], 0x20051d4d897c20d591c8057c21d950c8417c, 0x654123445002313021),
  ([7, 25, 42, 76, 112, 146, 164, 276, 289], 0xc419d61097b1804d5d2097c1e1914c8057c21d950c8417c, 0x125434554032010321),
  ([7, 25, 42, 76, 112, 146, 164, 289, 322], 0x21d950c8417d1e1914c8057c20d159c4817c, 0x254345354010121302),
  ([7, 25, 42, 76, 112, 146, 164, 289, 448], 0xc419d61097b, 0x524345540013121032),
  ([7, 25, 42, 76, 146, 224, 289, 336, 388], 0x19e0c415097a, 0x510542452403133210),
  ([7, 25, 42, 76, 146, 224, 292, 336, 385], 0x0, 0x540515532201433210),
  ([7, 25, 42, 84, 164, 200, 304, 322, 385], 0x1d9610c4817d2159cd08417d211d8d48057d, 0x40303443213412210),
  ([15, 49, 82, 100, 148, 162, 200, 280, 321], 0x0, 0x305254412143520),
  ([15, 49, 82, 100, 148, 168, 280, 290, 448], 0x0, 0x121314043243210),
  ([15, 49, 82, 100, 148, 168, 280, 321, 386], 0x0, 0x20134341241230),
  ([15, 113, 146, 164, 200, 276, 296, 322, 385], 0x0, 0x243532443210),
  ([7, 25, 42, 52, 76, 146, 193, 289, 322, 388], 0x0, 0x1442040231332104),
  ([7, 25, 42, 52, 76, 146, 193, 289, 322, 392], 0x0, 0x5453242310110432),
  ([7, 25, 42, 76, 112, 146, 164, 193, 276, 289], 0x219d4850c17e21d950c8417e, 0x5423451003121032),
  ([7, 25, 42, 76, 112, 146, 164, 289, 322, 392], 0x1da10814c57e1214c49d817e, 0x5454330121202310),
  ([7, 25, 42, 76, 112, 146, 164, 193, 276, 289, 322], 0x21d950c8417f, 0x54302110232103),
  ([7, 25, 42, 76, 112, 146, 164, 193, 276, 289, 322, 392], 0x0, 0x13221303210)]

theorem chk9_7 : D9_7.all (rowF 9 R9) = true := by decide +kernel

/-- Every linear family of lines with at least two points on 9 points has a proper 9-colouring. -/
theorem col9 (E : Finset (Line 9)) (hE : Lin E) (hE2 : ∀ a ∈ E, 2 ≤ a.card) : Col E :=
  col_of_rows 9 (by norm_num) R9 (D9_0 ++ D9_1 ++ D9_2 ++ D9_3 ++ D9_4 ++ D9_5 ++ D9_6 ++ D9_7) (by decide +kernel) (by decide +kernel)
    (by simp only [List.all_append, chk9_0, chk9_1, chk9_2, chk9_3, chk9_4, chk9_5, chk9_6, chk9_7, Bool.and_self]) E hE hE2

end Erdos19.Core

/-
# Erdős Problem 19 for `n < 10`

The Erdős–Faber–Lovász conjecture for fewer than ten cliques (Hindman 1981). Each shared vertex
is replaced by the set of cliques containing it. These sets form a linear family of lines on
`n` points, and a proper `n`-colouring of that family colours the shared vertices
(`EFLConfig.colorable_of_sharedColoring` does the rest). The colouring exists by the
kernel-checked classification in `Erdos19Lt10.Core` and `Erdos19Lt10.Data`.
-/

namespace Erdos19

open EFLConfig

/-- An `n`-colouring of every linear family of lines on `n` points colours every configuration
of `n` cliques. -/
theorem colorable_of_col {V : Type} {n : ℕ} (C : EFLConfig V n)
    (hcol : ∀ E : Finset (Finset (Fin n)), Core.Lin E → (∀ a ∈ E, 2 ≤ a.card) → Core.Col E) :
    C.graph.Colorable n := by
  classical
  let Sv : V → Finset (Fin n) := fun v => Finset.univ.filter (fun i => v ∈ C.A i)
  have hSv : ∀ v i, i ∈ Sv v ↔ v ∈ C.A i := by intro v i; simp [Sv]
  have hinj : ∀ u v, C.IsShared u → Sv u = Sv v → u = v := by
    rintro u v ⟨i, j, hij, hi, hj⟩ h
    have hvi : v ∈ C.A i := (hSv v i).1 (h ▸ (hSv u i).2 hi)
    have hvj : v ∈ C.A j := (hSv v j).1 (h ▸ (hSv u j).2 hj)
    exact Finset.card_le_one.1 (C.inter_le i j hij) u (Finset.mem_inter.2 ⟨hi, hj⟩) v
      (Finset.mem_inter.2 ⟨hvi, hvj⟩)
  have hsh : ∀ v, v ∈ C.sharedSet ↔ C.IsShared v := by
    intro v
    simp only [EFLConfig.sharedSet, Finset.mem_filter, Finset.mem_biUnion, Finset.mem_univ,
      true_and]
    exact ⟨fun h => h.2, fun h => ⟨C.cover v, h⟩⟩
  have hE : Core.Lin (C.sharedSet.image Sv) := by
    intro a ha b hb hab
    obtain ⟨u, -, rfl⟩ := Finset.mem_image.1 ha
    obtain ⟨v, -, rfl⟩ := Finset.mem_image.1 hb
    rw [Finset.card_le_one]
    intro i hi j hj
    by_contra hij
    rw [Finset.mem_inter, hSv, hSv] at hi hj
    have : u = v := Finset.card_le_one.1 (C.inter_le i j hij) u
      (Finset.mem_inter.2 ⟨hi.1, hj.1⟩) v (Finset.mem_inter.2 ⟨hi.2, hj.2⟩)
    exact hab (by rw [this])
  have hE2 : ∀ a ∈ C.sharedSet.image Sv, 2 ≤ a.card := by
    intro a ha
    obtain ⟨u, hu, rfl⟩ := Finset.mem_image.1 ha
    obtain ⟨i, j, hij, hi, hj⟩ := (hsh u).1 hu
    exact Finset.one_lt_card.2 ⟨i, (hSv u i).2 hi, j, (hSv u j).2 hj, hij⟩
  obtain ⟨f, hf1, hf2⟩ := hcol _ hE hE2
  let c : V → Fin n := fun v =>
    if h : f (Sv v) < n then ⟨f (Sv v), h⟩ else Classical.choose (C.cover v)
  refine C.colorable_of_sharedColoring c ?_
  intro i u v hu hv su sv huv
  by_contra hne
  have hmu : Sv u ∈ C.sharedSet.image Sv := Finset.mem_image_of_mem _ ((hsh u).2 su)
  have hmv : Sv v ∈ C.sharedSet.image Sv := Finset.mem_image_of_mem _ ((hsh v).2 sv)
  have hint : (Sv u ∩ Sv v).Nonempty :=
    ⟨i, Finset.mem_inter.2 ⟨(hSv u i).2 hu, (hSv v i).2 hv⟩⟩
  have hfne := hf2 _ hmu _ hmv (fun h => hne (hinj u v su h)) hint
  simp only [c, dif_pos (hf1 _ hmu), dif_pos (hf1 _ hmv)] at huv
  exact hfne (congrArg Fin.val huv)

/-- Hindman's theorem: the Erdős–Faber–Lovász conjecture holds for `n < 10`. -/
theorem solution :
    ∀ (V : Type) (n : ℕ) (C : EFLConfig V n), n < 10 → C.graph.chromaticNumber = n := by
  intro V n C hn
  refine le_antisymm ?_ C.le_chromaticNumber
  apply SimpleGraph.Colorable.chromaticNumber_le
  apply colorable_of_col C
  interval_cases n
  · exact Core.col0
  · exact Core.col1
  · exact Core.col2
  · exact Core.col3
  · exact Core.col4
  · exact Core.col5
  · exact Core.col6
  · exact Core.col7
  · exact Core.col8
  · exact Core.col9

end Erdos19