l3lab/ntp-mathlib huggingface dataset:
theorem StableUnderBaseChange.mk (h₁ : RespectsIso @P)
    (h₂ :
      ∀ ⦃R S T⦄ [CommRing R] [CommRing S] [CommRing T],
        ∀ [Algebra R S] [Algebra R T],
          P (algebraMap R T) →
            P (Algebra.TensorProduct.includeLeftRingHom : S →+* TensorProduct R S T)) :
    StableUnderBaseChange @P := by
  introv R h H
  let e := h.symm.1.equiv
  let f' :=
    Algebra.TensorProduct.productMap (IsScalarTower.toAlgHom R R' S')
      (IsScalarTower.toAlgHom R S S')
  have : ∀ x, e x = f' x := by
    intro x
    change e.toLinearMap.restrictScalars R x = f'.toLinearMap x
    congr 1
    apply TensorProduct.ext'
    intro x y
    simp [IsBaseChange.equiv_tmul, Algebra.smul_def]
  -- Porting Note: This had a lot of implicit inferences which didn't resolve anymore.
  -- Added those in
  convert h₁.1 (_ : R' →+* TensorProduct R R' S) (_ : TensorProduct R R' S ≃+* S')
      (h₂ H : P (_ : R' →+* TensorProduct R R' S))
  swap
  · refine' { e with map_mul' := fun x y => _ }
    change e (x * y) = e x * e y
    simp_rw [this]
    exact map_mul f' _ _
  · 

Proof state:
case h.e'_5
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
h₁ : RespectsIso P
h₂ :
  ∀ ⦃R S T : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] [inst_3 : Algebra R S]
    [inst_4 : Algebra R T], P (algebraMap R T) → P Algebra.TensorProduct.includeLeftRingHom
R S R' S' : Type u
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing S
inst✝⁸ : CommRing R'
inst✝⁷ : CommRing S'
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra R R'
inst✝⁴ : Algebra R S'
inst✝³ : Algebra S S'
inst✝² : Algebra R' S'
inst✝¹ : IsScalarTower R S S'
inst✝ : IsScalarTower R R' S'
h : Algebra.IsPushout R S R' S'
H : P (algebraMap R S)
e : TensorProduct R R' S ≃ₛₗ[id R'] S' :=
  IsBaseChange.equiv (_ : IsBaseChange R' (AlgHom.toLinearMap (IsScalarTower.toAlgHom R S S')))
f' : TensorProduct R R' S →ₐ[R] S' :=
  Algebra.TensorProduct.productMap (IsScalarTower.toAlgHom R R' S') (IsScalarTower.toAlgHom R S S')
this : ∀ (x : TensorProduct R R' S), e x = f' x
⊢ algebraMap R' S' =
    comp
      (RingEquiv.toRingHom
        {
          toEquiv :=
            { toFun := e.toFun, invFun := e.invFun, left_inv := (_ : Function.LeftInverse e.invFun e.toFun),
              right_inv := (_ : Function.RightInverse e.invFun e.toFun) },
          map_mul' := (_ : ∀ (x y : TensorProduct R R' S), e (x * y) = e x * e y),
          map_add' :=
            (_ :
              ∀ (x y : TensorProduct R R' S),
                AddHom.toFun e.toAddHom (x + y) = AddHom.toFun e.toAddHom x + AddHom.toFun e.toAddHom y) })
      Algebra.TensorProduct.includeLeftRingHom

Next tactic:
ext x
theorem StableUnderBaseChange.mk (h₁ : RespectsIso @P)
    (h₂ :
      ∀ ⦃R S T⦄ [CommRing R] [CommRing S] [CommRing T],
        ∀ [Algebra R S] [Algebra R T],
          P (algebraMap R T) →
            P (Algebra.TensorProduct.includeLeftRingHom : S →+* TensorProduct R S T)) :
    StableUnderBaseChange @P := by
  introv R h H
  let e := h.symm.1.equiv
  let f' :=
    Algebra.TensorProduct.productMap (IsScalarTower.toAlgHom R R' S')
      (IsScalarTower.toAlgHom R S S')
  have : ∀ x, e x = f' x := by
    intro x
    change e.toLinearMap.restrictScalars R x = f'.toLinearMap x
    congr 1
    apply TensorProduct.ext'
    intro x y
    simp [IsBaseChange.equiv_tmul, Algebra.smul_def]
  -- Porting Note: This had a lot of implicit inferences which didn't resolve anymore.
  -- Added those in
  convert h₁.1 (_ : R' →+* TensorProduct R R' S) (_ : TensorProduct R R' S ≃+* S')
      (h₂ H : P (_ : R' →+* TensorProduct R R' S))
  swap
  · refine' { e with map_mul' := fun x y => _ }
    change e (x * y) = e x * e y
    simp_rw [this]
    exact map_mul f' _ _
  · ext x
    

Proof state:
case h.e'_5.a
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
h₁ : RespectsIso P
h₂ :
  ∀ ⦃R S T : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] [inst_3 : Algebra R S]
    [inst_4 : Algebra R T], P (algebraMap R T) → P Algebra.TensorProduct.includeLeftRingHom
