Theorem: Polynomial.mirror_eval_one
File: Mathlib/Algebra/Polynomial/Mirror.lean

tactic: simp_rw [eval_eq_sum_range, one_pow, mul_one, mirror_natDegree]
state_before: R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ eval 1 p.mirror = eval 1 p
state_after: R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∑ x ∈ Finset.range (p.natDegree + 1), p.mirror.coeff x = ∑ x ∈ Finset.range (p.natDegree + 1), p.coeff x

tactic: refine Finset.sum_bij_ne_zero ?_ ?_ ?_ ?_ ?_
state_before: R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∑ x ∈ Finset.range (p.natDegree + 1), p.mirror.coeff x = ∑ x ∈ Finset.range (p.natDegree + 1), p.coeff x
state_after: case refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ (a : ℕ) → a ∈ Finset.range (p.natDegree + 1) → p.mirror.coeff a ≠ 0 → ℕ

case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ (a : ℕ) (h₁ : a ∈ Finset.range (p.natDegree + 1)) (h₂ : p.mirror.coeff a ≠ 0),
    ?refine_1 a h₁ h₂ ∈ Finset.range (p.natDegree + 1)

case refine_3
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ (a₁ : ℕ) (h₁₁ : a₁ ∈ Finset.range (p.natDegree + 1)) (h₁₂ : p.mirror.coeff a₁ ≠ 0) (a₂ : ℕ)
    (h₂₁ : a₂ ∈ Finset.range (p.natDegree + 1)) (h₂₂ : p.mirror.coeff a₂ ≠ 0),
    ?refine_1 a₁ h₁₁ h₁₂ = ?refine_1 a₂ h₂₁ h₂₂ → a₁ = a₂

case refine_4
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ b ∈ Finset.range (p.natDegree + 1),
    p.coeff b ≠ 0 → ∃ a, ∃ (h₁ : a ∈ Finset.range (p.natDegree + 1)) (h₂ : p.mirror.coeff a ≠ 0), ?refine_1 a h₁ h₂ = b

case refine_5
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ (a : ℕ) (h₁ : a ∈ Finset.range (p.natDegree + 1)) (h₂ : p.mirror.coeff a ≠ 0),
    p.mirror.coeff a = p.coeff (?refine_1 a h₁ h₂)

tactic: exact fun n _ _ => revAt (p.natDegree + p.natTrailingDegree) n
state_before: case refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ (a : ℕ) → a ∈ Finset.range (p.natDegree + 1) → p.mirror.coeff a ≠ 0 → ℕ
state_after: no goals

tactic: intro n hn hp
state_before: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ a ∈ Finset.range (p.natDegree + 1),
    p.mirror.coeff a ≠ 0 → (revAt (p.natDegree + p.natTrailingDegree)) a ∈ Finset.range (p.natDegree + 1)
state_after: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.mirror.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ∈ Finset.range (p.natDegree + 1)

tactic: rw [Finset.mem_range_succ_iff] at *
state_before: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.mirror.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ∈ Finset.range (p.natDegree + 1)
state_after: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.mirror.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ≤ p.natDegree

tactic: rw [revAt_le (hn.trans (Nat.le_add_right _ _))]
state_before: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.mirror.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ≤ p.natDegree
state_after: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.mirror.coeff n ≠ 0
⊢ p.natDegree + p.natTrailingDegree - n ≤ p.natDegree

tactic: rw [tsub_le_iff_tsub_le, add_comm, add_tsub_cancel_right, ← mirror_natTrailingDegree]
state_before: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.mirror.coeff n ≠ 0
⊢ p.natDegree + p.natTrailingDegree - n ≤ p.natDegree
state_after: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.mirror.coeff n ≠ 0
⊢ p.mirror.natTrailingDegree ≤ n

tactic: exact natTrailingDegree_le_of_ne_zero hp
state_before: case refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.mirror.coeff n ≠ 0
⊢ p.mirror.natTrailingDegree ≤ n
state_after: no goals

tactic: exact fun n₁ _ _ _ _ _ h => by rw [← @revAt_invol _ n₁, h, revAt_invol]
state_before: case refine_3
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ a₁ ∈ Finset.range (p.natDegree + 1),
    p.mirror.coeff a₁ ≠ 0 →
      ∀ a₂ ∈ Finset.range (p.natDegree + 1),
        p.mirror.coeff a₂ ≠ 0 →
          (revAt (p.natDegree + p.natTrailingDegree)) a₁ = (revAt (p.natDegree + p.natTrailingDegree)) a₂ → a₁ = a₂
state_after: no goals

