l3lab/ntp-mathlib huggingface dataset:
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
⊢ SuperpolynomialDecay l k f ↔ ∀ (z : ℤ), f =o[l] fun a => k a ^ z

Next tactic:
refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
⊢ f =o[l] fun a => k a ^ z

Next tactic:
have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
hk0 : ∀ᶠ (x : α) in l, k x ≠ 0
⊢ f =o[l] fun a => k a ^ z

Next tactic:
have : (fun _ : α => (1 : β)) =o[l] k :=
    isLittleO_of_tendsto' (hk0.mono fun x hkx hkx' => absurd hkx' hkx)
      (by simpa using hk.inv_tendsto_atTop)
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
  have : (fun _ : α => (1 : β)) =o[l] k :=
    isLittleO_of_tendsto' (hk0.mono fun x hkx hkx' => absurd hkx' hkx)
      (by 

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
hk0 : ∀ᶠ (x : α) in l, k x ≠ 0
⊢ Tendsto (fun x => 1 / k x) l (𝓝 0)

Next tactic:
simpa using hk.inv_tendsto_atTop
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
  have : (fun _ : α => (1 : β)) =o[l] k :=
    isLittleO_of_tendsto' (hk0.mono fun x hkx hkx' => absurd hkx' hkx)
      (by simpa using hk.inv_tendsto_atTop)
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
hk0 : ∀ᶠ (x : α) in l, k x ≠ 0
this : (fun x => 1) =o[l] k
⊢ f =o[l] fun a => k a ^ z

Next tactic:
have : f =o[l] fun x : α => k x * k x ^ (z - 1) := by
    simpa using this.mul_isBigO ((superpolynomialDecay_iff_isBigO f hk).1 h <| z - 1)
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
  have : (fun _ : α => (1 : β)) =o[l] k :=
    isLittleO_of_tendsto' (hk0.mono fun x hkx hkx' => absurd hkx' hkx)
      (by simpa using hk.inv_tendsto_atTop)
  have : f =o[l] fun x : α => k x * k x ^ (z - 1) := by
    

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
hk0 : ∀ᶠ (x : α) in l, k x ≠ 0
this : (fun x => 1) =o[l] k
⊢ f =o[l] fun x => k x * k x ^ (z - 1)

Next tactic:
simpa using this.mul_isBigO ((superpolynomialDecay_iff_isBigO f hk).1 h <| z - 1)
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
  have : (fun _ : α => (1 : β)) =o[l] k :=
    isLittleO_of_tendsto' (hk0.mono fun x hkx hkx' => absurd hkx' hkx)
      (by simpa using hk.inv_tendsto_atTop)
  have : f =o[l] fun x : α => k x * k x ^ (z - 1) := by
    simpa using this.mul_isBigO ((superpolynomialDecay_iff_isBigO f hk).1 h <| z - 1)
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
hk0 : ∀ᶠ (x : α) in l, k x ≠ 0
this✝ : (fun x => 1) =o[l] k
this : f =o[l] fun x => k x * k x ^ (z - 1)
⊢ f =o[l] fun a => k a ^ z

Next tactic:
refine' this.trans_isBigO (IsBigO.of_bound 1 (hk0.mono fun x hkx => le_of_eq _))
theorem superpolynomialDecay_iff_isLittleO (hk : Tendsto k l atTop) :
    SuperpolynomialDecay l k f ↔ ∀ z : ℤ, f =o[l] fun a : α => k a ^ z := by
  refine' ⟨fun h z => _, fun h => (superpolynomialDecay_iff_isBigO f hk).2 fun z => (h z).isBigO⟩
  have hk0 : ∀ᶠ x in l, k x ≠ 0 := hk.eventually_ne_atTop 0
  have : (fun _ : α => (1 : β)) =o[l] k :=
    isLittleO_of_tendsto' (hk0.mono fun x hkx hkx' => absurd hkx' hkx)
      (by simpa using hk.inv_tendsto_atTop)
  have : f =o[l] fun x : α => k x * k x ^ (z - 1) := by
    simpa using this.mul_isBigO ((superpolynomialDecay_iff_isBigO f hk).1 h <| z - 1)
  refine' this.trans_isBigO (IsBigO.of_bound 1 (hk0.mono fun x hkx => le_of_eq _))
  

Proof state:
α : Type u_1
β : Type u_2
l : Filter α
k f g g' : α → β
inst✝¹ : NormedLinearOrderedField β
inst✝ : OrderTopology β
hk : Tendsto k l atTop
h : SuperpolynomialDecay l k f
z : ℤ
hk0 : ∀ᶠ (x : α) in l, k x ≠ 0
this✝ : (fun x => 1) =o[l] k
this : f =o[l] fun x => k x * k x ^ (z - 1)
x : α
hkx : k x ≠ 0
⊢ ‖k x * k x ^ (z - 1)‖ = 1 * ‖k x ^ z‖

Next tactic:
rw [one_mul, zpow_sub_one₀ hkx, mul_comm (k x), mul_assoc, inv_mul_cancel hkx, mul_one]
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        

Proof state:
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
I : Ideal ℤ
g : ↥I →ₗ[ℤ] A
⊢ ∃ g', ∀ (x : ℤ) (mem : x ∈ I), g' x = g { val := x, property := mem }

Next tactic:
rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        

Proof state:
case mk.intro
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
m : ℤ
g : ↥(Submodule.span ℤ {m}) →ₗ[ℤ] A
⊢ ∃ g', ∀ (x : ℤ) (mem : x ∈ Submodule.span ℤ {m}), g' x = g { val := x, property := mem }

Next tactic:
obtain rfl | h0 := eq_or_ne m 0
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · 

Proof state:
case mk.intro.inl
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
g : ↥(Submodule.span ℤ {0}) →ₗ[ℤ] A
⊢ ∃ g', ∀ (x : ℤ) (mem : x ∈ Submodule.span ℤ {0}), g' x = g { val := x, property := mem }

Next tactic:
refine ⟨0, fun n hn ↦ ?_⟩
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          

Proof state:
case mk.intro.inl
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
g : ↥(Submodule.span ℤ {0}) →ₗ[ℤ] A
n : ℤ
hn : n ∈ Submodule.span ℤ {0}
⊢ 0 n = g { val := n, property := hn }

Next tactic:
rw [Submodule.span_zero_singleton] at hn
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          rw [Submodule.span_zero_singleton] at hn
          

Proof state:
case mk.intro.inl
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
g : ↥(Submodule.span ℤ {0}) →ₗ[ℤ] A
n : ℤ
hn✝ : n ∈ Submodule.span ℤ {0}
hn : n ∈ ⊥
⊢ 0 n = g { val := n, property := hn✝ }

Next tactic:
subst hn
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          rw [Submodule.span_zero_singleton] at hn
          subst hn
          

Proof state:
case mk.intro.inl
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
g : ↥(Submodule.span ℤ {0}) →ₗ[ℤ] A
hn : 0 ∈ Submodule.span ℤ {0}
⊢ 0 0 = g { val := 0, property := hn }

Next tactic:
exact (map_zero g).symm
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          rw [Submodule.span_zero_singleton] at hn
          subst hn
          exact (map_zero g).symm
        

Proof state:
case mk.intro.inr
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
m : ℤ
g : ↥(Submodule.span ℤ {m}) →ₗ[ℤ] A
h0 : m ≠ 0
⊢ ∃ g', ∀ (x : ℤ) (mem : x ∈ Submodule.span ℤ {m}), g' x = g { val := x, property := mem }

Next tactic:
let gₘ := g ⟨m, Submodule.subset_span (Set.mem_singleton _)⟩
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          rw [Submodule.span_zero_singleton] at hn
          subst hn
          exact (map_zero g).symm
        let gₘ := g ⟨m, Submodule.subset_span (Set.mem_singleton _)⟩
        

Proof state:
case mk.intro.inr
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
m : ℤ
g : ↥(Submodule.span ℤ {m}) →ₗ[ℤ] A
h0 : m ≠ 0
gₘ : A := g { val := m, property := (_ : m ∈ ↑(Submodule.span ℤ {m})) }
⊢ ∃ g', ∀ (x : ℤ) (mem : x ∈ Submodule.span ℤ {m}), g' x = g { val := x, property := mem }

Next tactic:
refine ⟨LinearMap.toSpanSingleton ℤ A (DivisibleBy.div gₘ m), fun n hn ↦ ?_⟩
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          rw [Submodule.span_zero_singleton] at hn
          subst hn
          exact (map_zero g).symm
        let gₘ := g ⟨m, Submodule.subset_span (Set.mem_singleton _)⟩
        refine ⟨LinearMap.toSpanSingleton ℤ A (DivisibleBy.div gₘ m), fun n hn ↦ ?_⟩
        

Proof state:
case mk.intro.inr
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
m : ℤ
g : ↥(Submodule.span ℤ {m}) →ₗ[ℤ] A
h0 : m ≠ 0
gₘ : A := g { val := m, property := (_ : m ∈ ↑(Submodule.span ℤ {m})) }
n : ℤ
hn : n ∈ Submodule.span ℤ {m}
⊢ (LinearMap.toSpanSingleton ℤ A (DivisibleBy.div gₘ m)) n = g { val := n, property := hn }

Next tactic:
rcases Submodule.mem_span_singleton.mp hn with ⟨n, rfl⟩
instance injective_of_divisible [DivisibleBy A ℤ] :
    Injective (⟨A,inferInstance⟩ : AddCommGroupCat) :=
  (injective_as_module_iff A).mp <|
    @Module.injective_object_of_injective_module ℤ _ A _ _ <|
      Module.Baer.injective fun I g ↦ by
        rcases IsPrincipalIdealRing.principal I with ⟨m, rfl⟩
        obtain rfl | h0 := eq_or_ne m 0
        · refine ⟨0, fun n hn ↦ ?_⟩
          rw [Submodule.span_zero_singleton] at hn
          subst hn
          exact (map_zero g).symm
        let gₘ := g ⟨m, Submodule.subset_span (Set.mem_singleton _)⟩
        refine ⟨LinearMap.toSpanSingleton ℤ A (DivisibleBy.div gₘ m), fun n hn ↦ ?_⟩
        rcases Submodule.mem_span_singleton.mp hn with ⟨n, rfl⟩
        

Proof state:
case mk.intro.inr.intro
A : Type u
inst✝¹ : AddCommGroup A
inst✝ : DivisibleBy A ℤ
m : ℤ
g : ↥(Submodule.span ℤ {m}) →ₗ[ℤ] A
h0 : m ≠ 0
gₘ : A := g { val := m, property := (_ : m ∈ ↑(Submodule.span ℤ {m})) }
n : ℤ
hn : n • m ∈ Submodule.span ℤ {m}
⊢ (LinearMap.toSpanSingleton ℤ A (DivisibleBy.div gₘ m)) (n • m) = g { val := n • m, property := hn }

Next tactic:
rw [map_zsmul, LinearMap.toSpanSingleton_apply, DivisibleBy.div_cancel gₘ h0, ← map_zsmul g,
          SetLike.mk_smul_mk]
instance injective_ratCircle : Injective <| of <| ULift.{u} <| AddCircle (1 : ℚ) :=
  have : Fact ((0 : ℚ) < 1) := ⟨by 

Proof state:
A : Type u
inst✝ : AddCommGroup A
⊢ 0 < 1

Next tactic:
norm_num
instance : Injective <| next A_ :=
  have : Fact ((0 : ℚ) < 1) := ⟨by 

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
⊢ 0 < 1

Next tactic:
norm_num
/-- The map into the next term of `A`'s injective resolution is coordinate-wise evaluation. -/
@[simps] def toNext : A_ ⟶ next A_ where
  toFun a i := i a
  map_zero' := by 

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
⊢ (fun a i => i a) 0 = 0

Next tactic:
simp only [map_zero]
/-- The map into the next term of `A`'s injective resolution is coordinate-wise evaluation. -/
@[simps] def toNext : A_ ⟶ next A_ where
  toFun a i := i a
  map_zero' := by simp only [map_zero]; 

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
⊢ (fun i => 0) = 0

Next tactic:
rfl
/-- The map into the next term of `A`'s injective resolution is coordinate-wise evaluation. -/
@[simps] def toNext : A_ ⟶ next A_ where
  toFun a i := i a
  map_zero' := by simp only [map_zero]; rfl
  map_add' _ _ := by 

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
x✝¹ x✝ : ↑A_
⊢ ZeroHom.toFun { toFun := fun a i => i a, map_zero' := (_ : (fun a i => i a) 0 = 0) } (x✝¹ + x✝) =
    ZeroHom.toFun { toFun := fun a i => i a, map_zero' := (_ : (fun a i => i a) 0 = 0) } x✝¹ +
      ZeroHom.toFun { toFun := fun a i => i a, map_zero' := (_ : (fun a i => i a) 0 = 0) } x✝

Next tactic:
simp only [map_add]
/-- The map into the next term of `A`'s injective resolution is coordinate-wise evaluation. -/
@[simps] def toNext : A_ ⟶ next A_ where
  toFun a i := i a
  map_zero' := by simp only [map_zero]; rfl
  map_add' _ _ := by simp only [map_add]; 

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
x✝¹ x✝ : ↑A_
⊢ (fun i => i x✝¹ + i x✝) = (fun i => i x✝¹) + fun i => i x✝

Next tactic:
rfl
lemma _root_.LinearMap.toSpanSingleton_ker :
    LinearMap.ker (LinearMap.toSpanSingleton ℤ A_ a) = Ideal.span {(addOrderOf a : ℤ)} := by
  

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
⊢ LinearMap.ker (LinearMap.toSpanSingleton ℤ (↑A_) a) = Ideal.span {↑(addOrderOf a)}

Next tactic:
ext1 x
lemma _root_.LinearMap.toSpanSingleton_ker :
    LinearMap.ker (LinearMap.toSpanSingleton ℤ A_ a) = Ideal.span {(addOrderOf a : ℤ)} := by
  ext1 x
  

Proof state:
case h
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
x : ℤ
⊢ x ∈ LinearMap.ker (LinearMap.toSpanSingleton ℤ (↑A_) a) ↔ x ∈ Ideal.span {↑(addOrderOf a)}

Next tactic:
rw [Ideal.mem_span_singleton, addOrderOf_dvd_iff_zsmul_eq_zero]
lemma _root_.LinearMap.toSpanSingleton_ker :
    LinearMap.ker (LinearMap.toSpanSingleton ℤ A_ a) = Ideal.span {(addOrderOf a : ℤ)} := by
  ext1 x
  rw [Ideal.mem_span_singleton, addOrderOf_dvd_iff_zsmul_eq_zero]
  

Proof state:
case h
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
x : ℤ
⊢ x ∈ LinearMap.ker (LinearMap.toSpanSingleton ℤ (↑A_) a) ↔ x • a = 0

Next tactic:
rfl
lemma divBy_self (n : ℕ) : divBy n n = 0 := by
  

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℕ
⊢ (divBy n) ↑n = 0

Next tactic:
obtain rfl | h0 := eq_or_ne n 0
lemma divBy_self (n : ℕ) : divBy n n = 0 := by
  obtain rfl | h0 := eq_or_ne n 0
  · 

Proof state:
case inl
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
⊢ (divBy 0) ↑0 = 0

Next tactic:
apply map_zero
lemma divBy_self (n : ℕ) : divBy n n = 0 := by
  obtain rfl | h0 := eq_or_ne n 0
  · apply map_zero
  

Proof state:
case inr
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℕ
h0 : n ≠ 0
⊢ (divBy n) ↑n = 0

Next tactic:
apply (AddCircle.coe_eq_zero_iff _).mpr ⟨1, _⟩
lemma divBy_self (n : ℕ) : divBy n n = 0 := by
  obtain rfl | h0 := eq_or_ne n 0
  · apply map_zero
  apply (AddCircle.coe_eq_zero_iff _).mpr ⟨1, _⟩
  

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℕ
h0 : n ≠ 0
⊢ 1 • 1 = (fun x => LinearMap.id ↑n • x) (↑n)⁻¹

Next tactic:
simp [mul_inv_cancel (Nat.cast_ne_zero (R := ℚ).mpr h0)]
/-- The map sending `n • a` to `n / 2` when `a` has infinite order,
  and to `n / addOrderOf a` otherwise. -/
@[simps!] noncomputable def toRatCircle : (ℤ ∙ a) →ₗ[ℤ] AddCircle (1 : ℚ) :=
  let e : ℤ ⧸ Ideal.span {(addOrderOf a : ℤ)} →ₗ[ℤ] AddCircle (1 : ℚ) :=
    Submodule.liftQSpanSingleton _ (divBy <| if addOrderOf a = 0 then 2 else addOrderOf a) <| by
      

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
⊢ (divBy (if addOrderOf a = 0 then 2 else addOrderOf a)) ↑(addOrderOf a) = 0

Next tactic:
split_ifs with h
/-- The map sending `n • a` to `n / 2` when `a` has infinite order,
  and to `n / addOrderOf a` otherwise. -/
@[simps!] noncomputable def toRatCircle : (ℤ ∙ a) →ₗ[ℤ] AddCircle (1 : ℚ) :=
  let e : ℤ ⧸ Ideal.span {(addOrderOf a : ℤ)} →ₗ[ℤ] AddCircle (1 : ℚ) :=
    Submodule.liftQSpanSingleton _ (divBy <| if addOrderOf a = 0 then 2 else addOrderOf a) <| by
      split_ifs with h
      · 

Proof state:
case pos
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
h : addOrderOf a = 0
⊢ (divBy 2) ↑(addOrderOf a) = 0

Next tactic:
rw [h, Nat.cast_zero, map_zero]
/-- The map sending `n • a` to `n / 2` when `a` has infinite order,
  and to `n / addOrderOf a` otherwise. -/
@[simps!] noncomputable def toRatCircle : (ℤ ∙ a) →ₗ[ℤ] AddCircle (1 : ℚ) :=
  let e : ℤ ⧸ Ideal.span {(addOrderOf a : ℤ)} →ₗ[ℤ] AddCircle (1 : ℚ) :=
    Submodule.liftQSpanSingleton _ (divBy <| if addOrderOf a = 0 then 2 else addOrderOf a) <| by
      split_ifs with h
      · rw [h, Nat.cast_zero, map_zero]
      · 

Proof state:
case neg
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
h : ¬addOrderOf a = 0
⊢ (divBy (addOrderOf a)) ↑(addOrderOf a) = 0

Next tactic:
apply divBy_self
lemma eq_zero_of_toRatCircle_apply_self
    (h : toRatCircle ⟨a, Submodule.mem_span_singleton_self a⟩ = 0) : a = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
h : toRatCircle { val := a, property := (_ : a ∈ Submodule.span ℤ {a}) } = 0
⊢ a = 0

Next tactic:
erw [toRatCircle, LinearMap.comp_apply, LinearEquiv.coe_toLinearMap,
    equivZModSpanAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,
    LinearMap.toSpanSingleton_one, AddCircle.coe_eq_zero_iff] at h
lemma eq_zero_of_toRatCircle_apply_self
    (h : toRatCircle ⟨a, Submodule.mem_span_singleton_self a⟩ = 0) : a = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [toRatCircle, LinearMap.comp_apply, LinearEquiv.coe_toLinearMap,
    equivZModSpanAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,
    LinearMap.toSpanSingleton_one, AddCircle.coe_eq_zero_iff] at h
  

Proof state:
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
h : ∃ n, n • 1 = (↑(if addOrderOf a = 0 then 2 else addOrderOf a))⁻¹
⊢ a = 0

Next tactic:
obtain ⟨n, hn⟩ := h
lemma eq_zero_of_toRatCircle_apply_self
    (h : toRatCircle ⟨a, Submodule.mem_span_singleton_self a⟩ = 0) : a = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [toRatCircle, LinearMap.comp_apply, LinearEquiv.coe_toLinearMap,
    equivZModSpanAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,
    LinearMap.toSpanSingleton_one, AddCircle.coe_eq_zero_iff] at h
  obtain ⟨n, hn⟩ := h
  

Proof state:
case intro
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℤ
hn : n • 1 = (↑(if addOrderOf a = 0 then 2 else addOrderOf a))⁻¹
⊢ a = 0

Next tactic:
apply_fun Rat.den at hn
lemma eq_zero_of_toRatCircle_apply_self
    (h : toRatCircle ⟨a, Submodule.mem_span_singleton_self a⟩ = 0) : a = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [toRatCircle, LinearMap.comp_apply, LinearEquiv.coe_toLinearMap,
    equivZModSpanAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,
    LinearMap.toSpanSingleton_one, AddCircle.coe_eq_zero_iff] at h
  obtain ⟨n, hn⟩ := h
  apply_fun Rat.den at hn
  

Proof state:
case intro
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℤ
hn : (n • 1).den = (↑(if addOrderOf a = 0 then 2 else addOrderOf a))⁻¹.den
⊢ a = 0

Next tactic:
rw [zsmul_one, Rat.coe_int_den, Rat.inv_coe_nat_den_of_pos] at hn
lemma eq_zero_of_toRatCircle_apply_self
    (h : toRatCircle ⟨a, Submodule.mem_span_singleton_self a⟩ = 0) : a = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [toRatCircle, LinearMap.comp_apply, LinearEquiv.coe_toLinearMap,
    equivZModSpanAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,
    LinearMap.toSpanSingleton_one, AddCircle.coe_eq_zero_iff] at h
  obtain ⟨n, hn⟩ := h
  apply_fun Rat.den at hn
  rw [zsmul_one, Rat.coe_int_den, Rat.inv_coe_nat_den_of_pos] at hn
  · 

Proof state:
case intro
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℤ
hn : 1 = if addOrderOf a = 0 then 2 else addOrderOf a
⊢ a = 0

Next tactic:
split_ifs at hn
lemma eq_zero_of_toRatCircle_apply_self
    (h : toRatCircle ⟨a, Submodule.mem_span_singleton_self a⟩ = 0) : a = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [toRatCircle, LinearMap.comp_apply, LinearEquiv.coe_toLinearMap,
    equivZModSpanAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,
    LinearMap.toSpanSingleton_one, AddCircle.coe_eq_zero_iff] at h
  obtain ⟨n, hn⟩ := h
  apply_fun Rat.den at hn
  rw [zsmul_one, Rat.coe_int_den, Rat.inv_coe_nat_den_of_pos] at hn
  · split_ifs at hn
    · 

Proof state:
case pos
A : Type u
inst✝ : AddCommGroup A
A_ : AddCommGroupCat
a : ↑A_
n : ℤ
h✝ : addOrderOf a = 0
hn : 1 = 2
⊢ a = 0

Next tactic:
cases hn