Theorem: Polynomial.card_support_le_one_iff_monomial
File: Mathlib/Data/Polynomial/Monomial.lean

tactic: constructor
state_before: R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
⊢ Finset.card (support f) ≤ 1 ↔ ∃ n a, f = ↑(monomial n) a

tactic: intro H
state_before: case mp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
⊢ Finset.card (support f) ≤ 1 → ∃ n a, f = ↑(monomial n) a

tactic: rw [Finset.card_le_one_iff_subset_singleton] at H
state_before: case mp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
H : Finset.card (support f) ≤ 1
⊢ ∃ n a, f = ↑(monomial n) a

tactic: rcases H with ⟨n, hn⟩
state_before: case mp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
H : ∃ x, support f ⊆ {x}
⊢ ∃ n a, f = ↑(monomial n) a

tactic: refine' ⟨n, f.coeff n, _⟩
state_before: case mp.intro
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
⊢ ∃ n a, f = ↑(monomial n) a

tactic: ext i
state_before: case mp.intro
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
⊢ f = ↑(monomial n) (coeff f n)

tactic: by_cases hi : i = n
state_before: case mp.intro.a
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
i : ℕ
⊢ coeff f i = coeff (↑(monomial n) (coeff f n)) i

tactic: simp [hi, coeff_monomial]
state_before: case pos
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
i : ℕ
hi : i = n
⊢ coeff f i = coeff (↑(monomial n) (coeff f n)) i

tactic: have : f.coeff i = 0 := by
  rw [← not_mem_support_iff]
  exact fun hi' => hi (Finset.mem_singleton.1 (hn hi'))
state_before: case neg
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ coeff f i = coeff (↑(monomial n) (coeff f n)) i

tactic: simp [this, Ne.symm hi, coeff_monomial]
state_before: case neg
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
i : ℕ
hi : ¬i = n
this : coeff f i = 0
⊢ coeff f i = coeff (↑(monomial n) (coeff f n)) i

tactic: rw [← not_mem_support_iff]
state_before: R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ coeff f i = 0

tactic: exact fun hi' => hi (Finset.mem_singleton.1 (hn hi'))
state_before: R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : support f ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ ¬i ∈ support f

tactic: rintro ⟨n, a, rfl⟩
state_before: case mpr
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
⊢ (∃ n a, f = ↑(monomial n) a) → Finset.card (support f) ≤ 1

tactic: rw [← Finset.card_singleton n]
state_before: case mpr.intro.intro
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r : R[X]
n : ℕ
a : R
⊢ Finset.card (support (↑(monomial n) a)) ≤ 1

tactic: apply Finset.card_le_of_subset
state_before: case mpr.intro.intro
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r : R[X]
n : ℕ
a : R
⊢ Finset.card (support (↑(monomial n) a)) ≤ Finset.card {n}

tactic: exact support_monomial' _ _
state_before: case mpr.intro.intro.a
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r : R[X]
n : ℕ
a : R
⊢ support (↑(monomial n) a) ⊆ {n}