Theorem: Metric.Sigma.dist_triangle
File: Mathlib/Topology/MetricSpace/Gluing.lean

tactic: rcases x with ⟨i, x⟩
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
x y z : (i : ι) × E i
⊢ dist x z ≤ dist x y + dist y z

tactic: rcases y with ⟨j, y⟩
state_before: case mk
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
y z : (i : ι) × E i
i : ι
x : E i
⊢ dist { fst := i, snd := x } z ≤ dist { fst := i, snd := x } y + dist y z

tactic: rcases z with ⟨k, z⟩
state_before: case mk.mk
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
z : (i : ι) × E i
i : ι
x : E i
j : ι
y : E j
⊢ dist { fst := i, snd := x } z ≤ dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } z

tactic: rcases eq_or_ne i k with (rfl | hik)
state_before: case mk.mk.mk
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
⊢ dist { fst := i, snd := x } { fst := k, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := k, snd := z }

tactic: rcases eq_or_ne i j with (rfl | hij)
state_before: case mk.mk.mk.inl
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
z : E i
⊢ dist { fst := i, snd := x } { fst := i, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := i, snd := z }

tactic: simpa using dist_triangle x y z
state_before: case mk.mk.mk.inl.inl
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x z y : E i
⊢ dist { fst := i, snd := x } { fst := i, snd := z } ≤
    dist { fst := i, snd := x } { fst := i, snd := y } + dist { fst := i, snd := y } { fst := i, snd := z }

tactic: simp only [Sigma.dist_same, Sigma.dist_ne hij, Sigma.dist_ne hij.symm]
state_before: case mk.mk.mk.inl.inr
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
z : E i
hij : i ≠ j
⊢ dist { fst := i, snd := x } { fst := i, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := i, snd := z }

tactic: calc
  dist x z ≤ dist x (Nonempty.some ⟨x⟩) + 0 + 0 + (0 + 0 + dist (Nonempty.some ⟨z⟩) z) := by
    simpa only [zero_add, add_zero] using dist_triangle _ _ _
  _ ≤ _ := by apply_rules [add_le_add, le_rfl, dist_nonneg, zero_le_one]
state_before: case mk.mk.mk.inl.inr
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
z : E i
hij : i ≠ j
⊢ dist x z ≤
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) y +
      (dist y (Nonempty.some (_ : Nonempty (E j))) + 1 + dist (Nonempty.some (_ : Nonempty (E i))) z)

tactic: simpa only [zero_add, add_zero] using dist_triangle _ _ _
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
z : E i
hij : i ≠ j
⊢ dist x z ≤ dist x (Nonempty.some (_ : Nonempty (E i))) + 0 + 0 + (0 + 0 + dist (Nonempty.some (_ : Nonempty (E i))) z)

tactic: apply_rules [add_le_add, le_rfl, dist_nonneg, zero_le_one]
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
z : E i
hij : i ≠ j
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 0 + 0 + (0 + 0 + dist (Nonempty.some (_ : Nonempty (E i))) z) ≤
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) y +
      (dist y (Nonempty.some (_ : Nonempty (E j))) + 1 + dist (Nonempty.some (_ : Nonempty (E i))) z)

tactic: rcases eq_or_ne i j with (rfl | hij)
state_before: case mk.mk.mk.inr
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
hik : i ≠ k
⊢ dist { fst := i, snd := x } { fst := k, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := k, snd := z }

tactic: simp only [Sigma.dist_ne hik, Sigma.dist_same]
state_before: case mk.mk.mk.inr.inl
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
k : ι
z : E k
hik : i ≠ k
y : E i
⊢ dist { fst := i, snd := x } { fst := k, snd := z } ≤
    dist { fst := i, snd := x } { fst := i, snd := y } + dist { fst := i, snd := y } { fst := k, snd := z }

tactic: calc
  dist x (Nonempty.some ⟨x⟩) + 1 + dist (Nonempty.some ⟨z⟩) z ≤
      dist x y + dist y (Nonempty.some ⟨y⟩) + 1 + dist (Nonempty.some ⟨z⟩) z :=
    by apply_rules [add_le_add, le_rfl, dist_triangle]
  _ = _ := by abel
