l3lab/ntp-mathlib huggingface dataset:
/-- The ring equivalence between `RingQuot r` and `(Ideal.ofRel r).quotient`
-/
def ringQuotEquivIdealQuotient (r : B → B → Prop) : RingQuot r ≃+* B ⧸ Ideal.ofRel r :=
  RingEquiv.ofHomInv (ringQuotToIdealQuotient r) (idealQuotientToRingQuot r)
    (by
      ext x
      simp_rw [ringQuotToIdealQuotient, lift_def, preLift_def, mkRingHom_def]
      change mkRingHom r x = _
      rw [mkRingHom_def]
      rfl)
    (by
      ext x
      

Proof state:
case h.a
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r✝ : R → R → Prop
inst✝¹ : Semiring T
B : Type uR
inst✝ : CommRing B
r : B → B → Prop
x : B
⊢ (RingHom.comp (RingHom.comp ↑(ringQuotToIdealQuotient r) ↑(idealQuotientToRingQuot r))
        (Ideal.Quotient.mk (Ideal.ofRel r)))
      x =
    (RingHom.comp (RingHom.id (B ⧸ Ideal.ofRel r)) (Ideal.Quotient.mk (Ideal.ofRel r))) x

Next tactic:
simp_rw [ringQuotToIdealQuotient, lift_def, preLift_def, mkRingHom_def]
/-- The ring equivalence between `RingQuot r` and `(Ideal.ofRel r).quotient`
-/
def ringQuotEquivIdealQuotient (r : B → B → Prop) : RingQuot r ≃+* B ⧸ Ideal.ofRel r :=
  RingEquiv.ofHomInv (ringQuotToIdealQuotient r) (idealQuotientToRingQuot r)
    (by
      ext x
      simp_rw [ringQuotToIdealQuotient, lift_def, preLift_def, mkRingHom_def]
      change mkRingHom r x = _
      rw [mkRingHom_def]
      rfl)
    (by
      ext x
      simp_rw [ringQuotToIdealQuotient, lift_def, preLift_def, mkRingHom_def]
      change Quot.lift _ _ ((mkRingHom r) x).toQuot = _
      

Proof state:
case h.a
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r✝ : R → R → Prop
inst✝¹ : Semiring T
B : Type uR
inst✝ : CommRing B
r : B → B → Prop
x : B
⊢ Quot.lift
      ⇑↑{ val := Ideal.Quotient.mk (Ideal.ofRel r),
            property :=
              (_ : ∀ (x y : B), r x y → (Ideal.Quotient.mk (Ideal.ofRel r)) x = (Ideal.Quotient.mk (Ideal.ofRel r)) y) }
      (_ :
        ∀ (a b : B),
          Rel r a b →
            ↑{ val := Ideal.Quotient.mk (Ideal.ofRel r),
                    property :=
                      (_ :
                        ∀ (x y : B),
                          r x y → (Ideal.Quotient.mk (Ideal.ofRel r)) x = (Ideal.Quotient.mk (Ideal.ofRel r)) y) }
                a =
              ↑{ val := Ideal.Quotient.mk (Ideal.ofRel r),
                    property :=
                      (_ :
                        ∀ (x y : B),
                          r x y → (Ideal.Quotient.mk (Ideal.ofRel r)) x = (Ideal.Quotient.mk (Ideal.ofRel r)) y) }
                b)
      ((mkRingHom r) x).toQuot =
    (RingHom.comp (RingHom.id (B ⧸ Ideal.ofRel r)) (Ideal.Quotient.mk (Ideal.ofRel r))) x

Next tactic:
rw [mkRingHom_def]
/-- The ring equivalence between `RingQuot r` and `(Ideal.ofRel r).quotient`
-/
def ringQuotEquivIdealQuotient (r : B → B → Prop) : RingQuot r ≃+* B ⧸ Ideal.ofRel r :=
  RingEquiv.ofHomInv (ringQuotToIdealQuotient r) (idealQuotientToRingQuot r)
    (by
      ext x
      simp_rw [ringQuotToIdealQuotient, lift_def, preLift_def, mkRingHom_def]
      change mkRingHom r x = _
      rw [mkRingHom_def]
      rfl)
    (by
      ext x
      simp_rw [ringQuotToIdealQuotient, lift_def, preLift_def, mkRingHom_def]
      change Quot.lift _ _ ((mkRingHom r) x).toQuot = _
      rw [mkRingHom_def]
      

Proof state:
case h.a
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r✝ : R → R → Prop
inst✝¹ : Semiring T
B : Type uR
inst✝ : CommRing B
r : B → B → Prop
x : B
⊢ Quot.lift
      ⇑↑{ val := Ideal.Quotient.mk (Ideal.ofRel r),
            property :=
              (_ : ∀ (x y : B), r x y → (Ideal.Quotient.mk (Ideal.ofRel r)) x = (Ideal.Quotient.mk (Ideal.ofRel r)) y) }
      (_ :
        ∀ (a b : B),
          Rel r a b →
            ↑{ val := Ideal.Quotient.mk (Ideal.ofRel r),
                    property :=
                      (_ :
                        ∀ (x y : B),
                          r x y → (Ideal.Quotient.mk (Ideal.ofRel r)) x = (Ideal.Quotient.mk (Ideal.ofRel r)) y) }
                a =
              ↑{ val := Ideal.Quotient.mk (Ideal.ofRel r),
                    property :=
                      (_ :
                        ∀ (x y : B),
                          r x y → (Ideal.Quotient.mk (Ideal.ofRel r)) x = (Ideal.Quotient.mk (Ideal.ofRel r)) y) }
                b)
      ({
            toMonoidHom :=
              {
                toOneHom :=
                  { toFun := fun x => { toQuot := Quot.mk (Rel r) x },
                    map_one' := (_ : { toQuot := Quot.mk (Rel r) 1 } = 1) },
                map_mul' :=
                  (_ :
                    ∀ (a a_1 : B),
                      { toQuot := Quot.mk (Rel r) (a * a_1) } =
                        { toQuot := Quot.mk (Rel r) a } * { toQuot := Quot.mk (Rel r) a_1 }) },
            map_zero' := (_ : { toQuot := Quot.mk (Rel r) 0 } = 0),
            map_add' :=
              (_ :
                ∀ (a a_1 : B),
                  { toQuot := Quot.mk (Rel r) (a + a_1) } =
                    { toQuot := Quot.mk (Rel r) a } + { toQuot := Quot.mk (Rel r) a_1 }) }
          x).toQuot =
    (RingHom.comp (RingHom.id (B ⧸ Ideal.ofRel r)) (Ideal.Quotient.mk (Ideal.ofRel r))) x

Next tactic:
rfl
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  

Proof state:
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b : R
h : Rel r a b
⊢ Rel r (Star.star a) (Star.star b)

Next tactic:
induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  | mul_left _ h  => rw [star_mul, star_mul]
                     exact Rel.mul_right h
  | mul_right _ h => rw [star_mul, star_mul]
                     exact Rel.mul_left h
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  

Proof state:
case of
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b x✝ y✝ : R
h : r x✝ y✝
⊢ Rel r (Star.star x✝) (Star.star y✝)

Next tactic:
| of h          => exact Rel.of (hr _ _ h)
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => 

Proof state:
case of
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b x✝ y✝ : R
h : r x✝ y✝
⊢ Rel r (Star.star x✝) (Star.star y✝)

Next tactic:
exact Rel.of (hr _ _ h)
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  

Proof state:
case add_left
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r a✝¹ b✝
h : Rel r (Star.star a✝¹) (Star.star b✝)
⊢ Rel r (Star.star (a✝¹ + c✝)) (Star.star (b✝ + c✝))

Next tactic:
| add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => 

Proof state:
case add_left
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r a✝¹ b✝
h : Rel r (Star.star a✝¹) (Star.star b✝)
⊢ Rel r (Star.star (a✝¹ + c✝)) (Star.star (b✝ + c✝))

Next tactic:
rw [star_add, star_add]
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     

Proof state:
case add_left
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r a✝¹ b✝
h : Rel r (Star.star a✝¹) (Star.star b✝)
⊢ Rel r (Star.star a✝¹ + Star.star c✝) (Star.star b✝ + Star.star c✝)

Next tactic:
exact Rel.add_left h
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  

Proof state:
case mul_left
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r a✝¹ b✝
h : Rel r (Star.star a✝¹) (Star.star b✝)
⊢ Rel r (Star.star (a✝¹ * c✝)) (Star.star (b✝ * c✝))

Next tactic:
| mul_left _ h  => rw [star_mul, star_mul]
                     exact Rel.mul_right h
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  | mul_left _ h  => 

Proof state:
case mul_left
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r a✝¹ b✝
h : Rel r (Star.star a✝¹) (Star.star b✝)
⊢ Rel r (Star.star (a✝¹ * c✝)) (Star.star (b✝ * c✝))

Next tactic:
rw [star_mul, star_mul]
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  | mul_left _ h  => rw [star_mul, star_mul]
                     

Proof state:
case mul_left
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r a✝¹ b✝
h : Rel r (Star.star a✝¹) (Star.star b✝)
⊢ Rel r (Star.star c✝ * Star.star a✝¹) (Star.star c✝ * Star.star b✝)

Next tactic:
exact Rel.mul_right h
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  | mul_left _ h  => rw [star_mul, star_mul]
                     exact Rel.mul_right h
  

Proof state:
case mul_right
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r b✝ c✝
h : Rel r (Star.star b✝) (Star.star c✝)
⊢ Rel r (Star.star (a✝¹ * b✝)) (Star.star (a✝¹ * c✝))

Next tactic:
| mul_right _ h => rw [star_mul, star_mul]
                     exact Rel.mul_left h
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  | mul_left _ h  => rw [star_mul, star_mul]
                     exact Rel.mul_right h
  | mul_right _ h => 

Proof state:
case mul_right
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r b✝ c✝
h : Rel r (Star.star b✝) (Star.star c✝)
⊢ Rel r (Star.star (a✝¹ * b✝)) (Star.star (a✝¹ * c✝))

Next tactic:
rw [star_mul, star_mul]
theorem Rel.star ⦃a b : R⦄ (h : Rel r a b) : Rel r (star a) (star b) := by
  induction h with
  | of h          => exact Rel.of (hr _ _ h)
  | add_left _ h  => rw [star_add, star_add]
                     exact Rel.add_left h
  | mul_left _ h  => rw [star_mul, star_mul]
                     exact Rel.mul_right h
  | mul_right _ h => rw [star_mul, star_mul]
                     

Proof state:
case mul_right
R : Type uR
inst✝⁵ : Semiring R
S : Type uS
inst✝⁴ : CommSemiring S
T : Type uT
A : Type uA
inst✝³ : Semiring A
inst✝² : Algebra S A
r : R → R → Prop
inst✝¹ : Semiring T
inst✝ : StarRing R
hr : ∀ (a b : R), r a b → r (Star.star a) (Star.star b)
a b a✝¹ b✝ c✝ : R
a✝ : Rel r b✝ c✝
h : Rel r (Star.star b✝) (Star.star c✝)
⊢ Rel r (Star.star b✝ * Star.star a✝¹) (Star.star c✝ * Star.star a✝¹)

Next tactic:
exact Rel.mul_left h
/-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/
def starRing {R : Type uR} [Semiring R] [StarRing R] (r : R → R → Prop)
    (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where
  star := star' r hr
  star_involutive := by
    

Proof state:
R✝ : Type uR
inst✝⁷ : Semiring R✝
S : Type uS
inst✝⁶ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁵ : Semiring A
inst✝⁴ : Algebra S A
r✝ : R✝ → R✝ → Prop
inst✝³ : Semiring T
inst✝² : StarRing R✝
hr✝ : ∀ (a b : R✝), r✝ a b → r✝ (star a) (star b)
R : Type uR
inst✝¹ : Semiring R
inst✝ : StarRing R
r : R → R → Prop
hr : ∀ (a b : R), r a b → r (star a) (star b)
⊢ Function.Involutive star

Next tactic:
rintro ⟨⟨⟩⟩
/-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/
def starRing {R : Type uR} [Semiring R] [StarRing R] (r : R → R → Prop)
    (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where
  star := star' r hr
  star_involutive := by
    rintro ⟨⟨⟩⟩
    

Proof state:
case mk.mk
R✝ : Type uR
inst✝⁷ : Semiring R✝
S : Type uS
inst✝⁶ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁵ : Semiring A
inst✝⁴ : Algebra S A
r✝ : R✝ → R✝ → Prop
inst✝³ : Semiring T
inst✝² : StarRing R✝
hr✝ : ∀ (a b : R✝), r✝ a b → r✝ (star a) (star b)
R : Type uR
inst✝¹ : Semiring R
inst✝ : StarRing R
r : R → R → Prop
hr : ∀ (a b : R), r a b → r (star a) (star b)
toQuot✝ : Quot (Rel r)
a✝ : R
⊢ star (star { toQuot := Quot.mk (Rel r) a✝ }) = { toQuot := Quot.mk (Rel r) a✝ }

Next tactic:
simp [star'_quot]
/-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/
def starRing {R : Type uR} [Semiring R] [StarRing R] (r : R → R → Prop)
    (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where
  star := star' r hr
  star_involutive := by
    rintro ⟨⟨⟩⟩
    simp [star'_quot]
  star_mul := by
    

Proof state:
R✝ : Type uR
inst✝⁷ : Semiring R✝
S : Type uS
inst✝⁶ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁵ : Semiring A
inst✝⁴ : Algebra S A
r✝ : R✝ → R✝ → Prop
inst✝³ : Semiring T
inst✝² : StarRing R✝
hr✝ : ∀ (a b : R✝), r✝ a b → r✝ (star a) (star b)
R : Type uR
inst✝¹ : Semiring R
inst✝ : StarRing R
r : R → R → Prop
hr : ∀ (a b : R), r a b → r (star a) (star b)
⊢ ∀ (r_1 s : RingQuot r), star (r_1 * s) = star s * star r_1

Next tactic:
rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩
/-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/
def starRing {R : Type uR} [Semiring R] [StarRing R] (r : R → R → Prop)
    (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where
  star := star' r hr
  star_involutive := by
    rintro ⟨⟨⟩⟩
    simp [star'_quot]
  star_mul := by
    rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩
    

Proof state:
case mk.mk.mk.mk
R✝ : Type uR
inst✝⁷ : Semiring R✝
S : Type uS
inst✝⁶ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁵ : Semiring A
inst✝⁴ : Algebra S A
r✝ : R✝ → R✝ → Prop
inst✝³ : Semiring T
inst✝² : StarRing R✝
hr✝ : ∀ (a b : R✝), r✝ a b → r✝ (star a) (star b)
R : Type uR
inst✝¹ : Semiring R
inst✝ : StarRing R
r : R → R → Prop
hr : ∀ (a b : R), r a b → r (star a) (star b)
toQuot✝¹ : Quot (Rel r)
a✝¹ : R
toQuot✝ : Quot (Rel r)
a✝ : R
⊢ star ({ toQuot := Quot.mk (Rel r) a✝¹ } * { toQuot := Quot.mk (Rel r) a✝ }) =
    star { toQuot := Quot.mk (Rel r) a✝ } * star { toQuot := Quot.mk (Rel r) a✝¹ }

Next tactic:
simp [star'_quot, mul_quot, star_mul]
/-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/
def starRing {R : Type uR} [Semiring R] [StarRing R] (r : R → R → Prop)
    (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where
  star := star' r hr
  star_involutive := by
    rintro ⟨⟨⟩⟩
    simp [star'_quot]
  star_mul := by
    rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩
    simp [star'_quot, mul_quot, star_mul]
  star_add := by
    

Proof state:
R✝ : Type uR
inst✝⁷ : Semiring R✝
S : Type uS
inst✝⁶ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁵ : Semiring A
inst✝⁴ : Algebra S A
r✝ : R✝ → R✝ → Prop
inst✝³ : Semiring T
inst✝² : StarRing R✝
hr✝ : ∀ (a b : R✝), r✝ a b → r✝ (star a) (star b)
R : Type uR
inst✝¹ : Semiring R
inst✝ : StarRing R
r : R → R → Prop
hr : ∀ (a b : R), r a b → r (star a) (star b)
⊢ ∀ (r_1 s : RingQuot r), star (r_1 + s) = star r_1 + star s

Next tactic:
rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩
/-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/
def starRing {R : Type uR} [Semiring R] [StarRing R] (r : R → R → Prop)
    (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where
  star := star' r hr
  star_involutive := by
    rintro ⟨⟨⟩⟩
    simp [star'_quot]
  star_mul := by
    rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩
    simp [star'_quot, mul_quot, star_mul]
  star_add := by
    rintro ⟨⟨⟩⟩ ⟨⟨⟩⟩
    

Proof state:
case mk.mk.mk.mk
R✝ : Type uR
inst✝⁷ : Semiring R✝
S : Type uS
inst✝⁶ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁵ : Semiring A
inst✝⁴ : Algebra S A
r✝ : R✝ → R✝ → Prop
inst✝³ : Semiring T
inst✝² : StarRing R✝
hr✝ : ∀ (a b : R✝), r✝ a b → r✝ (star a) (star b)
R : Type uR
inst✝¹ : Semiring R
inst✝ : StarRing R
r : R → R → Prop
hr : ∀ (a b : R), r a b → r (star a) (star b)
toQuot✝¹ : Quot (Rel r)
a✝¹ : R
toQuot✝ : Quot (Rel r)
a✝ : R
⊢ star ({ toQuot := Quot.mk (Rel r) a✝¹ } + { toQuot := Quot.mk (Rel r) a✝ }) =
    star { toQuot := Quot.mk (Rel r) a✝¹ } + star { toQuot := Quot.mk (Rel r) a✝ }

Next tactic:
simp [star'_quot, add_quot, star_add]
/-- The quotient map from an `S`-algebra to its quotient, as a homomorphism of `S`-algebras.
-/
irreducible_def mkAlgHom (s : A → A → Prop) : A →ₐ[S] RingQuot s :=
  { mkRingHom s with
    commutes' := fun _ ↦ by 

Proof state:
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
src✝ : A →+* RingQuot s := mkRingHom s
x✝ : S
⊢ OneHom.toFun
      (↑↑{ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : A), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) })
      ((algebraMap S A) x✝) =
    (algebraMap S (RingQuot s)) x✝

Next tactic:
simp [mkRingHom_def]
/-- The quotient map from an `S`-algebra to its quotient, as a homomorphism of `S`-algebras.
-/
irreducible_def mkAlgHom (s : A → A → Prop) : A →ₐ[S] RingQuot s :=
  { mkRingHom s with
    commutes' := fun _ ↦ by simp [mkRingHom_def]; 

Proof state:
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
src✝ : A →+* RingQuot s := mkRingHom s
x✝ : S
⊢ { toQuot := Quot.mk (Rel s) ((algebraMap S A) x✝) } = (algebraMap S (RingQuot s)) x✝

Next tactic:
rfl
@[simp]
theorem mkAlgHom_coe (s : A → A → Prop) : (mkAlgHom S s : A →+* RingQuot s) = mkRingHom s := by
  

Proof state:
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
⊢ ↑(mkAlgHom S s) = mkRingHom s

Next tactic:
simp_rw [mkAlgHom_def, mkRingHom_def]
theorem mkAlgHom_rel {s : A → A → Prop} {x y : A} (w : s x y) :
    mkAlgHom S s x = mkAlgHom S s y := by
  

Proof state:
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
x y : A
w : s x y
⊢ (mkAlgHom S s) x = (mkAlgHom S s) y

Next tactic:
simp [mkAlgHom_def, mkRingHom_def, Quot.sound (Rel.of w)]
theorem mkAlgHom_surjective (s : A → A → Prop) : Function.Surjective (mkAlgHom S s) := by
  

Proof state:
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
⊢ Function.Surjective ⇑(mkAlgHom S s)

Next tactic:
suffices : Function.Surjective fun x ↦ (⟨.mk (Rel s) x⟩ : RingQuot s)
theorem mkAlgHom_surjective (s : A → A → Prop) : Function.Surjective (mkAlgHom S s) := by
  suffices : Function.Surjective fun x ↦ (⟨.mk (Rel s) x⟩ : RingQuot s)
  · 

Proof state:
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
this : Function.Surjective fun x => { toQuot := Quot.mk (Rel s) x }
⊢ Function.Surjective ⇑(mkAlgHom S s)

Next tactic:
simpa [mkAlgHom_def, mkRingHom_def]
theorem mkAlgHom_surjective (s : A → A → Prop) : Function.Surjective (mkAlgHom S s) := by
  suffices : Function.Surjective fun x ↦ (⟨.mk (Rel s) x⟩ : RingQuot s)
  · simpa [mkAlgHom_def, mkRingHom_def]
  

Proof state:
case this
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
⊢ Function.Surjective fun x => { toQuot := Quot.mk (Rel s) x }

Next tactic:
rintro ⟨⟨a⟩⟩
theorem mkAlgHom_surjective (s : A → A → Prop) : Function.Surjective (mkAlgHom S s) := by
  suffices : Function.Surjective fun x ↦ (⟨.mk (Rel s) x⟩ : RingQuot s)
  · simpa [mkAlgHom_def, mkRingHom_def]
  rintro ⟨⟨a⟩⟩
  

Proof state:
case this.mk.mk
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r : R → R → Prop
inst✝ : Semiring T
s : A → A → Prop
toQuot✝ : Quot (Rel s)
a : A
⊢ ∃ a_1, (fun x => { toQuot := Quot.mk (Rel s) x }) a_1 = { toQuot := Quot.mk (Rel s) a }

Next tactic:
use a
@[ext 1100]
theorem ringQuot_ext' {s : A → A → Prop} (f g : RingQuot s →ₐ[S] B)
    (w : f.comp (mkAlgHom S s) = g.comp (mkAlgHom S s)) : f = g := by
  

Proof state:
R : Type uR
inst✝⁶ : Semiring R
S : Type uS
inst✝⁵ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁴ : Semiring A
inst✝³ : Algebra S A
r : R → R → Prop
inst✝² : Semiring T
B : Type u₄
inst✝¹ : Semiring B
inst✝ : Algebra S B
s : A → A → Prop
f g : RingQuot s →ₐ[S] B
w : AlgHom.comp f (mkAlgHom S s) = AlgHom.comp g (mkAlgHom S s)
⊢ f = g

Next tactic:
ext x
@[ext 1100]
theorem ringQuot_ext' {s : A → A → Prop} (f g : RingQuot s →ₐ[S] B)
    (w : f.comp (mkAlgHom S s) = g.comp (mkAlgHom S s)) : f = g := by
  ext x
  

Proof state:
case H
R : Type uR
inst✝⁶ : Semiring R
S : Type uS
inst✝⁵ : CommSemiring S
T : Type uT
A : Type uA
inst✝⁴ : Semiring A
inst✝³ : Algebra S A
r : R → R → Prop
inst✝² : Semiring T
B : Type u₄
inst✝¹ : Semiring B
inst✝ : Algebra S B
s : A → A → Prop
f g : RingQuot s →ₐ[S] B
w : AlgHom.comp f (mkAlgHom S s) = AlgHom.comp g (mkAlgHom S s)
x : RingQuot s
⊢ f x = g x

Next tactic:
rcases mkAlgHom_surjective S s x with ⟨x, rfl⟩