l3lab/ntp-mathlib huggingface dataset:
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  

Proof state:
case a.a
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
⊢ (∀ zI ∈ ↑(integralRep ↑I),
      ∃ zJ ∈ ↑I, (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * zJ = zI) ∧
    ∀ z ∈ ↑I, (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * z ∈ ↑(integralRep ↑I)

Next tactic:
constructor
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · 

Proof state:
case a.a.left
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
⊢ ∀ zI ∈ ↑(integralRep ↑I),
    ∃ zJ ∈ ↑I, (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * zJ = zI

Next tactic:
intro zJ' hzJ'
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    

Proof state:
case a.a.left
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zJ' : FractionRing R
hzJ' : zJ' ∈ ↑(integralRep ↑I)
⊢ ∃ zJ ∈ ↑I, (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * zJ = zJ'

Next tactic:
obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    

Proof state:
case a.a.left.intro.intro
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zJ : R
hzJ : zJ ∈ integralRep ↑I
hzJ' : (algebraMap R (FractionRing R)) zJ ∈ ↑(integralRep ↑I)
⊢ ∃ zJ_1 ∈ ↑I,
    (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * zJ_1 =
      (algebraMap R (FractionRing R)) zJ

Next tactic:
refine ⟨_, hzJ, ?_⟩
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    

Proof state:
case a.a.left.intro.intro
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zJ : R
hzJ : zJ ∈ integralRep ↑I
hzJ' : (algebraMap R (FractionRing R)) zJ ∈ ↑(integralRep ↑I)
⊢ (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) *
      (((algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)))⁻¹ *
        (algebraMap R (FractionRing R)) zJ) =
    (algebraMap R (FractionRing R)) zJ

Next tactic:
rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
  · 

Proof state:
case a.a.right
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
⊢ ∀ z ∈ ↑I, (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * z ∈ ↑(integralRep ↑I)

Next tactic:
intro zI' hzI'
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
  · intro zI' hzI'
    

Proof state:
case a.a.right
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zI' : FractionRing R
hzI' : zI' ∈ ↑I
⊢ (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * zI' ∈ ↑(integralRep ↑I)

Next tactic:
obtain ⟨y, hy⟩ := ha zI' hzI'
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
  · intro zI' hzI'
    obtain ⟨y, hy⟩ := ha zI' hzI'
    

Proof state:
case a.a.right.intro
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zI' : FractionRing R
hzI' : zI' ∈ ↑I
y : R
hy : (algebraMap R (FractionRing R)) y = Exists.choose (_ : IsFractional R⁰ ↑↑I) • zI'
⊢ (algebraMap R (FractionRing R)) (Exists.choose (_ : IsFractional R⁰ ↑↑I)) * zI' ∈ ↑(integralRep ↑I)

Next tactic:
rw [← Algebra.smul_def, mem_coeIdeal]
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
  · intro zI' hzI'
    obtain ⟨y, hy⟩ := ha zI' hzI'
    rw [← Algebra.smul_def, mem_coeIdeal]
    

Proof state:
case a.a.right.intro
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zI' : FractionRing R
hzI' : zI' ∈ ↑I
y : R
hy : (algebraMap R (FractionRing R)) y = Exists.choose (_ : IsFractional R⁰ ↑↑I) • zI'
⊢ ∃ x' ∈ integralRep ↑I, (algebraMap R (FractionRing R)) x' = Exists.choose (_ : IsFractional R⁰ ↑↑I) • zI'

Next tactic:
refine' ⟨y, _, hy⟩
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
  · intro zI' hzI'
    obtain ⟨y, hy⟩ := ha zI' hzI'
    rw [← Algebra.smul_def, mem_coeIdeal]
    refine' ⟨y, _, hy⟩
    

Proof state:
case a.a.right.intro
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zI' : FractionRing R
hzI' : zI' ∈ ↑I
y : R
hy : (algebraMap R (FractionRing R)) y = Exists.choose (_ : IsFractional R⁰ ↑↑I) • zI'
⊢ y ∈ integralRep ↑I

Next tactic:
show (algebraMap R _ a)⁻¹ * algebraMap R _ y ∈ (I : FractionalIdeal R⁰ (FractionRing R))
theorem ClassGroup.mk0_integralRep [IsDedekindDomain R]
    (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) :
    ClassGroup.mk0 ⟨ClassGroup.integralRep I, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩
      = ClassGroup.mk I := by
  let a := I.1.2.choose
  have a_ne_zero' := I.1.2.choose_spec.1
  have ha := I.1.2.choose_spec.2
  have fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0 :=
    IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors a_ne_zero'
  symm
  apply Quotient.sound
  change @Setoid.r _
    (QuotientGroup.leftRel (toPrincipalIdeal R (FractionRing R)).range) _ _
  rw [canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id, MonoidHom.id_apply,
      MonoidHom.id_apply, QuotientGroup.leftRel_apply]
  refine ⟨Units.mk0 (algebraMap R _ a) fa_ne_zero, ?_⟩
  rw [_root_.eq_inv_mul_iff_mul_eq, eq_comm, mul_comm I]
  apply Units.ext
  simp only [FractionalIdeal.coe_mk0, FractionalIdeal.map_canonicalEquiv_mk0,
    Units.val_mk0, coe_toPrincipalIdeal, Units.val_mul,
    FractionalIdeal.eq_spanSingleton_mul]
  constructor
  · intro zJ' hzJ'
    obtain ⟨zJ, hzJ, rfl⟩ := (mem_coeIdeal R⁰).mp hzJ'
    refine ⟨_, hzJ, ?_⟩
    rw [← mul_assoc, mul_inv_cancel fa_ne_zero, one_mul]
  · intro zI' hzI'
    obtain ⟨y, hy⟩ := ha zI' hzI'
    rw [← Algebra.smul_def, mem_coeIdeal]
    refine' ⟨y, _, hy⟩
    show (algebraMap R _ a)⁻¹ * algebraMap R _ y ∈ (I : FractionalIdeal R⁰ (FractionRing R))
    

Proof state:
case a.a.right.intro
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
a : R := Exists.choose (_ : IsFractional R⁰ ↑↑I)
a_ne_zero' : Exists.choose (_ : IsFractional R⁰ ↑↑I) ∈ R⁰
ha : ∀ b ∈ ↑↑I, IsInteger R (Exists.choose (_ : IsFractional R⁰ ↑↑I) • b)
fa_ne_zero : (algebraMap R (FractionRing R)) a ≠ 0
zI' : FractionRing R
hzI' : zI' ∈ ↑I
y : R
hy : (algebraMap R (FractionRing R)) y = Exists.choose (_ : IsFractional R⁰ ↑↑I) • zI'
⊢ ((algebraMap R (FractionRing R)) a)⁻¹ * (algebraMap R (FractionRing R)) y ∈ ↑I

Next tactic:
rwa [hy, Algebra.smul_def, ← mul_assoc, inv_mul_cancel fa_ne_zero, one_mul]
theorem ClassGroup.mk0_surjective [IsDedekindDomain R] :
    Function.Surjective (ClassGroup.mk0 : (Ideal R)⁰ → ClassGroup R) := by
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
⊢ Function.Surjective ⇑mk0

Next tactic:
rintro ⟨I⟩
theorem ClassGroup.mk0_surjective [IsDedekindDomain R] :
    Function.Surjective (ClassGroup.mk0 : (Ideal R)⁰ → ClassGroup R) := by
  rintro ⟨I⟩
  

Proof state:
case mk
R : Type u_1
K : Type u_2
L : Type u_3
inst✝¹¹ : CommRing R
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : DecidableEq L
inst✝⁷ : Algebra R K
inst✝⁶ : IsFractionRing R K
inst✝⁵ : Algebra K L
inst✝⁴ : FiniteDimensional K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
b✝ : ClassGroup R
I : (FractionalIdeal R⁰ (FractionRing R))ˣ
⊢ ∃ a, mk0 a = Quot.mk Setoid.r I

Next tactic:
refine ⟨⟨ ClassGroup.integralRep I.1, ClassGroup.integralRep_mem_nonZeroDivisors I.ne_zero⟩, ?_⟩