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

cleanups and improvements to lagrange #2203

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/Groups.v
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Require Export HoTT.Algebra.Groups.FreeProduct.

Require Export HoTT.Algebra.Groups.Presentation.
Require Export HoTT.Algebra.Groups.ShortExactSequence.
Require Export HoTT.Algebra.Groups.Lagrange.
Require Export HoTT.Algebra.Groups.Finite.

(** Examples *)

Expand Down
64 changes: 64 additions & 0 deletions theories/Algebra/Groups/Finite.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Require Import Basics Types.
Require Import Algebra.Groups.Group.
Require Import Algebra.Groups.Subgroup.
Require Import Algebra.Groups.QuotientGroup.
Require Import Spaces.Finite.Finite.
Require Import Spaces.Nat.Core Spaces.Nat.Division.
Require Import Truncations.Core.

Local Open Scope nat_scope.
Local Open Scope mc_mult_scope.

Set Universe Minimization ToSet.

(** * Finite Groups *)

(** ** Basic Properties *)

(** The order of a group is strictly positive. *)
Global Instance lt_zero_fcard_grp (G : Group) (fin_G : Finite G) : 0 < fcard G.
Proof.
pose proof (merely_equiv_fin G) as f.
strip_truncations.
destruct (fcard G).
- contradiction (f mon_unit).
- exact _.
Defined.

