l3lab/ntp-mathlib huggingface dataset:
/-- Given a signed measure `s` and a positive measurable set `i`, `toMeasureOfZeroLE`
provides the measure, mapping measurable sets `j` to `s (i ∩ j)`. -/
def toMeasureOfZeroLE (s : SignedMeasure α) (i : Set α) (hi₁ : MeasurableSet i) (hi₂ : 0 ≤[i] s) :
    Measure α := by
  refine' Measure.ofMeasurable (s.toMeasureOfZeroLE' i hi₂) _ _
  · simp_rw [toMeasureOfZeroLE', s.restrict_apply hi₁ MeasurableSet.empty, Set.empty_inter i,
      s.empty]
    rfl
  · intro f hf₁ hf₂
    have h₁ : ∀ n, MeasurableSet (i ∩ f n) := fun n => hi₁.inter (hf₁ n)
    have h₂ : Pairwise (Disjoint on fun n : ℕ => i ∩ f n) := by
      intro n m hnm
      exact ((hf₂ hnm).inf_left' i).inf_right' i
    simp only [toMeasureOfZeroLE', s.restrict_apply hi₁ (MeasurableSet.iUnion hf₁), Set.inter_comm,
      Set.inter_iUnion, s.of_disjoint_iUnion_nat h₁ h₂, ENNReal.some_eq_coe, id.def]
    have h : ∀ n, 0 ≤ s (i ∩ f n) := fun n =>
      s.nonneg_of_zero_le_restrict (s.zero_le_restrict_subset hi₁ (Set.inter_subset_left _ _) hi₂)
    rw [NNReal.coe_tsum_of_nonneg h, ENNReal.coe_tsum]
    · refine' tsum_congr fun n => _
      

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i : Set α
hi₁ : MeasurableSet i
hi₂ : VectorMeasure.restrict 0 i ≤ VectorMeasure.restrict s i
f : ℕ → Set α
hf₁ : ∀ (i : ℕ), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
h₁ : ∀ (n : ℕ), MeasurableSet (i ∩ f n)
h₂ : Pairwise (Disjoint on fun n => i ∩ f n)
h : ∀ (n : ℕ), 0 ≤ ↑s (i ∩ f n)
n : ℕ
⊢ ↑{ val := ↑s (i ∩ f n), property := (_ : 0 ≤ ↑s (i ∩ f n)) } =
    ↑{ val := ↑(VectorMeasure.restrict s i) (f n), property := (_ : 0 ≤ ↑(VectorMeasure.restrict s i) (f n)) }

Next tactic:
simp_rw [s.restrict_apply hi₁ (hf₁ n), Set.inter_comm]
/-- Given a signed measure `s` and a positive measurable set `i`, `toMeasureOfZeroLE`
provides the measure, mapping measurable sets `j` to `s (i ∩ j)`. -/
def toMeasureOfZeroLE (s : SignedMeasure α) (i : Set α) (hi₁ : MeasurableSet i) (hi₂ : 0 ≤[i] s) :
    Measure α := by
  refine' Measure.ofMeasurable (s.toMeasureOfZeroLE' i hi₂) _ _
  · simp_rw [toMeasureOfZeroLE', s.restrict_apply hi₁ MeasurableSet.empty, Set.empty_inter i,
      s.empty]
    rfl
  · intro f hf₁ hf₂
    have h₁ : ∀ n, MeasurableSet (i ∩ f n) := fun n => hi₁.inter (hf₁ n)
    have h₂ : Pairwise (Disjoint on fun n : ℕ => i ∩ f n) := by
      intro n m hnm
      exact ((hf₂ hnm).inf_left' i).inf_right' i
    simp only [toMeasureOfZeroLE', s.restrict_apply hi₁ (MeasurableSet.iUnion hf₁), Set.inter_comm,
      Set.inter_iUnion, s.of_disjoint_iUnion_nat h₁ h₂, ENNReal.some_eq_coe, id.def]
    have h : ∀ n, 0 ≤ s (i ∩ f n) := fun n =>
      s.nonneg_of_zero_le_restrict (s.zero_le_restrict_subset hi₁ (Set.inter_subset_left _ _) hi₂)
    rw [NNReal.coe_tsum_of_nonneg h, ENNReal.coe_tsum]
    · refine' tsum_congr fun n => _
      simp_rw [s.restrict_apply hi₁ (hf₁ n), Set.inter_comm]
    · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i : Set α
hi₁ : MeasurableSet i
hi₂ : VectorMeasure.restrict 0 i ≤ VectorMeasure.restrict s i
f : ℕ → Set α
hf₁ : ∀ (i : ℕ), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
h₁ : ∀ (n : ℕ), MeasurableSet (i ∩ f n)
h₂ : Pairwise (Disjoint on fun n => i ∩ f n)
h : ∀ (n : ℕ), 0 ≤ ↑s (i ∩ f n)
⊢ Summable fun n => { val := ↑s (i ∩ f n), property := (_ : 0 ≤ ↑s (i ∩ f n)) }

Next tactic:
exact (NNReal.summable_mk h).2 (s.m_iUnion h₁ h₂).summable
theorem toMeasureOfZeroLE_apply (hi : 0 ≤[i] s) (hi₁ : MeasurableSet i) (hj₁ : MeasurableSet j) :
    s.toMeasureOfZeroLE i hi₁ hi j = ((↑) : ℝ≥0 → ℝ≥0∞) ⟨s (i ∩ j), nonneg_of_zero_le_restrict
      s (zero_le_restrict_subset s hi₁ (Set.inter_subset_left _ _) hi)⟩ := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict 0 i ≤ VectorMeasure.restrict s i
hi₁ : MeasurableSet i
hj₁ : MeasurableSet j
⊢ ↑↑(toMeasureOfZeroLE s i hi₁ hi) j = ↑{ val := ↑s (i ∩ j), property := (_ : 0 ≤ ↑s (i ∩ j)) }

Next tactic:
simp_rw [toMeasureOfZeroLE, Measure.ofMeasurable_apply _ hj₁, toMeasureOfZeroLE',
    s.restrict_apply hi₁ hj₁, Set.inter_comm]
theorem toMeasureOfLEZero_apply (hi : s ≤[i] 0) (hi₁ : MeasurableSet i) (hj₁ : MeasurableSet j) :
    s.toMeasureOfLEZero i hi₁ hi j = ((↑) : ℝ≥0 → ℝ≥0∞) ⟨-s (i ∩ j), neg_apply s (i ∩ j) ▸
      nonneg_of_zero_le_restrict _ (zero_le_restrict_subset _ hi₁ (Set.inter_subset_left _ _)
      (@neg_zero (VectorMeasure α ℝ) _ ▸ neg_le_neg _ _ hi₁ hi))⟩ := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict s i ≤ VectorMeasure.restrict 0 i
hi₁ : MeasurableSet i
hj₁ : MeasurableSet j
⊢ ↑↑(toMeasureOfLEZero s i hi₁ hi) j = ↑{ val := -↑s (i ∩ j), property := (_ : 0 ≤ -↑s (i ∩ j)) }

Next tactic:
erw [toMeasureOfZeroLE_apply]
theorem toMeasureOfLEZero_apply (hi : s ≤[i] 0) (hi₁ : MeasurableSet i) (hj₁ : MeasurableSet j) :
    s.toMeasureOfLEZero i hi₁ hi j = ((↑) : ℝ≥0 → ℝ≥0∞) ⟨-s (i ∩ j), neg_apply s (i ∩ j) ▸
      nonneg_of_zero_le_restrict _ (zero_le_restrict_subset _ hi₁ (Set.inter_subset_left _ _)
      (@neg_zero (VectorMeasure α ℝ) _ ▸ neg_le_neg _ _ hi₁ hi))⟩ := by
  erw [toMeasureOfZeroLE_apply]
  · 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict s i ≤ VectorMeasure.restrict 0 i
hi₁ : MeasurableSet i
hj₁ : MeasurableSet j
⊢ ↑{ val := ↑(-s) (i ∩ j), property := (_ : 0 ≤ ↑(-s) (i ∩ j)) } =
    ↑{ val := -↑s (i ∩ j), property := (_ : 0 ≤ -↑s (i ∩ j)) }

Next tactic:
simp
theorem toMeasureOfLEZero_apply (hi : s ≤[i] 0) (hi₁ : MeasurableSet i) (hj₁ : MeasurableSet j) :
    s.toMeasureOfLEZero i hi₁ hi j = ((↑) : ℝ≥0 → ℝ≥0∞) ⟨-s (i ∩ j), neg_apply s (i ∩ j) ▸
      nonneg_of_zero_le_restrict _ (zero_le_restrict_subset _ hi₁ (Set.inter_subset_left _ _)
      (@neg_zero (VectorMeasure α ℝ) _ ▸ neg_le_neg _ _ hi₁ hi))⟩ := by
  erw [toMeasureOfZeroLE_apply]
  · simp
  · 

Proof state:
case hj₁
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict s i ≤ VectorMeasure.restrict 0 i
hi₁ : MeasurableSet i
hj₁ : MeasurableSet j
⊢ MeasurableSet j

Next tactic:
assumption
/-- `SignedMeasure.toMeasureOfZeroLE` is a finite measure. -/
instance toMeasureOfZeroLE_finite (hi : 0 ≤[i] s) (hi₁ : MeasurableSet i) :
    IsFiniteMeasure (s.toMeasureOfZeroLE i hi₁ hi) where
  measure_univ_lt_top := by
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict 0 i ≤ VectorMeasure.restrict s i
hi₁ : MeasurableSet i
⊢ ↑↑(toMeasureOfZeroLE s i hi₁ hi) univ < ⊤

Next tactic:
rw [toMeasureOfZeroLE_apply s hi hi₁ MeasurableSet.univ]
/-- `SignedMeasure.toMeasureOfZeroLE` is a finite measure. -/
instance toMeasureOfZeroLE_finite (hi : 0 ≤[i] s) (hi₁ : MeasurableSet i) :
    IsFiniteMeasure (s.toMeasureOfZeroLE i hi₁ hi) where
  measure_univ_lt_top := by
    rw [toMeasureOfZeroLE_apply s hi hi₁ MeasurableSet.univ]
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict 0 i ≤ VectorMeasure.restrict s i
hi₁ : MeasurableSet i
⊢ ↑{ val := ↑s (i ∩ univ), property := (_ : 0 ≤ ↑s (i ∩ univ)) } < ⊤

Next tactic:
exact ENNReal.coe_lt_top
/-- `SignedMeasure.toMeasureOfLEZero` is a finite measure. -/
instance toMeasureOfLEZero_finite (hi : s ≤[i] 0) (hi₁ : MeasurableSet i) :
    IsFiniteMeasure (s.toMeasureOfLEZero i hi₁ hi) where
  measure_univ_lt_top := by
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict s i ≤ VectorMeasure.restrict 0 i
hi₁ : MeasurableSet i
⊢ ↑↑(toMeasureOfLEZero s i hi₁ hi) univ < ⊤

Next tactic:
rw [toMeasureOfLEZero_apply s hi hi₁ MeasurableSet.univ]
/-- `SignedMeasure.toMeasureOfLEZero` is a finite measure. -/
instance toMeasureOfLEZero_finite (hi : s ≤[i] 0) (hi₁ : MeasurableSet i) :
    IsFiniteMeasure (s.toMeasureOfLEZero i hi₁ hi) where
  measure_univ_lt_top := by
    rw [toMeasureOfLEZero_apply s hi hi₁ MeasurableSet.univ]
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hi : VectorMeasure.restrict s i ≤ VectorMeasure.restrict 0 i
hi₁ : MeasurableSet i
⊢ ↑{ val := -↑s (i ∩ univ), property := (_ : 0 ≤ -↑s (i ∩ univ)) } < ⊤

Next tactic:
exact ENNReal.coe_lt_top
theorem toMeasureOfZeroLE_toSignedMeasure (hs : 0 ≤[Set.univ] s) :
    (s.toMeasureOfZeroLE Set.univ MeasurableSet.univ hs).toSignedMeasure = s := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hs : VectorMeasure.restrict 0 univ ≤ VectorMeasure.restrict s univ
⊢ Measure.toSignedMeasure (toMeasureOfZeroLE s univ (_ : MeasurableSet univ) hs) = s

Next tactic:
ext i hi
theorem toMeasureOfZeroLE_toSignedMeasure (hs : 0 ≤[Set.univ] s) :
    (s.toMeasureOfZeroLE Set.univ MeasurableSet.univ hs).toSignedMeasure = s := by
  ext i hi
  

Proof state:
case h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i✝ j : Set α
hs : VectorMeasure.restrict 0 univ ≤ VectorMeasure.restrict s univ
i : Set α
hi : MeasurableSet i
⊢ ↑(Measure.toSignedMeasure (toMeasureOfZeroLE s univ (_ : MeasurableSet univ) hs)) i = ↑s i

Next tactic:
simp [hi, toMeasureOfZeroLE_apply _ _ _ hi]
theorem toMeasureOfLEZero_toSignedMeasure (hs : s ≤[Set.univ] 0) :
    (s.toMeasureOfLEZero Set.univ MeasurableSet.univ hs).toSignedMeasure = -s := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i j : Set α
hs : VectorMeasure.restrict s univ ≤ VectorMeasure.restrict 0 univ
⊢ Measure.toSignedMeasure (toMeasureOfLEZero s univ (_ : MeasurableSet univ) hs) = -s

Next tactic:
ext i hi
theorem toMeasureOfLEZero_toSignedMeasure (hs : s ≤[Set.univ] 0) :
    (s.toMeasureOfLEZero Set.univ MeasurableSet.univ hs).toSignedMeasure = -s := by
  ext i hi
  

Proof state:
case h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
s : SignedMeasure α
i✝ j : Set α
hs : VectorMeasure.restrict s univ ≤ VectorMeasure.restrict 0 univ
i : Set α
hi : MeasurableSet i
⊢ ↑(Measure.toSignedMeasure (toMeasureOfLEZero s univ (_ : MeasurableSet univ) hs)) i = ↑(-s) i

Next tactic:
simp [hi, toMeasureOfLEZero_apply _ _ _ hi]
theorem zero_le_toSignedMeasure : 0 ≤ μ.toSignedMeasure := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
⊢ 0 ≤ toSignedMeasure μ

Next tactic:
rw [← le_restrict_univ_iff_le]
theorem zero_le_toSignedMeasure : 0 ≤ μ.toSignedMeasure := by
  rw [← le_restrict_univ_iff_le]
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
⊢ VectorMeasure.restrict 0 univ ≤ VectorMeasure.restrict (toSignedMeasure μ) univ

Next tactic:
refine' restrict_le_restrict_of_subset_le _ _ fun j hj₁ _ => _
theorem zero_le_toSignedMeasure : 0 ≤ μ.toSignedMeasure := by
  rw [← le_restrict_univ_iff_le]
  refine' restrict_le_restrict_of_subset_le _ _ fun j hj₁ _ => _
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
j : Set α
hj₁ : MeasurableSet j
x✝ : j ⊆ univ
⊢ ↑0 j ≤ ↑(toSignedMeasure μ) j

Next tactic:
simp only [Measure.toSignedMeasure_apply_measurable hj₁, coe_zero, Pi.zero_apply,
    ENNReal.toReal_nonneg, VectorMeasure.coe_zero]
theorem toSignedMeasure_toMeasureOfZeroLE :
    μ.toSignedMeasure.toMeasureOfZeroLE Set.univ MeasurableSet.univ
      ((le_restrict_univ_iff_le _ _).2 (zero_le_toSignedMeasure μ)) = μ := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
⊢ SignedMeasure.toMeasureOfZeroLE (toSignedMeasure μ) univ (_ : MeasurableSet univ)
      (_ : VectorMeasure.restrict 0 univ ≤ VectorMeasure.restrict (toSignedMeasure μ) univ) =
    μ

Next tactic:
refine' Measure.ext fun i hi => _
theorem toSignedMeasure_toMeasureOfZeroLE :
    μ.toSignedMeasure.toMeasureOfZeroLE Set.univ MeasurableSet.univ
      ((le_restrict_univ_iff_le _ _).2 (zero_le_toSignedMeasure μ)) = μ := by
  refine' Measure.ext fun i hi => _
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
i : Set α
hi : MeasurableSet i
⊢ ↑↑(SignedMeasure.toMeasureOfZeroLE (toSignedMeasure μ) univ (_ : MeasurableSet univ)
            (_ : VectorMeasure.restrict 0 univ ≤ VectorMeasure.restrict (toSignedMeasure μ) univ))
      i =
    ↑↑μ i

Next tactic:
lift μ i to ℝ≥0 using (measure_lt_top _ _).ne with m hm
theorem toSignedMeasure_toMeasureOfZeroLE :
    μ.toSignedMeasure.toMeasureOfZeroLE Set.univ MeasurableSet.univ
      ((le_restrict_univ_iff_le _ _).2 (zero_le_toSignedMeasure μ)) = μ := by
  refine' Measure.ext fun i hi => _
  lift μ i to ℝ≥0 using (measure_lt_top _ _).ne with m hm
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m✝ : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
i : Set α
hi : MeasurableSet i
m : ℝ≥0
hm : ↑m = ↑↑μ i
⊢ ↑↑(SignedMeasure.toMeasureOfZeroLE (toSignedMeasure μ) univ (_ : MeasurableSet univ)
            (_ : VectorMeasure.restrict 0 univ ≤ VectorMeasure.restrict (toSignedMeasure μ) univ))
      i =
    ↑m

Next tactic:
rw [SignedMeasure.toMeasureOfZeroLE_apply _ _ _ hi, coe_eq_coe]
theorem toSignedMeasure_toMeasureOfZeroLE :
    μ.toSignedMeasure.toMeasureOfZeroLE Set.univ MeasurableSet.univ
      ((le_restrict_univ_iff_le _ _).2 (zero_le_toSignedMeasure μ)) = μ := by
  refine' Measure.ext fun i hi => _
  lift μ i to ℝ≥0 using (measure_lt_top _ _).ne with m hm
  rw [SignedMeasure.toMeasureOfZeroLE_apply _ _ _ hi, coe_eq_coe]
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m✝ : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
i : Set α
hi : MeasurableSet i
m : ℝ≥0
hm : ↑m = ↑↑μ i
⊢ { val := ↑(toSignedMeasure μ) (univ ∩ i), property := (_ : 0 ≤ ↑(toSignedMeasure μ) (univ ∩ i)) } = m

Next tactic:
congr
theorem toSignedMeasure_toMeasureOfZeroLE :
    μ.toSignedMeasure.toMeasureOfZeroLE Set.univ MeasurableSet.univ
      ((le_restrict_univ_iff_le _ _).2 (zero_le_toSignedMeasure μ)) = μ := by
  refine' Measure.ext fun i hi => _
  lift μ i to ℝ≥0 using (measure_lt_top _ _).ne with m hm
  rw [SignedMeasure.toMeasureOfZeroLE_apply _ _ _ hi, coe_eq_coe]
  congr
  

Proof state:
case intro.e_val
α : Type u_1
β : Type u_2
m✝ : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
i : Set α
hi : MeasurableSet i
m : ℝ≥0
hm : ↑m = ↑↑μ i
⊢ ↑(toSignedMeasure μ) (univ ∩ i) = ↑m

Next tactic:
simp [hi, ← hm]
theorem eq_of_add [AddGroup α] (p : (a:α) = b) (H : (a' - b') - (a - b) = 0) : a' = b' := by
  

Proof state:
α : Type u_1
a b a' b' : α
inst✝ : AddGroup α
p : a = b
H : a' - b' - (a - b) = 0
⊢ a' = b'

Next tactic:
rw [← sub_eq_zero] at p ⊢
theorem eq_of_add [AddGroup α] (p : (a:α) = b) (H : (a' - b') - (a - b) = 0) : a' = b' := by
  rw [← sub_eq_zero] at p ⊢; 

Proof state:
α : Type u_1
a b a' b' : α
inst✝ : AddGroup α
p : a - b = 0
H : a' - b' - (a - b) = 0
⊢ a' - b' = 0

Next tactic:
rwa [sub_eq_zero, p] at H
theorem eq_of_add_pow [Ring α] [NoZeroDivisors α] (n : ℕ) (p : (a:α) = b)
    (H : (a' - b')^n - (a - b) = 0) : a' = b' := by
  

Proof state:
α : Type u_1
a b a' b' : α
inst✝¹ : Ring α
inst✝ : NoZeroDivisors α
n : ℕ
p : a = b
H : (a' - b') ^ n - (a - b) = 0
⊢ a' = b'

Next tactic:
rw [← sub_eq_zero] at p ⊢
theorem eq_of_add_pow [Ring α] [NoZeroDivisors α] (n : ℕ) (p : (a:α) = b)
    (H : (a' - b')^n - (a - b) = 0) : a' = b' := by
  rw [← sub_eq_zero] at p ⊢; 

Proof state:
α : Type u_1
a b a' b' : α
inst✝¹ : Ring α
inst✝ : NoZeroDivisors α
n : ℕ
p : a - b = 0
H : (a' - b') ^ n - (a - b) = 0
⊢ a' - b' = 0

Next tactic:
apply pow_eq_zero (n := n)
theorem eq_of_add_pow [Ring α] [NoZeroDivisors α] (n : ℕ) (p : (a:α) = b)
    (H : (a' - b')^n - (a - b) = 0) : a' = b' := by
  rw [← sub_eq_zero] at p ⊢; apply pow_eq_zero (n := n); 

Proof state:
α : Type u_1
a b a' b' : α
inst✝¹ : Ring α
inst✝ : NoZeroDivisors α
n : ℕ
p : a - b = 0
H : (a' - b') ^ n - (a - b) = 0
⊢ (a' - b') ^ n = 0

Next tactic:
rwa [sub_eq_zero, p] at H
theorem mono_iff_ker_eq_bot : Mono f ↔ LinearMap.ker f = ⊥ :=
  ⟨fun hf => ker_eq_bot_of_mono _, fun hf =>
    ConcreteCategory.mono_of_injective _ <| by 

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
hf : LinearMap.ker f = ⊥
⊢ Function.Injective ⇑f

Next tactic:
convert LinearMap.ker_eq_bot.1 hf
theorem mono_iff_injective : Mono f ↔ Function.Injective f := by
  

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
⊢ Mono f ↔ Function.Injective ⇑f

Next tactic:
rw [mono_iff_ker_eq_bot, LinearMap.ker_eq_bot]
theorem epi_iff_surjective : Epi f ↔ Function.Surjective f := by
  

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
⊢ Epi f ↔ Function.Surjective ⇑f

Next tactic:
rw [epi_iff_range_eq_top, LinearMap.range_eq_top]
instance forget_preservesEpimorphisms : (forget (ModuleCat.{v} R)).PreservesEpimorphisms where
    preserves f hf := by
      

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f✝ : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
X✝ Y✝ : ModuleCat R
f : X✝ ⟶ Y✝
hf : Epi f
⊢ Epi ((forget (ModuleCat R)).map f)

Next tactic:
erw [CategoryTheory.epi_iff_surjective, ← epi_iff_surjective]
instance forget_preservesEpimorphisms : (forget (ModuleCat.{v} R)).PreservesEpimorphisms where
    preserves f hf := by
      erw [CategoryTheory.epi_iff_surjective, ← epi_iff_surjective]
      

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f✝ : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
X✝ Y✝ : ModuleCat R
f : X✝ ⟶ Y✝
hf : Epi f
⊢ Epi f

Next tactic:
exact hf
instance forget_preservesMonomorphisms : (forget (ModuleCat.{v} R)).PreservesMonomorphisms where
    preserves f hf := by
      

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f✝ : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
X✝ Y✝ : ModuleCat R
f : X✝ ⟶ Y✝
hf : Mono f
⊢ Mono ((forget (ModuleCat R)).map f)

Next tactic:
erw [CategoryTheory.mono_iff_injective, ← mono_iff_injective]
instance forget_preservesMonomorphisms : (forget (ModuleCat.{v} R)).PreservesMonomorphisms where
    preserves f hf := by
      erw [CategoryTheory.mono_iff_injective, ← mono_iff_injective]
      

Proof state:
R : Type u
inst✝² : Ring R
X Y : ModuleCat R
f✝ : X ⟶ Y
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
X✝ Y✝ : ModuleCat R
f : X✝ ⟶ Y✝
hf : Mono f
⊢ Mono f

Next tactic:
exact hf
theorem mem_tangentConeAt_of_pow_smul {r : 𝕜} (hr₀ : r ≠ 0) (hr : ‖r‖ < 1)
    (hs : ∀ᶠ n : ℕ in atTop, x + r ^ n • y ∈ s) : y ∈ tangentConeAt 𝕜 s x := by
  

Proof state:
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y : E
s t : Set E
r : 𝕜
hr₀ : r ≠ 0
hr : ‖r‖ < 1
hs : ∀ᶠ (n : ℕ) in atTop, x + r ^ n • y ∈ s
⊢ y ∈ tangentConeAt 𝕜 s x

Next tactic:
refine ⟨fun n ↦ (r ^ n)⁻¹, fun n ↦ r ^ n • y, hs, ?_, ?_⟩
theorem mem_tangentConeAt_of_pow_smul {r : 𝕜} (hr₀ : r ≠ 0) (hr : ‖r‖ < 1)
    (hs : ∀ᶠ n : ℕ in atTop, x + r ^ n • y ∈ s) : y ∈ tangentConeAt 𝕜 s x := by
  refine ⟨fun n ↦ (r ^ n)⁻¹, fun n ↦ r ^ n • y, hs, ?_, ?_⟩
  · 

Proof state:
case refine_1
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y : E
s t : Set E
r : 𝕜
hr₀ : r ≠ 0
hr : ‖r‖ < 1
hs : ∀ᶠ (n : ℕ) in atTop, x + r ^ n • y ∈ s
⊢ Tendsto (fun n => ‖(fun n => (r ^ n)⁻¹) n‖) atTop atTop

Next tactic:
simp only [norm_inv, norm_pow, ← inv_pow]
theorem mem_tangentConeAt_of_pow_smul {r : 𝕜} (hr₀ : r ≠ 0) (hr : ‖r‖ < 1)
    (hs : ∀ᶠ n : ℕ in atTop, x + r ^ n • y ∈ s) : y ∈ tangentConeAt 𝕜 s x := by
  refine ⟨fun n ↦ (r ^ n)⁻¹, fun n ↦ r ^ n • y, hs, ?_, ?_⟩
  · simp only [norm_inv, norm_pow, ← inv_pow]
    

Proof state:
case refine_1
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y : E
s t : Set E
r : 𝕜
hr₀ : r ≠ 0
hr : ‖r‖ < 1
hs : ∀ᶠ (n : ℕ) in atTop, x + r ^ n • y ∈ s
⊢ Tendsto (fun n => ‖r‖⁻¹ ^ n) atTop atTop

Next tactic:
exact tendsto_pow_atTop_atTop_of_one_lt <| one_lt_inv (norm_pos_iff.2 hr₀) hr
theorem mem_tangentConeAt_of_pow_smul {r : 𝕜} (hr₀ : r ≠ 0) (hr : ‖r‖ < 1)
    (hs : ∀ᶠ n : ℕ in atTop, x + r ^ n • y ∈ s) : y ∈ tangentConeAt 𝕜 s x := by
  refine ⟨fun n ↦ (r ^ n)⁻¹, fun n ↦ r ^ n • y, hs, ?_, ?_⟩
  · simp only [norm_inv, norm_pow, ← inv_pow]
    exact tendsto_pow_atTop_atTop_of_one_lt <| one_lt_inv (norm_pos_iff.2 hr₀) hr
  · 

Proof state:
case refine_2
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y : E
s t : Set E
r : 𝕜
hr₀ : r ≠ 0
hr : ‖r‖ < 1
hs : ∀ᶠ (n : ℕ) in atTop, x + r ^ n • y ∈ s
⊢ Tendsto (fun n => (fun n => (r ^ n)⁻¹) n • (fun n => r ^ n • y) n) atTop (𝓝 y)

Next tactic:
simp only [inv_smul_smul₀ (pow_ne_zero _ hr₀), tendsto_const_nhds]
theorem tangentCone_mono (h : s ⊆ t) : tangentConeAt 𝕜 s x ⊆ tangentConeAt 𝕜 t x := by
  

Proof state:
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y : E
s t : Set E
h : s ⊆ t
⊢ tangentConeAt 𝕜 s x ⊆ tangentConeAt 𝕜 t x

Next tactic:
rintro y ⟨c, d, ds, ctop, clim⟩
theorem tangentCone_mono (h : s ⊆ t) : tangentConeAt 𝕜 s x ⊆ tangentConeAt 𝕜 t x := by
  rintro y ⟨c, d, ds, ctop, clim⟩
  

Proof state:
case intro.intro.intro.intro
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y✝ : E
s t : Set E
h : s ⊆ t
y : E
c : ℕ → 𝕜
d : ℕ → E
ds : ∀ᶠ (n : ℕ) in atTop, x + d n ∈ s
ctop : Tendsto (fun n => ‖c n‖) atTop atTop
clim : Tendsto (fun n => c n • d n) atTop (𝓝 y)
⊢ y ∈ tangentConeAt 𝕜 t x

Next tactic:
exact ⟨c, d, mem_of_superset ds fun n hn => h hn, ctop, clim⟩
/-- Auxiliary lemma ensuring that, under the assumptions defining the tangent cone,
the sequence `d` tends to 0 at infinity. -/
theorem tangentConeAt.lim_zero {α : Type*} (l : Filter α) {c : α → 𝕜} {d : α → E}
    (hc : Tendsto (fun n => ‖c n‖) l atTop) (hd : Tendsto (fun n => c n • d n) l (𝓝 y)) :
    Tendsto d l (𝓝 0) := by
  

Proof state:
𝕜 : Type u_1
inst✝⁶ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
F : Type u_3
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
G : Type u_4
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
x y : E
s t : Set E
α : Type u_5
l : Filter α
c : α → 𝕜
d : α → E
hc : Tendsto (fun n => ‖c n‖) l atTop
hd : Tendsto (fun n => c n • d n) l (𝓝 y)
⊢ Tendsto d l (𝓝 0)

Next tactic:
have A : Tendsto (fun n => ‖c n‖⁻¹) l (𝓝 0) := tendsto_inv_atTop_zero.comp hc