Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat({algebra/group_action_hom, data/equiv/mul_add}): add missing inverse defs #7847

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 40 additions & 2 deletions src/algebra/group_action_hom.lean
Expand Up @@ -93,6 +93,18 @@ ext $ λ x, by rw [comp_apply, id_apply]
@[simp] lemma comp_id (f : X →[M'] Y) : f.comp (mul_action_hom.id M') = f :=
ext $ λ x, by rw [comp_apply, id_apply]

variables {A B}

/-- The inverse of a bijective equivariant map is equivariant. -/
def inverse (f : A →[M] B) (g : B → A)
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
(h₁ : function.left_inverse g f) (h₂ : function.right_inverse g f) :
B →[M] A :=
{ to_fun := g,
map_smul' := λ m x,
calc g (m • x) = g (m • (f (g x))) : by rw h₂
... = g (f (m • (g x))) : by rw f.map_smul
... = m • g x : by rw h₁, }

variables {G} (H)

/-- The canonical map to the left cosets. -/
Expand All @@ -104,7 +116,6 @@ def to_quotient : G →[G] quotient_group.quotient H :=
end mul_action_hom

/-- Equivariant additive monoid homomorphisms. -/
@[nolint has_inhabited_instance]
structure distrib_mul_action_hom extends A →[M] B, A →+ B.

/-- Reinterpret an equivariant additive monoid homomorphism as an additive monoid homomorphism. -/
Expand All @@ -124,10 +135,12 @@ instance has_coe' : has_coe (A →+[M] B) (A →[M] B) :=
⟨to_mul_action_hom⟩

instance : has_coe_to_fun (A →+[M] B) :=
⟨_, λ c, c.to_fun⟩
⟨_, to_fun⟩
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's another one of these on line 238


variables {M A B}

@[simp] lemma to_fun_eq_coe (f : A →+[M] B) : f.to_fun = ⇑f := rfl

@[norm_cast] lemma coe_fn_coe (f : A →+[M] B) : ((f : A →+ B) : A → B) = f := rfl
@[norm_cast] lemma coe_fn_coe' (f : A →+[M] B) : ((f : A →[M] B) : A → B) = f := rfl

Expand All @@ -137,6 +150,24 @@ variables {M A B}
theorem ext_iff {f g : A →+[M] B} : f = g ↔ ∀ x, f x = g x :=
⟨λ H x, by rw H, ext⟩

instance : has_zero (A →+[M] B) :=
⟨{ map_smul' := by simp,
.. (0 : A →+ B) }⟩

instance : has_one (A →+[M] A) :=
⟨{ map_smul' := by simp,
.. add_monoid_hom.id A }⟩
ocfnash marked this conversation as resolved.
Show resolved Hide resolved

@[simp] lemma coe_zero : ((0 : A →+[M] B) : A → B) = 0 := rfl

@[simp] lemma coe_one : ((1 : A →+[M] A) : A → A) = id := rfl

lemma zero_apply (a : A) : (0 : A →+[M] B) a = 0 := rfl

lemma one_apply (a : A) : (1 : A →+[M] A) a = a := rfl

instance : inhabited (A →+[M] B) := ⟨0⟩

@[simp] lemma map_zero (f : A →+[M] B) : f 0 = 0 :=
f.map_zero'

Expand Down Expand Up @@ -175,6 +206,13 @@ ext $ λ x, by rw [comp_apply, id_apply]
@[simp] lemma comp_id (f : A →+[M] B) : f.comp (distrib_mul_action_hom.id M) = f :=
ext $ λ x, by rw [comp_apply, id_apply]

/-- The inverse of a bijective `distrib_mul_action_hom` is a `distrib_mul_action_hom`. -/
def inverse (f : A →+[M] B) (g : B → A)
(h₁ : function.left_inverse g f) (h₂ : function.right_inverse g f) :
B →+[M] A :=
{ .. (f : A →+ B).inverse g h₁ h₂,
.. (f : A →[M] B).inverse g h₁ h₂ }

end distrib_mul_action_hom

/-- Equivariant ring homomorphisms. -/
Expand Down
8 changes: 8 additions & 0 deletions src/data/equiv/mul_add.lean
Expand Up @@ -45,6 +45,14 @@ def mul_hom.inverse [has_mul M] [has_mul N] (f : mul_hom M N) (g : N → M)
... = g (f (g x * g y)) : by rw f.map_mul
... = g x * g y : h₁ _, }

/-- The inverse of a bijective `monoid_hom` is a `monoid_hom`. -/
@[to_additive "The inverse of a bijective `add_monoid_hom` is an `add_monoid_hom`."]
def monoid_hom.inverse {A B : Type*} [monoid A] [monoid B] (f : A →* B) (g : B → A)
(h₁ : function.left_inverse g f) (h₂ : function.right_inverse g f) :
B →* A :=
{ map_one' := show g 1 = 1, by rw [← f.map_one, h₁],
ocfnash marked this conversation as resolved.
Show resolved Hide resolved
.. (f : mul_hom A B).inverse g h₁ h₂, }

ocfnash marked this conversation as resolved.
Show resolved Hide resolved
set_option old_structure_cmd true

/-- add_equiv α β is the type of an equiv α ≃ β which preserves addition. -/
Expand Down