Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Planar orientations, directed cycles, and acyclic two-colorings

Definition
opg169_planar_dichromatic

by hao jia · Sep 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatoricsdirected-graphsgraph-theoryopen-problemplanar-graphs

This module couples a binary directed relation to an underlying finite simple graph by requiring exactly one direction on every edge and no arcs on nonedges. Planarity is represented by an injective crossing-free straight-line drawing of the underlying graph.

A directed cycle is a cyclic list of at least three distinct vertices following directed arcs. A two-coloring is valid when neither full induced color class contains such a cycle; colors may be unused. Strong connectivity uses nonempty reflexive-transitive directed reachability.

A least-order counterexample is planar, uncolorable, and smaller than every other uncolorable planar orientation in the same universe. The module also defines the underlying minimum-degree-three condition.

Definition code
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Data.Real.Basic
import Mathlib.Logic.Relation
import Mathlib.Data.Set.Card

namespace OPG169

universe u

abbrev Digraph (V : Type u) := V → V → Prop
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}

/-- A straight-line planar embedding of the underlying simple graph. -/
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)))

/-- `D` chooses exactly one direction for every edge of `G` and no arcs for
nonedges. -/
def IsOrientationOf {V : Type u} (D : Digraph V) (G : SimpleGraph V) : Prop :=
  (∀ v : V, ¬ D v v) ∧
  (∀ ⦃u v : V⦄, D u v → G.Adj u v) ∧
  ∀ ⦃u v : V⦄, G.Adj u v →
    (D u v ∨ D v u) ∧ ¬ (D u v ∧ D v u)

/-- A list of at least two distinct vertices joined cyclically by directed
arcs. In an orientation of a simple graph such a cycle necessarily has at
least three vertices. -/
def IsDirectedCycle {V : Type u} (D : Digraph V) (vs : List V) : Prop :=
  ∃ x y : V, ∃ middle : List V,
    vs = x :: (middle ++ [y]) ∧ 3 ≤ vs.length ∧
    vs.Nodup ∧ vs.Chain' D ∧ D y x

/-- The vertices of one color induce an acyclic digraph. -/
def ColorClassAcyclic {V : Type u} (D : Digraph V)
    (color : V → Fin 2) (k : Fin 2) : Prop :=
  ¬ ∃ vs : List V,
    IsDirectedCycle D vs ∧ ∀ v ∈ vs, color v = k

/-- A two-coloring in which both full induced color classes are acyclic.
Either color may be unused. -/
def IsAcyclicTwoColoring {V : Type u} (D : Digraph V)
    (color : V → Fin 2) : Prop :=
  ∀ k : Fin 2, ColorClassAcyclic D color k

def HasAcyclicTwoColoring {V : Type u} (D : Digraph V) : Prop :=
  ∃ color : V → Fin 2, IsAcyclicTwoColoring D color

/-- Nonempty strong connectivity under directed reachability. -/
def IsStronglyConnected {V : Type u} (D : Digraph V) : Prop :=
  Nonempty V ∧ ∀ u v : V, Relation.ReflTransGen D u v

/-- A counterexample of least vertex order among all finite planar
orientations in the same universe. -/
def IsLeastOrderCounterexample {V : Type u} [Fintype V]
    (G : SimpleGraph V) (D : Digraph V) : Prop :=
  IsPlanar G ∧ IsOrientationOf D G ∧ ¬ HasAcyclicTwoColoring D ∧
  ∀ (W : Type u) [Fintype W] (H : SimpleGraph W) (E : Digraph W),
    IsPlanar H → IsOrientationOf E H →
    Fintype.card W < Fintype.card V → HasAcyclicTwoColoring E

/-- Every vertex of the underlying graph has degree at least three. -/
def HasMinimumDegreeThree {V : Type u} (G : SimpleGraph V) : Prop :=
  ∀ v : V, 3 ≤ (G.neighborSet v).encard

end OPG169
Source
Open Problem Garden / UnsolvedMath OPG-169, https://www.unsolvedmath.com/problems/OPG-169; critical-digraph comparison: Mohar, Eigenvalues and colorings of digraphs, Section 2, https://www.sfu.ca/~mohar/Reprints/Inprint/BM09_LAA09_Mohar_EigenvaluesandColorings.pdf
Read-back

