The Königsberg bridges problem #
We show that a graph that represents the islands and mainlands of Königsberg and seven bridges between them has no Eulerian trail.
The vertices for the Königsberg graph; four vertices for the bodies of land and seven vertices for the bridges.
- V1: Konigsberg.Verts
- V2: Konigsberg.Verts
- V3: Konigsberg.Verts
- V4: Konigsberg.Verts
- B1: Konigsberg.Verts
- B2: Konigsberg.Verts
- B3: Konigsberg.Verts
- B4: Konigsberg.Verts
- B5: Konigsberg.Verts
- B6: Konigsberg.Verts
- B7: Konigsberg.Verts
Instances For
Equations
- Konigsberg.instDecidableEqVerts x y = if h : x.toCtorIdx = y.toCtorIdx then isTrue ⋯ else isFalse ⋯
Equations
- Konigsberg.instFintypeVerts = { elems := { val := ↑Konigsberg.Verts.enumList, nodup := Konigsberg.Verts.enumList_nodup }, complete := Konigsberg.instFintypeVerts.proof_1 }
Each of the connections between the islands/mainlands and the bridges.
These are ordered pairs, but the data becomes symmetric in Konigsberg.adj
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The adjacency relation for the Königsberg graph.
Equations
- Konigsberg.adj v w = (decide ((v, w) ∈ Konigsberg.edges) || decide ((w, v) ∈ Konigsberg.edges))
Instances For
The Königsberg graph structure. While the Königsberg bridge problem is usually described using a multigraph, the we use a "mediant" construction to transform it into a simple graph -- every edge in the multigraph is subdivided into a path of two edges. This construction preserves whether a graph is Eulerian.
(TODO: once mathlib has multigraphs, either prove the mediant construction preserves the Eulerian property or switch this file to use multigraphs.
Equations
- Konigsberg.graph = { Adj := fun (v w : Konigsberg.Verts) => Konigsberg.adj v w = true, symm := Konigsberg.graph.proof_1, loopless := Konigsberg.graph.proof_2 }
Instances For
Equations
To speed up the proof, this is a cache of all the degrees of each vertex,
proved in Konigsberg.degree_eq_degree
.
Equations
- Konigsberg.degree Konigsberg.Verts.V1 = 5
- Konigsberg.degree Konigsberg.Verts.V2 = 3
- Konigsberg.degree Konigsberg.Verts.V3 = 3
- Konigsberg.degree Konigsberg.Verts.V4 = 3
- Konigsberg.degree Konigsberg.Verts.B1 = 2
- Konigsberg.degree Konigsberg.Verts.B2 = 2
- Konigsberg.degree Konigsberg.Verts.B3 = 2
- Konigsberg.degree Konigsberg.Verts.B4 = 2
- Konigsberg.degree Konigsberg.Verts.B5 = 2
- Konigsberg.degree Konigsberg.Verts.B6 = 2
- Konigsberg.degree Konigsberg.Verts.B7 = 2
Instances For
The Königsberg graph is not Eulerian.