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

tensor products of abelian groups #2021

Merged
merged 45 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3c6ad57
grp_pow_commutes
Alizter Jul 8, 2024
d58355b
tensor products of abelian groups
Alizter Jul 9, 2024
5b89691
more comments and simplify some proofs
Alizter Jul 10, 2024
b733df5
add universal property
Alizter Jul 11, 2024
f9c589c
TensorProduct: fix typos in comments
jdchristensen Jul 12, 2024
df441c6
TensorProduct: drop (P 0) from induction principles
jdchristensen Jul 12, 2024
87afe85
Abelianization: rename ab map to abel_in
Alizter Jul 13, 2024
4c9a8d2
fix abel_in negation lemma usage
Alizter Jul 13, 2024
4f84baf
Abelianization: inline proof of abel_unit
jdchristensen Jul 13, 2024
82b0feb
simplify induction principles
Alizter Jul 13, 2024
b63352a
remove unneeded lemma
Alizter Jul 13, 2024
5dee8c1
small simplifications
Alizter Jul 13, 2024
8b88d03
simplify induction hypothesis to +
Alizter Jul 13, 2024
08a26b1
cleanup names
Alizter Jul 13, 2024
edc74fa
TensorProduct: simplify proof of induction principle
jdchristensen Jul 13, 2024
9373e4d
fix typo
Alizter Jul 13, 2024
baa3a89
TensorProduct: update comments
jdchristensen Jul 13, 2024
920db0c
Add grp_homo_op_agree, and use it in many places
jdchristensen Jul 13, 2024
ee4daf5
TensorProduct: factor out defn of bilinear pairs to make goals small
jdchristensen Jul 13, 2024
4758acc
Simplifications involving grp_pow and ab_mul
jdchristensen Jul 16, 2024
4001f97
Merge branch 'master' into ab-tensor
Alizter Jul 17, 2024
42207b7
fix arguments of grp_homo_map
Alizter Jul 17, 2024
4d246eb
bilinear -> biadditive for consistency
Alizter Jul 17, 2024
5873da3
TensorProduct, QuotientGroup: some speed-ups
jdchristensen Jul 18, 2024
d5ba157
stagger definition of twist
Alizter Jul 18, 2024
afac23b
simpl arg hint for ab_tensor_prod_twist_map
Alizter Jul 18, 2024
5b06920
make `FreeGroup_rec o freegroup_in` definitionally the identity
Alizter Jul 19, 2024
1589b71
FreeGroup, TensorProduct: some cleanups
jdchristensen Jul 19, 2024
0a58839
remove reduction rules as they are definitional
Alizter Jul 19, 2024
67e9b6c
cleanup in FreeGroup.v
Alizter Jul 19, 2024
1d49f73
add comment about words_rec
Alizter Jul 19, 2024
7c74b6e
remove exact idpath
Alizter Jul 19, 2024
7ddd945
FreeGroup: use a instead of x for a "letter" in A + A
jdchristensen Jul 20, 2024
46c1bf0
use more list operations in FreeGroup.v
Alizter Jul 20, 2024
e2f8d74
write a little intro for tensor products
Alizter Jul 20, 2024
f2c9ec7
small changes to comments
Alizter Jul 20, 2024
1b5da89
TensorProduct: update introductory comments
jdchristensen Jul 20, 2024
b687878
premetric.v: get rid of shadowed definition of uncurry
jdchristensen Jul 22, 2024
a6873f0
fix typo
Alizter Jul 22, 2024
da27427
TensorProduct: simplify and/or speed up some proofs
jdchristensen Jul 22, 2024
25a60a4
TensorProduct.v: updates to comments
jdchristensen Jul 22, 2024
aed0f0d
Abelianization.v: minor stylistic changes
jdchristensen Jul 22, 2024
49c2b7e
TensorProduct: speed up some *ind_hprop* lines
jdchristensen Jul 22, 2024
a2f3382
remove redundant quotient_abgroup_map
Alizter Jul 22, 2024
ade3c43
fix wording in comment
Alizter Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion theories/Algebra/AbGroups/AbPushout.v
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Proof.
- intros [x y] q; strip_truncations; simpl.
destruct q as [a q]. cbn in q.
refine (ap (uncurry (fun x y => b x + c y)) q^ @ _).
unfold uncurry; cbn.
cbn.
refine (ap011 sg_op (preserves_negate _) (p a)^ @ _).
exact (left_inverse _).
Defined.
Expand Down
14 changes: 14 additions & 0 deletions theories/Algebra/AbGroups/AbelianGroup.v
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Global Instance negate_abgroup (A : AbGroup) : Negate A := group_inverse.
Definition ab_comm {A : AbGroup} (x y : A) : x + y = y + x
:= commutativity x y.

