Minimum Coloring with a witnessing 2-sequence
Lax528502.ColoringInstances · concepts/Lax528502/ColoringInstances.lean · lax-528502
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
An instance consists of a graph , a positive integer , and a valid -sequence of . It is accepted if has a proper -coloring. The binary language contains exactly the encodings of accepted instances. The promise consists of the encodings of all instances, including negative ones.
Concept map
Lean source view on GitHub
| 1 | import Lax528502.ContractionInput |
| 2 | import Lax434930.PolynomialTime |
| 3 | import Lax759944.BinaryWordEncoding |
| 4 | import Mathlib.Combinatorics.SimpleGraph.Coloring.Vertex |
| 5 | |
| 6 | /-! |
| 7 | --- |
| 8 | title: Minimum Coloring with a witnessing 2-sequence |
| 9 | type: definition |
| 10 | --- |
| 11 | An instance consists of a graph , a positive integer , and a valid |
| 12 | -sequence of . It is accepted if has a proper -coloring. |
| 13 | The binary language contains exactly the encodings of accepted instances. |
| 14 | The promise consists of the encodings of all instances, including negative ones. |
| 15 | -/ |
| 16 | |
| 17 | namespace Lax528502.ColoringInstances |
| 18 | |
| 19 | open Lax228581.TwinWidth Lax434930.PolynomialTime Lax759944.BinaryWordEncoding |
| 20 | |
| 21 | /-- Write the RAM binary encoding over 2 symbols. A separator is 1, a zero |
| 22 | digit is 00, and a one digit is 01. These codewords form a prefix code. -/ |
| 23 | def binary (words : List ℕ) : Word := |
| 24 | (encode words).flatMap fun s => match s with |
| 25 | | .separator => [true] |
| 26 | | .zero => [false, false] |
| 27 | | .one => [false, true] |
| 28 | |
| 29 | /-- A graph, a witnessing 2-sequence, and the positive number of colors supplied as input. -/ |
| 30 | structure Instance where |
| 31 | n : ℕ |
| 32 | graph : SimpleGraph (Fin n) |
| 33 | sequence : PartitionSequence graph 2 |
| 34 | colors : ℕ |
| 35 | positive : 0 < colors |
| 36 | |
| 37 | noncomputable def Instance.words (I : Instance) : List ℕ := |
| 38 | I.colors :: ContractionInput.encode (Equiv.refl _) I.graph I.sequence |
| 39 | |
| 40 | noncomputable def Instance.bits (I : Instance) : Word := binary I.words |
| 41 | |
| 42 | /-- Encodings of all valid instances, including graphs that require more colors. -/ |
| 43 | def validColoringInstances : Language := {w | ∃ I : Instance, I.bits = w} |
| 44 | |
| 45 | /-- Minimum Coloring with a given 2-sequence and the color bound as part of the input. -/ |
| 46 | def minimumColoringWithTwoSequence : Language := |
| 47 | {w | ∃ I : Instance, I.bits = w ∧ I.graph.Colorable I.colors} |
| 48 | |
| 49 | /-- A polynomial many-one reduction whose output satisfies the promise on every input. -/ |
| 50 | def PolynomialManyOneReduction (source target : Language) (withOutputsIn : Language) : Prop := |
| 51 | ∃ f : Word → Word, Nonempty (Turing.TM2ComputableInPolyTime id id f) ∧ |
| 52 | ∀ x, f x ∈ withOutputsIn ∧ (x ∈ source ↔ f x ∈ target) |
| 53 | |
| 54 | /-- The promise language of the coloring verifier. -/ |
| 55 | abbrev wellFormed := validColoringInstances |
| 56 | |
| 57 | /-- The target language of the coloring reduction. -/ |
| 58 | abbrev minimumColoring := minimumColoringWithTwoSequence |
| 59 | |
| 60 | end Lax528502.ColoringInstances |
| 61 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments