While this submission is a draft, it cannot be used by other submissions.

Multicoloured Clique

Lax470956.MulticolouredClique · concepts/Lax470956/MulticolouredClique.lean · lax-470956

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    An instance is a graph on nn vertices together with a colouring of its vertices by kk colours, in which adjacent vertices always receive different colours. It is a yes-instance if the graph contains a clique with one vertex of each colour — necessarily of size kk.

    Parameterized by the number kk of colours, this problem is W[1]-complete. It is the standard starting point for parameterized hardness proofs, because a reduction from it may assume the kk vertices of a solution are distinguishable in advance, one per colour.

    Concept map
    5 concepts; 2 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Lax271696.GraphEncoding
    2import Lax470956.ParameterizedComplexity
    3
    4/-!
    5---
    6title: Multicoloured Clique
    7type: definition
    8---
    9An instance is a graph on nn vertices together with a colouring of its vertices by kk
    10colours, in which adjacent vertices always receive different colours. It is a
    11yes-instance if the graph contains a clique with one vertex of each colour — necessarily
    12of size kk.
    13
    14Parameterized by the number kk of colours, this problem is W[1]-complete. It is the
    15standard starting point for parameterized hardness proofs, because a reduction from it
    16may assume the kk vertices of a solution are distinguishable in advance, one per colour.
    17
    18# Formalization notes
    19
    20The graph is a mathlib `SimpleGraph (Fin n)` and is encoded by the compressed sparse row
    21format of `Lax271696.GraphEncoding`, so that an instance of this problem is an
    22instance of the format every other statement in the archive built on that encoding uses.
    23The colouring is appended as one entry per vertex, and the number of colours as a final
    24entry, following the convention that a parameterized instance carries its parameter at
    25the end of the word.
    26
    27That adjacent vertices differ in colour is a field of the instance rather than a
    28consequence: the source of this problem is a kk-partite graph with edges only between
    29distinct parts, and a reduction from it uses that the endpoints of an edge have two
    30different colours. It costs nothing, since an instance violating it has no multicoloured
    31clique through the offending edge anyway.
    32
    33The adjacency list of each vertex is required to be strictly increasing. The archive's
    34graph format does not ask for this — it lets a list name its neighbours in any order and
    35more than once — but sorted lists are the convention of the format in practice, and
    36the requirement is what lets a linear-time reduction enumerate the edges in a canonical
    37order by a single scan. Without it a reduction would first have to sort and deduplicate
    38its input; that is possible in linear time, but it is work about the input format rather
    39than about the problem, and restricting the admissible words only makes the source
    40problem easier to be reduced *from* in the sense that fewer words need handling — the
    41problem itself, a graph and a colouring, is unchanged.
    42
    43A solution is given as a function from colours to vertices rather than as a set, so that
    44"one vertex of each colour" is the statement that the function is a section of the
    45colouring, and the size of the clique needs no separate cardinality argument.
    46-/
    47
    48namespace Lax470956.MulticolouredClique
    49
    50/-- An instance of Multicoloured Clique: a graph whose vertices are coloured so that
    51adjacent vertices differ in colour. -/
    52structure Instance where
    53 /-- The number `k` of colours, the parameter. -/
    54 colours : ℕ
    55 /-- The number `n` of vertices. -/
    56 vertices : ℕ
    57 /-- The graph. -/
    58 graph : SimpleGraph (Fin vertices)
    59 /-- The colour of each vertex. -/
    60 colour : Fin vertices → Fin colours
    61 /-- Adjacent vertices differ in colour. -/
    62 adj_colour_ne : ∀ u v, graph.Adj u v → colour u ≠ colour v
    63
    64/-- `G` contains a multicoloured clique: one vertex of each colour, pairwise adjacent. -/
    65def Instance.HasMulticolouredClique (G : Instance) : Prop :=
    66 ∃ f : Fin G.colours → Fin G.vertices,
    67 (∀ c, G.colour (f c) = c) ∧ ∀ c c', c ≠ c' → G.graph.Adj (f c) (f c')
    68
    69/-- The word `x` presents the instance `G`: a compressed sparse row block encoding the
    70graph, with each adjacency list strictly increasing, followed by one entry per vertex
    71giving its colour, followed by the number of colours. -/
    72def EncodesInstance (x : List ℕ) (G : Instance) : Prop :=
    73 ∃ g, x = g ++ (List.ofFn fun v => (G.colour v : ℕ)) ++ [G.colours] ∧
    74 Lax271696.GraphEncoding.EncodesGraph g G.vertices G.graph
    75 ∀ u < G.vertices, ∀ t, Lax271696.GraphEncoding.offset g u ≤ t →
    76 t + 1 < Lax271696.GraphEncoding.offset g (u + 1) →
    77 Lax271696.GraphEncoding.target g t < Lax271696.GraphEncoding.target g (t + 1)
    78
    79/-- The words that encode an instance. -/
    80def Instances : Set (List ℕ) := {x | ∃ G, EncodesInstance x G}
    81
    82/-- **Multicoloured Clique**, parameterized by the number of colours. The parameter is
    83the last entry of the word. -/
    84def problem : ParameterizedComplexity.Problem where
    85 Domain := Instances
    86 Yes x := ∃ G, EncodesInstance x G ∧ G.HasMulticolouredClique
    87 param x := x.getLast? |>.getD 0
    88
    89end Lax470956.MulticolouredClique
    90
    Formalization notes

    The graph is a mathlib SimpleGraph(Finn)SimpleGraph (Fin n) and is encoded by the compressed sparse row format of Lax271696.GraphEncodingLax271696.GraphEncoding, so that an instance of this problem is an instance of the format every other statement in the archive built on that encoding uses. The colouring is appended as one entry per vertex, and the number of colours as a final entry, following the convention that a parameterized instance carries its parameter at the end of the word.

    That adjacent vertices differ in colour is a field of the instance rather than a consequence: the source of this problem is a kk-partite graph with edges only between distinct parts, and a reduction from it uses that the endpoints of an edge have two different colours. It costs nothing, since an instance violating it has no multicoloured clique through the offending edge anyway.

    The adjacency list of each vertex is required to be strictly increasing. The archive's graph format does not ask for this — it lets a list name its neighbours in any order and more than once — but sorted lists are the convention of the format in practice, and the requirement is what lets a linear-time reduction enumerate the edges in a canonical order by a single scan. Without it a reduction would first have to sort and deduplicate its input; that is possible in linear time, but it is work about the input format rather than about the problem, and restricting the admissible words only makes the source problem easier to be reduced from in the sense that fewer words need handling — the problem itself, a graph and a colouring, is unchanged.

    A solution is given as a function from colours to vertices rather than as a set, so that "one vertex of each colour" is the statement that the function is a section of the colouring, and the size of the clique needs no separate cardinality argument.

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…