Theorem: Polynomial.IsWeaklyEisensteinAt.exists_mem_adjoin_mul_eq_pow_natDegree
File: Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean

tactic: rw [aeval_def, Polynomial.eval₂_eq_eval_map, eval_eq_sum_range, range_add_one,
  sum_insert not_mem_range_self, sum_range, (hmo.map (algebraMap R S)).coeff_natDegree,
  one_mul] at hx
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hx : ↑(aeval x) f = 0
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
⊢ ∃ y, y ∈ adjoin R {x} ∧ ↑(algebraMap R S) p * y = x ^ natDegree (Polynomial.map (algebraMap R S) f)

tactic: replace hx := eq_neg_of_add_eq_zero_left hx
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) +
      ∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), coeff (Polynomial.map (algebraMap R S) f) ↑i * x ^ ↑i =
    0
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
⊢ ∃ y, y ∈ adjoin R {x} ∧ ↑(algebraMap R S) p * y = x ^ natDegree (Polynomial.map (algebraMap R S) f)

tactic: have : ∀ n < f.natDegree, p ∣ f.coeff n := by
  intro n hn
  refine' mem_span_singleton.1 (by simpa using hf.mem hn)
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), coeff (Polynomial.map (algebraMap R S) f) ↑i * x ^ ↑i
⊢ ∃ y, y ∈ adjoin R {x} ∧ ↑(algebraMap R S) p * y = x ^ natDegree (Polynomial.map (algebraMap R S) f)

tactic: choose! φ hφ using this
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), coeff (Polynomial.map (algebraMap R S) f) ↑i * x ^ ↑i
this : ∀ (n : ℕ), n < natDegree f → p ∣ coeff f n
⊢ ∃ y, y ∈ adjoin R {x} ∧ ↑(algebraMap R S) p * y = x ^ natDegree (Polynomial.map (algebraMap R S) f)

tactic: rw [hx, ← mul_sum, neg_eq_neg_one_mul, ← mul_assoc (-1 : S), mul_comm (-1 : S), mul_assoc]
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
φ : ℕ → R
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)),
        ↑(algebraMap R S) p * (↑(algebraMap R S) (φ ↑i) * x ^ ↑i)
hφ : ∀ (n : ℕ), n < natDegree f → coeff f n = p * φ n
⊢ ∃ y, y ∈ adjoin R {x} ∧ ↑(algebraMap R S) p * y = x ^ natDegree (Polynomial.map (algebraMap R S) f)

tactic: refine'
  ⟨-1 * ∑ i : Fin (f.map (algebraMap R S)).natDegree, (algebraMap R S) (φ i.1) * x ^ i.1, _, rfl⟩
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
φ : ℕ → R
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)),
        ↑(algebraMap R S) p * (↑(algebraMap R S) (φ ↑i) * x ^ ↑i)
hφ : ∀ (n : ℕ), n < natDegree f → coeff f n = p * φ n
⊢ ∃ y,
    y ∈ adjoin R {x} ∧
      ↑(algebraMap R S) p * y =
        ↑(algebraMap R S) p *
          (-1 * ∑ x_1 : Fin (natDegree (Polynomial.map (algebraMap R S) f)), ↑(algebraMap R S) (φ ↑x_1) * x ^ ↑x_1)

tactic: exact
  Subalgebra.mul_mem _ (Subalgebra.neg_mem _ (Subalgebra.one_mem _))
    (Subalgebra.sum_mem _ fun i _ =>
      Subalgebra.mul_mem _ (Subalgebra.algebraMap_mem _ _)
        (Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton x)) _))
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
φ : ℕ → R
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)),
        ↑(algebraMap R S) p * (↑(algebraMap R S) (φ ↑i) * x ^ ↑i)
hφ : ∀ (n : ℕ), n < natDegree f → coeff f n = p * φ n
⊢ -1 * ∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), ↑(algebraMap R S) (φ ↑i) * x ^ ↑i ∈ adjoin R {x}

tactic: intro n hn
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), coeff (Polynomial.map (algebraMap R S) f) ↑i * x ^ ↑i
⊢ ∀ (n : ℕ), n < natDegree f → p ∣ coeff f n

tactic: refine' mem_span_singleton.1 (by simpa using hf.mem hn)
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), coeff (Polynomial.map (algebraMap R S) f) ↑i * x ^ ↑i
n : ℕ
hn : n < natDegree f
⊢ p ∣ coeff f n

tactic: simpa using hf.mem hn
state_before: R : Type u
inst✝² : CommRing R
𝓟 : Ideal R
f : R[X]
hf✝ : IsWeaklyEisensteinAt f 𝓟
S : Type v
inst✝¹ : CommRing S
inst✝ : Algebra R S
p : R
x : S
hmo : Monic f
hf : IsWeaklyEisensteinAt f (Submodule.span R {p})
hx :
  x ^ natDegree (Polynomial.map (algebraMap R S) f) =
    -∑ i : Fin (natDegree (Polynomial.map (algebraMap R S) f)), coeff (Polynomial.map (algebraMap R S) f) ↑i * x ^ ↑i
n : ℕ
hn : n < natDegree f
⊢ coeff f n ∈ span {p}