File: Mathlib/Combinatorics/SimpleGraph/Metric.lean

full_name: SimpleGraph.edist
code: /--
The extended distance between two vertices is the length of the shortest walk between them.
It is `⊤` if no such walk exists.
-/
noncomputable def edist (u v : V) : ℕ∞ 
goal: ℕ∞

full_name: SimpleGraph.edist_eq_sInf
code: theorem edist_eq_sInf : G.edist u v = sInf (Set.range fun w : G.Walk u v ↦ (w.length : ℕ∞)) 
goal: G.edist u v = sInf (Set.range fun w => ↑w.length)

full_name: SimpleGraph.Reachable.exists_walk_length_eq_edist
code: protected theorem Reachable.exists_walk_length_eq_edist (hr : G.Reachable u v) :
    ∃ p : G.Walk u v, p.length = G.edist u v 
goal: ∃ p, ↑p.length = G.edist u v

full_name: SimpleGraph.Connected.exists_walk_length_eq_edist
code: protected theorem Connected.exists_walk_length_eq_edist  (hconn : G.Connected) (u v : V) :
    ∃ p : G.Walk u v, p.length = G.edist u v 
goal: ∃ p, ↑p.length = G.edist u v

full_name: SimpleGraph.edist_le
code: theorem edist_le (p : G.Walk u v) :
    G.edist u v ≤ p.length 
goal: G.edist u v ≤ ↑p.length

full_name: SimpleGraph.edist_eq_zero_iff
code: @[simp]
theorem edist_eq_zero_iff :
    G.edist u v = 0 ↔ u = v 
goal: G.edist u v = 0 ↔ u = v

full_name: SimpleGraph.edist_self
code: theorem edist_self : edist G v v = 0 
goal: G.edist v v = 0

full_name: SimpleGraph.edist_pos_of_ne
code: theorem edist_pos_of_ne (hne : u ≠ v) :
    0 < G.edist u v 
goal: 0 < G.edist u v

full_name: SimpleGraph.edist_eq_top_of_not_reachable
code: lemma edist_eq_top_of_not_reachable (h : ¬G.Reachable u v) :
    G.edist u v = ⊤ 
goal: G.edist u v = ⊤

full_name: SimpleGraph.reachable_of_edist_ne_top
code: theorem reachable_of_edist_ne_top (h : G.edist u v ≠ ⊤) :
    G.Reachable u v 
goal: G.Reachable u v

full_name: SimpleGraph.exists_walk_of_edist_ne_top
code: lemma exists_walk_of_edist_ne_top (h : G.edist u v ≠ ⊤) :
    ∃ p : G.Walk u v, p.length = G.edist u v 
goal: ∃ p, ↑p.length = G.edist u v

full_name: SimpleGraph.edist_triangle
code: protected theorem edist_triangle : G.edist u w ≤ G.edist u v + G.edist v w 
goal: G.edist u w ≤ G.edist u v + G.edist v w

full_name: SimpleGraph.edist_comm
code: theorem edist_comm : G.edist u v = G.edist v u 
goal: G.edist u v = G.edist v u

full_name: SimpleGraph.exists_walk_of_edist_eq_coe
code: lemma exists_walk_of_edist_eq_coe {k : ℕ} (h : G.edist u v = k) :
    ∃ p : G.Walk u v, p.length = k 
goal: ∃ p, p.length = k

full_name: SimpleGraph.edist_ne_top_iff_reachable
code: lemma edist_ne_top_iff_reachable : G.edist u v ≠ ⊤ ↔ G.Reachable u v 
goal: G.edist u v ≠ ⊤ ↔ G.Reachable u v

full_name: SimpleGraph.edist_eq_one_iff_adj
code: /--
The extended distance between vertices is equal to `1` if and only if these vertices are adjacent.
-/
@[simp]
theorem edist_eq_one_iff_adj : G.edist u v = 1 ↔ G.Adj u v 
goal: G.edist u v = 1 ↔ G.Adj u v

full_name: SimpleGraph.dist
code: /--
The distance between two vertices is the length of the shortest walk between them.
If no such walk exists, this uses the junk value of `0`.
-/
noncomputable def dist (u v : V) : ℕ 
goal: ℕ

full_name: SimpleGraph.dist_eq_sInf
code: theorem dist_eq_sInf : G.dist u v = sInf (Set.range (Walk.length : G.Walk u v → ℕ)) 
goal: G.dist u v = sInf (Set.range SimpleGraph.Walk.length)

full_name: SimpleGraph.Reachable.exists_walk_length_eq_dist
code: protected theorem Reachable.exists_walk_length_eq_dist (hr : G.Reachable u v) :
    ∃ p : G.Walk u v, p.length = G.dist u v 
goal: ∃ p, p.length = G.dist u v

