/-- Multiplicity of the ideal norm, for powers of prime ideals. -/
theorem cardQuot_pow_of_prime [IsDedekindDomain S] [Module.Finite ℤ S] [Module.Free ℤ S] {i : ℕ} :
    cardQuot (P ^ i) = cardQuot P ^ i := by
  let _ := Module.Free.chooseBasis ℤ S
  classical
  induction' i with i ih
  · simp
  letI := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i.succ) (pow_ne_zero _ hP)
  letI := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (pow_ne_zero _ hP)
  letI := Ideal.fintypeQuotientOfFreeOfNeBot P hP
  have : P ^ (i + 1) < P ^ i := Ideal.pow_succ_lt_pow hP i
  suffices hquot : map (P ^ i.succ).mkQ (P ^ i) ≃ S ⧸ P
  · rw [pow_succ (cardQuot P), ← ih, cardQuot_apply (P ^ i.succ), ←
      card_quotient_mul_card_quotient (P ^ i) (P ^ i.succ) this.le, cardQuot_apply (P ^ i),
      cardQuot_apply P]
    congr 1
    rw [Fintype.card_eq]
    exact ⟨hquot⟩
  choose a a_mem a_not_mem using SetLike.exists_of_lt this
  choose f g hg hf using fun c (hc : c ∈ P ^ i) =>
    Ideal.exists_mul_add_mem_pow_succ hP a c a_mem a_not_mem hc
  choose k hk_mem hk_eq using fun c' (hc' : c' ∈ map (mkQ (P ^ i.succ)) (P ^ i)) =>
    Submodule.mem_map.mp hc'
  refine Equiv.ofBijective (fun c' => Quotient.mk'' (f (k c' c'.prop) (hk_mem c' c'.prop))) ⟨?_, ?_⟩
  · rintro ⟨c₁', hc₁'⟩ ⟨c₂', hc₂'⟩ h
    rw [Subtype.mk_eq_mk, ← hk_eq _ hc₁', ← hk_eq _ hc₂', mkQ_apply, mkQ_apply,
      Submodule.Quotient.eq, ← hf _ (hk_mem _ hc₁'), ← hf _ (hk_mem _ hc₂')]
    

Proof state:
case hquot.refine_1.mk.mk
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : a ∉ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
  ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), (mkQ (P ^ Nat.succ i)) (k c' hc') = c'
c₁' : S ⧸ P ^ Nat.succ i
hc₁' : c₁' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
c₂' : S ⧸ P ^ Nat.succ i
hc₂' : c₂' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
h :
  (fun c' =>
        Quotient.mk''
          (f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
            (_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
      { val := c₁', property := hc₁' } =
    (fun c' =>
        Quotient.mk''
          (f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
            (_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
      { val := c₂', property := hc₂' }
⊢ a * f (k c₁' hc₁') (_ : k c₁' hc₁' ∈ P ^ i) + g (k c₁' hc₁') (_ : k c₁' hc₁' ∈ P ^ i) -
      (a * f (k c₂' hc₂') (_ : k c₂' hc₂' ∈ P ^ i) + g (k c₂' hc₂') (_ : k c₂' hc₂' ∈ P ^ i)) ∈
    P ^ Nat.succ i

Next tactic:
refine Ideal.mul_add_mem_pow_succ_inj _ _ _ _ _ _ a_mem (hg _ _) (hg _ _) ?_