The Gossiping Problem
Lax630294.Gossiping · concepts/Lax630294/Gossiping.lean · lax-630294
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
Let be a multigraph. A labeling assigns a natural number to every edge. A strict temporal path from to is a path from to in whose edge labels strictly increase in traversal order; the path of length zero is allowed. The labeled graph is temporally connected if, for every ordered pair of vertices , there is a strict temporal path from to . The instance of Gossiping is a yes-instance if some labeling makes temporally connected.
Interpreting each edge as a call between its endpoints and each label as the time of the call, a labeling is an ordering of the calls, and it is temporally connected exactly when every participant learns every secret.
Concept map
Lean source view on GitHub
| 1 | import Mathlib.Combinatorics.Graph.Basic |
| 2 | import Mathlib.Order.Fin.Basic |
| 3 | import Mathlib.Order.Monotone.Basic |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: The Gossiping Problem |
| 8 | type: definition |
| 9 | --- |
| 10 | |
| 11 | Let `G` be a multigraph. A *labeling* assigns a natural number to every edge. |
| 12 | A *strict temporal path* from `u` to `v` is a path from `u` to `v` in `G` whose |
| 13 | edge labels strictly increase in traversal order; the path of length zero is |
| 14 | allowed. The labeled graph is *temporally connected* if, for every ordered pair |
| 15 | of vertices `u, v`, there is a strict temporal path from `u` to `v`. The instance |
| 16 | `G` of Gossiping is a *yes-instance* if some labeling makes `G` temporally |
| 17 | connected. |
| 18 | |
| 19 | Interpreting each edge as a call between its endpoints and each label as the |
| 20 | time of the call, a labeling is an ordering of the calls, and it is temporally |
| 21 | connected exactly when every participant learns every secret. |
| 22 | |
| 23 | # Formalization notes |
| 24 | |
| 25 | Multigraphs are Mathlib's `Graph α β`, with vertex type `α` and edge type `β`; |
| 26 | parallel edges and loops are allowed, and `G.IsLink e x y` states that the edge |
| 27 | `e` has the ends `x` and `y`. Finiteness is not part of the definition and is |
| 28 | assumed where it matters. Loops never lie on a path, so they do not influence |
| 29 | the answer. Labels are taken in `ℕ`; only their relative order matters. A path |
| 30 | of length `k` is given by its `k + 1` pairwise distinct vertices `x 0, …, x k` |
| 31 | and its `k` edges `e 0, …, e (k - 1)`, where `e i` links `x i` and `x (i + 1)`. |
| 32 | A graph with at most one vertex is a yes-instance, since only paths of length |
| 33 | zero are required. |
| 34 | -/ |
| 35 | |
| 36 | namespace Lax630294.Gossiping |
| 37 | |
| 38 | open Graph |
| 39 | |
| 40 | variable {α β : Type*} |
| 41 | |
| 42 | /-- A strict temporal path from `u` to `v` with respect to the labeling `ℓ`: a path |
| 43 | of some length `k` whose edge labels strictly increase along the path. -/ |
| 44 | def HasTemporalPath (G : Graph α β) (ℓ : β → ℕ) (u v : α) : Prop := |
| 45 | ∃ (k : ℕ) (x : Fin (k + 1) → α) (e : Fin k → β), |
| 46 | x 0 = u ∧ x (Fin.last k) = v ∧ Function.Injective x ∧ |
| 47 | (∀ i : Fin k, G.IsLink (e i) (x i.castSucc) (x i.succ)) ∧ |
| 48 | StrictMono (fun i => ℓ (e i)) |
| 49 | |
| 50 | /-- The labeling `ℓ` makes `G` temporally connected: every vertex reaches every |
| 51 | vertex by a strict temporal path. -/ |
| 52 | def IsTemporallyConnected (G : Graph α β) (ℓ : β → ℕ) : Prop := |
| 53 | ∀ u ∈ V(G), ∀ v ∈ V(G), HasTemporalPath G ℓ u v |
| 54 | |
| 55 | /-- `G` is label-connected, i.e. a yes-instance of Gossiping: some labeling makes it temporally connected. -/ |
| 56 | def IsLabelConnected (G : Graph α β) : Prop := |
| 57 | ∃ ℓ : β → ℕ, IsTemporallyConnected G ℓ |
| 58 | |
| 59 | end Lax630294.Gossiping |
| 60 |
Formalization notes
Multigraphs are Mathlib's , with vertex type and edge type ; parallel edges and loops are allowed, and states that the edge has the ends and . Finiteness is not part of the definition and is assumed where it matters. Loops never lie on a path, so they do not influence the answer. Labels are taken in ; only their relative order matters. A path of length is given by its pairwise distinct vertices and its edges , where links and . A graph with at most one vertex is a yes-instance, since only paths of length zero are required.
Builds on
none
Used by
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments