l3lab/ntp-mathlib huggingface dataset:
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      

Proof state:
case inr.a.hG.a
n : ℕ
hn : NeZero n
m : ZMod (2 * n)
⊢ 2 * n = 2 * n / Nat.gcd (2 * n) (ZMod.val m) * gcd (2 * n) (ZMod.val m)

Next tactic:
exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · 

Proof state:
case inr.a.hG.xa
n : ℕ
hn : NeZero n
m : ZMod (2 * n)
⊢ xa m ^ lcm (2 * n) 4 = 1

Next tactic:
rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
      

Proof state:
case inr.a.hG.xa
n : ℕ
hn : NeZero n
m : ZMod (2 * n)
⊢ 4 ∣ lcm (2 * n) 4

Next tactic:
exact dvd_lcm_right (2 * n) 4
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
      exact dvd_lcm_right (2 * n) 4
  · 

Proof state:
case inr.a
n : ℕ
hn : NeZero n
⊢ lcm (2 * n) 4 ∣ Monoid.exponent (QuaternionGroup n)

Next tactic:
apply lcm_dvd
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
      exact dvd_lcm_right (2 * n) 4
  · apply lcm_dvd
    · 

Proof state:
case inr.a.hab
n : ℕ
hn : NeZero n
⊢ 2 * n ∣ Monoid.exponent (QuaternionGroup n)

Next tactic:
convert Monoid.order_dvd_exponent (a 1)
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
      exact dvd_lcm_right (2 * n) 4
  · apply lcm_dvd
    · convert Monoid.order_dvd_exponent (a 1)
      

Proof state:
case h.e'_3
n : ℕ
hn : NeZero n
⊢ 2 * n = orderOf (a 1)

Next tactic:
exact orderOf_a_one.symm
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
      exact dvd_lcm_right (2 * n) 4
  · apply lcm_dvd
    · convert Monoid.order_dvd_exponent (a 1)
      exact orderOf_a_one.symm
    · 

Proof state:
case inr.a.hcb
n : ℕ
hn : NeZero n
⊢ 4 ∣ Monoid.exponent (QuaternionGroup n)

Next tactic:
convert Monoid.order_dvd_exponent (xa (0 : ZMod (2 * n)))
theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 := by
  rw [← normalize_eq 2, ← lcm_mul_left, normalize_eq]
  norm_num
  cases' eq_zero_or_neZero n with hn hn
  · subst hn
    simp only [lcm_zero_left, mul_zero]
    exact Monoid.exponent_eq_zero_of_order_zero orderOf_a_one
  apply Nat.dvd_antisymm
  · apply Monoid.exponent_dvd_of_forall_pow_eq_one
    rintro (m | m)
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_a]
      refine' Nat.dvd_trans ⟨gcd (2 * n) m.val, _⟩ (dvd_lcm_left (2 * n) 4)
      exact (Nat.div_mul_cancel (Nat.gcd_dvd_left (2 * n) m.val)).symm
    · rw [← orderOf_dvd_iff_pow_eq_one, orderOf_xa]
      exact dvd_lcm_right (2 * n) 4
  · apply lcm_dvd
    · convert Monoid.order_dvd_exponent (a 1)
      exact orderOf_a_one.symm
    · convert Monoid.order_dvd_exponent (xa (0 : ZMod (2 * n)))
      

Proof state:
case h.e'_3
n : ℕ
hn : NeZero n
⊢ 4 = orderOf (xa 0)

Next tactic:
exact (orderOf_xa 0).symm
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  

Proof state:
x : ℝ
hx : x ≠ 0
⊢ HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
cases' hx.lt_or_lt with hx hx
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · 

Proof state:
case inl
x : ℝ
hx✝ : x ≠ 0
hx : x < 0
⊢ HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    

Proof state:
case inl
x : ℝ
hx✝ : x ≠ 0
hx : x < 0
⊢ HasStrictDerivAt sqrt 0 x ∧ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
    

Proof state:
case inl
x : ℝ
hx✝ : x ≠ 0
hx : x < 0
this : sqrt =ᶠ[𝓝 x] fun x => 0
⊢ HasStrictDerivAt sqrt 0 x ∧ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
exact
      ⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
        contDiffAt_const.congr_of_eventuallyEq this⟩
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
    exact
      ⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
        contDiffAt_const.congr_of_eventuallyEq this⟩
  · 

Proof state:
case inr
x : ℝ
hx✝ : x ≠ 0
hx : 0 < x
⊢ HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
have : ↑2 * sqrt x ^ (2 - 1) ≠ 0 := by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
    exact
      ⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
        contDiffAt_const.congr_of_eventuallyEq this⟩
  · have : ↑2 * sqrt x ^ (2 - 1) ≠ 0 := by 

Proof state:
x : ℝ
hx✝ : x ≠ 0
hx : 0 < x
⊢ 2 * sqrt x ^ (2 - 1) ≠ 0

Next tactic:
simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
    exact
      ⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
        contDiffAt_const.congr_of_eventuallyEq this⟩
  · have : ↑2 * sqrt x ^ (2 - 1) ≠ 0 := by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
    

