Documentation

CslibFrontier.Computability.Distributed.OrientedCycle.ColeVishkin

Cole–Vishkin colour reduction on oriented cycles #

The deterministic coin tossing of Cole and Vishkin in the LOCAL model on oriented cycles. A node of colour a whose successor has colour b ≠ a takes the new colour cvColor a b = 2 i + aᵢ, where i is the least bit position at which a and b differ. One such round turns a proper colouring with colours below M into one with colours below 2 ⌈log₂ M⌉ (cvColor_lt), so log* N rounds take colours below N to colours below 6 (iterate_cvBound_logStar_le). Three more rounds then remove the colours 5, 4 and 3, one at a time: in the round removing colour k, the nodes of colour k are pairwise non-adjacent and pick the least colour in {0, 1, 2} unused by their neighbours.

threeColoring K performs K reduction rounds followed by the three removal rounds. From distinct identifiers below N (in particular identifiers {0, …, n - 1}, N = n) it 3-colours every oriented cycle within log* N + 3 rounds (threeColoring_run_of_injective).

Since a node can learn one more colour on each side per round, two reduction steps fit into one round. fastThreeColoring s performs 2 s reduction steps in s rounds and then the three removal rounds. It 3-colours within ⌈(log* N) / 2⌉ + 3 rounds (fastThreeColoring_run), the upper bound matching Linial's lower bound (log* n) / 2 - 1 up to an additive constant.

The results hold on every oriented cycle and on the infinite oriented path (n = 0); only a proper initial colouring with colours below N is assumed.

Main definitions #

Main results #

References #

The bit-index reduction step #

The least bit position at which a and b differ, searched with fuel steps.

The least bit position at which distinct a and b differ. For a = b there is no such position and the value (a + b) carries no meaning.

Distinct numbers differ at bit lowestDiffBit a b.

Below lowestDiffBit a b, the bits of a and b agree.

The Cole–Vishkin colour of a node with colour a whose successor has colour b: twice the least differing bit position, plus the bit of a there Cole and Vishkin.

theorem Cslib.Distributed.OrientedCycle.cvColor_ne {a b c : ℕ} (hab : a ≠ b) :

Cole–Vishkin properness. If a ≠ b, then nodes coloured a, b, c in a row get different new colours: equal new colours would force the same bit position i and a, b to agree at i.

theorem Cslib.Distributed.OrientedCycle.cvColor_lt_of_lt_two_pow {a b L : ℕ} (hab : a ≠ b) (ha : a < 2 ^ L) (hb : b < 2 ^ L) :
cvColor a b < 2 * L

Colours below 2 ^ L give Cole–Vishkin colours below 2 L.

theorem Cslib.Distributed.OrientedCycle.cvColor_lt {a b M : ℕ} (hab : a ≠ b) (ha : a < M) (hb : b < M) :
cvColor a b < 2 * Nat.clog 2 M

One Cole–Vishkin round. Distinct colours below M give Cole–Vishkin colours below 2 ⌈log₂ M⌉.

Removing one colour per round #

The least colour in {0, 1, 2} different from p and q.

In the round removing colour k, a node of colour k (whose neighbours have other colours) recolours to freeColor p q; other nodes keep their colours.

theorem Cslib.Distributed.OrientedCycle.reduceColor_ne {k p a b q : ℕ} (hab : a ≠ b) :
reduceColor k p a b ≠ reduceColor k a b q

One colour-removal round keeps a colouring proper: nodes of colour k are not adjacent, so they recolour simultaneously without conflict.

theorem Cslib.Distributed.OrientedCycle.reduceColor_lt {k p a q : ℕ} (hk : 3 ≤ k) (ha : a < k + 1) :
reduceColor k p a q < k

Removing colour k ≥ 3 from colours ≤ k leaves colours < k.

The algorithm #

The map M ↦ 2 ⌈log₂ M⌉ bounding the colours after one Cole–Vishkin round.

s Cole–Vishkin bounds from the tower of height m + s leave at most 4 + 2 (2 ↑↑ m).

log* N Cole–Vishkin rounds take colours below N to colours below 6.

At least log* N Cole–Vishkin rounds take colours below N to colours below 6: further rounds keep the bound, since cvBound M ≤ 6 for M ≤ 6.

The Cole–Vishkin 3-colouring algorithm with parameter K: K bit-index reduction rounds, then three rounds removing colours 5, 4 and 3; afterwards nodes keep their colours. Its input is an initial proper colouring, for instance by distinct identifiers.

theorem Cslib.Distributed.OrientedCycle.threeColoring.state_of_le {n K N : ℕ} {x : ZMod n → ℕ} (hx : IsProperColoring x) (hN : ∀ (v : ZMod n), x v < N) {s : ℕ} (hs : s ≤ K) :

During the first K rounds the colouring stays proper, with colours below cvBound^[s] N after s rounds. In particular one round leaves colours below 2 ⌈log₂ N⌉.

theorem Cslib.Distributed.OrientedCycle.threeColoring.state_add_of_le {n K N : ℕ} {x : ZMod n → ℕ} (hx : IsProperColoring x) (hN : ∀ (v : ZMod n), x v < N) (h6 : cvBound^[K] N ≤ 6) {i : ℕ} (hi : i ≤ 3) :
IsProperColoring ((threeColoring K).state x (K + i)) ∧ ∀ (v : ZMod n), (threeColoring K).state x (K + i) v < 6 - i