tactic: rw [← @revAt_invol _ n₁, h, revAt_invol]
state_before: R : Type u_1
inst✝ : Semiring R
p q : R[X]
n₁ : ℕ
x✝⁴ : n₁ ∈ Finset.range (p.natDegree + 1)
x✝³ : p.mirror.coeff n₁ ≠ 0
x✝² : ℕ
x✝¹ : x✝² ∈ Finset.range (p.natDegree + 1)
x✝ : p.mirror.coeff x✝² ≠ 0
h : (revAt (p.natDegree + p.natTrailingDegree)) n₁ = (revAt (p.natDegree + p.natTrailingDegree)) x✝²
⊢ n₁ = x✝²
state_after: no goals

tactic: intro n hn hp
state_before: case refine_4
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ b ∈ Finset.range (p.natDegree + 1),
    p.coeff b ≠ 0 →
      ∃ a,
        ∃ (_ : a ∈ Finset.range (p.natDegree + 1)) (_ : p.mirror.coeff a ≠ 0),
          (revAt (p.natDegree + p.natTrailingDegree)) a = b
state_after: case refine_4
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ ∃ a,
    ∃ (_ : a ∈ Finset.range (p.natDegree + 1)) (_ : p.mirror.coeff a ≠ 0),
      (revAt (p.natDegree + p.natTrailingDegree)) a = n

tactic: use revAt (p.natDegree + p.natTrailingDegree) n
state_before: case refine_4
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ ∃ a,
    ∃ (_ : a ∈ Finset.range (p.natDegree + 1)) (_ : p.mirror.coeff a ≠ 0),
      (revAt (p.natDegree + p.natTrailingDegree)) a = n
state_after: case h
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ ∃ (_ : (revAt (p.natDegree + p.natTrailingDegree)) n ∈ Finset.range (p.natDegree + 1)) (_ :
    p.mirror.coeff ((revAt (p.natDegree + p.natTrailingDegree)) n) ≠ 0),
    (revAt (p.natDegree + p.natTrailingDegree)) ((revAt (p.natDegree + p.natTrailingDegree)) n) = n

tactic: refine ⟨?_, ?_, revAt_invol⟩
state_before: case h
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ ∃ (_ : (revAt (p.natDegree + p.natTrailingDegree)) n ∈ Finset.range (p.natDegree + 1)) (_ :
    p.mirror.coeff ((revAt (p.natDegree + p.natTrailingDegree)) n) ≠ 0),
    (revAt (p.natDegree + p.natTrailingDegree)) ((revAt (p.natDegree + p.natTrailingDegree)) n) = n
state_after: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ∈ Finset.range (p.natDegree + 1)

case h.refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ p.mirror.coeff ((revAt (p.natDegree + p.natTrailingDegree)) n) ≠ 0

tactic: rw [Finset.mem_range_succ_iff] at *
state_before: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ∈ Finset.range (p.natDegree + 1)
state_after: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ≤ p.natDegree

tactic: rw [revAt_le (hn.trans (Nat.le_add_right _ _))]
state_before: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.coeff n ≠ 0
⊢ (revAt (p.natDegree + p.natTrailingDegree)) n ≤ p.natDegree
state_after: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.coeff n ≠ 0
⊢ p.natDegree + p.natTrailingDegree - n ≤ p.natDegree

tactic: rw [tsub_le_iff_tsub_le, add_comm, add_tsub_cancel_right]
state_before: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.coeff n ≠ 0
⊢ p.natDegree + p.natTrailingDegree - n ≤ p.natDegree
state_after: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.coeff n ≠ 0
⊢ p.natTrailingDegree ≤ n

tactic: exact natTrailingDegree_le_of_ne_zero hp
state_before: case h.refine_1
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ≤ p.natDegree
hp : p.coeff n ≠ 0
⊢ p.natTrailingDegree ≤ n
state_after: no goals

tactic: rwa [coeff_mirror, revAt_invol]
state_before: case h.refine_2
R : Type u_1
inst✝ : Semiring R
p q : R[X]
n : ℕ
hn : n ∈ Finset.range (p.natDegree + 1)
hp : p.coeff n ≠ 0
⊢ p.mirror.coeff ((revAt (p.natDegree + p.natTrailingDegree)) n) ≠ 0
state_after: no goals

tactic: exact fun n _ _ => p.coeff_mirror n
state_before: case refine_5
R : Type u_1
inst✝ : Semiring R
p q : R[X]
⊢ ∀ a ∈ Finset.range (p.natDegree + 1),
    p.mirror.coeff a ≠ 0 → p.mirror.coeff a = p.coeff ((revAt (p.natDegree + p.natTrailingDegree)) a)
state_after: no goals