Theorem: DivisorChain.card_subset_divisors_le_length_of_chain
File: Mathlib/RingTheory/ChainOfDivisors.lean

tactic: 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_card fun x hx => mem_image x <| hm x hx).trans Finset.card_image_le
state_before: 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 ∈ m, r ≤ q
⊢ m.card ≤ n + 1
state_after: no goals

tactic: 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⟩
state_before: 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 ∈ m, r ≤ q
⊢ m.card ≤ n + 1
state_after: 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 ∈ m, r ≤ q
mem_image : ∀ r ≤ q, r ∈ Finset.image c Finset.univ
⊢ m.card ≤ n + 1

tactic: rw [← Finset.card_fin (n + 1)]
state_before: 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 ∈ m, r ≤ q
mem_image : ∀ r ≤ q, r ∈ Finset.image c Finset.univ
⊢ m.card ≤ n + 1
state_after: 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 ∈ m, r ≤ q
mem_image : ∀ r ≤ q, r ∈ Finset.image c Finset.univ
⊢ m.card ≤ Finset.univ.card

tactic: exact (Finset.card_le_card fun x hx => mem_image x <| hm x hx).trans Finset.card_image_le
state_before: 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 ∈ m, r ≤ q
mem_image : ∀ r ≤ q, r ∈ Finset.image c Finset.univ
⊢ m.card ≤ Finset.univ.card
state_after: no goals

tactic: intro r hr
state_before: 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 ∈ m, r ≤ q
⊢ ∀ r ≤ q, r ∈ Finset.image c Finset.univ
state_after: 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 ∈ m, r ≤ q
r : Associates M
hr : r ≤ q
⊢ r ∈ Finset.image c Finset.univ

tactic: obtain ⟨i, hi⟩ := h₂.1 hr
state_before: 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 ∈ m, r ≤ q
r : Associates M
hr : r ≤ q
⊢ r ∈ Finset.image c Finset.univ
state_after: 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 ∈ m, r ≤ q
r : Associates M
hr : r ≤ q
i : Fin (n + 1)
hi : r = c i
⊢ r ∈ Finset.image c Finset.univ

tactic: exact Finset.mem_image.2 ⟨i, Finset.mem_univ _, hi.symm⟩
state_before: 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 ∈ m, r ≤ q
r : Associates M
hr : r ≤ q
i : Fin (n + 1)
hi : r = c i
⊢ r ∈ Finset.image c Finset.univ
state_after: no goals