In the three colour-removal rounds after round K, the colouring stays proper and loses colours 5, 4 and 3, provided K Cole–Vishkin rounds leave at most 6 colours.

After round K + 3 every node keeps its colour.

theorem Cslib.Distributed.OrientedCycle.threeColoring_run_of_iterate_le {n K N : ℕ} {x : ZMod n → ℕ} (hx : IsProperColoring x) (hN : ∀ (v : ZMod n), x v < N) (h6 : cvBound^[K] N ≤ 6) {r : ℕ} (hr : K + 3 ≤ r) :
IsProperColoring ((threeColoring K).run x r) ∧ ∀ (v : ZMod n), (threeColoring K).run x r v < 3

The algorithm threeColoring K 3-colours within K + 3 rounds whenever K Cole–Vishkin rounds bring the colours of the initial proper colouring below 6.

theorem Cslib.Distributed.OrientedCycle.threeColoring_run {n N : ℕ} {x : ZMod n → ℕ} (hx : IsProperColoring x) (hN : ∀ (v : ZMod n), x v < N) {r : ℕ} (hr : N.logStar + 3 ≤ r) :

Cole–Vishkin 3-colouring Cole and Vishkin. On every oriented cycle (and on the infinite oriented path, n = 0), from a proper colouring with colours below N, the algorithm threeColoring (log* N) computes a proper colouring with colours 0, 1, 2 within log* N + 3 rounds.

theorem Cslib.Distributed.OrientedCycle.threeColoring_run_of_injective {n N : ℕ} {x : ZMod n → ℕ} (hx : Function.Injective x) (hn : n ≠ 1) (hN : ∀ (v : ZMod n), x v < N) {r : ℕ} (hr : N.logStar + 3 ≤ r) :

Cole–Vishkin 3-colouring from identifiers. If the nodes of an oriented n-cycle, n ≠ 1, have distinct identifiers below N, then threeColoring (log* N) 3-colours it within log* N + 3 rounds.

Two Cole–Vishkin steps per round #

k Cole–Vishkin steps on the infinite oriented path: node j recolours from its own colour and its successor's.

theorem Cslib.Distributed.OrientedCycle.cvIter_congr {k : ℕ} {w w' : ℤ → ℕ} {j : ℤ} (h : ∀ (i : ℤ), j ≤ i → i ≤ j + ↑k → w i = w' i) :
cvIter k w j = cvIter k w' j
theorem Cslib.Distributed.OrientedCycle.cvIter_ne {w : ℤ → ℕ} (hw : ∀ (j : ℤ), w j ≠ w (j + 1)) (k : ℕ) (j : ℤ) :
cvIter k w j ≠ cvIter k w (j + 1)
theorem Cslib.Distributed.OrientedCycle.cvIter_lt {w : ℤ → ℕ} {N : ℕ} (hw : ∀ (j : ℤ), w j ≠ w (j + 1)) (hN : ∀ (j : ℤ), w j < N) (k : ℕ) (j : ℤ) :
theorem Cslib.Distributed.OrientedCycle.cvIter_shift (k : ℕ) (w : ℤ → ℕ) (j : ℤ) :
cvIter k (fun (i : ℤ) => w (i + 1)) j = cvIter k w (j + 1)

2s Cole–Vishkin steps as a rule of radius s: a node reads the colours at offsets -s, …, s and outputs the colour that node -s would have after 2s one-sided steps.

theorem Cslib.Distributed.OrientedCycle.cvRule_apply_lt {n N : ℕ} {x : ZMod n → ℕ} (hx : IsProperColoring x) (hN : ∀ (v : ZMod n), x v < N) {s : ℕ} (hs : N.logStar ≤ 2 * s) (v : ZMod n) :
(cvRule s).apply x v < 6

The fast Cole–Vishkin algorithm: 2s bit-index reductions in s rounds (each round a node learns one more colour on each side), then three colour-removal rounds.

theorem Cslib.Distributed.OrientedCycle.fastThreeColoring_run {n N s : ℕ} {x : ZMod n → ℕ} (hx : IsProperColoring x) (hN : ∀ (v : ZMod n), x v < N) (hs : N.logStar ≤ 2 * s) {r : ℕ} (hr : s + 3 ≤ r) :

Cole–Vishkin with two reductions per round. From a proper colouring with colours below N, fastThreeColoring s 3-colours every oriented cycle within s + 3 rounds when log* N ≤ 2s; with s = ⌈log* N / 2⌉ this is ⌈log* N / 2⌉ + 3 rounds.

The Cole–Vishkin algorithm fastThreeColoring s as a rule of radius s + 3.

theorem Cslib.Distributed.OrientedCycle.fastThreeColoringRule_toFun {s N : ℕ} {y : ℤ → ℕ} (hy : ∀ (i : ℤ), y i ≠ y (i + 1)) (hN : ∀ (i : ℤ), y i < N) (hs : N.logStar ≤ 2 * s) :

On the infinite oriented path, fastThreeColoringRule s 3-colours every proper colouring with colours below N when log* N ≤ 2s: node 0 and node 1 get different colours below 3.