2014-09-09 16:25:35 +00:00
|
|
|
-- Copyright (c) 2014 Floris van Doorn. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Floris van Doorn
|
|
|
|
|
|
|
|
-- category
|
2014-10-05 17:50:13 +00:00
|
|
|
import logic.eq logic.connectives
|
2014-09-09 16:25:35 +00:00
|
|
|
import data.unit data.sigma data.prod
|
2014-09-16 18:58:54 +00:00
|
|
|
import algebra.function
|
2014-09-09 16:25:35 +00:00
|
|
|
|
|
|
|
inductive category [class] (ob : Type) (mor : ob → ob → Type) : Type :=
|
|
|
|
mk : Π (comp : Π⦃A B C : ob⦄, mor B C → mor A B → mor A C)
|
|
|
|
(id : Π {A : ob}, mor A A),
|
|
|
|
(Π {A B C D : ob} {f : mor A B} {g : mor B C} {h : mor C D},
|
|
|
|
comp h (comp g f) = comp (comp h g) f) →
|
|
|
|
(Π {A B : ob} {f : mor A B}, comp f id = f) →
|
|
|
|
(Π {A B : ob} {f : mor A B}, comp id f = f) →
|
|
|
|
category ob mor
|
|
|
|
|
|
|
|
namespace category
|
|
|
|
precedence `∘` : 60
|
|
|
|
|
|
|
|
section
|
|
|
|
parameters {ob : Type} {mor : ob → ob → Type} {Cat : category ob mor}
|
2014-09-17 21:39:05 +00:00
|
|
|
definition compose := rec (λ comp id assoc idr idl, comp) Cat
|
|
|
|
definition id := rec (λ comp id assoc idr idl, id) Cat
|
|
|
|
definition ID (A : ob) := @id A
|
2014-09-09 16:25:35 +00:00
|
|
|
|
|
|
|
infixr `∘` := compose
|
|
|
|
|
|
|
|
theorem assoc : Π {A B C D : ob} {f : mor A B} {g : mor B C} {h : mor C D},
|
|
|
|
h ∘ (g ∘ f) = (h ∘ g) ∘ f :=
|
|
|
|
rec (λ comp id assoc idr idl, assoc) Cat
|
|
|
|
|
|
|
|
theorem id_right : Π {A B : ob} {f : mor A B}, f ∘ id = f :=
|
|
|
|
rec (λ comp id assoc idr idl, idr) Cat
|
|
|
|
theorem id_left : Π {A B : ob} {f : mor A B}, id ∘ f = f :=
|
|
|
|
rec (λ comp id assoc idr idl, idl) Cat
|
|
|
|
|
|
|
|
theorem id_left2 {A B : ob} {f : mor A B} : id ∘ f = f :=
|
|
|
|
rec (λ comp id assoc idr idl, idl A B f) Cat
|
|
|
|
end
|
|
|
|
end category
|