Theorem: Polynomial.IsUnitTrinomial.irreducible_aux1
File: Mathlib/Data/Polynomial/UnitTrinomial.lean

tactic: have key : n - m + k < n := by rwa [← lt_tsub_iff_right, tsub_lt_tsub_iff_left_of_le hmn.le]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
⊢ ↑C ↑v * (↑C ↑u * X ^ (m + n) + ↑C ↑w * X ^ (n - m + k + n)) =
    { toFinsupp := Finsupp.filter (Set.Ioo (k + n) (n + n)) (p * mirror p).toFinsupp }

tactic: rw [hp, trinomial_mirror hkm hmn u.ne_zero w.ne_zero]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * (↑C ↑u * X ^ (m + n) + ↑C ↑w * X ^ (n - m + k + n)) =
    { toFinsupp := Finsupp.filter (Set.Ioo (k + n) (n + n)) (p * mirror p).toFinsupp }

tactic: simp_rw [trinomial_def, C_mul_X_pow_eq_monomial, add_mul, mul_add, monomial_mul_monomial,
  toFinsupp_add, toFinsupp_monomial, Finsupp.filter_add]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * (↑C ↑u * X ^ (m + n) + ↑C ↑w * X ^ (n - m + k + n)) =
    {
      toFinsupp :=
        Finsupp.filter (Set.Ioo (k + n) (n + n))
          (trinomial k m n ↑u ↑v ↑w * trinomial k (n - m + k) n ↑w ↑v ↑u).toFinsupp }

tactic: rw [Finsupp.filter_add, Finsupp.filter_add, Finsupp.filter_add, Finsupp.filter_add,
  Finsupp.filter_add, Finsupp.filter_add, Finsupp.filter_add, Finsupp.filter_add]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * ↑(monomial (m + n)) ↑u + ↑C ↑v * ↑(monomial (n - m + k + n)) ↑w =
    {
      toFinsupp :=
        Finsupp.filter (Set.Ioo (k + n) (n + n))
          (Finsupp.single (k + k) (↑u * ↑w) + Finsupp.single (k + (n - m + k)) (↑u * ↑v) +
                Finsupp.single (k + n) (↑u * ↑u) +
              (Finsupp.single (m + k) (↑v * ↑w) + Finsupp.single (m + (n - m + k)) (↑v * ↑v) +
                Finsupp.single (m + n) (↑v * ↑u)) +
            (Finsupp.single (n + k) (↑w * ↑w) + Finsupp.single (n + (n - m + k)) (↑w * ↑v) +
              Finsupp.single (n + n) (↑w * ↑u))) }

tactic: rw [Finsupp.filter_single_of_neg, Finsupp.filter_single_of_neg, Finsupp.filter_single_of_neg,
  Finsupp.filter_single_of_neg, Finsupp.filter_single_of_neg, Finsupp.filter_single_of_pos,
  Finsupp.filter_single_of_neg, Finsupp.filter_single_of_pos, Finsupp.filter_single_of_neg]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * ↑(monomial (m + n)) ↑u + ↑C ↑v * ↑(monomial (n - m + k + n)) ↑w =
    {
      toFinsupp :=
        Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (k + k) (↑u * ↑w)) +
                Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (k + (n - m + k)) (↑u * ↑v)) +
              Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (k + n) (↑u * ↑u)) +
            (Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (m + k) (↑v * ↑w)) +
                Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (m + (n - m + k)) (↑v * ↑v)) +
              Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (m + n) (↑v * ↑u))) +
          (Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (n + k) (↑w * ↑w)) +
              Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (n + (n - m + k)) (↑w * ↑v)) +
            Finsupp.filter (Set.Ioo (k + n) (n + n)) (Finsupp.single (n + n) (↑w * ↑u))) }

tactic: rwa [← lt_tsub_iff_right, tsub_lt_tsub_iff_left_of_le hmn.le]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
⊢ n - m + k < n

tactic: simp only [add_zero, zero_add, ofFinsupp_add, ofFinsupp_single]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * ↑(monomial (m + n)) ↑u + ↑C ↑v * ↑(monomial (n - m + k + n)) ↑w =
    {
      toFinsupp :=
        0 + 0 + 0 + (0 + 0 + Finsupp.single (m + n) (↑v * ↑u)) + (0 + Finsupp.single (n + (n - m + k)) (↑w * ↑v) + 0) }

tactic: rw [ofFinsupp_add]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * ↑(monomial (m + n)) ↑u + ↑C ↑v * ↑(monomial (n - m + k + n)) ↑w =
    { toFinsupp := Finsupp.single (m + n) (↑v * ↑u) + Finsupp.single (n + (n - m + k)) (↑w * ↑v) }

tactic: simp only [ofFinsupp_single]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * ↑(monomial (m + n)) ↑u + ↑C ↑v * ↑(monomial (n - m + k + n)) ↑w =
    { toFinsupp := Finsupp.single (m + n) (↑v * ↑u) } + { toFinsupp := Finsupp.single (n + (n - m + k)) (↑w * ↑v) }

tactic: rw [C_mul_monomial, C_mul_monomial, mul_comm (v : ℤ) w, add_comm (n - m + k) n]
state_before: p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ↑C ↑v * ↑(monomial (m + n)) ↑u + ↑C ↑v * ↑(monomial (n - m + k + n)) ↑w =
    ↑(monomial (m + n)) (↑v * ↑u) + ↑(monomial (n + (n - m + k))) (↑w * ↑v)

tactic: exact fun h => h.2.ne rfl
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (n + n)

tactic: refine' ⟨_, add_lt_add_left key n⟩
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ Set.Ioo (k + n) (n + n) (n + (n - m + k))

tactic: rwa [add_comm, add_lt_add_iff_left, lt_add_iff_pos_left, tsub_pos_iff_lt]
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ k + n < n + (n - m + k)

tactic: exact fun h => h.1.ne (add_comm k n)
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (n + k)

tactic: exact ⟨add_lt_add_right hkm n, add_lt_add_right hmn n⟩
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ Set.Ioo (k + n) (n + n) (m + n)

tactic: rw [← add_assoc, add_tsub_cancel_of_le hmn.le, add_comm]
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (m + (n - m + k))

tactic: exact fun h => h.1.ne rfl
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (n + k) (n + n) (n + k)

tactic: intro h
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (m + k)

tactic: have := h.1
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
h : Set.Ioo (k + n) (n + n) (m + k)
⊢ False

tactic: rw [add_comm, add_lt_add_iff_right] at this
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
h : Set.Ioo (k + n) (n + n) (m + k)
this : k + n < m + k
⊢ False

tactic: exact asymm this hmn
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
h : Set.Ioo (k + n) (n + n) (m + k)
this : n < m
⊢ False

tactic: exact fun h => h.1.ne rfl
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (k + n)

tactic: exact fun h => asymm ((add_lt_add_iff_left k).mp h.1) key
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (k + (n - m + k))

tactic: exact fun h => asymm ((add_lt_add_iff_left k).mp h.1) (hkm.trans hmn)
state_before: case h
p q : ℤ[X]
k m n : ℕ
hkm : k < m
hmn : m < n
u v w : ℤˣ
hp : p = trinomial k m n ↑u ↑v ↑w
key : n - m + k < n
⊢ ¬Set.Ioo (k + n) (n + n) (k + k)