Skip to content

Commit 652dbc7

Browse files
committed
feat(Combinatorics/SimpleGraph): add theorem SimpleGraph.Connected.diff_dist_adj (#27468)
This contribution was created as part of the Utrecht Summerschool "Formalizing Mathematics in Lean" in July 2025.
1 parent 03f9314 commit 652dbc7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Mathlib/Combinatorics/SimpleGraph/Metric.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,14 @@ theorem dist_eq_one_iff_adj : G.dist u v = 1 ↔ G.Adj u v := by
247247
rw [dist, ENat.toNat_eq_iff, ENat.coe_one, edist_eq_one_iff_adj]
248248
decide
249249

250+
theorem Connected.diff_dist_adj (hG : G.Connected) (hadj : G.Adj v w) :
251+
G.dist u w = G.dist u v ∨ G.dist u w = G.dist u v + 1 ∨ G.dist u w = G.dist u v - 1 := by
252+
have : G.dist v w = 1 := dist_eq_one_iff_adj.mpr hadj
253+
have : G.dist w v = 1 := dist_eq_one_iff_adj.mpr hadj.symm
254+
have : G.dist u w ≤ G.dist u v + G.dist v w := hG.dist_triangle
255+
have : G.dist u v ≤ G.dist u w + G.dist w v := hG.dist_triangle
256+
omega
257+
250258
theorem Walk.isPath_of_length_eq_dist (p : G.Walk u v) (hp : p.length = G.dist u v) :
251259
p.IsPath := by
252260
classical

0 commit comments

Comments
 (0)