l3lab/ntp-mathlib huggingface dataset:
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
⊢ (lift k (_ : ∀ (y : ↥S), IsUnit ((toMap f) ↑y))) ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z) = z

Next tactic:
rw [lift_spec]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
⊢ (toMap f) (sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).1 =
    (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * z

Next tactic:
cases' f.surj z with x hx
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap f) (sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).1 =
    (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * z

Next tactic:
conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
| (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * z

Next tactic:
congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
| (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * z

Next tactic:
congr
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    

Proof state:
case a
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
| (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2
case a
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
| z

Next tactic:
next => skip
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
| (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2

Next tactic:
skip
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    

Proof state:
case a
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
| z

Next tactic:
rw [f.eq_mk'_iff_mul_eq.2 hx]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap f) (sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).1 =
    (toMap f) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * mk' f x.1 x.2

Next tactic:
rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap f) ((sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).1 * ↑x.2) =
    (toMap f) (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * x.1)

Next tactic:
apply k.eq_of_eq f.map_units
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) ((sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).1 * ↑x.2) =
    (toMap k) (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * x.1)

Next tactic:
rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) (sec f z).1 * ((toMap k) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * (toMap k) ↑x.2) =
    (toMap k) ↑(sec f z).2 * ((toMap k) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * (toMap k) x.1)

Next tactic:
repeat' rw [← k.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' 

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) (sec f z).1 * ((toMap k) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * (toMap k) ↑x.2) =
    (toMap k) ↑(sec f z).2 * ((toMap k) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * (toMap k) x.1)

Next tactic:
rw [← k.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' 

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) (sec f z).1 * (toMap k) (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * ↑x.2) =
    (toMap k) ↑(sec f z).2 * ((toMap k) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * (toMap k) x.1)

Next tactic:
rw [← k.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' 

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) ((sec f z).1 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * ↑x.2)) =
    (toMap k) ↑(sec f z).2 * ((toMap k) ↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * (toMap k) x.1)

Next tactic:
rw [← k.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' 

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) ((sec f z).1 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * ↑x.2)) =
    (toMap k) ↑(sec f z).2 * (toMap k) (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * x.1)

Next tactic:
rw [← k.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' 

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) ((sec f z).1 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * ↑x.2)) =
    (toMap k) (↑(sec f z).2 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * x.1))

Next tactic:
rw [← k.toMap.map_mul]
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' rw [← k.toMap.map_mul]
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap k) ((sec f z).1 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * ↑x.2)) =
    (toMap k) (↑(sec f z).2 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * x.1))

Next tactic:
apply f.eq_of_eq k.map_units
/-- Given two Localization maps `f : M →* N, k : M →* P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`. -/
@[to_additive (attr := simp)
    "Given two Localization maps `f : M →+ N, k : M →+ P` for a Submonoid `S ⊆ M`, the hom
from `P` to `N` induced by `f` is left inverse to the hom from `N` to `P` induced by `k`."]
theorem lift_left_inverse {k : LocalizationMap S P} (z : N) :
    k.lift f.map_units (f.lift k.map_units z) = z := by
  rw [lift_spec]
  cases' f.surj z with x hx
  conv_rhs =>
    congr
    next => skip
    rw [f.eq_mk'_iff_mul_eq.2 hx]
  rw [mk', ← mul_assoc, mul_inv_right f.map_units, ← f.toMap.map_mul, ← f.toMap.map_mul]
  apply k.eq_of_eq f.map_units
  rw [k.toMap.map_mul, k.toMap.map_mul, ← sec_spec, mul_assoc, lift_spec_mul]
  repeat' rw [← k.toMap.map_mul]
  apply f.eq_of_eq k.map_units
  

Proof state:
case intro
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
f : LocalizationMap S N
g : M →* P
hg : ∀ (y : ↥S), IsUnit (g ↑y)
k : LocalizationMap S P
z : N
x : M × ↥S
hx : z * (toMap f) ↑x.2 = (toMap f) x.1
⊢ (toMap f) ((sec f z).1 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * ↑x.2)) =
    (toMap f) (↑(sec f z).2 * (↑(sec k ((lift f (_ : ∀ (y : ↥S), IsUnit ((toMap k) ↑y))) z)).2 * x.1))

Next tactic:
repeat' rw [f.toMap.map_mul]