Timings for Z.v
Require Import Spaces.Pos.Core Spaces.Int.
Require Import Algebra.AbGroups.AbelianGroup.
(** * The group of integers *)
(** See also Cyclic.v for a definition of the integers as the free group on one generator. *)
Local Open Scope int_scope.
Section MinimizationToSet.
Local Set Universe Minimization ToSet.
Definition abgroup_Z@{} : AbGroup@{Set}.
refine (Build_Group Int int_add 0 int_negation _); repeat split.
exact int_add_negation_l.
exact int_add_negation_r.
(** We can multiply by [n : Int] in any abelian group. *)
Definition ab_mul (n : Int) {A : AbGroup} : GroupHomomorphism A A.
exact (grp_homo_compose ab_homo_negation (ab_mul_nat (pos_to_nat p))).
exact (ab_mul_nat (pos_to_nat p)).
(** Homomorphisms respect multiplication. *)
Lemma ab_mul_homo {A B : AbGroup} (n : Int) (f : GroupHomomorphism A B)
: grp_homo_compose f (ab_mul n) == grp_homo_compose (ab_mul n) f.
refine (grp_homo_inv _ _ @ _).
(** Multiplication by zero gives the constant group homomorphism. *)
Definition ab_mul_const `{Funext} {A : AbGroup} : ab_mul 0 (A:=A) = grp_homo_const.
apply equiv_path_grouphomomorphism.