What the Lean code literally says, in plain math · gpt-5.6-luna

Digraph. For a type VVV, a digraph DDD on VVV is a binary relation: for vertices u,v∈Vu,v\in Vu,v∈V, D(u,v)D(u,v)D(u,v) means there is a directed arc from uuu to vvv.

Point and segment definitions. A point is an ordered pair of real numbers. For points a=(a1,a2)a=(a_1,a_2)a=(a1​,a2​) and b=(b1,b2)b=(b_1,b_2)b=(b1​,b2​) and a real number ttt, pointOnSegment is the point ((1−t)a1+tb1,(1−t)a2+tb2)((1-t)a_1+tb_1,(1-t)a_2+tb_2)((1−t)a1​+tb1​,(1−t)a2​+tb2​). The closed segment from aaa to bbb is the set of points xxx for which there exists a real ttt with 0≤t≤10\le t\le 10≤t≤1 and x=((1−t)a1+tb1,(1−t)a2+tb2)x=((1-t)a_1+tb_1,(1-t)a_2+tb_2)x=((1−t)a1​+tb1​,(1−t)a2​+tb2​).

Planarity. For a simple graph GGG on a type VVV, IsPlanar G means that there exists an injective map p:V→R2p:V\to\mathbb R^2p:V→R2 such that: whenever aaa and bbb are adjacent in GGG and vvv is different from both aaa and bbb, p(v)p(v)p(v) does not lie on the closed segment from p(a)p(a)p(a) to p(b)p(b)p(b); and whenever aaa is adjacent to bbb, ccc is adjacent to ddd, and a≠ca\ne ca=c, a≠da\ne da=d, b≠cb\ne cb=c, and b≠db\ne db=d, the closed segments from p(a)p(a)p(a) to p(b)p(b)p(b) and from p(c)p(c)p(c) to p(d)p(d)p(d) are disjoint.

Orientation. IsOrientationOf D G means that DDD has no loops, every directed arc of DDD joins adjacent vertices of GGG, and for every edge joining uuu and vvv, exactly one of D(u,v)D(u,v)D(u,v) and D(v,u)D(v,u)D(v,u) holds.

Directed cycle. IsDirectedCycle D vs means that there exist vertices x,yx,yx,y and a list middle such that vs=xvs=xvs=x followed by the elements of middle and then yyy, that vsvsvs has length at least 333, that no vertex occurs more than once in vsvsvs, that every consecutive pair of vertices in vsvsvs is joined by a directed arc of DDD, and that D(y,x)D(y,x)D(y,x) holds.

Acyclic color classes. Given a digraph DDD, a coloring color:V→Fin 2color:V\to\mathrm{Fin}\,2color:V→Fin2 and a color k∈Fin 2k\in\mathrm{Fin}\,2k∈Fin2, ColorClassAcyclic D color k means that there is no directed cycle all of whose vertices receive color kkk. IsAcyclicTwoColoring D color means this holds for each of the two colors, and HasAcyclicTwoColoring D means that at least one coloring color:V→Fin 2color:V\to\mathrm{Fin}\,2color:V→Fin2 has this property; either color is allowed to be unused.

Strong connectivity. IsStronglyConnected D means that VVV is nonempty and, for every pair of vertices u,vu,vu,v, there is a finite directed walk from uuu to vvv using zero or more arcs of DDD; in particular, walks of length zero are allowed.

Least-order counterexample. For a type VVV equipped with a finite-type structure, a simple graph GGG on VVV and a digraph DDD on VVV, IsLeastOrderCounterexample G D means that GGG is planar, DDD is an orientation of GGG, DDD has no acyclic two-coloring, and, for every type WWW in the same universe equipped with a finite-type structure, every simple graph HHH on WWW, and every digraph EEE on WWW, if HHH is planar, EEE is an orientation of HHH, and the finite cardinality of WWW is strictly smaller than that of VVV, then EEE has an acyclic two-coloring.

Minimum degree. HasMinimumDegreeThree G means that every vertex vvv has a neighbor set in GGG whose cardinality is at least 333.

Human review
  • Endorsed by Shuze Chen · Sep 8, 2026

  • Endorsed by hao jia · Sep 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me