Definition ab_neg_op {A : AbGroup} (x y : A) : - (x + y) = -x - y.
Proof.
lhs nrapply grp_inv_op.
apply ab_comm.
Defined.

(** ** Paths between abelian groups *)

Definition equiv_path_abgroup `{Univalence} {A B : AbGroup@{u}}
Expand Down Expand Up @@ -100,6 +106,14 @@ Defined.
Definition QuotientAbGroup (G : AbGroup) (H : Subgroup G) : AbGroup
:= (Build_AbGroup (QuotientGroup' G H (isnormal_ab_subgroup G H)) _).

Arguments QuotientAbGroup G H : simpl never.

Definition quotient_abgroup_map (G : AbGroup) (H : Subgroup G)
: GroupHomomorphism G (QuotientAbGroup G H).
Proof.
snrapply grp_quotient_map.
Defined.

Alizter marked this conversation as resolved.
Show resolved Hide resolved
Definition quotient_abgroup_rec {G : AbGroup}
(N : Subgroup G) (H : AbGroup)
(f : GroupHomomorphism G H) (h : forall n : G, N n -> f n = mon_unit)
Expand Down
99 changes: 52 additions & 47 deletions theories/Algebra/AbGroups/Abelianization.v
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ From this we can show that Abel G is an abelian group.
In fact this models the following HIT:

HIT Abel (G : Group) :=
| ab : G -> Abel G
| ab_comm : forall x y z, ab (x * (y * z)) = ab (x * (z * y)).
| abel_in : G -> Abel G
| abel_in_comm : forall x y z, abel_in (x * (y * z)) = abel_in (x * (z * y)).

We also derive ab and ab_comm from our coequalizer definition, and even prove the induction and computation rules for this HIT.
We also derive [abel_in] and [abel_in_comm] from our coequalizer definition, and even prove the induction and computation rules for this HIT.

This HIT was suggested by Dan Christensen.
*)
Expand All @@ -80,15 +80,15 @@ Section Abel.
(uncurry2 (fun a b c : G => a * (c * b)))).

(** We have a natural map from G to Abel G. *)
Definition ab : G -> Abel.
Definition abel_in : G -> Abel.
Proof.
intro g.
apply tr, coeq, g.
Defined.

(** This map satisfies the condition ab_comm. *)
Definition ab_comm a b c
: ab (a * (b * c)) = ab (a * (c * b)).
Definition abel_in_comm a b c
: abel_in (a * (b * c)) = abel_in (a * (c * b)).
Proof.
apply (ap tr).
exact (cglue (a, b, c)).
Expand All @@ -99,7 +99,7 @@ Section Abel.

(** We can derive the induction principle from the ones for truncation and the coequalizer. *)
Definition Abel_ind (P : Abel -> Type) `{forall x, IsHSet (P x)}
(a : forall x, P (ab x)) (c : forall x y z, DPath P (ab_comm x y z)
(a : forall x, P (abel_in x)) (c : forall x y z, DPath P (abel_in_comm x y z)
(a (x * (y * z))) (a (x * (z * y))))
: forall (x : Abel), P x.
Proof.
Expand All @@ -112,11 +112,11 @@ Section Abel.
Defined.

(** The computation rule can also be proven. *)
Definition Abel_ind_beta_ab_comm (P : Abel -> Type)
`{forall x, IsHSet (P x)}(a : forall x, P (ab x))
(c : forall x y z, DPath P (ab_comm x y z)
Definition Abel_ind_beta_abel_in_comm (P : Abel -> Type)
`{forall x, IsHSet (P x)}(a : forall x, P (abel_in x))
(c : forall x y z, DPath P (abel_in_comm x y z)
(a (x * (y * z))) (a (x * (z * y))))
(x y z : G) : apD (Abel_ind P a c) (ab_comm x y z) = c x y z.
(x y z : G) : apD (Abel_ind P a c) (abel_in_comm x y z) = c x y z.
Proof.
refine (apD_compose' tr _ _ @ ap _ _ @ concat_V_pp _ _).
rapply Coeq_ind_beta_cglue.
Expand All @@ -133,7 +133,7 @@ Section Abel.

(** Here is a simpler version of Abel_ind when our target is an HProp. This lets us discard all the higher paths. *)
Definition Abel_ind_hprop (P : Abel -> Type) `{forall x, IsHProp (P x)}
(a : forall x, P (ab x)) : forall (x : Abel), P x.
(a : forall x, P (abel_in x)) : forall (x : Abel), P x.
Proof.
srapply (Abel_ind _ a).
intros; apply path_ishprop.
Expand All @@ -152,9 +152,10 @@ End Abel.
(** The [IsHProp] argument of [Abel_ind_hprop] can usually be found by typeclass resolution, but [srapply] is slow, so we use this tactic instead. *)
Local Ltac Abel_ind_hprop x := snrapply Abel_ind_hprop; [exact _ | intro x].

(** We make sure that G is implicit in the arguments of ab and ab_comm. *)
Arguments ab {_}.
Arguments ab_comm {_}.
(** We make sure that G is implicit in the arguments of [abel_in
and [abel_in_comm]. *)
Arguments abel_in {_}.
Arguments abel_in_comm {_}.

(** Now we can show that Abel G is in fact an abelian group. *)

Expand All @@ -163,7 +164,9 @@ Section AbelGroup.
Context (G : Group).

(** Firstly we derive the operation on Abel G. This is defined as follows:
ab x + ab y := ab (x y)
<<
abel_in x + abel_in y := abel_in (x * y)
>>
But we need to also check that it preserves ab_comm in the appropriate way. *)
Global Instance abel_sgop : SgOp (Abel G).
Proof.
Expand All @@ -173,21 +176,21 @@ Section AbelGroup.
revert a.
srapply Abel_rec.
{ intro a.
exact (ab (a * b)). }
exact (abel_in (a * b)). }
intros a c d; hnf.
(* The pattern seems to be to alternate associativity and ab_comm. *)
refine (ap _ (associativity _ _ _)^ @ _).
refine (ab_comm _ _ _ @ _).
refine (abel_in_comm _ _ _ @ _).
refine (ap _ (associativity _ _ _) @ _).
refine (ab_comm _ _ _ @ _).
refine (abel_in_comm _ _ _ @ _).
refine (ap _ (associativity _ _ _)^ @ _).
refine (ab_comm _ _ _ @ _).
refine (abel_in_comm _ _ _ @ _).
refine (ap _ (associativity _ _ _)). }
intros b c d.
revert a.
Abel_ind_hprop a; simpl.
refine (ap _ (associativity _ _ _) @ _).
refine (ab_comm _ _ _ @ _).
refine (abel_in_comm _ _ _ @ _).
refine (ap _ (associativity _ _ _)^).
Defined.

Expand All @@ -205,7 +208,7 @@ Section AbelGroup.
Global Instance abel_issemigroup : IsSemiGroup (Abel G) := {}.

(** We define the unit as ab of the unit of G *)
Global Instance abel_mon_unit : MonUnit (Abel G) := ab mon_unit.
Global Instance abel_mon_unit : MonUnit (Abel G) := abel_in mon_unit.

(** By using Abel_ind_hprop we can prove the left and right identity laws. *)
Global Instance abel_leftidentity : LeftIdentity abel_sgop abel_mon_unit.
Expand All @@ -230,25 +233,30 @@ Section AbelGroup.
Abel_ind_hprop y.
revert x.
Abel_ind_hprop x.
refine ((ap ab (left_identity _))^ @ _).
refine (_ @ (ap ab (left_identity _))).
apply ab_comm.
refine ((ap abel_in (left_identity _))^ @ _).
refine (_ @ (ap abel_in (left_identity _))).
apply abel_in_comm.
Defined.

(** Now we can define the negation. This is just
- (ab g) := (ab (g^-1))
<<
- (abel_in g) := abel_in (- g)
>>
However when checking that it respects ab_comm we have to show the following:
ab (- z * - y * - x) = ab (- y * - z * - x)
there is no obvious way to do this, but we note that ab (x * y) is exactly the definition of ab x + ab y! Hence by commutativity we can show this. *)
<<
abel_in (- z * - y * - x) = abel_in (- y * - z * - x)
>>
there is no obvious way to do this, but we note that [abel_in (x * y)] is exactly the definition of [abel_in x + abel_in y]! Hence by commutativity we can show this. *)
Global Instance abel_negate : Negate (Abel G).
Proof.
srapply Abel_rec.
{ intro g.
exact (ab (-g)). }
exact (abel_in (-g)). }
intros x y z; cbn.
rewrite ?negate_sg_op.
change (ab(- z) * ab(- y) * ab (- x) = ab (- y) * ab (- z) * ab(- x)).
by rewrite (commutativity (ab (-z)) (ab (-y))).
change (abel_in (- z) * abel_in (- y) * abel_in (- x)
= abel_in (- y) * abel_in (- z) * abel_in (- x)).
by rewrite (commutativity (abel_in (-z)) (abel_in (-y))).
Defined.

(** Again by Abel_ind_hprop and the corresponding laws for G we can prove the left and right inverse laws. *)
Expand All @@ -270,16 +278,16 @@ Section AbelGroup.
(** And since the operation is commutative, an abelian group. *)
Global Instance isabgroup_abel : IsAbGroup (Abel G) := {}.

(** By definition, the map ab is also a group homomorphism. *)
Global Instance issemigrouppreserving_ab : IsSemiGroupPreserving ab.
(** By definition, the map [abel_in] is also a group homomorphism. *)
Global Instance issemigrouppreserving_abel_in : IsSemiGroupPreserving abel_in.
Proof.
by unfold IsSemiGroupPreserving.
Defined.

End AbelGroup.

(** We can easily prove that ab is a surjection. *)
Global Instance issurj_ab {G : Group} : IsSurjection (@ab G).
(** We can easily prove that [abel_in] is a surjection. *)
Global Instance issurj_abel_in {G : Group} : IsSurjection (@abel_in G).
Proof.
apply BuildIsSurjection.
Abel_ind_hprop x.
Expand All @@ -300,23 +308,20 @@ Proof.
- exact _.
Defined.

(** The unit of this map is the map ab which typeclasses can pick up to be a homomorphism. We write it out explicitly here. *)
Definition abel_unit (X : Group)
: GroupHomomorphism X (abel X).
Proof.
snrapply @Build_GroupHomomorphism.
+ exact ab.
+ exact _.
Defined.
Arguments abel G : simpl never.

(** The unit of this map is the map [abel_in] which typeclasses can pick up to be a homomorphism. We write it out explicitly here. *)
Definition abel_unit {G : Group}
: GroupHomomorphism G (abel G)
:= @Build_GroupHomomorphism G (abel G) abel_in _.

Definition grp_homo_abel_rec {G : Group} {A : AbGroup} (f : G $-> A)
: abel G $-> A.
Proof.
snrapply Build_GroupHomomorphism.
{ srapply (Abel_rec _ _ f).
intros x y z.
refine (grp_homo_op _ _ _ @ _ @ (grp_homo_op _ _ _)^).
apply (ap (_ *.)).
nrapply grp_homo_op_agree; trivial.
refine (grp_homo_op _ _ _ @ _ @ (grp_homo_op _ _ _)^).
apply commutativity. }
intros y.
Expand All @@ -327,7 +332,7 @@ Defined.

(** Finally we can prove that our construction abel is an abelianization. *)
Global Instance isabelianization_abel {G : Group}
: IsAbelianization (abel G) (abel_unit G).
: IsAbelianization (abel G) abel_unit.
Proof.
intros A. constructor.
{ intros h.
Expand Down Expand Up @@ -377,7 +382,7 @@ Global Instance issurj_isabelianization {G : Group}
: IsAbelianization A eta -> IsSurjection eta.
Proof.
intros k.
pose (homotopic_isabelianization A (abel G) eta (abel_unit G)) as p.
pose (homotopic_isabelianization A (abel G) eta abel_unit) as p.
refine (@cancelL_isequiv_conn_map _ _ _ _ _ _ _
(conn_map_homotopic _ _ _ p _)).
Defined.
Expand Down
3 changes: 1 addition & 2 deletions theories/Algebra/AbGroups/Biproduct.v
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ Proof.
intros h k.
intros [a b].
refine (ap f (ab_biprod_decompose _ _) @ _ @ ap g (ab_biprod_decompose _ _)^).
refine (grp_homo_op _ _ _ @ _ @ (grp_homo_op _ _ _)^).
exact (ap011 (+) (h a) (k b)).
exact (grp_homo_op_agree f g (h a) (k b)).
Defined.

(* Maps out of biproducts are determined on the two inclusions. *)
Expand Down
6 changes: 2 additions & 4 deletions theories/Algebra/AbGroups/Cyclic.v
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ Lemma Z1_mul_nat_beta {A : AbGroup} (a : A) (n : nat)
Proof.
induction n as [|n H].
1: easy.
refine (grp_pow_natural _ _ _ @ _); simpl.
by rewrite grp_unit_r.
exact (grp_pow_natural _ _ _).
Defined.

(** [ab_Z1] is projective. *)
Expand All @@ -65,8 +64,7 @@ Proof.
apply path_homomorphism_from_free_group.
simpl.
intros [].
refine (_ @ a.2).
exact (ap p (grp_unit_r _)).
exact a.2.
Defined.

(** The map sending the generator to [1 : Int]. *)
Expand Down
8 changes: 7 additions & 1 deletion theories/Algebra/AbGroups/FreeAbelianGroup.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Require Import Types.Sigma Types.Forall Types.Paths.
Require Import WildCat.Core WildCat.EquivGpd.
Require Import Algebra.AbGroups.AbelianGroup Algebra.AbGroups.Abelianization.
Require Import Algebra.Groups.FreeGroup.
Require Import Spaces.List.Core.

(** * Free Abelian Groups *)

Expand All @@ -29,6 +30,11 @@ Global Instance isfreeabgroup_isfreeabgroupon (S : Type) (F_S : AbGroup) (i : S
Definition FreeAbGroup (S : Type) : AbGroup
:= abel (FreeGroup S).

Arguments FreeAbGroup S : simpl never.

Definition freeabgroup_in {S : Type} : S -> FreeAbGroup S
:= abel_unit o freegroup_in.

(** The abelianization of a free group on a set is a free abelian group on that set. *)
Global Instance isfreeabgroupon_isabelianization_isfreegroup `{Funext}
{S : Type} {G : Group} {A : AbGroup} (f : S -> G) (g : G $-> A)
Expand All @@ -50,6 +56,6 @@ Global Instance isfreeabgroup_freeabgroup `{Funext} (S : Type)
: IsFreeAbGroup (FreeAbGroup S).
Proof.
exists S.
exists (abel_unit (FreeGroup S) o freegroup_in).
exists (abel_unit (G:=FreeGroup S) o freegroup_in).
srapply isfreeabgroupon_isabelianization_isfreegroup.
Defined.
Loading
Loading