[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ₀ χ₁ : MulChar R R'
h : (fun χ => χ.toFun) χ₀ = (fun χ => χ.toFun) χ₁
⊢ χ₀ = χ₁
[PROOFSTEP]
cases χ₀
[GOAL]
case mk
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ₁ : MulChar R R'
toMonoidHom✝ : R →* R'
map_nonunit'✝ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝) a = 0
h : (fun χ => χ.toFun) { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ } = (fun χ => χ.toFun) χ₁
⊢ { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ } = χ₁
[PROOFSTEP]
cases χ₁
[GOAL]
case mk.mk
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
toMonoidHom✝¹ : R →* R'
map_nonunit'✝¹ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝¹) a = 0
toMonoidHom✝ : R →* R'
map_nonunit'✝ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝) a = 0
h :
  (fun χ => χ.toFun) { toMonoidHom := toMonoidHom✝¹, map_nonunit' := map_nonunit'✝¹ } =
    (fun χ => χ.toFun) { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ }
⊢ { toMonoidHom := toMonoidHom✝¹, map_nonunit' := map_nonunit'✝¹ } =
    { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ }
[PROOFSTEP]
congr
[GOAL]
case mk.mk.e_toMonoidHom
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
toMonoidHom✝¹ : R →* R'
map_nonunit'✝¹ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝¹) a = 0
toMonoidHom✝ : R →* R'
map_nonunit'✝ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝) a = 0
h :
  (fun χ => χ.toFun) { toMonoidHom := toMonoidHom✝¹, map_nonunit' := map_nonunit'✝¹ } =
    (fun χ => χ.toFun) { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ }
⊢ toMonoidHom✝¹ = toMonoidHom✝
[PROOFSTEP]
apply MonoidHom.ext (fun _ => congr_fun h _)
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ R → R'
[PROOFSTEP]
classical exact fun x => if IsUnit x then 1 else 0
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ R → R'
[PROOFSTEP]
exact fun x => if IsUnit x then 1 else 0
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ (if IsUnit 1 then 1 else 0) = 1
[PROOFSTEP]
simp only [isUnit_one, if_true]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ ∀ (x y : R),
    OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
        (x * y) =
      OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
          x *
        OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
          y
[PROOFSTEP]
intro x y
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
⊢ OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
      (x * y) =
    OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) } x *
      OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) } y
[PROOFSTEP]
classical
simp only [IsUnit.mul_iff, boole_mul]
split_ifs <;> tauto
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
⊢ OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
      (x * y) =
    OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) } x *
      OneHom.toFun { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) } y
