2014-12-12 04:14:53 +00:00
|
|
|
-- Copyright (c) 2014 Jakob von Raumer. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Jakob von Raumer
|
|
|
|
-- Ported from Coq HoTT
|
2015-02-13 02:28:39 +00:00
|
|
|
import .precategory.basic .precategory.morphism .group types.pi
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
open eq function prod sigma pi is_trunc morphism nat path_algebra unit prod sigma.ops
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
structure foo (A : Type) := (bsp : A)
|
|
|
|
|
2015-02-13 02:28:39 +00:00
|
|
|
structure groupoid [class] (ob : Type) extends parent : precategory ob :=
|
2014-12-12 04:14:53 +00:00
|
|
|
(all_iso : Π ⦃a b : ob⦄ (f : hom a b),
|
2015-02-13 02:28:39 +00:00
|
|
|
@is_iso ob parent a b f)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
namespace groupoid
|
|
|
|
|
2015-01-26 19:31:12 +00:00
|
|
|
attribute all_iso [instance]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
universe variable l
|
|
|
|
open precategory
|
2015-02-21 00:30:32 +00:00
|
|
|
definition groupoid_of_1_type (A : Type.{l})
|
2014-12-12 04:14:53 +00:00
|
|
|
(H : is_trunc (nat.zero .+1) A) : groupoid.{l l} A :=
|
|
|
|
groupoid.mk
|
2014-12-12 19:19:06 +00:00
|
|
|
(λ (a b : A), a = b)
|
2015-02-21 00:30:32 +00:00
|
|
|
(λ (a b : A), have ish : is_hset (a = b), from is_trunc_eq nat.zero a b, ish)
|
2014-12-12 19:19:06 +00:00
|
|
|
(λ (a b c : A) (p : b = c) (q : a = b), q ⬝ p)
|
|
|
|
(λ (a : A), refl a)
|
2015-02-21 00:30:32 +00:00
|
|
|
(λ (a b c d : A) (p : c = d) (q : b = c) (r : a = b), con.assoc r q p)
|
|
|
|
(λ (a b : A) (p : a = b), con_idp p)
|
|
|
|
(λ (a b : A) (p : a = b), idp_con p)
|
2014-12-12 19:19:06 +00:00
|
|
|
(λ (a b : A) (p : a = b), @is_iso.mk A _ a b p (p⁻¹)
|
2015-02-21 00:30:32 +00:00
|
|
|
!con.left_inv !con.right_inv)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
-- A groupoid with a contractible carrier is a group
|
2015-02-21 00:30:32 +00:00
|
|
|
definition group_of_is_contr_groupoid {ob : Type} (H : is_contr ob)
|
2014-12-12 04:14:53 +00:00
|
|
|
(G : groupoid ob) : group (hom (center ob) (center ob)) :=
|
|
|
|
begin
|
|
|
|
fapply group.mk,
|
|
|
|
intros (f, g), apply (comp f g),
|
|
|
|
apply homH,
|
|
|
|
intros (f, g, h), apply ((assoc f g h)⁻¹),
|
|
|
|
apply (ID (center ob)),
|
|
|
|
intro f, apply id_left,
|
|
|
|
intro f, apply id_right,
|
|
|
|
intro f, exact (morphism.inverse f),
|
|
|
|
intro f, exact (morphism.inverse_compose f),
|
|
|
|
end
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition group_of_unit_groupoid (G : groupoid unit) : group (hom ⋆ ⋆) :=
|
2014-12-12 04:14:53 +00:00
|
|
|
begin
|
|
|
|
fapply group.mk,
|
|
|
|
intros (f, g), apply (comp f g),
|
|
|
|
apply homH,
|
|
|
|
intros (f, g, h), apply ((assoc f g h)⁻¹),
|
|
|
|
apply (ID ⋆),
|
|
|
|
intro f, apply id_left,
|
|
|
|
intro f, apply id_right,
|
|
|
|
intro f, exact (morphism.inverse f),
|
|
|
|
intro f, exact (morphism.inverse_compose f),
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Conversely we can turn each group into a groupoid on the unit type
|
|
|
|
definition of_group (A : Type.{l}) [G : group A] : groupoid.{l l} unit :=
|
|
|
|
begin
|
|
|
|
fapply groupoid.mk,
|
|
|
|
intros, exact A,
|
|
|
|
intros, apply (@group.carrier_hset A G),
|
|
|
|
intros (a, b, c, g, h), exact (@group.mul A G g h),
|
|
|
|
intro a, exact (@group.one A G),
|
|
|
|
intros, exact ((@group.mul_assoc A G h g f)⁻¹),
|
2015-02-21 00:30:32 +00:00
|
|
|
intros, exact (@group.one_mul A G f),
|
|
|
|
intros, exact (@group.mul_one A G f),
|
2014-12-12 04:14:53 +00:00
|
|
|
intros, apply is_iso.mk,
|
|
|
|
apply mul_left_inv,
|
|
|
|
apply mul_right_inv,
|
|
|
|
end
|
|
|
|
|
2015-02-13 02:28:39 +00:00
|
|
|
protected definition hom_group {A : Type} [G : groupoid A] (a : A) :
|
|
|
|
group (hom a a) :=
|
|
|
|
begin
|
|
|
|
fapply group.mk,
|
|
|
|
intros (f, g), apply (comp f g),
|
|
|
|
apply homH,
|
|
|
|
intros (f, g, h), apply ((assoc f g h)⁻¹),
|
|
|
|
apply (ID a),
|
|
|
|
intro f, apply id_left,
|
|
|
|
intro f, apply id_right,
|
|
|
|
intro f, exact (morphism.inverse f),
|
|
|
|
intro f, exact (morphism.inverse_compose f),
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
end groupoid
|