Index of theproofnetwork/open-problems@860a535/Prove2Me/Definitions/Def_opg401_circular_coloring.lean
qedmarket’s copy of theproofnetwork/open-problems@860a535, 1 Dec 2026original source ↗
/-From Prove2Me, definition `opg401_circular_coloring` (https://prove2.me/definitions/11e5bd7b-80e3-4a66-b74a-ce450b9791ea). Apache-2.0 per Prove2Me's terms.-/import Mathlib.Combinatorics.SimpleGraph.Finiteimport Mathlib.Data.Finset.Cardimport Mathlib.Data.Real.Basicimport Mathlib.Data.Set.Card namespace OPG401 universe u abbrev Point := ℝ × ℝ def pointOnSegment (a b : Point) (t : ℝ) : Point := ((1 - t) * a.1 + t * b.1, (1 - t) * a.2 + t * b.2) def closedSegment (a b : Point) : Set Point := {x | ∃ t : ℝ, 0 ≤ t ∧ t ≤ 1 ∧ x = pointOnSegment a b t} def openSegment (a b : Point) : Set Point := {x | ∃ t : ℝ, 0 < t ∧ t < 1 ∧ x = pointOnSegment a b t} /-- A finite graph is represented as planar by an injective straight-line drawing:no third vertex lies on an edge, and nonincident edges are disjoint. -/def IsPlanar {V : Type u} (G : SimpleGraph V) : Prop := ∃ p : V → Point, Function.Injective p ∧ (∀ ⦃a b v : V⦄, G.Adj a b → v ≠ a → v ≠ b → p v ∉ closedSegment (p a) (p b)) ∧ (∀ ⦃a b c d : V⦄, G.Adj a b → G.Adj c d → a ≠ c → a ≠ d → b ≠ c → b ≠ d → Disjoint (closedSegment (p a) (p b)) (closedSegment (p c) (p d))) /-- The graph contains no triangle. -/def IsTriangleFree {V : Type u} (G : SimpleGraph V) : Prop := ∀ ⦃a b c : V⦄, G.Adj a b → G.Adj b c → ¬ G.Adj c a /-- Every vertex has at most three neighbors. -/def IsSubcubic {V : Type u} (G : SimpleGraph V) : Prop := ∀ v : V, (G.neighborSet v).encard ≤ 3 /-- Shortest cyclic distance between two residues modulo `p`. -/def circularDistance {p : ℕ} (a b : Fin p) : ℕ := min ((a.val + p - b.val) % p) ((b.val + p - a.val) % p) /-- The edge constraint for a `(p,q)`-coloring, using shortest cyclic distance. -/def PQCompatible (p q : ℕ) (a b : Fin p) : Prop := q ≤ circularDistance a b ∧ circularDistance a b ≤ p - q /-- A `(p,q)`-coloring of a simple graph. -/def IsPQColoring {V : Type u} (G : SimpleGraph V) (p q : ℕ) (color : V → Fin p) : Prop := ∀ ⦃u v : V⦄, G.Adj u v → PQCompatible p q (color u) (color v) /-- The colors that may be assigned next to a vertex of color `a` in a`(20,7)`-coloring. -/noncomputable def allowedColors (a : Fin 20) : Finset (Fin 20) := by classical exact Finset.univ.filter fun z => PQCompatible 20 7 z a end OPG401