no goals
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
⊢ Finset.card m ≤ n + 1
classical
  have mem_image : ∀ r : Associates M, r ≤ q → r ∈ Finset.univ.image c := by
    intro r hr
    obtain ⟨i, hi⟩ := h₂.1 hr
    exact Finset.mem_image.2 ⟨i, Finset.mem_univ _, hi.symm⟩
  rw [← Finset.card_fin (n + 1)]
  exact (Finset.card_le_of_subset fun x hx => mem_image x <| hm x hx).trans Finset.card_image_le
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
mem_image : ∀ (r : Associates M), r ≤ q → r ∈ Finset.image c Finset.univ
⊢ Finset.card m ≤ n + 1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
⊢ Finset.card m ≤ n + 1
have mem_image : ∀ r : Associates M, r ≤ q → r ∈ Finset.univ.image c := by
  intro r hr
  obtain ⟨i, hi⟩ := h₂.1 hr
  exact Finset.mem_image.2 ⟨i, Finset.mem_univ _, hi.symm⟩
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
mem_image : ∀ (r : Associates M), r ≤ q → r ∈ Finset.image c Finset.univ
⊢ Finset.card m ≤ Finset.card Finset.univ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
mem_image : ∀ (r : Associates M), r ≤ q → r ∈ Finset.image c Finset.univ
⊢ Finset.card m ≤ n + 1
rw [← Finset.card_fin (n + 1)]
no goals
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
mem_image : ∀ (r : Associates M), r ≤ q → r ∈ Finset.image c Finset.univ
⊢ Finset.card m ≤ Finset.card Finset.univ
exact (Finset.card_le_of_subset fun x hx => mem_image x <| hm x hx).trans Finset.card_image_le
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
r : Associates M
hr : r ≤ q
⊢ r ∈ Finset.image c Finset.univ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
⊢ ∀ (r : Associates M), r ≤ q → r ∈ Finset.image c Finset.univ
intro r hr
case intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
r : Associates M
hr : r ≤ q
i : Fin (n + 1)
hi : r = c i
⊢ r ∈ Finset.image c Finset.univ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
r : Associates M
hr : r ≤ q
⊢ r ∈ Finset.image c Finset.univ
obtain ⟨i, hi⟩ := h₂.1 hr
no goals
case intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
n : ℕ
c : Fin (n + 1) → Associates M
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
m : Finset (Associates M)
hm : ∀ (r : Associates M), r ∈ m → r ≤ q
r : Associates M
hr : r ≤ q
i : Fin (n + 1)
hi : r = c i
⊢ r ∈ Finset.image c Finset.univ
exact Finset.mem_image.2 ⟨i, Finset.mem_univ _, hi.symm⟩