Proof state:
case inr
x : ℝ
hx✝ : x ≠ 0
hx : 0 < x
this : 2 * sqrt x ^ (2 - 1) ≠ 0
⊢ HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
constructor
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
    exact
      ⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
        contDiffAt_const.congr_of_eventuallyEq this⟩
  · have : ↑2 * sqrt x ^ (2 - 1) ≠ 0 := by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
    constructor
    · 

Proof state:
case inr.left
x : ℝ
hx✝ : x ≠ 0
hx : 0 < x
this : 2 * sqrt x ^ (2 - 1) ≠ 0
⊢ HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x

Next tactic:
simpa using sqPartialHomeomorph.hasStrictDerivAt_symm hx this (hasStrictDerivAt_pow 2 _)
theorem deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) :
    HasStrictDerivAt sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, ContDiffAt ℝ n sqrt x := by
  cases' hx.lt_or_lt with hx hx
  · rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero]
    have : sqrt =ᶠ[𝓝 x] fun _ => 0 := (gt_mem_nhds hx).mono fun x hx => sqrt_eq_zero_of_nonpos hx.le
    exact
      ⟨(hasStrictDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq this.symm, fun n =>
        contDiffAt_const.congr_of_eventuallyEq this⟩
  · have : ↑2 * sqrt x ^ (2 - 1) ≠ 0 := by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ]
    constructor
    · simpa using sqPartialHomeomorph.hasStrictDerivAt_symm hx this (hasStrictDerivAt_pow 2 _)
    · 

Proof state:
case inr.right
x : ℝ
hx✝ : x ≠ 0
hx : 0 < x
this : 2 * sqrt x ^ (2 - 1) ≠ 0
⊢ ∀ (n : ℕ∞), ContDiffAt ℝ n sqrt x

Next tactic:
exact fun n => sqPartialHomeomorph.contDiffAt_symm_deriv this hx (hasDerivAt_pow 2 (sqrt x))
        (contDiffAt_id.pow 2)
