3-colorability
Lax799700.ThreeColorability · concepts/Lax799700/ThreeColorability.lean · lax-799700
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
A graph is a structure of Mathlib's graph vocabulary, a single binary relation; ThreeColorable says some map into three colors separates every adjacent pair, and ThreeCol is the decision problem. A self-loop makes a structure a no-instance. On structures arising from Mathlib's simple graphs the property agrees with Mathlib's colorability. Membership in NP is by a first-order reduction to SAT, hardness by an ordered first-order reduction from SAT.
Concept map
Evidence
This concept declares 3 statements. Each proof establishes one of them relative to its assumptions.
1 threeCol_iff proven
2 threeCol_NP_complete proven
3 threeColorable_iso proven
Lean source view on GitHub
| 1 | import Mathlib.ModelTheory.Graph |
| 2 | import Mathlib.Combinatorics.SimpleGraph.Coloring.Vertex |
| 3 | import Mathlib.ModelTheory.Semantics |
| 4 | import Mathlib.ModelTheory.Complexity |
| 5 | import Mathlib.Tactic.FinCases |
| 6 | import Lax904597.Classes |
| 7 | import Lax799700.Problems |
| 8 | |
| 9 | /-! |
| 10 | --- |
| 11 | title: 3-colorability |
| 12 | type: theorem |
| 13 | --- |
| 14 | A graph is a structure of Mathlib's graph vocabulary, a single binary |
| 15 | relation; ThreeColorable says some map into three colors separates every |
| 16 | adjacent pair, and ThreeCol is the decision problem. A self-loop makes a |
| 17 | structure a no-instance. On structures arising from Mathlib's simple |
| 18 | graphs the property agrees with Mathlib's colorability. Membership in NP |
| 19 | is by a first-order reduction to SAT, hardness by an ordered first-order |
| 20 | reduction from SAT. |
| 21 | |
| 22 | -/ |
| 23 | |
| 24 | namespace Lax799700.ThreeColorability |
| 25 | |
| 26 | open FirstOrder |
| 27 | |
| 28 | open Language Structure |
| 29 | |
| 30 | section Graph |
| 31 | |
| 32 | variable (V : Type) [Language.graph.Structure V] |
| 33 | |
| 34 | /-- A `Language.graph`-structure is 3-colorable if the vertices can be colored |
| 35 | with 3 colors so that adjacent vertices get distinct colors. (On structures |
| 36 | with self-loops this is never satisfiable, matching the usual convention.) -/ |
| 37 | def ThreeColorable : Prop := |
| 38 | ∃ c : V → Fin 3, ∀ x y : V, RelMap adj ![x, y] → c x ≠ c y |
| 39 | |
| 40 | end Graph |
| 41 | |
| 42 | open Lax904597.Problems Lax904597.Classes Lax799700.Problems |
| 43 | |
| 44 | /-- The property `ThreeColorable` is isomorphism-invariant. -/ |
| 45 | axiom threeColorable_iso : ∀ {A B : Type} [FirstOrder.Language.graph.Structure A] [FirstOrder.Language.graph.Structure B], |
| 46 | (A ≃[FirstOrder.Language.graph] B) → (ThreeColorable A ↔ ThreeColorable B) |
| 47 | |
| 48 | /-- The problem ThreeCol: does the structure satisfy `ThreeColorable`? -/ |
| 49 | def ThreeCol : DecisionProblem FirstOrder.Language.graph := |
| 50 | DecisionProblem.ofPred ThreeColorable |
| 51 | |
| 52 | /-- The yes-instances of ThreeCol are exactly the structures satisfying |
| 53 | `ThreeColorable`. -/ |
| 54 | axiom threeCol_iff : ∀ (A : Type) [FirstOrder.Language.graph.Structure A], ThreeCol A ↔ ThreeColorable A |
| 55 | |
| 56 | /-- ThreeCol is NP-complete. -/ |
| 57 | axiom threeCol_NP_complete : NP.Complete ThreeCol |
| 58 | |
| 59 | end Lax799700.ThreeColorability |
| 60 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments