Theorem: SimpleGraph.exists_maximal_degree_vertex
File: Mathlib/Combinatorics/SimpleGraph/Finite.lean

Proof steps:
state_before: V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
⊢ ∃ v, G.maxDegree = G.degree v
state_after: case intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
t : ℕ
ht : (image (fun v => G.degree v) univ).max = ↑t
⊢ ∃ v, G.maxDegree = G.degree v
tactic: obtain ⟨t, ht⟩ := max_of_nonempty (univ_nonempty.image fun v => G.degree v)
state_before: case intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
t : ℕ
ht : (image (fun v => G.degree v) univ).max = ↑t
⊢ ∃ v, G.maxDegree = G.degree v
state_after: case intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
t : ℕ
ht : (image (fun v => G.degree v) univ).max = ↑t
ht₂ : t ∈ image (fun v => G.degree v) univ
⊢ ∃ v, G.maxDegree = G.degree v
tactic: have ht₂ := mem_of_max ht
state_before: case intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
t : ℕ
ht : (image (fun v => G.degree v) univ).max = ↑t
ht₂ : t ∈ image (fun v => G.degree v) univ
⊢ ∃ v, G.maxDegree = G.degree v
state_after: case intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
t : ℕ
ht : (image (fun v => G.degree v) univ).max = ↑t
ht₂ : ∃ a, True ∧ G.degree a = t
⊢ ∃ v, G.maxDegree = G.degree v
tactic: simp only [mem_image, mem_univ, exists_prop_of_true] at ht₂
state_before: case intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
t : ℕ
ht : (image (fun v => G.degree v) univ).max = ↑t
ht₂ : ∃ a, True ∧ G.degree a = t
⊢ ∃ v, G.maxDegree = G.degree v
state_after: case intro.intro.intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
v : V
left✝ : True
ht : (image (fun v => G.degree v) univ).max = ↑(G.degree v)
⊢ ∃ v, G.maxDegree = G.degree v
tactic: rcases ht₂ with ⟨v, _, rfl⟩
state_before: case intro.intro.intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
v : V
left✝ : True
ht : (image (fun v => G.degree v) univ).max = ↑(G.degree v)
⊢ ∃ v, G.maxDegree = G.degree v
state_after: case intro.intro.intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
v : V
left✝ : True
ht : (image (fun v => G.degree v) univ).max = ↑(G.degree v)
⊢ G.maxDegree = G.degree v
tactic: refine ⟨v, ?_⟩
state_before: case intro.intro.intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
v : V
left✝ : True
ht : (image (fun v => G.degree v) univ).max = ↑(G.degree v)
⊢ G.maxDegree = G.degree v
state_after: case intro.intro.intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
v : V
left✝ : True
ht : (image (fun v => G.degree v) univ).max = ↑(G.degree v)
⊢ Option.getD (↑(G.degree v)) 0 = G.degree v
tactic: rw [maxDegree, ht]
state_before: case intro.intro.intro
V : Type u_1
G : SimpleGraph V
e : Sym2 V
inst✝² : Fintype V
inst✝¹ : DecidableRel G.Adj
inst✝ : Nonempty V
v : V
left✝ : True
ht : (image (fun v => G.degree v) univ).max = ↑(G.degree v)
⊢ Option.getD (↑(G.degree v)) 0 = G.degree v
state_after: no goals
tactic: rfl