Skip to content

Commit

Permalink
chore: @[simp] cancel_(right|left) (#6300)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
  • Loading branch information
semorrison and semorrison committed Sep 5, 2023
1 parent 5dac7e8 commit 08ccb2b
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Mathlib/Algebra/Hom/Centroid.lean
Expand Up @@ -225,11 +225,13 @@ theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f :=
rfl
#align centroid_hom.id_comp CentroidHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩
#align centroid_hom.cancel_right CentroidHom.cancel_right

@[simp]
theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Hom/Freiman.lean
Expand Up @@ -251,7 +251,7 @@ theorem comp_assoc (f : A →*[n] β) (g : B →*[n] γ) (h : C →*[n] δ) {hf
#align freiman_hom.comp_assoc FreimanHom.comp_assoc
#align add_freiman_hom.comp_assoc AddFreimanHom.comp_assoc

@[to_additive]
@[to_additive (attr := simp)]
theorem cancel_right {g₁ g₂ : B →*[n] γ} {f : A →*[n] β} (hf : Function.Surjective f) {hg₁ hg₂} :
g₁.comp f hg₁ = g₂.comp f hg₂ ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => h ▸ rfl⟩
Expand Down
4 changes: 4 additions & 0 deletions Mathlib/Algebra/Hom/Ring.lean
Expand Up @@ -322,11 +322,13 @@ theorem coe_mul (f g : α →ₙ+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align non_unital_ring_hom.coe_mul NonUnitalRingHom.coe_mul

@[simp]
theorem cancel_right {g₁ g₂ : β →ₙ+* γ} {f : α →ₙ+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align non_unital_ring_hom.cancel_right NonUnitalRingHom.cancel_right

@[simp]
theorem cancel_left {g : β →ₙ+* γ} {f₁ f₂ : α →ₙ+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
Expand Down Expand Up @@ -732,11 +734,13 @@ theorem coe_mul (f g : α →+* α) : ⇑(f * g) = f ∘ g :=
rfl
#align ring_hom.coe_mul RingHom.coe_mul

@[simp]
theorem cancel_right {g₁ g₂ : β →+* γ} {f : α →+* β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => RingHom.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align ring_hom.cancel_right RingHom.cancel_right

@[simp]
theorem cancel_left {g : β →+* γ} {f₁ f₂ : α →+* β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => RingHom.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/Algebra/Module/LinearMap.lean
Expand Up @@ -570,10 +570,12 @@ theorem id_comp : id.comp f = f :=

variable {f g} {f' : M₂ →ₛₗ[σ₂₃] M₃} {g' : M₁ →ₛₗ[σ₁₂] M₂}

@[simp]
theorem cancel_right (hg : Function.Surjective g) : f.comp g = f'.comp g ↔ f = f' :=
fun h ↦ ext <| hg.forall.2 (ext_iff.1 h), fun h ↦ h ▸ rfl⟩
#align linear_map.cancel_right LinearMap.cancel_right

@[simp]
theorem cancel_left (hf : Function.Injective f) : f.comp g = f.comp g' ↔ g = g' :=
fun h ↦ ext fun x ↦ hf <| by rw [← comp_apply, h, comp_apply], fun h ↦ h ▸ rfl⟩
#align linear_map.cancel_left LinearMap.cancel_left
Expand Down
6 changes: 4 additions & 2 deletions Mathlib/Algebra/Order/Hom/Monoid.lean
Expand Up @@ -453,14 +453,14 @@ theorem id_comp (f : α →*o β) : (OrderMonoidHom.id β).comp f = f :=
#align order_monoid_hom.id_comp OrderMonoidHom.id_comp
#align order_add_monoid_hom.id_comp OrderAddMonoidHom.id_comp

@[to_additive]
@[to_additive (attr := simp)]
theorem cancel_right {g₁ g₂ : β →*o γ} {f : α →*o β} (hf : Function.Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun _ => by congr⟩
#align order_monoid_hom.cancel_right OrderMonoidHom.cancel_right
#align order_add_monoid_hom.cancel_right OrderAddMonoidHom.cancel_right

@[to_additive]
@[to_additive (attr := simp)]
theorem cancel_left {g : β →*o γ} {f₁ f₂ : α →*o β} (hg : Function.Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down Expand Up @@ -708,11 +708,13 @@ theorem comp_id (f : α →*₀o β) : f.comp (OrderMonoidWithZeroHom.id α) = f
theorem id_comp (f : α →*₀o β) : (OrderMonoidWithZeroHom.id β).comp f = f := rfl
#align order_monoid_with_zero_hom.id_comp OrderMonoidWithZeroHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : β →*₀o γ} {f : α →*₀o β} (hf : Function.Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun _ => by congr⟩
#align order_monoid_with_zero_hom.cancel_right OrderMonoidWithZeroHom.cancel_right

@[simp]
theorem cancel_left {g : β →*₀o γ} {f₁ f₂ : α →*₀o β} (hg : Function.Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
3 changes: 3 additions & 0 deletions Mathlib/Algebra/Order/Hom/Ring.lean
Expand Up @@ -326,10 +326,13 @@ theorem id_comp (f : α →+*o β) : (OrderRingHom.id β).comp f = f :=
rfl
#align order_ring_hom.id_comp OrderRingHom.id_comp

@[simp]
theorem cancel_right {f₁ f₂ : β →+*o γ} {g : α →+*o β} (hg : Surjective g) :
f₁.comp g = f₂.comp g ↔ f₁ = f₂ :=
fun h => ext <| hg.forall.2 <| FunLike.ext_iff.1 h, fun h => by rw [h]⟩
#align order_ring_hom.cancel_right OrderRingHom.cancel_right

@[simp]
theorem cancel_left {f : β →+*o γ} {g₁ g₂ : α →+*o β} (hf : Injective f) :
f.comp g₁ = f.comp g₂ ↔ g₁ = g₂ :=
fun h => ext fun a => hf <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
6 changes: 6 additions & 0 deletions Mathlib/Order/Heyting/Hom.lean
Expand Up @@ -352,10 +352,12 @@ theorem id_comp (f : HeytingHom α β) : (HeytingHom.id β).comp f = f :=
ext fun _ => rfl
#align heyting_hom.id_comp HeytingHom.id_comp

@[simp]
theorem cancel_right (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align heyting_hom.cancel_right HeytingHom.cancel_right

@[simp]
theorem cancel_left (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => HeytingHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align heyting_hom.cancel_left HeytingHom.cancel_left
Expand Down Expand Up @@ -477,10 +479,12 @@ theorem id_comp (f : CoheytingHom α β) : (CoheytingHom.id β).comp f = f :=
ext fun _ => rfl
#align coheyting_hom.id_comp CoheytingHom.id_comp

@[simp]
theorem cancel_right (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align coheyting_hom.cancel_right CoheytingHom.cancel_right

@[simp]
theorem cancel_left (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => CoheytingHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align coheyting_hom.cancel_left CoheytingHom.cancel_left
Expand Down Expand Up @@ -599,10 +603,12 @@ theorem id_comp (f : BiheytingHom α β) : (BiheytingHom.id β).comp f = f :=
ext fun _ => rfl
#align biheyting_hom.id_comp BiheytingHom.id_comp

@[simp]
theorem cancel_right (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align biheyting_hom.cancel_right BiheytingHom.cancel_right

@[simp]
theorem cancel_left (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => BiheytingHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align biheyting_hom.cancel_left BiheytingHom.cancel_left
Expand Down
6 changes: 6 additions & 0 deletions Mathlib/Order/Hom/Bounded.lean
Expand Up @@ -280,11 +280,13 @@ theorem id_comp (f : TopHom α β) : (TopHom.id β).comp f = f :=
TopHom.ext fun _ => rfl
#align top_hom.id_comp TopHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : TopHom β γ} {f : TopHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => TopHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun g => comp g f)⟩
#align top_hom.cancel_right TopHom.cancel_right

@[simp]
theorem cancel_left {g : TopHom β γ} {f₁ f₂ : TopHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => TopHom.ext fun a => hg <| by rw [← TopHom.comp_apply, h, TopHom.comp_apply],
Expand Down Expand Up @@ -470,11 +472,13 @@ theorem id_comp (f : BotHom α β) : (BotHom.id β).comp f = f :=
BotHom.ext fun _ => rfl
#align bot_hom.id_comp BotHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : BotHom β γ} {f : BotHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => BotHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (comp · f)⟩
#align bot_hom.cancel_right BotHom.cancel_right

@[simp]
theorem cancel_left {g : BotHom β γ} {f₁ f₂ : BotHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => BotHom.ext fun a => hg <| by rw [← BotHom.comp_apply, h, BotHom.comp_apply],
Expand Down Expand Up @@ -684,12 +688,14 @@ theorem id_comp (f : BoundedOrderHom α β) : (BoundedOrderHom.id β).comp f = f
BoundedOrderHom.ext fun _ => rfl
#align bounded_order_hom.id_comp BoundedOrderHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : BoundedOrderHom β γ} {f : BoundedOrderHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => BoundedOrderHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h,
congr_arg (fun g => comp g f)⟩
#align bounded_order_hom.cancel_right BoundedOrderHom.cancel_right

@[simp]
theorem cancel_left {g : BoundedOrderHom β γ} {f₁ f₂ : BoundedOrderHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h =>
Expand Down
8 changes: 8 additions & 0 deletions Mathlib/Order/Hom/CompleteLattice.lean
Expand Up @@ -337,11 +337,13 @@ theorem id_comp (f : sSupHom α β) : (sSupHom.id β).comp f = f :=
ext fun _ => rfl
#align Sup_hom.id_comp sSupHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : sSupHom β γ} {f : sSupHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align Sup_hom.cancel_right sSupHom.cancel_right

@[simp]
theorem cancel_left {g : sSupHom β γ} {f₁ f₂ : sSupHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down Expand Up @@ -481,11 +483,13 @@ theorem id_comp (f : sInfHom α β) : (sInfHom.id β).comp f = f :=
ext fun _ => rfl
#align Inf_hom.id_comp sInfHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : sInfHom β γ} {f : sInfHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align Inf_hom.cancel_right sInfHom.cancel_right

@[simp]
theorem cancel_left {g : sInfHom β γ} {f₁ f₂ : sInfHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down Expand Up @@ -634,11 +638,13 @@ theorem id_comp (f : FrameHom α β) : (FrameHom.id β).comp f = f :=
ext fun _ => rfl
#align frame_hom.id_comp FrameHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : FrameHom β γ} {f : FrameHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align frame_hom.cancel_right FrameHom.cancel_right

@[simp]
theorem cancel_left {g : FrameHom β γ} {f₁ f₂ : FrameHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down Expand Up @@ -764,11 +770,13 @@ theorem id_comp (f : CompleteLatticeHom α β) : (CompleteLatticeHom.id β).comp
ext fun _ => rfl
#align complete_lattice_hom.id_comp CompleteLatticeHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : CompleteLatticeHom β γ} {f : CompleteLatticeHom α β}
(hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align complete_lattice_hom.cancel_right CompleteLatticeHom.cancel_right

@[simp]
theorem cancel_left {g : CompleteLatticeHom β γ} {f₁ f₂ : CompleteLatticeHom α β}
(hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
12 changes: 12 additions & 0 deletions Mathlib/Order/Hom/Lattice.lean
Expand Up @@ -421,11 +421,13 @@ theorem comp_assoc (f : SupHom γ δ) (g : SupHom β γ) (h : SupHom α β) :
@[simp] theorem id_comp (f : SupHom α β) : (SupHom.id β).comp f = f := rfl
#align sup_hom.id_comp SupHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : SupHom β γ} {f : SupHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => SupHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
#align sup_hom.cancel_right SupHom.cancel_right

@[simp]
theorem cancel_left {g : SupHom β γ} {f₁ f₂ : SupHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => SupHom.ext fun a => hg <| by rw [← SupHom.comp_apply, h, SupHom.comp_apply],
Expand Down Expand Up @@ -607,11 +609,13 @@ theorem comp_assoc (f : InfHom γ δ) (g : InfHom β γ) (h : InfHom α β) :
@[simp] theorem id_comp (f : InfHom α β) : (InfHom.id β).comp f = f := rfl
#align inf_hom.id_comp InfHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : InfHom β γ} {f : InfHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => InfHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
#align inf_hom.cancel_right InfHom.cancel_right

@[simp]
theorem cancel_left {g : InfHom β γ} {f₁ f₂ : InfHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => InfHom.ext fun a => hg <| by rw [← InfHom.comp_apply, h, InfHom.comp_apply],
Expand Down Expand Up @@ -808,11 +812,13 @@ theorem comp_assoc (f : SupBotHom γ δ) (g : SupBotHom β γ) (h : SupBotHom α
@[simp] theorem id_comp (f : SupBotHom α β) : (SupBotHom.id β).comp f = f := rfl
#align sup_bot_hom.id_comp SupBotHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : SupBotHom β γ} {f : SupBotHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
#align sup_bot_hom.cancel_right SupBotHom.cancel_right

@[simp]
theorem cancel_left {g : SupBotHom β γ} {f₁ f₂ : SupBotHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => SupBotHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down Expand Up @@ -968,11 +974,13 @@ theorem comp_assoc (f : InfTopHom γ δ) (g : InfTopHom β γ) (h : InfTopHom α
@[simp] theorem id_comp (f : InfTopHom α β) : (InfTopHom.id β).comp f = f := rfl
#align inf_top_hom.id_comp InfTopHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : InfTopHom β γ} {f : InfTopHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
#align inf_top_hom.cancel_right InfTopHom.cancel_right

@[simp]
theorem cancel_left {g : InfTopHom β γ} {f₁ f₂ : InfTopHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => InfTopHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down Expand Up @@ -1148,11 +1156,13 @@ theorem id_comp (f : LatticeHom α β) : (LatticeHom.id β).comp f = f :=
LatticeHom.ext fun _ => rfl
#align lattice_hom.id_comp LatticeHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : LatticeHom β γ} {f : LatticeHom α β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => LatticeHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
#align lattice_hom.cancel_right LatticeHom.cancel_right

@[simp]
theorem cancel_left {g : LatticeHom β γ} {f₁ f₂ : LatticeHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => LatticeHom.ext fun a => hg <| by rw [← LatticeHom.comp_apply, h, LatticeHom.comp_apply],
Expand Down Expand Up @@ -1342,12 +1352,14 @@ theorem comp_assoc (f : BoundedLatticeHom γ δ) (g : BoundedLatticeHom β γ)
@[simp] theorem id_comp (f : BoundedLatticeHom α β) : (BoundedLatticeHom.id β).comp f = f := rfl
#align bounded_lattice_hom.id_comp BoundedLatticeHom.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : BoundedLatticeHom β γ} {f : BoundedLatticeHom α β}
(hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => BoundedLatticeHom.ext <| hf.forall.2 <| FunLike.ext_iff.1 h,
fun h => congr_arg₂ _ h rfl⟩
#align bounded_lattice_hom.cancel_right BoundedLatticeHom.cancel_right

@[simp]
theorem cancel_left {g : BoundedLatticeHom β γ} {f₁ f₂ : BoundedLatticeHom α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/Topology/Bornology/Hom.lean
Expand Up @@ -188,12 +188,14 @@ theorem id_comp (f : LocallyBoundedMap α β) : (LocallyBoundedMap.id β).comp f
ext fun _ => rfl
#align locally_bounded_map.id_comp LocallyBoundedMap.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : LocallyBoundedMap β γ} {f : LocallyBoundedMap α β}
(hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, congrArg (fun x => comp x f)⟩
-- porting note: unification was not strong enough to do `congrArg _`.
#align locally_bounded_map.cancel_right LocallyBoundedMap.cancel_right

@[simp]
theorem cancel_left {g : LocallyBoundedMap β γ} {f₁ f₂ : LocallyBoundedMap α β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/Topology/ContinuousFunction/Basic.lean
Expand Up @@ -270,11 +270,13 @@ theorem comp_const (f : C(β, γ)) (b : β) : f.comp (const α b) = const α (f
ext fun _ => rfl
#align continuous_map.comp_const ContinuousMap.comp_const

@[simp]
theorem cancel_right {f₁ f₂ : C(β, γ)} {g : C(α, β)} (hg : Surjective g) :
f₁.comp g = f₂.comp g ↔ f₁ = f₂ :=
fun h => ext <| hg.forall.2 <| FunLike.ext_iff.1 h, congr_arg (ContinuousMap.comp · g)⟩
#align continuous_map.cancel_right ContinuousMap.cancel_right

@[simp]
theorem cancel_left {f : C(β, γ)} {g₁ g₂ : C(α, β)} (hf : Injective f) :
f.comp g₁ = f.comp g₂ ↔ g₁ = g₂ :=
fun h => ext fun a => hf <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
Expand Down
3 changes: 2 additions & 1 deletion Mathlib/Topology/Hom/Open.lean
Expand Up @@ -151,15 +151,16 @@ theorem id_comp (f : α →CO β) : (ContinuousOpenMap.id β).comp f = f :=
ext fun _ => rfl
#align continuous_open_map.id_comp ContinuousOpenMap.id_comp

@[simp]
theorem cancel_right {g₁ g₂ : β →CO γ} {f : α →CO β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun h => congr_arg₂ _ h rfl⟩
#align continuous_open_map.cancel_right ContinuousOpenMap.cancel_right

@[simp]
theorem cancel_left {g : β →CO γ} {f₁ f₂ : α →CO β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align continuous_open_map.cancel_left ContinuousOpenMap.cancel_left

end ContinuousOpenMap

2 changes: 2 additions & 0 deletions Mathlib/Topology/MetricSpace/Dilation.lean
Expand Up @@ -389,11 +389,13 @@ def ratioHom : (α →ᵈ α) →* ℝ≥0 := ⟨⟨ratio, ratio_one⟩, ratio_m
theorem ratio_pow (f : α →ᵈ α) (n : ℕ) : ratio (f ^ n) = ratio f ^ n :=
ratioHom.map_pow _ _

@[simp]
theorem cancel_right {g₁ g₂ : β →ᵈ γ} {f : α →ᵈ β} (hf : Surjective f) :
g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
fun h => Dilation.ext <| hf.forall.2 (ext_iff.1 h), fun h => h ▸ rfl⟩
#align dilation.cancel_right Dilation.cancel_right

@[simp]
theorem cancel_left {g : β →ᵈ γ} {f₁ f₂ : α →ᵈ β} (hg : Injective g) :
g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
fun h => Dilation.ext fun x => hg <| by rw [← comp_apply, h, comp_apply], fun h => h ▸ rfl⟩
Expand Down

0 comments on commit 08ccb2b

Please sign in to comment.