Theorem: Poly.sumsq_eq_zero
File: Mathlib/NumberTheory/Dioph.lean

tactic: rw [List.forall_cons, ← sumsq_eq_zero _ ps]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
⊢ (sumsq (p :: ps)) x = 0 ↔ List.Forall (fun a => a x = 0) (p :: ps)
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
⊢ (sumsq (p :: ps)) x = 0 ↔ p x = 0 ∧ (sumsq ps) x = 0

tactic: rw [sumsq]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
⊢ (sumsq (p :: ps)) x = 0 ↔ p x = 0 ∧ (sumsq ps) x = 0
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
⊢ (p * p + sumsq ps) x = 0 ↔ p x = 0 ∧ (sumsq ps) x = 0

tactic: exact
  ⟨fun h : p x * p x + sumsq ps x = 0 =>
    have : p x = 0 :=
      eq_zero_of_mul_self_eq_zero <|
        le_antisymm
          (by
            rw [← h]
            have t := add_le_add_left (sumsq_nonneg x ps) (p x * p x)
            rwa [add_zero] at t)
          (mul_self_nonneg _)
    ⟨this, by simp [this] at h; exact h⟩,
  fun ⟨h1, h2⟩ => by rw [add_apply, mul_apply, h1, h2]; rfl⟩
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
⊢ (p * p + sumsq ps) x = 0 ↔ p x = 0 ∧ (sumsq ps) x = 0
state_after: no goals

tactic: rw [← h]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
h : p x * p x + (sumsq ps) x = 0
⊢ p x * p x ≤ 0
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
h : p x * p x + (sumsq ps) x = 0
⊢ p x * p x ≤ p x * p x + (sumsq ps) x

tactic: have t := add_le_add_left (sumsq_nonneg x ps) (p x * p x)
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
h : p x * p x + (sumsq ps) x = 0
⊢ p x * p x ≤ p x * p x + (sumsq ps) x
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
h : p x * p x + (sumsq ps) x = 0
t : p x * p x + 0 ≤ p x * p x + (sumsq ps) x
⊢ p x * p x ≤ p x * p x + (sumsq ps) x

tactic: rwa [add_zero] at t
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
h : p x * p x + (sumsq ps) x = 0
t : p x * p x + 0 ≤ p x * p x + (sumsq ps) x
⊢ p x * p x ≤ p x * p x + (sumsq ps) x
state_after: no goals

tactic: simp [this] at h
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
h : p x * p x + (sumsq ps) x = 0
this : p x = 0
⊢ (sumsq ps) x = 0
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
this : p x = 0
h : (sumsq ps) x = 0
⊢ (sumsq ps) x = 0

tactic: exact h
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
this : p x = 0
h : (sumsq ps) x = 0
⊢ (sumsq ps) x = 0
state_after: no goals

tactic: rw [add_apply, mul_apply, h1, h2]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
x✝ : p x = 0 ∧ (sumsq ps) x = 0
h1 : p x = 0
h2 : (sumsq ps) x = 0
⊢ (p * p + sumsq ps) x = 0
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
x✝ : p x = 0 ∧ (sumsq ps) x = 0
h1 : p x = 0
h2 : (sumsq ps) x = 0
⊢ 0 * 0 + 0 = 0

tactic: rfl
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
x : α → ℕ
p : Poly α
ps : List (Poly α)
x✝ : p x = 0 ∧ (sumsq ps) x = 0
h1 : p x = 0
h2 : (sumsq ps) x = 0
⊢ 0 * 0 + 0 = 0
state_after: no goals