state_before: case mk.mk.mk.inr.inl
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
k : ι
z : E k
hik : i ≠ k
y : E i
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z ≤
    dist x y + (dist y (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z)

tactic: apply_rules [add_le_add, le_rfl, dist_triangle]
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
k : ι
z : E k
hik : i ≠ k
y : E i
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z ≤
    dist x y + dist y (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z

tactic: abel
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
k : ι
z : E k
hik : i ≠ k
y : E i
⊢ dist x y + dist y (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z =
    dist x y + (dist y (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z)

tactic: rcases eq_or_ne j k with (rfl | hjk)
state_before: case mk.mk.mk.inr.inr
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
hik : i ≠ k
hij : i ≠ j
⊢ dist { fst := i, snd := x } { fst := k, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := k, snd := z }

tactic: simp only [Sigma.dist_ne hij, Sigma.dist_same]
state_before: case mk.mk.mk.inr.inr.inl
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
hij : i ≠ j
z : E j
hik : i ≠ j
⊢ dist { fst := i, snd := x } { fst := j, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := j, snd := z }

tactic: calc
  dist x (Nonempty.some ⟨x⟩) + 1 + dist (Nonempty.some ⟨z⟩) z ≤
      dist x (Nonempty.some ⟨x⟩) + 1 + (dist (Nonempty.some ⟨z⟩) y + dist y z) :=
    by apply_rules [add_le_add, le_rfl, dist_triangle]
  _ = _ := by abel
state_before: case mk.mk.mk.inr.inr.inl
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
hij : i ≠ j
z : E j
hik : i ≠ j
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) z ≤
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) y + dist y z

tactic: apply_rules [add_le_add, le_rfl, dist_triangle]
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
hij : i ≠ j
z : E j
hik : i ≠ j
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) z ≤
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + (dist (Nonempty.some (_ : Nonempty (E j))) y + dist y z)

tactic: abel
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
hij : i ≠ j
z : E j
hik : i ≠ j
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + (dist (Nonempty.some (_ : Nonempty (E j))) y + dist y z) =
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) y + dist y z

tactic: simp only [hik, hij, hjk, Sigma.dist_ne, Ne.def, not_false_iff]
state_before: case mk.mk.mk.inr.inr.inr
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
hik : i ≠ k
hij : i ≠ j
hjk : j ≠ k
⊢ dist { fst := i, snd := x } { fst := k, snd := z } ≤
    dist { fst := i, snd := x } { fst := j, snd := y } + dist { fst := j, snd := y } { fst := k, snd := z }

tactic: calc
  dist x (Nonempty.some ⟨x⟩) + 1 + dist (Nonempty.some ⟨z⟩) z =
      dist x (Nonempty.some ⟨x⟩) + 1 + 0 + (0 + 0 + dist (Nonempty.some ⟨z⟩) z) :=
    by simp only [add_zero, zero_add]
  _ ≤ _ := by apply_rules [add_le_add, zero_le_one, dist_nonneg, le_rfl]
state_before: case mk.mk.mk.inr.inr.inr
ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
hik : i ≠ k
hij : i ≠ j
hjk : j ≠ k
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z ≤
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) y +
      (dist y (Nonempty.some (_ : Nonempty (E j))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z)

tactic: simp only [add_zero, zero_add]
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
hik : i ≠ k
hij : i ≠ j
hjk : j ≠ k
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z =
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + 0 + (0 + 0 + dist (Nonempty.some (_ : Nonempty (E k))) z)

tactic: apply_rules [add_le_add, zero_le_one, dist_nonneg, le_rfl]
state_before: ι : Type u_1
E : ι → Type u_2
inst✝ : (i : ι) → MetricSpace (E i)
i : ι
x : E i
j : ι
y : E j
k : ι
z : E k
hik : i ≠ k
hij : i ≠ j
hjk : j ≠ k
⊢ dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + 0 + (0 + 0 + dist (Nonempty.some (_ : Nonempty (E k))) z) ≤
    dist x (Nonempty.some (_ : Nonempty (E i))) + 1 + dist (Nonempty.some (_ : Nonempty (E j))) y +
      (dist y (Nonempty.some (_ : Nonempty (E j))) + 1 + dist (Nonempty.some (_ : Nonempty (E k))) z)