Theorem: IsLocalization.integerNormalization_spec
File: Mathlib/RingTheory/Localization/Integral.lean

tactic: use Classical.choose (exist_integer_multiples_of_finset M (p.support.image p.coeff))
state_before: R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
⊢ ∃ b, ∀ (i : ℕ), (algebraMap R S) ((integerNormalization M p).coeff i) = ↑b • p.coeff i
state_after: case h
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
⊢ ∀ (i : ℕ), (algebraMap R S) ((integerNormalization M p).coeff i) = ↑(Classical.choose ⋯) • p.coeff i

tactic: intro i
state_before: case h
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
⊢ ∀ (i : ℕ), (algebraMap R S) ((integerNormalization M p).coeff i) = ↑(Classical.choose ⋯) • p.coeff i
state_after: case h
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
⊢ (algebraMap R S) ((integerNormalization M p).coeff i) = ↑(Classical.choose ⋯) • p.coeff i

tactic: rw [integerNormalization_coeff, coeffIntegerNormalization]
state_before: case h
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
⊢ (algebraMap R S) ((integerNormalization M p).coeff i) = ↑(Classical.choose ⋯) • p.coeff i
state_after: case h
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
⊢ (algebraMap R S) (if hi : i ∈ p.support then Classical.choose ⋯ else 0) = ↑(Classical.choose ⋯) • p.coeff i

tactic: split_ifs with hi
state_before: case h
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
⊢ (algebraMap R S) (if hi : i ∈ p.support then Classical.choose ⋯ else 0) = ↑(Classical.choose ⋯) • p.coeff i
state_after: case pos
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
hi : i ∈ p.support
⊢ (algebraMap R S) (Classical.choose ⋯) = ↑(Classical.choose ⋯) • p.coeff i

case neg
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
hi : i ∉ p.support
⊢ (algebraMap R S) 0 = ↑(Classical.choose ⋯) • p.coeff i

tactic: exact
  Classical.choose_spec
    (Classical.choose_spec (exist_integer_multiples_of_finset M (p.support.image p.coeff))
      (p.coeff i) (Finset.mem_image.mpr ⟨i, hi, rfl⟩))
state_before: case pos
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
hi : i ∈ p.support
⊢ (algebraMap R S) (Classical.choose ⋯) = ↑(Classical.choose ⋯) • p.coeff i
state_after: no goals

tactic: rw [RingHom.map_zero, not_mem_support_iff.mp hi, smul_zero]
state_before: case neg
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
inst✝ : IsLocalization M S
p : S[X]
i : ℕ
hi : i ∉ p.support
⊢ (algebraMap R S) 0 = ↑(Classical.choose ⋯) • p.coeff i
state_after: no goals