R S R' S' : Type u
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing S
inst✝⁸ : CommRing R'
inst✝⁷ : CommRing S'
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra R R'
inst✝⁴ : Algebra R S'
inst✝³ : Algebra S S'
inst✝² : Algebra R' S'
inst✝¹ : IsScalarTower R S S'
inst✝ : IsScalarTower R R' S'
h : Algebra.IsPushout R S R' S'
H : P (algebraMap R S)
e : TensorProduct R R' S ≃ₛₗ[id R'] S' :=
  IsBaseChange.equiv (_ : IsBaseChange R' (AlgHom.toLinearMap (IsScalarTower.toAlgHom R S S')))
f' : TensorProduct R R' S →ₐ[R] S' :=
  Algebra.TensorProduct.productMap (IsScalarTower.toAlgHom R R' S') (IsScalarTower.toAlgHom R S S')
this : ∀ (x : TensorProduct R R' S), e x = f' x
x : R'
⊢ (algebraMap R' S') x =
    (comp
        (RingEquiv.toRingHom
          {
            toEquiv :=
              { toFun := e.toFun, invFun := e.invFun, left_inv := (_ : Function.LeftInverse e.invFun e.toFun),
                right_inv := (_ : Function.RightInverse e.invFun e.toFun) },
            map_mul' := (_ : ∀ (x y : TensorProduct R R' S), e (x * y) = e x * e y),
            map_add' :=
              (_ :
                ∀ (x y : TensorProduct R R' S),
                  AddHom.toFun e.toAddHom (x + y) = AddHom.toFun e.toAddHom x + AddHom.toFun e.toAddHom y) })
        Algebra.TensorProduct.includeLeftRingHom)
      x

Next tactic:
change _ = e (x ⊗ₜ[R] 1)
theorem StableUnderBaseChange.mk (h₁ : RespectsIso @P)
    (h₂ :
      ∀ ⦃R S T⦄ [CommRing R] [CommRing S] [CommRing T],
        ∀ [Algebra R S] [Algebra R T],
          P (algebraMap R T) →
            P (Algebra.TensorProduct.includeLeftRingHom : S →+* TensorProduct R S T)) :
    StableUnderBaseChange @P := by
  introv R h H
  let e := h.symm.1.equiv
  let f' :=
    Algebra.TensorProduct.productMap (IsScalarTower.toAlgHom R R' S')
      (IsScalarTower.toAlgHom R S S')
  have : ∀ x, e x = f' x := by
    intro x
    change e.toLinearMap.restrictScalars R x = f'.toLinearMap x
    congr 1
    apply TensorProduct.ext'
    intro x y
    simp [IsBaseChange.equiv_tmul, Algebra.smul_def]
  -- Porting Note: This had a lot of implicit inferences which didn't resolve anymore.
  -- Added those in
  convert h₁.1 (_ : R' →+* TensorProduct R R' S) (_ : TensorProduct R R' S ≃+* S')
      (h₂ H : P (_ : R' →+* TensorProduct R R' S))
  swap
  · refine' { e with map_mul' := fun x y => _ }
    change e (x * y) = e x * e y
    simp_rw [this]
    exact map_mul f' _ _
  · ext x
    change _ = e (x ⊗ₜ[R] 1)
    --Porting note: Had `dsimp only [e]` here, which didn't work anymore
    

Proof state:
case h.e'_5.a
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
h₁ : RespectsIso P
h₂ :
  ∀ ⦃R S T : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] [inst_3 : Algebra R S]
    [inst_4 : Algebra R T], P (algebraMap R T) → P Algebra.TensorProduct.includeLeftRingHom