[PROOFSTEP]
simp only [IsUnit.mul_iff, boole_mul]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
⊢ (if IsUnit x ∧ IsUnit y then 1 else 0) = if IsUnit x then if IsUnit y then 1 else 0 else 0
[PROOFSTEP]
split_ifs
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
h✝² : IsUnit x ∧ IsUnit y
h✝¹ : IsUnit x
h✝ : IsUnit y
⊢ 1 = 1
[PROOFSTEP]
tauto
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
h✝² : IsUnit x ∧ IsUnit y
h✝¹ : IsUnit x
h✝ : ¬IsUnit y
⊢ 1 = 0
[PROOFSTEP]
tauto
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
h✝¹ : IsUnit x ∧ IsUnit y
h✝ : ¬IsUnit x
⊢ 1 = 0
[PROOFSTEP]
tauto
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
h✝² : ¬(IsUnit x ∧ IsUnit y)
h✝¹ : IsUnit x
h✝ : IsUnit y
⊢ 0 = 1
[PROOFSTEP]
tauto
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
h✝² : ¬(IsUnit x ∧ IsUnit y)
h✝¹ : IsUnit x
h✝ : ¬IsUnit y
⊢ 0 = 0
[PROOFSTEP]
tauto
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
x y : R
h✝¹ : ¬(IsUnit x ∧ IsUnit y)
h✝ : ¬IsUnit x
⊢ 0 = 0
[PROOFSTEP]
tauto
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ ∀ (a : R),
    ¬IsUnit a →
      OneHom.toFun
          (↑{
              toOneHom :=
                { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun
                        { toFun := fun x => if IsUnit x then 1 else 0,
                          map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
                        (x * y) =
                      OneHom.toFun
                          { toFun := fun x => if IsUnit x then 1 else 0,
                            map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
                          x *
                        OneHom.toFun
                          { toFun := fun x => if IsUnit x then 1 else 0,
                            map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
                          y) })
          a =
        0
[PROOFSTEP]
intro a ha
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
a : R
ha : ¬IsUnit a
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : R),
                OneHom.toFun
                    { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
                      x *
                    OneHom.toFun
                      { toFun := fun x => if IsUnit x then 1 else 0, map_one' := (_ : (if IsUnit 1 then 1 else 0) = 1) }
                      y) })
      a =
    0
[PROOFSTEP]
simp only [ha, if_false]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
h : ∀ (a : R), ↑χ a = ↑χ' a
⊢ χ = χ'
[PROOFSTEP]
cases χ
[GOAL]
case mk
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ' : MulChar R R'
toMonoidHom✝ : R →* R'
map_nonunit'✝ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝) a = 0
h : ∀ (a : R), ↑{ toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ } a = ↑χ' a
⊢ { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ } = χ'
[PROOFSTEP]
cases χ'
[GOAL]
case mk.mk
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
toMonoidHom✝¹ : R →* R'
map_nonunit'✝¹ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝¹) a = 0
toMonoidHom✝ : R →* R'
map_nonunit'✝ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝) a = 0
h :
  ∀ (a : R),
    ↑{ toMonoidHom := toMonoidHom✝¹, map_nonunit' := map_nonunit'✝¹ } a =
      ↑{ toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ } a
⊢ { toMonoidHom := toMonoidHom✝¹, map_nonunit' := map_nonunit'✝¹ } =
    { toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ }
[PROOFSTEP]
congr
[GOAL]
case mk.mk.e_toMonoidHom
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
toMonoidHom✝¹ : R →* R'
map_nonunit'✝¹ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝¹) a = 0
toMonoidHom✝ : R →* R'
map_nonunit'✝ : ∀ (a : R), ¬IsUnit a → OneHom.toFun (↑toMonoidHom✝) a = 0
h :
  ∀ (a : R),
    ↑{ toMonoidHom := toMonoidHom✝¹, map_nonunit' := map_nonunit'✝¹ } a =
      ↑{ toMonoidHom := toMonoidHom✝, map_nonunit' := map_nonunit'✝ } a
⊢ toMonoidHom✝¹ = toMonoidHom✝
[PROOFSTEP]
exact MonoidHom.ext h
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
h : ∀ (a : Rˣ), ↑χ ↑a = ↑χ' ↑a
⊢ χ = χ'
[PROOFSTEP]
apply ext'
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
h : ∀ (a : Rˣ), ↑χ ↑a = ↑χ' ↑a
⊢ ∀ (a : R), ↑χ a = ↑χ' a
[PROOFSTEP]
intro a
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
h : ∀ (a : Rˣ), ↑χ ↑a = ↑χ' ↑a
a : R
⊢ ↑χ a = ↑χ' a
[PROOFSTEP]
by_cases ha : IsUnit a
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
h : ∀ (a : Rˣ), ↑χ ↑a = ↑χ' ↑a
a : R
ha : IsUnit a
⊢ ↑χ a = ↑χ' a
[PROOFSTEP]
exact h ha.unit
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
h : ∀ (a : Rˣ), ↑χ ↑a = ↑χ' ↑a
a : R
ha : ¬IsUnit a
⊢ ↑χ a = ↑χ' a
[PROOFSTEP]
rw [map_nonunit χ ha, map_nonunit χ' ha]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
⊢ χ = χ' → ∀ (a : Rˣ), ↑χ ↑a = ↑χ' ↑a
[PROOFSTEP]
rintro rfl a
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
a : Rˣ
⊢ ↑χ ↑a = ↑χ ↑a
[PROOFSTEP]
rfl
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ R → R'
[PROOFSTEP]
classical exact fun x => if hx : IsUnit x then f hx.unit else 0
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ R → R'
[PROOFSTEP]
exact fun x => if hx : IsUnit x then f hx.unit else 0
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1
[PROOFSTEP]
have h1 : (isUnit_one.unit : Rˣ) = 1 := Units.eq_iff.mp rfl
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
h1 : IsUnit.unit (_ : IsUnit 1) = 1
⊢ (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1
[PROOFSTEP]
simp only [h1, dif_pos, Units.val_eq_one, map_one, isUnit_one]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ ∀ (x y : R),
    OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        (x * y) =
      OneHom.toFun
          { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
            map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
          x *
        OneHom.toFun
          { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
            map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
          y
[PROOFSTEP]
classical
intro x y
by_cases hx : IsUnit x
· simp only [hx, IsUnit.mul_iff, true_and_iff, dif_pos]
  by_cases hy : IsUnit y
  · simp only [hy, dif_pos]
    have hm : (IsUnit.mul_iff.mpr ⟨hx, hy⟩).unit = hx.unit * hy.unit := Units.eq_iff.mp rfl
    rw [hm, map_mul]
    norm_cast
  · simp only [hy, not_false_iff, dif_neg, mul_zero]
· simp only [hx, IsUnit.mul_iff, false_and_iff, not_false_iff, dif_neg, zero_mul]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ ∀ (x y : R),
    OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        (x * y) =
      OneHom.toFun
          { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
            map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
          x *
        OneHom.toFun
          { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
            map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
          y
[PROOFSTEP]
intro x y
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
⊢ OneHom.toFun
      { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
        map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        x *
      OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        y
[PROOFSTEP]
by_cases hx : IsUnit x
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
⊢ OneHom.toFun
      { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
        map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        x *
      OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        y
[PROOFSTEP]
simp only [hx, IsUnit.mul_iff, true_and_iff, dif_pos]
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
⊢ (if h : IsUnit y then ↑(↑f (IsUnit.unit (_ : IsUnit (x * y)))) else 0) =
    ↑(↑f (IsUnit.unit (_ : IsUnit x))) * if h : IsUnit y then ↑(↑f (IsUnit.unit (_ : IsUnit y))) else 0
[PROOFSTEP]
by_cases hy : IsUnit y
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
hy : IsUnit y
⊢ (if h : IsUnit y then ↑(↑f (IsUnit.unit (_ : IsUnit (x * y)))) else 0) =
    ↑(↑f (IsUnit.unit (_ : IsUnit x))) * if h : IsUnit y then ↑(↑f (IsUnit.unit (_ : IsUnit y))) else 0
[PROOFSTEP]
simp only [hy, dif_pos]
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
hy : IsUnit y
⊢ ↑(↑f (IsUnit.unit (_ : IsUnit (x * y)))) = ↑(↑f (IsUnit.unit (_ : IsUnit x))) * ↑(↑f (IsUnit.unit (_ : IsUnit y)))
[PROOFSTEP]
have hm : (IsUnit.mul_iff.mpr ⟨hx, hy⟩).unit = hx.unit * hy.unit := Units.eq_iff.mp rfl
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
hy : IsUnit y
hm : IsUnit.unit (_ : IsUnit (x * y)) = IsUnit.unit hx * IsUnit.unit hy
⊢ ↑(↑f (IsUnit.unit (_ : IsUnit (x * y)))) = ↑(↑f (IsUnit.unit (_ : IsUnit x))) * ↑(↑f (IsUnit.unit (_ : IsUnit y)))
[PROOFSTEP]
rw [hm, map_mul]
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
hy : IsUnit y
hm : IsUnit.unit (_ : IsUnit (x * y)) = IsUnit.unit hx * IsUnit.unit hy
⊢ ↑(↑f (IsUnit.unit hx) * ↑f (IsUnit.unit hy)) = ↑(↑f (IsUnit.unit (_ : IsUnit x))) * ↑(↑f (IsUnit.unit (_ : IsUnit y)))
[PROOFSTEP]
norm_cast
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : IsUnit x
hy : ¬IsUnit y
⊢ (if h : IsUnit y then ↑(↑f (IsUnit.unit (_ : IsUnit (x * y)))) else 0) =
    ↑(↑f (IsUnit.unit (_ : IsUnit x))) * if h : IsUnit y then ↑(↑f (IsUnit.unit (_ : IsUnit y))) else 0
[PROOFSTEP]
simp only [hy, not_false_iff, dif_neg, mul_zero]
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x y : R
hx : ¬IsUnit x
⊢ OneHom.toFun
      { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
        map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        x *
      OneHom.toFun
        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
        y
[PROOFSTEP]
simp only [hx, IsUnit.mul_iff, false_and_iff, not_false_iff, dif_neg, zero_mul]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ ∀ (a : R),
    ¬IsUnit a →
      OneHom.toFun
          (↑{
              toOneHom :=
                { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                  map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun
                        { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                          map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
                        (x * y) =
                      OneHom.toFun
                          { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                            map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
                          x *
                        OneHom.toFun
                          { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                            map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
                          y) })
          a =
        0
[PROOFSTEP]
intro a ha
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
a : R
ha : ¬IsUnit a
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
              map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : R),
                OneHom.toFun
                    { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                      map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                        map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
                      x *
                    OneHom.toFun
                      { toFun := fun x => if hx : IsUnit x then ↑(↑f (IsUnit.unit hx)) else 0,
                        map_one' := (_ : (if hx : IsUnit 1 then ↑(↑f (IsUnit.unit hx)) else 0) = 1) }
                      y) })
      a =
    0
[PROOFSTEP]
simp only [ha, not_false_iff, dif_neg]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
a : Rˣ
⊢ ↑(ofUnitHom f) ↑a = ↑(↑f a)
[PROOFSTEP]
simp [ofUnitHom]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ Function.LeftInverse ofUnitHom toUnitHom
[PROOFSTEP]
intro χ
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
⊢ ofUnitHom (toUnitHom χ) = χ
[PROOFSTEP]
ext x
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
x : Rˣ
⊢ ↑(ofUnitHom (toUnitHom χ)) ↑x = ↑χ ↑x
[PROOFSTEP]
rw [ofUnitHom_coe, coe_toUnitHom]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ Function.RightInverse ofUnitHom toUnitHom
[PROOFSTEP]
intro f
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
⊢ toUnitHom (ofUnitHom f) = f
[PROOFSTEP]
ext x
[GOAL]
case h.a
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
f : Rˣ →* R'ˣ
x : Rˣ
⊢ ↑(↑(toUnitHom (ofUnitHom f)) x) = ↑(↑f x)
[PROOFSTEP]
simp only [coe_toUnitHom, ofUnitHom_coe]
[GOAL]
R✝ : Type u
inst✝³ : CommMonoid R✝
R' : Type v
inst✝² : CommMonoidWithZero R'
R : Type u
inst✝¹ : CommMonoidWithZero R
inst✝ : Nontrivial R
χ : MulChar R R'
⊢ ↑χ 0 = 0
[PROOFSTEP]
rw [map_nonunit χ not_isUnit_zero]
[GOAL]
R✝ : Type u
inst✝³ : CommMonoid R✝
R' : Type v
inst✝² : CommMonoidWithZero R'
R : Type u
inst✝¹ : CommRing R
inst✝ : Nontrivial R
χ : MulChar R R'
⊢ ↑χ ↑(ringChar R) = 0
[PROOFSTEP]
rw [ringChar.Nat.cast_ringChar, χ.map_zero]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
a : Rˣ
⊢ ↑1 ↑a = 1
[PROOFSTEP]
classical exact dif_pos a.isUnit
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
a : Rˣ
⊢ ↑1 ↑a = 1
[PROOFSTEP]
exact dif_pos a.isUnit
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ χ' : MulChar R R'
src✝ : R →* R' := χ.toMonoidHom * χ'.toMonoidHom
a : R
ha : ¬IsUnit a
⊢ OneHom.toFun
      (↑{ toOneHom := { toFun := ↑χ * ↑χ', map_one' := (_ : OneHom.toFun (↑src✝) 1 = 1) },
          map_mul' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) })
      a =
    0
[PROOFSTEP]
simp only [map_nonunit χ ha, zero_mul, Pi.mul_apply]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
⊢ 1 * χ = χ
[PROOFSTEP]
ext
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
a✝ : Rˣ
⊢ ↑(1 * χ) ↑a✝ = ↑χ ↑a✝
[PROOFSTEP]
simp only [one_mul, Pi.mul_apply, MulChar.coeToFun_mul, MulChar.one_apply_coe]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
⊢ χ * 1 = χ
[PROOFSTEP]
ext
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
a✝ : Rˣ
⊢ ↑(χ * 1) ↑a✝ = ↑χ ↑a✝
[PROOFSTEP]
simp only [mul_one, Pi.mul_apply, MulChar.coeToFun_mul, MulChar.one_apply_coe]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
src✝ : R →* R' := MonoidHom.comp (↑MonoidWithZero.inverse) χ.toMonoidHom
a : R
ha : ¬IsUnit a
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := fun a => ↑MonoidWithZero.inverse (↑χ a), map_one' := (_ : OneHom.toFun (↑src✝) 1 = 1) },
          map_mul' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) })
      a =
    0
[PROOFSTEP]
simp [map_nonunit _ ha]
[GOAL]
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
⊢ ↑χ⁻¹ a = ↑χ (Ring.inverse a)
[PROOFSTEP]
by_cases ha : IsUnit a
[GOAL]
case pos
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : IsUnit a
⊢ ↑χ⁻¹ a = ↑χ (Ring.inverse a)
[PROOFSTEP]
rw [inv_apply_eq_inv]
[GOAL]
case pos
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : IsUnit a
⊢ Ring.inverse (↑χ a) = ↑χ (Ring.inverse a)
[PROOFSTEP]
have h := IsUnit.map χ ha
[GOAL]
case pos
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : IsUnit a
h : IsUnit (↑χ a)
⊢ Ring.inverse (↑χ a) = ↑χ (Ring.inverse a)
[PROOFSTEP]
apply IsUnit.mul_right_injective h
[GOAL]
case pos.a
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : IsUnit a
h : IsUnit (↑χ a)
⊢ (fun x x_1 => x * x_1) (↑χ a) (Ring.inverse (↑χ a)) = (fun x x_1 => x * x_1) (↑χ a) (↑χ (Ring.inverse a))
[PROOFSTEP]
dsimp only
  -- Porting note: was
      -- rw [Ring.mul_inverse_cancel _ h, ← map_mul, Ring.mul_inverse_cancel _ ha, MulChar.map_one]
[GOAL]
case pos.a
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : IsUnit a
h : IsUnit (↑χ a)
⊢ ↑χ a * Ring.inverse (↑χ a) = ↑χ a * ↑χ (Ring.inverse a)
[PROOFSTEP]
erw [Ring.mul_inverse_cancel _ h, ← map_mul, Ring.mul_inverse_cancel _ ha]
[GOAL]
case pos.a
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : IsUnit a
h : IsUnit (↑χ a)
⊢ 1 = ↑χ 1
[PROOFSTEP]
exact (MulChar.map_one χ).symm
[GOAL]
case neg
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
ha : ¬IsUnit a
⊢ ↑χ⁻¹ a = ↑χ (Ring.inverse a)
[PROOFSTEP]
revert ha
[GOAL]
case neg
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
⊢ ¬IsUnit a → ↑χ⁻¹ a = ↑χ (Ring.inverse a)
[PROOFSTEP]
nontriviality R
[GOAL]
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
✝ : Nontrivial R
⊢ ¬IsUnit a → ↑χ⁻¹ a = ↑χ (Ring.inverse a)
[PROOFSTEP]
intro ha
[GOAL]
R✝ : Type u
inst✝² : CommMonoid R✝
R' : Type v
inst✝¹ : CommMonoidWithZero R'
R : Type u
inst✝ : CommMonoidWithZero R
χ : MulChar R R'
a : R
✝ : Nontrivial R
ha : ¬IsUnit a
⊢ ↑χ⁻¹ a = ↑χ (Ring.inverse a)
[PROOFSTEP]
rw [map_nonunit _ ha, Ring.inverse_non_unit a ha, MulChar.map_zero χ]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
⊢ χ⁻¹ * χ = 1
[PROOFSTEP]
ext x
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
x : Rˣ
⊢ ↑(χ⁻¹ * χ) ↑x = ↑1 ↑x
[PROOFSTEP]
rw [coeToFun_mul, Pi.mul_apply, inv_apply_eq_inv]
  -- Porting note: was
    -- simp only [Ring.inverse_mul_cancel _ (IsUnit.map _ x.isUnit)]
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
x : Rˣ
⊢ Ring.inverse (↑χ ↑x) * ↑χ ↑x = ↑1 ↑x
[PROOFSTEP]
erw [Ring.inverse_mul_cancel _ (IsUnit.map χ x.isUnit)]
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
x : Rˣ
⊢ 1 = ↑1 ↑x
[PROOFSTEP]
rw [one_apply_coe]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ ∀ (a b c : MulChar R R'), a * b * c = a * (b * c)
[PROOFSTEP]
intro χ₁ χ₂ χ₃
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ₁ χ₂ χ₃ : MulChar R R'
⊢ χ₁ * χ₂ * χ₃ = χ₁ * (χ₂ * χ₃)
[PROOFSTEP]
ext a
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ₁ χ₂ χ₃ : MulChar R R'
a : Rˣ
⊢ ↑(χ₁ * χ₂ * χ₃) ↑a = ↑(χ₁ * (χ₂ * χ₃)) ↑a
[PROOFSTEP]
simp only [mul_assoc, Pi.mul_apply, MulChar.coeToFun_mul]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
⊢ ∀ (a b : MulChar R R'), a * b = b * a
[PROOFSTEP]
intro χ₁ χ₂
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ₁ χ₂ : MulChar R R'
⊢ χ₁ * χ₂ = χ₂ * χ₁
[PROOFSTEP]
ext a
[GOAL]
case h
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ₁ χ₂ : MulChar R R'
a : Rˣ
⊢ ↑(χ₁ * χ₂) ↑a = ↑(χ₂ * χ₁) ↑a
[PROOFSTEP]
simp only [mul_comm, Pi.mul_apply, MulChar.coeToFun_mul]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
n : ℕ
a : Rˣ
⊢ ↑(χ ^ n) ↑a = ↑χ ↑a ^ n
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
a : Rˣ
⊢ ↑(χ ^ Nat.zero) ↑a = ↑χ ↑a ^ Nat.zero
[PROOFSTEP]
rw [pow_zero, pow_zero, one_apply_coe]
[GOAL]
case succ
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
a : Rˣ
n : ℕ
ih : ↑(χ ^ n) ↑a = ↑χ ↑a ^ n
⊢ ↑(χ ^ Nat.succ n) ↑a = ↑χ ↑a ^ Nat.succ n
[PROOFSTEP]
rw [pow_succ, pow_succ, mul_apply, ih]
[GOAL]
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
n : ℕ
hn : 0 < n
a : R
⊢ ↑(χ ^ n) a = ↑χ a ^ n
[PROOFSTEP]
by_cases ha : IsUnit a
[GOAL]
case pos
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
n : ℕ
hn : 0 < n
a : R
ha : IsUnit a
⊢ ↑(χ ^ n) a = ↑χ a ^ n
[PROOFSTEP]
exact pow_apply_coe χ n ha.unit
[GOAL]
case neg
R : Type u
inst✝¹ : CommMonoid R
R' : Type v
inst✝ : CommMonoidWithZero R'
χ : MulChar R R'
n : ℕ
hn : 0 < n
a : R
ha : ¬IsUnit a
⊢ ↑(χ ^ n) a = ↑χ a ^ n
[PROOFSTEP]
rw [map_nonunit (χ ^ n) ha, map_nonunit χ ha, zero_pow hn]
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
⊢ IsNontrivial χ ↔ χ ≠ 1
[PROOFSTEP]
simp only [IsNontrivial, Ne.def, ext_iff, not_forall, one_apply_coe]
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
f : R' →+* R''
src✝ : R →* R'' := MonoidHom.comp (↑f) χ.toMonoidHom
a : R
ha : ¬IsUnit a
⊢ OneHom.toFun
      (↑{ toOneHom := { toFun := fun a => ↑f (↑χ a), map_one' := (_ : OneHom.toFun (↑src✝) 1 = 1) },
          map_mul' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) })
      a =
    0
[PROOFSTEP]
simp only [map_nonunit χ ha, map_zero]
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsNontrivial χ
f : R' →+* R''
hf : Function.Injective ↑f
⊢ IsNontrivial (ringHomComp χ f)
[PROOFSTEP]
obtain ⟨a, ha⟩ := hχ
[GOAL]
case intro
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
f : R' →+* R''
hf : Function.Injective ↑f
a : Rˣ
ha : ↑χ ↑a ≠ 1
⊢ IsNontrivial (ringHomComp χ f)
[PROOFSTEP]
use a
[GOAL]
case h
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
f : R' →+* R''
hf : Function.Injective ↑f
a : Rˣ
ha : ↑χ ↑a ≠ 1
⊢ ↑(ringHomComp χ f) ↑a ≠ 1
[PROOFSTEP]
simp_rw [ringHomComp_apply, ← RingHom.map_one f]
[GOAL]
case h
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
f : R' →+* R''
hf : Function.Injective ↑f
a : Rˣ
ha : ↑χ ↑a ≠ 1
⊢ ↑f (↑χ ↑a) ≠ ↑f 1
[PROOFSTEP]
exact fun h => ha (hf h)
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
f : R' →+* R''
⊢ IsQuadratic (ringHomComp χ f)
[PROOFSTEP]
intro a
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
f : R' →+* R''
a : R
⊢ ↑(ringHomComp χ f) a = 0 ∨ ↑(ringHomComp χ f) a = 1 ∨ ↑(ringHomComp χ f) a = -1
[PROOFSTEP]
rcases hχ a with (ha | ha | ha)
[GOAL]
case inl
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
f : R' →+* R''
a : R
ha : ↑χ a = 0
⊢ ↑(ringHomComp χ f) a = 0 ∨ ↑(ringHomComp χ f) a = 1 ∨ ↑(ringHomComp χ f) a = -1
[PROOFSTEP]
simp [ha]
[GOAL]
case inr.inl
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
f : R' →+* R''
a : R
ha : ↑χ a = 1
⊢ ↑(ringHomComp χ f) a = 0 ∨ ↑(ringHomComp χ f) a = 1 ∨ ↑(ringHomComp χ f) a = -1
[PROOFSTEP]
simp [ha]
[GOAL]
case inr.inr
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
f : R' →+* R''
a : R
ha : ↑χ a = -1
⊢ ↑(ringHomComp χ f) a = 0 ∨ ↑(ringHomComp χ f) a = 1 ∨ ↑(ringHomComp χ f) a = -1
[PROOFSTEP]
simp [ha]
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
⊢ χ⁻¹ = χ
[PROOFSTEP]
ext x
[GOAL]
case h
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
⊢ ↑χ⁻¹ ↑x = ↑χ ↑x
[PROOFSTEP]
rw [inv_apply_eq_inv]
[GOAL]
case h
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
⊢ Ring.inverse (↑χ ↑x) = ↑χ ↑x
[PROOFSTEP]
rcases hχ x with (h₀ | h₁ | h₂)
[GOAL]
case h.inl
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
h₀ : ↑χ ↑x = 0
⊢ Ring.inverse (↑χ ↑x) = ↑χ ↑x
[PROOFSTEP]
rw [h₀, Ring.inverse_zero]
[GOAL]
case h.inr.inl
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
h₁ : ↑χ ↑x = 1
⊢ Ring.inverse (↑χ ↑x) = ↑χ ↑x
[PROOFSTEP]
rw [h₁, Ring.inverse_one]
[GOAL]
case h.inr.inr
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
h₂ : ↑χ ↑x = -1
⊢ Ring.inverse (↑χ ↑x) = ↑χ ↑x
[PROOFSTEP]
have : (-1 : R') = (-1 : R'ˣ) := by rw [Units.val_neg, Units.val_one]
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
h₂ : ↑χ ↑x = -1
⊢ -1 = ↑(-1)
[PROOFSTEP]
rw [Units.val_neg, Units.val_one]
[GOAL]
case h.inr.inr
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
h₂ : ↑χ ↑x = -1
this : -1 = ↑(-1)
⊢ Ring.inverse (↑χ ↑x) = ↑χ ↑x
[PROOFSTEP]
rw [h₂, this, Ring.inverse_unit (-1 : R'ˣ)]
[GOAL]
case h.inr.inr
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
x : Rˣ
h₂ : ↑χ ↑x = -1
this : -1 = ↑(-1)
⊢ ↑(-1)⁻¹ = ↑(-1)
[PROOFSTEP]
rfl
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
⊢ χ ^ 2 = 1
[PROOFSTEP]
rw [← mul_left_inv χ, pow_two, hχ.inv]
[GOAL]
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
⊢ χ ^ p = χ
[PROOFSTEP]
ext x
[GOAL]
case h
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
⊢ ↑(χ ^ p) ↑x = ↑χ ↑x
[PROOFSTEP]
rw [pow_apply_coe]
[GOAL]
case h
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
⊢ ↑χ ↑x ^ p = ↑χ ↑x
[PROOFSTEP]
rcases hχ x with (hx | hx | hx)
[GOAL]
case h.inl
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
hx : ↑χ ↑x = 0
⊢ ↑χ ↑x ^ p = ↑χ ↑x
[PROOFSTEP]
rw [hx]
[GOAL]
case h.inr.inl
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
hx : ↑χ ↑x = 1
⊢ ↑χ ↑x ^ p = ↑χ ↑x
[PROOFSTEP]
rw [hx]
[GOAL]
case h.inr.inr
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
hx : ↑χ ↑x = -1
⊢ ↑χ ↑x ^ p = ↑χ ↑x
[PROOFSTEP]
rw [hx]
[GOAL]
case h.inl
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
hx : ↑χ ↑x = 0
⊢ 0 ^ p = 0
[PROOFSTEP]
rw [zero_pow (@Fact.out p.Prime).pos]
[GOAL]
case h.inr.inl
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
hx : ↑χ ↑x = 1
⊢ 1 ^ p = 1
[PROOFSTEP]
rw [one_pow]
[GOAL]
case h.inr.inr
R : Type u
inst✝³ : CommRing R
R' : Type v
inst✝² : CommRing R'
R'' : Type w
inst✝¹ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP R' p
x : Rˣ
hx : ↑χ ↑x = -1
⊢ (-1) ^ p = -1
[PROOFSTEP]
exact CharP.neg_one_pow_char R' p
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
n : ℕ
hn : Even n
⊢ χ ^ n = 1
[PROOFSTEP]
obtain ⟨n, rfl⟩ := even_iff_two_dvd.mp hn
[GOAL]
case intro
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
n : ℕ
hn : Even (2 * n)
⊢ χ ^ (2 * n) = 1
[PROOFSTEP]
rw [pow_mul, hχ.sq_eq_one, one_pow]
[GOAL]
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
n : ℕ
hn : Odd n
⊢ χ ^ n = χ
[PROOFSTEP]
obtain ⟨n, rfl⟩ := hn
[GOAL]
case intro
R : Type u
inst✝² : CommRing R
R' : Type v
inst✝¹ : CommRing R'
R'' : Type w
inst✝ : CommRing R''
χ : MulChar R R'
hχ : IsQuadratic χ
n : ℕ
⊢ χ ^ (2 * n + 1) = χ
[PROOFSTEP]
rw [pow_add, pow_one, hχ.pow_even (even_two_mul _), one_mul]
[GOAL]
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : IsDomain R'
χ : MulChar R R'
hχ : IsNontrivial χ
⊢ ∑ a : R, ↑χ a = 0
[PROOFSTEP]
rcases hχ with ⟨b, hb⟩
[GOAL]
case intro
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : IsDomain R'
χ : MulChar R R'
b : Rˣ
hb : ↑χ ↑b ≠ 1
⊢ ∑ a : R, ↑χ a = 0
[PROOFSTEP]
refine'
  eq_zero_of_mul_eq_self_left hb
    _
      -- POrting note: `map_mul` isn't applied
[GOAL]
case intro
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : IsDomain R'
χ : MulChar R R'
b : Rˣ
hb : ↑χ ↑b ≠ 1
⊢ ↑χ ↑b * ∑ a : R, ↑χ a = ∑ a : R, ↑χ a
[PROOFSTEP]
simp only [Finset.mul_sum, ← map_mul]
[GOAL]
case intro
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : IsDomain R'
χ : MulChar R R'
b : Rˣ
hb : ↑χ ↑b ≠ 1
⊢ ∑ x : R, ↑χ (↑b * x) = ∑ x : R, ↑χ x
[PROOFSTEP]
refine Fintype.sum_bijective _ (Units.mulLeft_bijective b) _ _ fun x => rfl
[GOAL]
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
⊢ ∑ a : R, ↑1 a = ↑(Fintype.card Rˣ)
[PROOFSTEP]
calc
  (∑ a, (1 : MulChar R R') a) = ∑ a : R, if IsUnit a then 1 else 0 := Finset.sum_congr rfl fun a _ => ?_
  _ = ((Finset.univ : Finset R).filter IsUnit).card := Finset.sum_boole
  _ = (Finset.univ.map ⟨((↑) : Rˣ → R), Units.ext⟩).card := ?_
  _ = Fintype.card Rˣ := congr_arg _ (Finset.card_map _)
[GOAL]
case calc_1
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
a : R
x✝ : a ∈ Finset.univ
⊢ ↑1 a = if IsUnit a then 1 else 0
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
a : R
x✝ : a ∈ Finset.univ
h : IsUnit a
⊢ ↑1 a = 1
[PROOFSTEP]
exact one_apply_coe h.unit
[GOAL]
case neg
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
a : R
x✝ : a ∈ Finset.univ
h : ¬IsUnit a
⊢ ↑1 a = 0
[PROOFSTEP]
exact map_nonunit _ h
[GOAL]
case calc_2
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
⊢ ↑(Finset.card (Finset.filter IsUnit Finset.univ)) =
    ↑(Finset.card (Finset.map { toFun := Units.val, inj' := (_ : Function.Injective Units.val) } Finset.univ))
[PROOFSTEP]
congr
[GOAL]
case calc_2.e_a.e_s
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
⊢ Finset.filter IsUnit Finset.univ =
    Finset.map { toFun := Units.val, inj' := (_ : Function.Injective Units.val) } Finset.univ
[PROOFSTEP]
ext a
[GOAL]
case calc_2.e_a.e_s.a
R : Type u
inst✝⁴ : CommRing R
R' : Type v
inst✝³ : CommRing R'
R'' : Type w
inst✝² : CommRing R''
inst✝¹ : Fintype R
inst✝ : DecidableEq R
a : R
⊢ a ∈ Finset.filter IsUnit Finset.univ ↔
    a ∈ Finset.map { toFun := Units.val, inj' := (_ : Function.Injective Units.val) } Finset.univ
[PROOFSTEP]
simp only [Finset.mem_filter, Finset.mem_univ, true_and_iff, Finset.mem_map, Function.Embedding.coeFn_mk,
  exists_true_left, IsUnit]
