/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import FormalConjecturesUtil

The 1-2-3 conjecture (Karoński–Łuczak–Thomason 2004; proved by Keusch 2024)

References:

    [KLT04] Karoński, M., Łuczak, T. and Thomason, A. (2004). "Edge weights and vertex colours." J. Combin. Theory Ser. B 91, pp. 151--157.

    [ABDMRT07] Addario-Berry, L., Dalal, K., McDiarmid, C., Reed, B. A. and Thomason, A. (2007). "Vertex-colouring edge-weightings." Combinatorica 27, pp. 1--12.

    [KKP10] Kalkowski, M., Karoński, M. and Pfender, F. (2010). "Vertex-coloring edge-weightings: towards the 1-2-3-conjecture." J. Combin. Theory Ser. B 100, pp. 347--349.

    [Ke24] Keusch, R. (2024). "A solution to the 1-2-3 conjecture." J. Combin. Theory Ser. B 166, pp. 183--202. arXiv:2303.02611

@[expose] public sectionopen SimpleGraph Finsetnamespace OneTwoThreeConjecturevariable {V : Type*} [Fintype V] [DecidableEq V]

The weighted degree of v under the edge weighting w: the sum of the weights of the edges incident to v.

def weightedDegree (G : SimpleGraph V) [DecidableRel G.Adj] (w : Sym2 V → ℕ) (v : V) : ℕ := ∑ e ∈ G.incidenceFinset v, w e

An edge weighting w of G is vertex-colouring if adjacent vertices receive different weighted degrees.

def IsVertexColouringWeighting (G : SimpleGraph V) [DecidableRel G.Adj] (w : Sym2 V → ℕ) : Prop := ∀ u v, G.Adj u v → weightedDegree G w u ≠ weightedDegree G w v

G has no isolated edge: no edge has both endpoints of degree 1 (equivalently, no connected component is a single edge).

def NoIsolatedEdge (G : SimpleGraph V) [DecidableRel G.Adj] : Prop := ∀ u v, G.Adj u v → 2 ≤ G.degree u ∨ 2 ≤ G.degree v

The 1-2-3 conjecture (Karoński–Łuczak–Thomason 2004), proved by Keusch (2024).

Every finite simple graph with no isolated edge admits an edge weighting with weights in ${1, 2, 3}$ such that adjacent vertices have different weighted degrees.

@[category research solved, AMS 5] theorem one_two_three_conjecture : ∀ {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj], NoIsolatedEdge G → ∃ w : Sym2 V → ℕ, (∀ e ∈ G.edgeFinset, 1 ≤ w e ∧ w e ≤ 3) ∧ IsVertexColouringWeighting G w := ⊢ ∀ {V : Type} [inst : Fintype V] [inst_1 : DecidableEq V] (G : SimpleGraph V) [inst_2 : DecidableRel G.Adj], NoIsolatedEdge G → ∃ w, (∀ e ∈ G.edgeFinset, 1 ≤ w e ∧ w e ≤ 3) ∧ IsVertexColouringWeighting G w All goals completed! 🐙

Kalkowski–Karoński–Pfender (2010): weights in ${1, \dots, 5}$ suffice.

Reference: [KKP10].

@[category research solved, AMS 5] theorem one_two_three_conjecture.variants.one_to_five {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hG : NoIsolatedEdge G) : ∃ w : Sym2 V → ℕ, (∀ e ∈ G.edgeFinset, 1 ≤ w e ∧ w e ≤ 5) ∧ IsVertexColouringWeighting G w := V:Typeinst✝²:Fintype Vinst✝¹:DecidableEq VG:SimpleGraph Vinst✝:DecidableRel G.AdjhG:NoIsolatedEdge G⊢ ∃ w, (∀ e ∈ G.edgeFinset, 1 ≤ w e ∧ w e ≤ 5) ∧ IsVertexColouringWeighting G w All goals completed! 🐙

Addario-Berry–Dalal–McDiarmid–Reed–Thomason (2007): weights in ${1, \dots, 30}$ suffice.

Reference: [ABDMRT07]; see also the introduction of [KKP10].