theorem HasDerivWithinAt.sqrt (hf : HasDerivWithinAt f f' s x) (hx : f x ≠ 0) :
    HasDerivWithinAt (fun y => sqrt (f y)) (f' / (2 * sqrt (f x))) s x := by
  

Proof state:
f : ℝ → ℝ
s : Set ℝ
f' x : ℝ
hf : HasDerivWithinAt f f' s x
hx : f x ≠ 0
⊢ HasDerivWithinAt (fun y => Real.sqrt (f y)) (f' / (2 * Real.sqrt (f x))) s x

Next tactic:
simpa only [(· ∘ ·), div_eq_inv_mul, mul_one] using
    (hasDerivAt_sqrt hx).comp_hasDerivWithinAt x hf
theorem HasDerivAt.sqrt (hf : HasDerivAt f f' x) (hx : f x ≠ 0) :
    HasDerivAt (fun y => sqrt (f y)) (f' / (2 * sqrt (f x))) x := by
  

Proof state:
f : ℝ → ℝ
s : Set ℝ
f' x : ℝ
hf : HasDerivAt f f' x
hx : f x ≠ 0
⊢ HasDerivAt (fun y => Real.sqrt (f y)) (f' / (2 * Real.sqrt (f x))) x

Next tactic:
simpa only [(· ∘ ·), div_eq_inv_mul, mul_one] using (hasDerivAt_sqrt hx).comp x hf
theorem HasStrictDerivAt.sqrt (hf : HasStrictDerivAt f f' x) (hx : f x ≠ 0) :
    HasStrictDerivAt (fun t => sqrt (f t)) (f' / (2 * sqrt (f x))) x := by
  

Proof state:
f : ℝ → ℝ
s : Set ℝ
f' x : ℝ
hf : HasStrictDerivAt f f' x
hx : f x ≠ 0
⊢ HasStrictDerivAt (fun t => Real.sqrt (f t)) (f' / (2 * Real.sqrt (f x))) x

Next tactic:
simpa only [(· ∘ ·), div_eq_inv_mul, mul_one] using (hasStrictDerivAt_sqrt hx).comp x hf
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : LinearIndependent R b
⊢ LinearIndependent Rₛ b

Next tactic:
rw [linearIndependent_iff'] at hli ⊢
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
⊢ ∀ (s : Finset ι) (g : ι → Rₛ), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0

Next tactic:
intro s g hg i hi
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i : ι
hi : i ∈ s
⊢ g i = 0

Next tactic:
choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i : ι
hi : i ∈ s
a : ↥S
g' : ι → R
hg' : ∀ i ∈ s, (algebraMap R Rₛ) (g' i) = ↑a • g i
⊢ g i = 0

Next tactic:
specialize hli s g' _ i hi
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
  specialize hli s g' _ i hi
  · 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i : ι
hi : i ∈ s
a : ↥S
g' : ι → R
hg' : ∀ i ∈ s, (algebraMap R Rₛ) (g' i) = ↑a • g i
⊢ ∑ i in s, g' i • b i = 0

Next tactic:
rw [← @smul_zero _ M _ _ (a : R), ← hg, Finset.smul_sum]
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
  specialize hli s g' _ i hi
  · rw [← @smul_zero _ M _ _ (a : R), ← hg, Finset.smul_sum]
    

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i : ι
hi : i ∈ s
a : ↥S
g' : ι → R
hg' : ∀ i ∈ s, (algebraMap R Rₛ) (g' i) = ↑a • g i
⊢ ∑ i in s, g' i • b i = ∑ x in s, ↑a • g x • b x

Next tactic:
refine' Finset.sum_congr rfl fun i hi => _
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
  specialize hli s g' _ i hi
  · rw [← @smul_zero _ M _ _ (a : R), ← hg, Finset.smul_sum]
    refine' Finset.sum_congr rfl fun i hi => _
    

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
hli : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i✝ : ι
hi✝ : i✝ ∈ s
a : ↥S
g' : ι → R
hg' : ∀ i ∈ s, (algebraMap R Rₛ) (g' i) = ↑a • g i
i : ι
hi : i ∈ s
⊢ g' i • b i = ↑a • g i • b i

Next tactic:
rw [← IsScalarTower.algebraMap_smul Rₛ, hg' i hi, smul_assoc]
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
  specialize hli s g' _ i hi
  · rw [← @smul_zero _ M _ _ (a : R), ← hg, Finset.smul_sum]
    refine' Finset.sum_congr rfl fun i hi => _
    rw [← IsScalarTower.algebraMap_smul Rₛ, hg' i hi, smul_assoc]
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i : ι
hi : i ∈ s
a : ↥S
g' : ι → R
hg' : ∀ i ∈ s, (algebraMap R Rₛ) (g' i) = ↑a • g i
hli : g' i = 0
⊢ g i = 0

Next tactic:
refine' (IsLocalization.map_units Rₛ a).mul_right_eq_zero.mp _
theorem LinearIndependent.localization {ι : Type*} {b : ι → M} (hli : LinearIndependent R b) :
    LinearIndependent Rₛ b := by
  rw [linearIndependent_iff'] at hli ⊢
  intro s g hg i hi
  choose! a g' hg' using IsLocalization.exist_integer_multiples S s g
  specialize hli s g' _ i hi
  · rw [← @smul_zero _ M _ _ (a : R), ← hg, Finset.smul_sum]
    refine' Finset.sum_congr rfl fun i hi => _
    rw [← IsScalarTower.algebraMap_smul Rₛ, hg' i hi, smul_assoc]
  refine' (IsLocalization.map_units Rₛ a).mul_right_eq_zero.mp _
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝⁶ : CommRing R
inst✝⁵ : CommRing Rₛ
inst✝⁴ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : Module R M
inst✝¹ : Module Rₛ M
inst✝ : IsScalarTower R Rₛ M
ι : Type u_4
b : ι → M
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • b i = 0
i : ι
hi : i ∈ s
a : ↥S
g' : ι → R
hg' : ∀ i ∈ s, (algebraMap R Rₛ) (g' i) = ↑a • g i
hli : g' i = 0
⊢ (algebraMap R Rₛ) ↑a * g i = 0

Next tactic:
rw [← Algebra.smul_def, ← map_zero (algebraMap R Rₛ), ← hli, hg' i hi]
theorem LinearIndependent.localization_localization {ι : Type*} {v : ι → A}
    (hv : LinearIndependent R v) : LinearIndependent Rₛ (algebraMap A Aₛ ∘ v) := by
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
v : ι → A
hv : LinearIndependent R v
⊢ LinearIndependent Rₛ (⇑(algebraMap A Aₛ) ∘ v)

Next tactic:
rw [linearIndependent_iff'] at hv ⊢
theorem LinearIndependent.localization_localization {ι : Type*} {v : ι → A}
    (hv : LinearIndependent R v) : LinearIndependent Rₛ (algebraMap A Aₛ ∘ v) := by
  rw [linearIndependent_iff'] at hv ⊢
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
v : ι → A
hv : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • v i = 0 → ∀ i ∈ s, g i = 0
⊢ ∀ (s : Finset ι) (g : ι → Rₛ), ∑ i in s, g i • (⇑(algebraMap A Aₛ) ∘ v) i = 0 → ∀ i ∈ s, g i = 0

Next tactic:
intro s g hg i hi
theorem LinearIndependent.localization_localization {ι : Type*} {v : ι → A}
    (hv : LinearIndependent R v) : LinearIndependent Rₛ (algebraMap A Aₛ ∘ v) := by
  rw [linearIndependent_iff'] at hv ⊢
  intro s g hg i hi
  

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
v : ι → A
hv : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • v i = 0 → ∀ i ∈ s, g i = 0
s : Finset ι
g : ι → Rₛ
hg : ∑ i in s, g i • (⇑(algebraMap A Aₛ) ∘ v) i = 0
i : ι
hi : i ∈ s
⊢ g i = 0

Next tactic:
choose! a g' hg' using IsLocalization.exist_integer_multiples S s g