-
Notifications
You must be signed in to change notification settings - Fork 298
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] - refactor(algebra/hom/group): generalize a few lemmas to monoid_hom_class
#13447
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
63b708b
generalize `injective_iff` to `monoid_hom_class`
j-loreaux 1489be0
more generalizations
j-loreaux de4562c
update name
j-loreaux 74b280d
fix after rename
j-loreaux 5f96f7d
fix
j-loreaux 14ab99e
remove `ring_hom.injective_iff`
j-loreaux e6f92a2
fix straggler
j-loreaux 69a5772
fix lint
j-loreaux 1e6fb39
fix test
j-loreaux c7377b3
Merge branch 'master' into j-loreaux/monoid-hom-class-injective
j-loreaux File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,6 +307,11 @@ lemma map_div [group G] [group H] [monoid_hom_class F G H] | |
(f : F) (x y : G) : f (x / y) = f x / f y := | ||
by rw [div_eq_mul_inv, div_eq_mul_inv, map_mul_inv] | ||
|
||
@[to_additive] | ||
theorem map_div' [div_inv_monoid G] [div_inv_monoid H] [monoid_hom_class F G H] (f : F) | ||
(hf : ∀ x, f (x⁻¹) = (f x)⁻¹) (a b : G) : f (a / b) = f a / f b := | ||
by rw [div_eq_mul_inv, div_eq_mul_inv, map_mul, hf] | ||
|
||
-- to_additive puts the arguments in the wrong order, so generate an auxiliary lemma, then | ||
-- swap its arguments. | ||
@[to_additive map_nsmul.aux, simp] theorem map_pow [monoid G] [monoid H] [monoid_hom_class F G H] | ||
|
@@ -662,30 +667,26 @@ add_decl_doc add_monoid_hom.map_add | |
|
||
namespace monoid_hom | ||
variables {mM : mul_one_class M} {mN : mul_one_class N} {mP : mul_one_class P} | ||
variables [group G] [comm_group H] | ||
variables [group G] [comm_group H] [monoid_hom_class F M N] | ||
|
||
include mM mN | ||
|
||
@[to_additive] | ||
lemma map_mul_eq_one (f : M →* N) {a b : M} (h : a * b = 1) : f a * f b = 1 := | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: this already had a generalized version, and this namespaced one wasn't used anywhere besides the two lemmas below, so I removed it. |
||
map_mul_eq_one f h | ||
|
||
/-- Given a monoid homomorphism `f : M →* N` and an element `x : M`, if `x` has a right inverse, | ||
then `f x` has a right inverse too. For elements invertible on both sides see `is_unit.map`. -/ | ||
@[to_additive "Given an add_monoid homomorphism `f : M →+ N` and an element `x : M`, if `x` has | ||
a right inverse, then `f x` has a right inverse too."] | ||
lemma map_exists_right_inv (f : M →* N) {x : M} (hx : ∃ y, x * y = 1) : | ||
lemma map_exists_right_inv (f : F) {x : M} (hx : ∃ y, x * y = 1) : | ||
∃ y, f x * y = 1 := | ||
let ⟨y, hy⟩ := hx in ⟨f y, f.map_mul_eq_one hy⟩ | ||
let ⟨y, hy⟩ := hx in ⟨f y, map_mul_eq_one f hy⟩ | ||
|
||
/-- Given a monoid homomorphism `f : M →* N` and an element `x : M`, if `x` has a left inverse, | ||
then `f x` has a left inverse too. For elements invertible on both sides see `is_unit.map`. -/ | ||
@[to_additive "Given an add_monoid homomorphism `f : M →+ N` and an element `x : M`, if `x` has | ||
a left inverse, then `f x` has a left inverse too. For elements invertible on both sides see | ||
`is_add_unit.map`."] | ||
lemma map_exists_left_inv (f : M →* N) {x : M} (hx : ∃ y, y * x = 1) : | ||
lemma map_exists_left_inv (f : F) {x : M} (hx : ∃ y, y * x = 1) : | ||
∃ y, y * f x = 1 := | ||
let ⟨y, hy⟩ := hx in ⟨f y, f.map_mul_eq_one hy⟩ | ||
let ⟨y, hy⟩ := hx in ⟨f y, map_mul_eq_one f hy⟩ | ||
|
||
end monoid_hom | ||
|
||
|
@@ -885,11 +886,6 @@ protected theorem monoid_hom.map_zpow' [div_inv_monoid M] [div_inv_monoid N] (f | |
f (a ^ n) = (f a) ^ n := | ||
map_zpow' f hf a n | ||
|
||
@[to_additive] | ||
theorem monoid_hom.map_div' [div_inv_monoid M] [div_inv_monoid N] (f : M →* N) | ||
(hf : ∀ x, f (x⁻¹) = (f x)⁻¹) (a b : M) : f (a / b) = f a / f b := | ||
by rw [div_eq_mul_inv, div_eq_mul_inv, f.map_mul, hf] | ||
|
||
section End | ||
|
||
namespace monoid | ||
|
@@ -1055,10 +1051,10 @@ by { ext, simp only [mul_apply, function.comp_app, map_mul, coe_comp] } | |
/-- If two homomorphism from a group to a monoid are equal at `x`, then they are equal at `x⁻¹`. -/ | ||
@[to_additive "If two homomorphism from an additive group to an additive monoid are equal at `x`, | ||
then they are equal at `-x`." ] | ||
lemma eq_on_inv {G} [group G] [monoid M] {f g : G →* M} {x : G} (h : f x = g x) : | ||
f x⁻¹ = g x⁻¹ := | ||
lemma eq_on_inv {G} [group G] [monoid M] [monoid_hom_class F G M] {f g : F} {x : G} | ||
(h : f x = g x) : f x⁻¹ = g x⁻¹ := | ||
left_inv_eq_right_inv (map_mul_eq_one f $ inv_mul_self x) $ | ||
h.symm ▸ g.map_mul_eq_one $ mul_inv_self x | ||
h.symm ▸ map_mul_eq_one g $ mul_inv_self x | ||
|
||
/-- Group homomorphisms preserve inverse. -/ | ||
@[to_additive] | ||
|
@@ -1084,24 +1080,24 @@ protected theorem map_mul_inv {G H} [group G] [group H] (f : G →* H) (g h : G) | |
map_mul_inv f g h | ||
|
||
/-- A homomorphism from a group to a monoid is injective iff its kernel is trivial. | ||
For the iff statement on the triviality of the kernel, see `monoid_hom.injective_iff'`. -/ | ||
For the iff statement on the triviality of the kernel, see `injective_iff_map_eq_one'`. -/ | ||
@[to_additive "A homomorphism from an additive group to an additive monoid is injective iff | ||
its kernel is trivial. For the iff statement on the triviality of the kernel, | ||
see `add_monoid_hom.injective_iff'`."] | ||
lemma injective_iff {G H} [group G] [mul_one_class H] (f : G →* H) : | ||
function.injective f ↔ (∀ a, f a = 1 → a = 1) := | ||
see `injective_iff_map_eq_zero'`."] | ||
lemma _root_.injective_iff_map_eq_one {G H} [group G] [mul_one_class H] [monoid_hom_class F G H] | ||
(f : F) : function.injective f ↔ (∀ a, f a = 1 → a = 1) := | ||
⟨λ h x, (map_eq_one_iff f h).mp, | ||
λ h x y hxy, mul_inv_eq_one.1 $ h _ $ by rw [f.map_mul, hxy, ← f.map_mul, mul_inv_self, f.map_one]⟩ | ||
λ h x y hxy, mul_inv_eq_one.1 $ h _ $ by rw [map_mul, hxy, ← map_mul, mul_inv_self, map_one]⟩ | ||
|
||
/-- A homomorphism from a group to a monoid is injective iff its kernel is trivial, | ||
stated as an iff on the triviality of the kernel. | ||
For the implication, see `monoid_hom.injective_iff`. -/ | ||
For the implication, see `injective_iff_map_eq_one`. -/ | ||
@[to_additive "A homomorphism from an additive group to an additive monoid is injective iff its | ||
kernel is trivial, stated as an iff on the triviality of the kernel. For the implication, see | ||
`add_monoid_hom.injective_iff`."] | ||
lemma injective_iff' {G H} [group G] [mul_one_class H] (f : G →* H) : | ||
function.injective f ↔ (∀ a, f a = 1 ↔ a = 1) := | ||
f.injective_iff.trans $ forall_congr $ λ a, ⟨λ h, ⟨h, λ H, H.symm ▸ f.map_one⟩, iff.mp⟩ | ||
`injective_iff_map_eq_zero`."] | ||
lemma _root_.injective_iff_map_eq_one' {G H} [group G] [mul_one_class H] [monoid_hom_class F G H] | ||
(f : F) : function.injective f ↔ (∀ a, f a = 1 ↔ a = 1) := | ||
(injective_iff_map_eq_one f).trans $ forall_congr $ λ a, ⟨λ h, ⟨h, λ H, H.symm ▸ map_one f⟩, iff.mp⟩ | ||
|
||
include mM | ||
/-- Makes a group homomorphism from a proof that the map preserves multiplication. -/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved/generalized from the namespaced version below.