@[category research solved, AMS 5] theorem one_two_three_conjecture.variants.one_to_thirty {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hG : NoIsolatedEdge G) : ∃ w : Sym2 V → ℕ, (∀ e ∈ G.edgeFinset, 1 ≤ w e ∧ w e ≤ 30) ∧ IsVertexColouringWeighting G w := V:Typeinst✝²:Fintype Vinst✝¹:DecidableEq VG:SimpleGraph Vinst✝:DecidableRel G.AdjhG:NoIsolatedEdge G⊢ ∃ w, (∀ e ∈ G.edgeFinset, 1 ≤ w e ∧ w e ≤ 30) ∧ IsVertexColouringWeighting G w All goals completed! 🐙

The hypothesis "no isolated edge" is necessary.

A single edge K₂ has no vertex-colouring edge weighting at all: both endpoints receive the weight of the unique edge as their weighted degree.

w:Sym2 (Fin 2) → ℕhw:IsVertexColouringWeighting (completeGraph (Fin 2)) wh:∀ (v : Fin 2), (completeGraph (Fin 2)).incidenceFinset v = {s(0, 1)}⊢ weightedDegree (completeGraph (Fin 2)) w 0 = weightedDegree (completeGraph (Fin 2)) w 1 All goals completed! 🐙

Weights ${1, 2}$ do not suffice: the triangle.

In K₃ the three vertex sums are a + b, a + c, b + c for the three edge weights a, b, c, and they are pairwise distinct only if a, b, c are, which is impossible with two available weights. Hence the constant 3 in the conjecture cannot be lowered to 2.

w:Sym2 (Fin 3) → ℕhw:∀ e ∈ (completeGraph (Fin 3)).edgeFinset, 1 ≤ w e ∧ w e ≤ 2hcol:IsVertexColouringWeighting (completeGraph (Fin 3)) wh0:(completeGraph (Fin 3)).incidenceFinset 0 = {s(0, 1), s(0, 2)}h1:(completeGraph (Fin 3)).incidenceFinset 1 = {s(0, 1), s(1, 2)}h2:(completeGraph (Fin 3)).incidenceFinset 2 = {s(0, 2), s(1, 2)}e01:s(0, 1) ∈ (completeGraph (Fin 3)).edgeFinsete02:s(0, 2) ∈ (completeGraph (Fin 3)).edgeFinsete12:s(1, 2) ∈ (completeGraph (Fin 3)).edgeFinsetha:1 ≤ w s(0, 1) ∧ w s(0, 1) ≤ 2hb:1 ≤ w s(0, 2) ∧ w s(0, 2) ≤ 2hc:1 ≤ w s(1, 2) ∧ w s(1, 2) ≤ 2d01:weightedDegree (completeGraph (Fin 3)) w 0 ≠ weightedDegree (completeGraph (Fin 3)) w 1d02:weightedDegree (completeGraph (Fin 3)) w 0 ≠ weightedDegree (completeGraph (Fin 3)) w 2d12:weightedDegree (completeGraph (Fin 3)) w 1 ≠ weightedDegree (completeGraph (Fin 3)) w 2⊢ False w:Sym2 (Fin 3) → ℕhw:∀ e ∈ (completeGraph (Fin 3)).edgeFinset, 1 ≤ w e ∧ w e ≤ 2hcol:IsVertexColouringWeighting (completeGraph (Fin 3)) wh0:(completeGraph (Fin 3)).incidenceFinset 0 = {s(0, 1), s(0, 2)}h1:(completeGraph (Fin 3)).incidenceFinset 1 = {s(0, 1), s(1, 2)}h2:(completeGraph (Fin 3)).incidenceFinset 2 = {s(0, 2), s(1, 2)}e01:s(0, 1) ∈ (completeGraph (Fin 3)).edgeFinsete02:s(0, 2) ∈ (completeGraph (Fin 3)).edgeFinsete12:s(1, 2) ∈ (completeGraph (Fin 3)).edgeFinsetha:1 ≤ w s(0, 1) ∧ w s(0, 1) ≤ 2hb:1 ≤ w s(0, 2) ∧ w s(0, 2) ≤ 2hc:1 ≤ w s(1, 2) ∧ w s(1, 2) ≤ 2d01:w s(0, 1) + w s(0, 2) ≠ w s(0, 1) + w s(1, 2)d02:w s(0, 1) + w s(0, 2) ≠ w s(0, 2) + w s(1, 2)d12:w s(0, 1) + w s(1, 2) ≠ w s(0, 2) + w s(1, 2)⊢ False All goals completed! 🐙end OneTwoThreeConjecture