R S R' S' : Type u
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing S
inst✝⁸ : CommRing R'
inst✝⁷ : CommRing S'
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra R R'
inst✝⁴ : Algebra R S'
inst✝³ : Algebra S S'
inst✝² : Algebra R' S'
inst✝¹ : IsScalarTower R S S'
inst✝ : IsScalarTower R R' S'
h : Algebra.IsPushout R S R' S'
H : P (algebraMap R S)
e : TensorProduct R R' S ≃ₛₗ[id R'] S' :=
  IsBaseChange.equiv (_ : IsBaseChange R' (AlgHom.toLinearMap (IsScalarTower.toAlgHom R S S')))
f' : TensorProduct R R' S →ₐ[R] S' :=
  Algebra.TensorProduct.productMap (IsScalarTower.toAlgHom R R' S') (IsScalarTower.toAlgHom R S S')
this : ∀ (x : TensorProduct R R' S), e x = f' x
x : R'
⊢ (algebraMap R' S') x = e (x ⊗ₜ[R] 1)

Next tactic:
rw [h.symm.1.equiv_tmul, Algebra.smul_def, AlgHom.toLinearMap_apply, map_one, mul_one]
theorem StableUnderBaseChange.pushout_inl (hP : RingHom.StableUnderBaseChange @P)
    (hP' : RingHom.RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : R ⟶ T) (H : P g) :
    P (pushout.inl : S ⟶ pushout f g) := by
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : StableUnderBaseChange P
hP' : RespectsIso P
R S T : CommRingCat
f : R ⟶ S
g : R ⟶ T
H : P g
⊢ P pushout.inl

Next tactic:
rw [←
    show _ = pushout.inl from
      colimit.isoColimitCocone_ι_inv ⟨_, CommRingCat.pushoutCoconeIsColimit f g⟩
        WalkingSpan.left,
    hP'.cancel_right_isIso]
theorem StableUnderBaseChange.pushout_inl (hP : RingHom.StableUnderBaseChange @P)
    (hP' : RingHom.RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : R ⟶ T) (H : P g) :
    P (pushout.inl : S ⟶ pushout f g) := by
  rw [←
    show _ = pushout.inl from
      colimit.isoColimitCocone_ι_inv ⟨_, CommRingCat.pushoutCoconeIsColimit f g⟩
        WalkingSpan.left,
    hP'.cancel_right_isIso]
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : StableUnderBaseChange P
hP' : RespectsIso P
R S T : CommRingCat
f : R ⟶ S
g : R ⟶ T
H : P g
⊢ P
    ({ cocone := CommRingCat.pushoutCocone f g, isColimit := CommRingCat.pushoutCoconeIsColimit f g }.cocone.ι.app
      WalkingSpan.left)

Next tactic:
letI := f.toAlgebra
theorem StableUnderBaseChange.pushout_inl (hP : RingHom.StableUnderBaseChange @P)
    (hP' : RingHom.RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : R ⟶ T) (H : P g) :
    P (pushout.inl : S ⟶ pushout f g) := by
  rw [←
    show _ = pushout.inl from
      colimit.isoColimitCocone_ι_inv ⟨_, CommRingCat.pushoutCoconeIsColimit f g⟩
        WalkingSpan.left,
    hP'.cancel_right_isIso]
  letI := f.toAlgebra
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : StableUnderBaseChange P
hP' : RespectsIso P
R S T : CommRingCat
f : R ⟶ S
g : R ⟶ T
H : P g
this : Algebra ↑R ↑S := toAlgebra f
⊢ P
    ({ cocone := CommRingCat.pushoutCocone f g, isColimit := CommRingCat.pushoutCoconeIsColimit f g }.cocone.ι.app
      WalkingSpan.left)

Next tactic:
letI := g.toAlgebra
theorem StableUnderBaseChange.pushout_inl (hP : RingHom.StableUnderBaseChange @P)
    (hP' : RingHom.RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : R ⟶ T) (H : P g) :
    P (pushout.inl : S ⟶ pushout f g) := by
  rw [←
    show _ = pushout.inl from
      colimit.isoColimitCocone_ι_inv ⟨_, CommRingCat.pushoutCoconeIsColimit f g⟩
        WalkingSpan.left,
    hP'.cancel_right_isIso]
  letI := f.toAlgebra
  letI := g.toAlgebra
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : StableUnderBaseChange P
hP' : RespectsIso P
R S T : CommRingCat
f : R ⟶ S
g : R ⟶ T
H : P g
this✝ : Algebra ↑R ↑S := toAlgebra f
this : Algebra ↑R ↑T := toAlgebra g
⊢ P
    ({ cocone := CommRingCat.pushoutCocone f g, isColimit := CommRingCat.pushoutCoconeIsColimit f g }.cocone.ι.app
      WalkingSpan.left)

Next tactic:
dsimp only [CommRingCat.pushoutCocone_inl, PushoutCocone.ι_app_left]
theorem StableUnderBaseChange.pushout_inl (hP : RingHom.StableUnderBaseChange @P)
    (hP' : RingHom.RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : R ⟶ T) (H : P g) :
    P (pushout.inl : S ⟶ pushout f g) := by
  rw [←
    show _ = pushout.inl from
      colimit.isoColimitCocone_ι_inv ⟨_, CommRingCat.pushoutCoconeIsColimit f g⟩
        WalkingSpan.left,
    hP'.cancel_right_isIso]
  letI := f.toAlgebra
  letI := g.toAlgebra
  dsimp only [CommRingCat.pushoutCocone_inl, PushoutCocone.ι_app_left]
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : StableUnderBaseChange P
hP' : RespectsIso P
R S T : CommRingCat
f : R ⟶ S
g : R ⟶ T
H : P g
this✝ : Algebra ↑R ↑S := toAlgebra f
this : Algebra ↑R ↑T := toAlgebra g
⊢ P Algebra.TensorProduct.includeLeftRingHom

Next tactic:
apply hP R T S (TensorProduct R S T)
theorem StableUnderBaseChange.pushout_inl (hP : RingHom.StableUnderBaseChange @P)
    (hP' : RingHom.RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : R ⟶ T) (H : P g) :
    P (pushout.inl : S ⟶ pushout f g) := by
  rw [←
    show _ = pushout.inl from
      colimit.isoColimitCocone_ι_inv ⟨_, CommRingCat.pushoutCoconeIsColimit f g⟩
        WalkingSpan.left,
    hP'.cancel_right_isIso]
  letI := f.toAlgebra
  letI := g.toAlgebra
  dsimp only [CommRingCat.pushoutCocone_inl, PushoutCocone.ι_app_left]
  apply hP R T S (TensorProduct R S T)
  

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hP : StableUnderBaseChange P
hP' : RespectsIso P
R S T : CommRingCat
f : R ⟶ S
g : R ⟶ T
H : P g
this✝ : Algebra ↑R ↑S := toAlgebra f
this : Algebra ↑R ↑T := toAlgebra g
⊢ P (algebraMap ↑R ↑T)

Next tactic:
exact H
instance : BraidedCategory (AlgebraCat.{u} R) :=
  braidedCategoryOfFaithful (toModuleCatMonoidalFunctor R)
    (fun X Y => (Algebra.TensorProduct.comm R X Y).toAlgebraIso)
    (by 

Proof state:
R : Type u
inst✝ : CommRing R
⊢ ∀ (X Y : AlgebraCat R),
    LaxMonoidalFunctor.μ (toModuleCatMonoidalFunctor R).toLaxMonoidalFunctor X Y ≫
        (toModuleCatMonoidalFunctor R).toLaxMonoidalFunctor.toFunctor.map
          ((fun X Y => AlgEquiv.toAlgebraIso (Algebra.TensorProduct.comm R ↑X ↑Y)) X Y).hom =
      (β_ ((toModuleCatMonoidalFunctor R).toLaxMonoidalFunctor.toFunctor.obj X)
            ((toModuleCatMonoidalFunctor R).toLaxMonoidalFunctor.toFunctor.obj Y)).hom ≫
        LaxMonoidalFunctor.μ (toModuleCatMonoidalFunctor R).toLaxMonoidalFunctor Y X

Next tactic:
aesop_cat
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  

Proof state:
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
⊢ ∃ C, ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ∀ t ≤ K, ↑↑μ (closedBall x (t * ε)) ≤ ↑C * ↑↑μ (closedBall x ε)

Next tactic:
let C := doublingConstant μ
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  

Proof state:
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
⊢ ∃ C, ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ∀ t ≤ K, ↑↑μ (closedBall x (t * ε)) ≤ ↑C * ↑↑μ (closedBall x ε)

Next tactic:
have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
    refine' (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => _
    calc
      μ (closedBall x ((2 : ℝ) ^ (n + 1) * ε)) = μ (closedBall x ((2 : ℝ) ^ n * (2 * ε))) := by
        rw [pow_succ', mul_assoc]
      _ ≤ ↑(C ^ n) * μ (closedBall x (2 * ε)) := (hε.1 x)
      _ ≤ ↑(C ^ n) * (C * μ (closedBall x ε)) := by gcongr; exact hε.2 x
      _ = ↑(C ^ (n + 1)) * μ (closedBall x ε) := by rw [← mul_assoc, pow_succ', ENNReal.coe_mul]
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    

Proof state:
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
⊢ ∀ (n : ℕ), ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * ε)) ≤ ↑(C ^ n) * ↑↑μ (closedBall x ε)

Next tactic:
intro n
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    

Proof state:
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
⊢ ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * ε)) ≤ ↑(C ^ n) * ↑↑μ (closedBall x ε)

Next tactic:
induction' n with n ih
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · 

Proof state:
case zero
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
⊢ ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ Nat.zero * ε)) ≤ ↑(C ^ Nat.zero) * ↑↑μ (closedBall x ε)

Next tactic:
simp
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    

Proof state:
case succ
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
ih : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * ε)) ≤ ↑(C ^ n) * ↑↑μ (closedBall x ε)
⊢ ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ Nat.succ n * ε)) ≤ ↑(C ^ Nat.succ n) * ↑↑μ (closedBall x ε)

Next tactic:
replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
    

Proof state:
case succ
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
ih : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))
⊢ ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ Nat.succ n * ε)) ≤ ↑(C ^ Nat.succ n) * ↑↑μ (closedBall x ε)

Next tactic:
refine' (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => _
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
    refine' (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => _
    

Proof state:
case succ
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
ih : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))
ε : ℝ
hε :
  (∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))) ∧
    ∀ (x : α), ↑↑μ (closedBall x (2 * ε)) ≤ ↑(doublingConstant μ) * ↑↑μ (closedBall x ε)