full_name: SimpleGraph.Connected.exists_walk_length_eq_dist
code: protected theorem Connected.exists_walk_length_eq_dist (hconn : G.Connected) (u v : V) :
    ∃ p : G.Walk u v, p.length = G.dist u v 
goal: ∃ p, p.length = G.dist u v

full_name: SimpleGraph.dist_le
code: theorem dist_le (p : G.Walk u v) : G.dist u v ≤ p.length 
goal: G.dist u v ≤ p.length

full_name: SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable
code: @[simp]
theorem dist_eq_zero_iff_eq_or_not_reachable :
    G.dist u v = 0 ↔ u = v ∨ ¬G.Reachable u v 
goal: G.dist u v = 0 ↔ u = v ∨ ¬G.Reachable u v

full_name: SimpleGraph.dist_self
code: theorem dist_self : dist G v v = 0 
goal: G.dist v v = 0

full_name: SimpleGraph.Reachable.dist_eq_zero_iff
code: protected theorem Reachable.dist_eq_zero_iff (hr : G.Reachable u v) :
    G.dist u v = 0 ↔ u = v 
goal: G.dist u v = 0 ↔ u = v

full_name: SimpleGraph.Reachable.pos_dist_of_ne
code: protected theorem Reachable.pos_dist_of_ne (h : G.Reachable u v) (hne : u ≠ v) :
    0 < G.dist u v 
goal: 0 < G.dist u v

full_name: SimpleGraph.Connected.dist_eq_zero_iff
code: protected theorem Connected.dist_eq_zero_iff (hconn : G.Connected) :
    G.dist u v = 0 ↔ u = v 
goal: G.dist u v = 0 ↔ u = v

full_name: SimpleGraph.Connected.pos_dist_of_ne
code: protected theorem Connected.pos_dist_of_ne (hconn : G.Connected) (hne : u ≠ v) :
    0 < G.dist u v 
goal: 0 < G.dist u v

full_name: SimpleGraph.dist_eq_zero_of_not_reachable
code: theorem dist_eq_zero_of_not_reachable (h : ¬G.Reachable u v) : G.dist u v = 0 
goal: G.dist u v = 0

full_name: SimpleGraph.nonempty_of_pos_dist
code: theorem nonempty_of_pos_dist (h : 0 < G.dist u v) :
    (Set.univ : Set (G.Walk u v)).Nonempty 
goal: Set.univ.Nonempty

full_name: SimpleGraph.Connected.dist_triangle
code: protected theorem Connected.dist_triangle (hconn : G.Connected) :
    G.dist u w ≤ G.dist u v + G.dist v w 
goal: G.dist u w ≤ G.dist u v + G.dist v w

full_name: SimpleGraph.dist_comm
code: theorem dist_comm : G.dist u v = G.dist v u 
goal: G.dist u v = G.dist v u

full_name: SimpleGraph.dist_ne_zero_iff_ne_and_reachable
code: lemma dist_ne_zero_iff_ne_and_reachable : G.dist u v ≠ 0 ↔ u ≠ v ∧ G.Reachable u v 
goal: G.dist u v ≠ 0 ↔ u ≠ v ∧ G.Reachable u v

full_name: SimpleGraph.Reachable.of_dist_ne_zero
code: lemma Reachable.of_dist_ne_zero (h : G.dist u v ≠ 0) : G.Reachable u v 
goal: G.Reachable u v

full_name: SimpleGraph.exists_walk_of_dist_ne_zero
code: lemma exists_walk_of_dist_ne_zero (h : G.dist u v ≠ 0) :
    ∃ p : G.Walk u v, p.length = G.dist u v 
goal: ∃ p, p.length = G.dist u v

full_name: SimpleGraph.dist_eq_one_iff_adj
code: /--
The distance between vertices is equal to `1` if and only if these vertices are adjacent.
-/
@[simp]
theorem dist_eq_one_iff_adj : G.dist u v = 1 ↔ G.Adj u v 
goal: G.dist u v = 1 ↔ G.Adj u v

full_name: SimpleGraph.Walk.isPath_of_length_eq_dist
code: theorem Walk.isPath_of_length_eq_dist (p : G.Walk u v) (hp : p.length = G.dist u v) :
    p.IsPath 
goal: p.IsPath

full_name: SimpleGraph.Reachable.exists_path_of_dist
code: lemma Reachable.exists_path_of_dist (hr : G.Reachable u v) :
    ∃ (p : G.Walk u v), p.IsPath ∧ p.length = G.dist u v 
goal: ∃ p, p.IsPath ∧ p.length = G.dist u v

full_name: SimpleGraph.Connected.exists_path_of_dist
code: lemma Connected.exists_path_of_dist (hconn : G.Connected) (u v : V) :
    ∃ (p : G.Walk u v), p.IsPath ∧ p.length = G.dist u v 
goal: ∃ p, p.IsPath ∧ p.length = G.dist u v