Theorem: Vitali.exists_disjoint_subfamily_covering_enlargment_closedBall
File: Mathlib/MeasureTheory/Covering/Vitali.lean

tactic: rcases eq_empty_or_nonempty t with (rfl | _)
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: by_cases ht : ∀ a ∈ t, r a < 0
state_before: case inr
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: push_neg at ht
state_before: case neg
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ¬∀ (a : ι), a ∈ t → r a < 0
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: let t' := { a ∈ t | 0 ≤ r a }
state_before: case neg
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: rcases exists_disjoint_subfamily_covering_enlargment (fun a => closedBall (x a) (r a)) t' r 2
    one_lt_two (fun a ha => ha.2) R (fun a ha => hr a ha.1) fun a ha =>
    ⟨x a, mem_closedBall_self ha.2⟩ with
  ⟨u, ut', u_disj, hu⟩
state_before: case neg
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: have A : ∀ a ∈ t', ∃ b ∈ u, closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b) := by
  intro a ha
  rcases hu a ha with ⟨b, bu, hb, rb⟩
  refine' ⟨b, bu, _⟩
  have : dist (x a) (x b) ≤ r a + r b := dist_le_add_of_nonempty_closedBall_inter_closedBall hb
  apply closedBall_subset_closedBall'
  linarith
state_before: case neg.intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: refine' ⟨u, ut'.trans fun a ha => ha.1, u_disj, fun a ha => _⟩
state_before: case neg.intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: rcases le_or_lt 0 (r a) with (h'a | h'a)
state_before: case neg.intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
a : ι
ha : a ∈ t
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: exact ⟨∅, Subset.refl _, pairwiseDisjoint_empty, by simp⟩
state_before: case inl
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ ∅ → r a ≤ R
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ ∅ → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: simp
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ ∅ → r a ≤ R
⊢ ∀ (a : ι), a ∈ ∅ → ∃ b, b ∈ ∅ ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: exact ⟨t, Subset.rfl, fun a ha b _ _ => by
  simp only [Function.onFun, closedBall_eq_empty.2 (ht a ha), empty_disjoint],
  fun a ha => ⟨a, ha, by simp only [closedBall_eq_empty.2 (ht a ha), empty_subset]⟩⟩
state_before: case pos
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∀ (a : ι), a ∈ t → r a < 0
⊢ ∃ u x_1,
    (PairwiseDisjoint u fun a => closedBall (x a) (r a)) ∧
      ∀ (a : ι), a ∈ t → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: simp only [Function.onFun, closedBall_eq_empty.2 (ht a ha), empty_disjoint]
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∀ (a : ι), a ∈ t → r a < 0
a : ι
ha : a ∈ t
b : ι
x✝¹ : b ∈ t
x✝ : a ≠ b
⊢ (Disjoint on fun a => closedBall (x a) (r a)) a b

tactic: simp only [closedBall_eq_empty.2 (ht a ha), empty_subset]
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∀ (a : ι), a ∈ t → r a < 0
a : ι
ha : a ∈ t
⊢ closedBall (x a) (r a) ⊆ closedBall (x a) (5 * r a)

tactic: intro a ha
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
⊢ ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: rcases hu a ha with ⟨b, bu, hb, rb⟩
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
a : ι
ha : a ∈ t'
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: refine' ⟨b, bu, _⟩
state_before: case intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
a : ι
ha : a ∈ t'
b : ι
bu : b ∈ u
hb : Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b))
rb : r a ≤ 2 * r b
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: have : dist (x a) (x b) ≤ r a + r b := dist_le_add_of_nonempty_closedBall_inter_closedBall hb
state_before: case intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
a : ι
ha : a ∈ t'
b : ι
bu : b ∈ u
hb : Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b))
rb : r a ≤ 2 * r b
⊢ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: apply closedBall_subset_closedBall'
state_before: case intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
a : ι
ha : a ∈ t'
b : ι
bu : b ∈ u
hb : Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b))
rb : r a ≤ 2 * r b
this : dist (x a) (x b) ≤ r a + r b
⊢ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: linarith
state_before: case intro.intro.intro.h
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
a : ι
ha : a ∈ t'
b : ι
bu : b ∈ u
hb : Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b))
rb : r a ≤ 2 * r b
this : dist (x a) (x b) ≤ r a + r b
⊢ r a + dist (x a) (x b) ≤ 5 * r b

tactic: exact A a ⟨ha, h'a⟩
state_before: case neg.intro.intro.intro.inl
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
a : ι
ha : a ∈ t
h'a : 0 ≤ r a
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: rcases ht with ⟨b, rb⟩
state_before: case neg.intro.intro.intro.inr
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
ht : ∃ a, a ∈ t ∧ 0 ≤ r a
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
a : ι
ha : a ∈ t
h'a : r a < 0
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: rcases A b ⟨rb.1, rb.2⟩ with ⟨c, cu, _⟩
state_before: case neg.intro.intro.intro.inr.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
a : ι
ha : a ∈ t
h'a : r a < 0
b : ι
rb : b ∈ t ∧ 0 ≤ r b
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: refine' ⟨c, cu, by simp only [closedBall_eq_empty.2 h'a, empty_subset]⟩
state_before: case neg.intro.intro.intro.inr.intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
a : ι
ha : a ∈ t
h'a : r a < 0
b : ι
rb : b ∈ t ∧ 0 ≤ r b
c : ι
cu : c ∈ u
right✝ : closedBall (x b) (r b) ⊆ closedBall (x c) (5 * r c)
⊢ ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)

tactic: simp only [closedBall_eq_empty.2 h'a, empty_subset]
state_before: α : Type u_1
ι : Type u_2
inst✝ : MetricSpace α
t : Set ι
x : ι → α
r : ι → ℝ
R : ℝ
hr : ∀ (a : ι), a ∈ t → r a ≤ R
h✝ : Set.Nonempty t
t' : Set ι := {a | a ∈ t ∧ 0 ≤ r a}
u : Set ι
ut' : u ⊆ t'
u_disj : PairwiseDisjoint u fun a => closedBall (x a) (r a)
hu : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ Set.Nonempty (closedBall (x a) (r a) ∩ closedBall (x b) (r b)) ∧ r a ≤ 2 * r b
A : ∀ (a : ι), a ∈ t' → ∃ b, b ∈ u ∧ closedBall (x a) (r a) ⊆ closedBall (x b) (5 * r b)
a : ι
ha : a ∈ t
h'a : r a < 0
b : ι
rb : b ∈ t ∧ 0 ≤ r b
c : ι
cu : c ∈ u
right✝ : closedBall (x b) (r b) ⊆ closedBall (x c) (5 * r c)
⊢ closedBall (x a) (r a) ⊆ closedBall (x c) (5 * r c)