x : α
⊢ ↑↑μ (closedBall x (2 ^ Nat.succ n * ε)) ≤ ↑(C ^ Nat.succ n) * ↑↑μ (closedBall x ε)

Next tactic:
calc
      μ (closedBall x ((2 : ℝ) ^ (n + 1) * ε)) = μ (closedBall x ((2 : ℝ) ^ n * (2 * ε))) := by
        rw [pow_succ', mul_assoc]
      _ ≤ ↑(C ^ n) * μ (closedBall x (2 * ε)) := (hε.1 x)
      _ ≤ ↑(C ^ n) * (C * μ (closedBall x ε)) := by gcongr; exact hε.2 x
      _ = ↑(C ^ (n + 1)) * μ (closedBall x ε) := by rw [← mul_assoc, pow_succ', ENNReal.coe_mul]
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
    refine' (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => _
    calc
      μ (closedBall x ((2 : ℝ) ^ (n + 1) * ε)) = μ (closedBall x ((2 : ℝ) ^ n * (2 * ε))) := by
        

Proof state:
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
ih : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))
ε : ℝ
hε :
  (∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))) ∧
    ∀ (x : α), ↑↑μ (closedBall x (2 * ε)) ≤ ↑(doublingConstant μ) * ↑↑μ (closedBall x ε)
