-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: group markings #19475
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
Open
YaelDillies
wants to merge
4
commits into
master
Choose a base branch
from
group_marking
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: group markings #19475
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| /- | ||
| Copyright (c) 2023 Yaël Dillies. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Yaël Dillies | ||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.Analysis.Normed.Group.Quotient | ||
| public import Mathlib.GroupTheory.FreeGroup.Reduce | ||
|
|
||
| /-! | ||
| # Marked groups | ||
|
|
||
| This file defines group markings and induces a norm on marked groups. | ||
|
|
||
| ## Main declarations | ||
|
|
||
| * `GroupMarking G S`: Marking of the group `G` by a type `S`, namely a surjective monoid | ||
| homomorphism `FreeGroup S →* G`. | ||
| * `MarkedGroup`: If `m : GroupMarking G S`, then `MarkedGroup m` is a type synonym for `G` | ||
| endowed with the metric coming from `m`. | ||
| * `MarkedGroup.instNormedGroup`: A marked group is normed by the word metric of the marking. | ||
| -/ | ||
|
|
||
| open Function List Nat | ||
|
|
||
| variable {G S : Type*} [Group G] | ||
|
|
||
| /-- A marking of an additive group is a generating family of elements. -/ | ||
| structure AddGroupMarking (G S : Type*) [AddGroup G] extends FreeAddGroup S →+ G where | ||
| toFun_surjective : Surjective toFun | ||
|
|
||
| /-- A marking of a group is a generating family of elements. -/ | ||
| @[to_additive] | ||
| structure GroupMarking (G S : Type*) [Group G] extends FreeGroup S →* G where | ||
| toFun_surjective : Surjective toFun | ||
|
|
||
| /-- Reinterpret a marking of `G` by `S` as an additive monoid homomorphism `FreeAddGroup S →+ G`. -/ | ||
| add_decl_doc AddGroupMarking.toAddMonoidHom | ||
|
|
||
| /-- Reinterpret a marking of `G` by `S` as a monoid homomorphism `FreeGroup S →+ G`. -/ | ||
| add_decl_doc GroupMarking.toMonoidHom | ||
|
|
||
| namespace GroupMarking | ||
|
|
||
| @[to_additive] | ||
| instance instFunLike : FunLike (GroupMarking G S) (FreeGroup S) G where | ||
| coe f := f.toFun | ||
| coe_injective' := by rintro ⟨⟨⟨_, _⟩, _⟩, _⟩; congr! | ||
|
|
||
| @[to_additive] | ||
| instance instMonoidHomClass : MonoidHomClass (GroupMarking G S) (FreeGroup S) G where | ||
| map_mul f := f.map_mul' | ||
| map_one f := f.map_one' | ||
|
|
||
| @[to_additive] | ||
| lemma coe_surjective (m : GroupMarking G S) : Surjective m := m.toFun_surjective | ||
|
|
||
| end GroupMarking | ||
|
|
||
| /-- The trivial group marking. -/ | ||
| @[to_additive "The trivial additive group marking."] | ||
| def GroupMarking.refl : GroupMarking G G := | ||
| { FreeGroup.lift id with toFun_surjective := fun x => ⟨FreeGroup.of x, FreeGroup.lift.of⟩ } | ||
|
|
||
| @[to_additive] instance : Inhabited (GroupMarking G G) := ⟨.refl⟩ | ||
|
|
||
| variable {m : GroupMarking G S} | ||
|
|
||
| set_option linter.unusedVariables false in | ||
| /-- A type synonym of `G`, tagged with a group marking. -/ | ||
| @[to_additive (attr := nolint unusedArguments) | ||
| "A type synonym of `G`, tagged with an additive group marking."] | ||
| def MarkedGroup (m : GroupMarking G S) : Type _ := G | ||
|
|
||
| @[to_additive] instance MarkedGroup.instGroup : Group (MarkedGroup m) := ‹Group G› | ||
|
|
||
| /-- "Identity" isomorphism between `G` and a group marking of it. -/ | ||
| @[to_additive "\"Identity\" isomorphism between `G` and an additive group marking of it."] | ||
| def toMarkedGroup : G ≃* MarkedGroup m := .refl _ | ||
|
|
||
| /-- "Identity" isomorphism between a group marking of `G` and itself. -/ | ||
| @[to_additive "\"Identity\" isomorphism between an additive group marking of `G` and itself."] | ||
| def ofMarkedGroup : MarkedGroup m ≃* G := .refl _ | ||
|
|
||
| @[to_additive (attr := simp)] | ||
| lemma toMarkedGroup_symm_eq : (toMarkedGroup : G ≃* MarkedGroup m).symm = ofMarkedGroup := rfl | ||
|
|
||
| @[to_additive (attr := simp)] | ||
| lemma ofMarkedGroup_symm_eq : (ofMarkedGroup : MarkedGroup m ≃* G).symm = toMarkedGroup := rfl | ||
|
|
||
| @[to_additive (attr := simp)] | ||
| lemma toMarkedGroup_ofMarkedGroup (a) : toMarkedGroup (ofMarkedGroup (a : MarkedGroup m)) = a := rfl | ||
|
|
||
| @[to_additive (attr := simp)] | ||
| lemma ofMarkedGroup_toMarkedGroup (a) : ofMarkedGroup (toMarkedGroup a : MarkedGroup m) = a := rfl | ||
|
|
||
| @[to_additive] | ||
| lemma toMarkedGroup_inj {a b} : (toMarkedGroup a : MarkedGroup m) = toMarkedGroup b ↔ a = b := .rfl | ||
|
|
||
| @[to_additive] | ||
| lemma ofMarkedGroup_inj {a b : MarkedGroup m} : ofMarkedGroup a = ofMarkedGroup b ↔ a = b := .rfl | ||
|
|
||
| variable (α : Type*) | ||
|
|
||
| @[to_additive] | ||
| instance MarkedGroup.instInhabited [Inhabited G] : Inhabited (MarkedGroup m) := ‹Inhabited G› | ||
|
|
||
| @[to_additive] | ||
| instance MarkedGroup.instSmul [SMul G α] : SMul (MarkedGroup m) α := ‹SMul G α› | ||
|
|
||
| @[to_additive] | ||
| instance MarkedGroup.instMulAction [MulAction G α] : MulAction (MarkedGroup m) α := ‹MulAction G α› | ||
|
|
||
| @[to_additive (attr := simp)] | ||
| lemma toMarkedGroup_smul (g : G) (x : α) [SMul G α] : | ||
| (toMarkedGroup g : MarkedGroup m) • x = g • x := rfl | ||
|
|
||
| @[to_additive (attr := simp)] | ||
| lemma ofMarkedGroup_smul (g : MarkedGroup m) (x : α) [SMul G α] : ofMarkedGroup g • x = g • x := rfl | ||
|
|
||
| /-- A marked group is equivalent to a quotient of the free group by a normal subgroup. -/ | ||
| @[simps! apply] | ||
| noncomputable def quotientEquivMarkedGroup : FreeGroup S ⧸ m.toMonoidHom.ker ≃* MarkedGroup m := | ||
| QuotientGroup.quotientKerEquivOfSurjective _ m.coe_surjective | ||
|
|
||
| @[to_additive] | ||
| private lemma mul_aux [DecidableEq S] (x : MarkedGroup m) : | ||
| ∃ (n : _) (l : FreeGroup S), toMarkedGroup (m l) = x ∧ l.toWord.length ≤ n := by | ||
| classical | ||
| obtain ⟨l, rfl⟩ := m.coe_surjective x | ||
| exact ⟨_, _, rfl, le_rfl⟩ | ||
|
|
||
| @[to_additive] | ||
| private lemma mul_aux' [DecidableEq S] (x : MarkedGroup m) : | ||
| ∃ (n : _) (l : FreeGroup S), toMarkedGroup (m l) = x ∧ l.toWord.length = n := by | ||
| classical | ||
| obtain ⟨l, rfl⟩ := m.coe_surjective x | ||
| exact ⟨_, _, rfl, rfl⟩ | ||
|
|
||
| @[to_additive] | ||
| private lemma find_mul_aux [DecidableEq S] (x : MarkedGroup m) | ||
| [DecidablePred fun n ↦ ∃ l, toMarkedGroup (m l) = x ∧ l.toWord.length ≤ n] | ||
| [DecidablePred fun n ↦ ∃ l, toMarkedGroup (m l) = x ∧ l.toWord.length = n] : | ||
| Nat.find (mul_aux x) = Nat.find (mul_aux' x) := by | ||
| classical | ||
| exact _root_.le_antisymm (Nat.find_mono fun n => Exists.imp fun l => And.imp_right le_of_eq) <| | ||
| (Nat.le_find_iff _ _).2 fun k hk ⟨l, hl, hlk⟩ => (Nat.lt_find_iff _ _).1 hk _ hlk ⟨l, hl, rfl⟩ | ||
|
|
||
| @[to_additive] | ||
| noncomputable instance : NormedGroup (MarkedGroup m) where | ||
| norm x := ‖quotientEquivMarkedGroup.symm x‖ | ||
|
|
||
| namespace MarkedGroup | ||
|
|
||
| @[to_additive add_norm_def] | ||
| private lemma norm_def [DecidableEq S] (x : MarkedGroup m) | ||
| [DecidablePred fun n ↦ ∃ l, toMarkedGroup (m l) = x ∧ l.toWord.length = n] : | ||
| ‖x‖ = Nat.find (mul_aux' x) := by | ||
| convert congr_arg Nat.cast (find_mul_aux _) | ||
| classical | ||
| infer_instance | ||
|
|
||
| @[to_additive add_norm_def] | ||
| lemma norm_le_iff [DecidableEq S] (x : MarkedGroup m) | ||
| [DecidablePred fun n ↦ ∃ l, toMarkedGroup (m l) = x ∧ l.toWord.length = n] : | ||
| ‖x‖ = Nat.find (mul_aux' x) := by | ||
| convert congr_arg Nat.cast (find_mul_aux _) | ||
| classical | ||
| infer_instance | ||
|
|
||
| end MarkedGroup | ||
This file contains hidden or 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 hidden or 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.
It's generally not a great idea to have a lemma of this form, where the definition depends on a private lemma. You should instead give properties of the norm which can be useful without referencing private lemmas. For instance, the lemma that there exists a word in the free group with length n which corresponds to x is tricky to prove from the public API. This, and related lemmas (the norm is the smallest n with that property) should be included as part of the norm API.