(** ** Lagrange's theorem *)

(** Lagrange's Theorem - Given a finite group [G] and a finite subgroup [H] of [G], the order of [H] divides the order of [G].

Note that constructively, a subgroup of a finite group cannot be shown to be finite without excluded middle. We therefore have to assume it is. This in turn implies that the subgroup is decidable. *)
Definition divides_fcard_subgroup {U : Univalence}
jdchristensen marked this conversation as resolved.
Show resolved Hide resolved
(G : Group) (H : Subgroup G) {fin_G : Finite G} {fin_H : Finite H}
: (fcard H | fcard G).
Proof.
exists (subgroup_index G H).
Alizter marked this conversation as resolved.
Show resolved Hide resolved
symmetry.
refine (fcard_quotient (in_cosetL H) @ _).
refine (_ @ finadd_const _ _).
apply ap, path_forall.
srapply Quotient_ind_hprop; simpl.
intros x.
apply fcard_equiv'.
apply equiv_sigma_in_cosetL_subgroup.
Defined.

(** As a corollary, the index of a subgroup is the order of the group divided by the order of the subgroup. *)
Definition subgroup_index_fcard_div {U : Univalence}
(G : Group) (H : Subgroup G) (fin_G : Finite G) (fin_H : Finite H)
: subgroup_index G H = fcard G / fcard H.
Proof.
rapply nat_div_moveL_nV.
apply divides_fcard_subgroup.
Defined.

(** Therefore we can show that the order of the quotient group [G / H] is the order of [G] divided by the order of [H]. *)
Definition fcard_grp_quotient {U : Univalence}
(G : Group) (H : NormalSubgroup G)
(fin_G : Finite G) (fin_H : Finite H)
: fcard (QuotientGroup G H) = fcard G / fcard H.
Proof.
rapply subgroup_index_fcard_div.
Defined.
53 changes: 0 additions & 53 deletions theories/Algebra/Groups/Lagrange.v

This file was deleted.

55 changes: 53 additions & 2 deletions theories/Algebra/Groups/QuotientGroup.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Local Open Scope mc_scope.
Local Open Scope mc_mult_scope.
Local Open Scope wc_iso_scope.

(** ** Congruence quotients *)

Section GroupCongruenceQuotient.

(** A congruence on a group is a relation satisfying [R x x' -> R y y' -> R (x * y) (x' * y')]. Because we also require that [R] is reflexive, we also know that [R y y' -> R (x * y) (x * y')] for any [x], and similarly for multiplication on the right by [x]. We don't need to assume that [R] is symmetric or transitive. *)
Expand Down Expand Up @@ -106,6 +108,55 @@ Section GroupCongruenceQuotient.

End GroupCongruenceQuotient.

(** ** Sets of cosets *)

Section Cosets.

Context (G : Group) (H : Subgroup G).

Definition LeftCoset := G / in_cosetL H.

(** TODO: Way too many universes, needs fixing *)
(** The set of left cosets of a finite subgroup of a finite group is finite. *)
Global Instance finite_leftcoset `{Univalence, Finite G, Finite H}
: Finite LeftCoset.
Proof.
nrapply finite_quotient.
1-5: exact _.
intros x y.
apply (detachable_finite_subset H).
Defined.

(** The index of a subgroup is the number of cosets of the subgroup. *)
Definition subgroup_index `{Univalence, Finite G, Finite H} : nat
:= fcard LeftCoset.

Definition RightCoset := G / in_cosetR H.

(** The set of left cosets is equivalent to the set of right coset. *)
Definition equiv_leftcoset_rightcoset
: LeftCoset <~> RightCoset.
Proof.
snrapply equiv_quotient_functor.
- exact inv.
- exact _.
- intros x y; simpl.
by rewrite grp_inv_inv.
Defined.

(** The set of right cosets of a finite subgroup of a finite group is finite since it is equivalent to the set of left cosets. *)
Global Instance finite_rightcoset `{Univalence, Finite G, Finite H}
: Finite RightCoset.
Proof.
nrapply finite_equiv'.
1: apply equiv_leftcoset_rightcoset.
exact _.
Defined.

End Cosets.

(** ** Quotient groups *)

(** Now we can define the quotient group by a normal subgroup. *)

Section QuotientGroup.
Expand All @@ -126,7 +177,7 @@ Section QuotientGroup.

(** Now we have to make a choice whether to pick the left or right cosets. Due to existing convention we shall pick left cosets but we note that we could equally have picked right. *)
Definition QuotientGroup : Group
:= Build_Group (G / (in_cosetL N)) _ _ _ _.
:= Build_Group (LeftCoset G N) _ _ _ _.

Definition grp_quotient_map : G $-> QuotientGroup.
Proof.
Expand Down Expand Up @@ -343,7 +394,7 @@ Proof.
simpl in triv.
apply related_quotient_paths in triv.
2-5: exact _.
apply equiv_subgroup_inverse.
apply equiv_subgroup_inv.
nrapply (subgroup_in_op_l _ _ 1 triv) .
apply subgroup_in_unit.
Defined.
28 changes: 27 additions & 1 deletion theories/Algebra/Groups/Subgroup.v
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ Proof.
apply subgroup_in_inv'.
Defined.

Definition equiv_subgroup_inverse {G : Group} (H : Subgroup G) (x : G)
Definition equiv_subgroup_inv {G : Group} (H : Subgroup G) (x : G)
: H x <~> H x^ := Build_Equiv _ _ (subgroup_in_inv H x) _.

Definition equiv_subgroup_op_inv {G : Group} (H : Subgroup G) (x y : G)
: H (x * y^) <~> H (y * x^).
Proof.
nrefine (_ oE equiv_subgroup_inv _ _).
by rewrite grp_inv_op, grp_inv_inv.
Defined.

(** The group given by a subgroup *)
Definition subgroup_group {G : Group} (H : Subgroup G) : Group.
Proof.
Expand Down Expand Up @@ -366,6 +373,25 @@ Proof.
all: by intro.
Defined.

(** The sigma type of a left coset is equivalent to the sigma type of the subgroup. *)
Definition equiv_sigma_in_cosetL_subgroup (G : Group) (H : Subgroup G) (x : G)
: sig (in_cosetL H x) <~> sig H.
Proof.
snrapply equiv_functor_sigma'.
- rapply (Build_Equiv _ _ (x^ *.)).
- reflexivity.
Defined.

(** The sigma type of a right coset is equivalent to the sigma type of the subgroup. *)
Definition equiv_sigma_in_cosetR_subgroup (G : Group) (H : Subgroup G) (x : G)
: sig (in_cosetR H x) <~> sig H.
Proof.
snrapply equiv_functor_sigma'.
- rapply (Build_Equiv _ _ (.* x ^)).
- simpl; intros y.
apply equiv_subgroup_op_inv.
Defined.

(** A normal subgroup is a subgroup closed under conjugation. *)
Class IsNormalSubgroup {G : Group} (N : Subgroup G)
:= isnormal : forall {x y}, N (x * y) -> N (y * x).
Expand Down
9 changes: 9 additions & 0 deletions theories/Spaces/Nat/Division.v
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,15 @@ Proof.
nrapply nat_mod_mul_l.
Defined.

(** We can move a divisor from the right to become a factor on the left of an equation. *)
Definition nat_div_moveL_nV n m k : 0 < k -> n * k = m -> n = m / k.
Proof.
intros H p.
rewrite <- p.
symmetry.
rapply nat_div_mul_cancel_r.
Defined.

(** ** Greatest Common Divisor *)

(** The greatest common divisor of [0] and a number is the number itself. *)
Expand Down
Loading