x : α
⊢ ↑↑μ (closedBall x (2 ^ (n + 1) * ε)) = ↑↑μ (closedBall x (2 ^ n * (2 * ε)))

Next tactic:
rw [pow_succ', mul_assoc]
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
    refine' (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => _
    calc
      μ (closedBall x ((2 : ℝ) ^ (n + 1) * ε)) = μ (closedBall x ((2 : ℝ) ^ n * (2 * ε))) := by
        rw [pow_succ', mul_assoc]
      _ ≤ ↑(C ^ n) * μ (closedBall x (2 * ε)) := (hε.1 x)
      _ ≤ ↑(C ^ n) * (C * μ (closedBall x ε)) := by 

Proof state:
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
ih : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))
ε : ℝ
hε :
  (∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))) ∧
    ∀ (x : α), ↑↑μ (closedBall x (2 * ε)) ≤ ↑(doublingConstant μ) * ↑↑μ (closedBall x ε)
x : α
⊢ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε)) ≤ ↑(C ^ n) * (↑C * ↑↑μ (closedBall x ε))

Next tactic:
gcongr
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
    ∃ C : ℝ≥0,
      ∀ᶠ ε in 𝓝[>] 0, ∀ (x t) (_ : t ≤ K), μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
  let C := doublingConstant μ
  have hμ :
    ∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
      μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := by
    intro n
    induction' n with n ih
    · simp
    replace ih := eventually_nhdsWithin_pos_mul_left (two_pos : 0 < (2 : ℝ)) ih
    refine' (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => _
    calc
      μ (closedBall x ((2 : ℝ) ^ (n + 1) * ε)) = μ (closedBall x ((2 : ℝ) ^ n * (2 * ε))) := by
        rw [pow_succ', mul_assoc]
      _ ≤ ↑(C ^ n) * μ (closedBall x (2 * ε)) := (hε.1 x)
      _ ≤ ↑(C ^ n) * (C * μ (closedBall x ε)) := by gcongr; 

Proof state:
case bc
α : Type u_1
inst✝² : MetricSpace α
inst✝¹ : MeasurableSpace α
μ : Measure α
inst✝ : IsUnifLocDoublingMeasure μ
K : ℝ
C : ℝ≥0 := doublingConstant μ
n : ℕ
ih : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))
ε : ℝ
hε :
  (∀ (x : α), ↑↑μ (closedBall x (2 ^ n * (2 * ε))) ≤ ↑(C ^ n) * ↑↑μ (closedBall x (2 * ε))) ∧
    ∀ (x : α), ↑↑μ (closedBall x (2 * ε)) ≤ ↑(doublingConstant μ) * ↑↑μ (closedBall x ε)
x : α
⊢ ↑↑μ (closedBall x (2 * ε)) ≤ ↑C * ↑↑μ (closedBall x ε)

Next tactic:
exact hε.2 x