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

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

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) → f.support.card ≤ 1

tactic: intro H
state_before: case mp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
⊢ f.support.card ≤ 1 → ∃ n a, f = (monomial n) a
state_after: case mp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
H : f.support.card ≤ 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 : f.support.card ≤ 1
⊢ ∃ n a, f = (monomial n) a
state_after: case mp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q r f : R[X]
H : ∃ x, f.support ⊆ {x}
⊢ ∃ 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, f.support ⊆ {x}
⊢ ∃ n a, f = (monomial n) a
state_after: case mp.intro
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
⊢ ∃ 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 : f.support ⊆ {n}
⊢ ∃ n a, f = (monomial n) a
state_after: case mp.intro
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
⊢ f = (monomial n) (f.coeff n)

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 : f.support ⊆ {n}
⊢ f = (monomial n) (f.coeff n)
state_after: case mp.intro.a
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
i : ℕ
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff i

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 : f.support ⊆ {n}
i : ℕ
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff i
state_after: case pos
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
i : ℕ
hi : i = n
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff i

case neg
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff 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 : f.support ⊆ {n}
i : ℕ
hi : i = n
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff i
state_after: no goals

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 : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff i
state_after: case neg
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
this : f.coeff i = 0
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff 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 : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
this : f.coeff i = 0
⊢ f.coeff i = ((monomial n) (f.coeff n)).coeff i
state_after: no goals

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 : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ f.coeff i = 0
state_after: R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r f : R[X]
n : ℕ
hn : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ i ∉ f.support

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 : f.support ⊆ {n}
i : ℕ
hi : ¬i = n
⊢ i ∉ f.support
state_after: no goals

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) → f.support.card ≤ 1
state_after: case mpr.intro.intro
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r : R[X]
n : ℕ
a : R
⊢ ((monomial n) a).support.card ≤ 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
⊢ ((monomial n) a).support.card ≤ 1
state_after: case mpr.intro.intro
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r : R[X]
n : ℕ
a : R
⊢ ((monomial n) a).support.card ≤ {n}.card

tactic: apply Finset.card_le_card
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
⊢ ((monomial n) a).support.card ≤ {n}.card
state_after: case mpr.intro.intro.a
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q r : R[X]
n : ℕ
a : R
⊢ ((monomial n) a).support ⊆ {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
⊢ ((monomial n) a).support ⊆ {n}
state_after: no goals