2014-10-09 01:44:01 +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
|
|
|
|
|
|
|
|
|
|
-- This file contains basic constructions on categories, including common categories
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
import .natural_transformation
|
2014-10-09 01:44:01 +00:00
|
|
|
|
import data.unit data.sigma data.prod data.empty data.bool
|
|
|
|
|
|
|
|
|
|
open eq eq.ops prod
|
|
|
|
|
namespace category
|
2014-10-09 05:57:41 +00:00
|
|
|
|
namespace opposite
|
2014-10-09 01:44:01 +00:00
|
|
|
|
section
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition opposite [reducible] {ob : Type} (C : category ob) : category ob :=
|
2014-10-09 01:44:01 +00:00
|
|
|
|
mk (λa b, hom b a)
|
|
|
|
|
(λ a b c f g, g ∘ f)
|
|
|
|
|
(λ a, id)
|
|
|
|
|
(λ a b c d f g h, symm !assoc)
|
|
|
|
|
(λ a b f, !id_right)
|
|
|
|
|
(λ a b f, !id_left)
|
|
|
|
|
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition Opposite [reducible] (C : Category) : Category := Mk (opposite C)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
--direct construction:
|
|
|
|
|
-- MK C
|
|
|
|
|
-- (λa b, hom b a)
|
|
|
|
|
-- (λ a b c f g, g ∘ f)
|
|
|
|
|
-- (λ a, id)
|
|
|
|
|
-- (λ a b c d f g h, symm !assoc)
|
|
|
|
|
-- (λ a b f, !id_right)
|
|
|
|
|
-- (λ a b f, !id_left)
|
|
|
|
|
|
|
|
|
|
infixr `∘op`:60 := @compose _ (opposite _) _ _ _
|
|
|
|
|
|
|
|
|
|
variables {C : Category} {a b c : C}
|
|
|
|
|
|
|
|
|
|
theorem compose_op {f : hom a b} {g : hom b c} : f ∘op g = g ∘ f := rfl
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
theorem op_op' {ob : Type} (C : category ob) : opposite (opposite C) = C :=
|
2014-10-09 01:44:01 +00:00
|
|
|
|
category.rec (λ hom comp id assoc idl idr, refl (mk _ _ _ _ _ _)) C
|
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
theorem op_op : Opposite (Opposite C) = C :=
|
|
|
|
|
(@congr_arg _ _ _ _ (Category.mk C) (op_op' C)) ⬝ !Category.equal
|
|
|
|
|
|
|
|
|
|
end
|
2014-10-09 05:57:41 +00:00
|
|
|
|
end opposite
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition type_category [reducible] : category Type :=
|
2014-10-09 01:44:01 +00:00
|
|
|
|
mk (λa b, a → b)
|
|
|
|
|
(λ a b c, function.compose)
|
|
|
|
|
(λ a, function.id)
|
2014-12-22 19:54:01 +00:00
|
|
|
|
(λ a b c d h g f, symm (function.compose.assoc h g f))
|
|
|
|
|
(λ a b f, function.compose.left_id f)
|
|
|
|
|
(λ a b f, function.compose.right_id f)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition Type_category [reducible] : Category := Mk type_category
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
|
|
|
|
section
|
|
|
|
|
open decidable unit empty
|
2014-10-12 20:06:00 +00:00
|
|
|
|
variables {A : Type} [H : decidable_eq A]
|
2014-10-10 01:01:06 +00:00
|
|
|
|
include H
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition set_hom [reducible] (a b : A) := decidable.rec_on (H a b) (λh, unit) (λh, empty)
|
2015-04-01 19:36:33 +00:00
|
|
|
|
theorem set_hom_subsingleton [instance] (a b : A) : subsingleton (set_hom a b) := rec_subsingleton
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition set_compose [reducible] {a b c : A} (g : set_hom b c) (f : set_hom a b) : set_hom a c :=
|
2014-10-09 01:44:01 +00:00
|
|
|
|
decidable.rec_on
|
|
|
|
|
(H b c)
|
|
|
|
|
(λ Hbc g, decidable.rec_on
|
|
|
|
|
(H a b)
|
|
|
|
|
(λ Hab f, rec_on_true (trans Hab Hbc) ⋆)
|
|
|
|
|
(λh f, empty.rec _ f) f)
|
|
|
|
|
(λh (g : empty), empty.rec _ g) g
|
2014-11-04 00:22:30 +00:00
|
|
|
|
omit H
|
2014-11-07 03:18:11 +00:00
|
|
|
|
definition discrete_category (A : Type) [H : decidable_eq A] : category A :=
|
2014-10-09 01:44:01 +00:00
|
|
|
|
mk (λa b, set_hom a b)
|
|
|
|
|
(λ a b c g f, set_compose g f)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
(λ a, decidable.rec_on_true rfl ⋆)
|
|
|
|
|
(λ a b c d h g f, @subsingleton.elim (set_hom a d) _ _ _)
|
|
|
|
|
(λ a b f, @subsingleton.elim (set_hom a b) _ _ _)
|
|
|
|
|
(λ a b f, @subsingleton.elim (set_hom a b) _ _ _)
|
2015-01-26 19:31:12 +00:00
|
|
|
|
local attribute discrete_category [reducible]
|
2014-11-07 03:18:11 +00:00
|
|
|
|
definition Discrete_category (A : Type) [H : decidable_eq A] := Mk (discrete_category A)
|
2015-04-22 02:13:19 +00:00
|
|
|
|
section
|
2015-01-26 19:31:12 +00:00
|
|
|
|
local attribute discrete_category [instance]
|
2014-11-25 01:24:30 +00:00
|
|
|
|
include H
|
2015-01-26 16:28:13 +00:00
|
|
|
|
theorem discrete_category.endomorphism {a b : A} (f : a ⟶ b) : a = b :=
|
2014-11-25 01:24:30 +00:00
|
|
|
|
decidable.rec_on (H a b) (λh f, h) (λh f, empty.rec _ f) f
|
|
|
|
|
|
2015-01-26 16:28:13 +00:00
|
|
|
|
theorem discrete_category.discrete {a b : A} (f : a ⟶ b)
|
|
|
|
|
: eq.rec_on (discrete_category.endomorphism f) f = (ID b) :=
|
2014-11-25 01:24:30 +00:00
|
|
|
|
@subsingleton.elim _ !set_hom_subsingleton _ _
|
|
|
|
|
|
|
|
|
|
definition discrete_category.rec_on {P : Πa b, a ⟶ b → Type} {a b : A} (f : a ⟶ b)
|
|
|
|
|
(H : ∀a, P a a id) : P a b f :=
|
2015-01-26 16:28:13 +00:00
|
|
|
|
cast (dcongr_arg3 P rfl (discrete_category.endomorphism f)⁻¹
|
|
|
|
|
(@subsingleton.elim _ !set_hom_subsingleton _ _))⁻¹ (H a)
|
2014-11-25 01:24:30 +00:00
|
|
|
|
end
|
2014-10-09 01:44:01 +00:00
|
|
|
|
end
|
|
|
|
|
section
|
2014-11-04 00:22:30 +00:00
|
|
|
|
open unit bool
|
2014-11-07 03:18:11 +00:00
|
|
|
|
definition category_one := discrete_category unit
|
2014-11-04 00:22:30 +00:00
|
|
|
|
definition Category_one := Mk category_one
|
2014-11-07 03:18:11 +00:00
|
|
|
|
definition category_two := discrete_category bool
|
2014-11-04 00:22:30 +00:00
|
|
|
|
definition Category_two := Mk category_two
|
2014-10-09 01:44:01 +00:00
|
|
|
|
end
|
|
|
|
|
|
2014-10-09 05:57:41 +00:00
|
|
|
|
namespace product
|
2014-11-25 01:24:30 +00:00
|
|
|
|
section
|
|
|
|
|
open prod
|
|
|
|
|
definition prod_category [reducible] {obC obD : Type} (C : category obC) (D : category obD)
|
|
|
|
|
: category (obC × obD) :=
|
|
|
|
|
mk (λa b, hom (pr1 a) (pr1 b) × hom (pr2 a) (pr2 b))
|
|
|
|
|
(λ a b c g f, (pr1 g ∘ pr1 f , pr2 g ∘ pr2 f) )
|
|
|
|
|
(λ a, (id,id))
|
|
|
|
|
(λ a b c d h g f, pair_eq !assoc !assoc )
|
|
|
|
|
(λ a b f, prod.equal !id_left !id_left )
|
|
|
|
|
(λ a b f, prod.equal !id_right !id_right)
|
|
|
|
|
|
|
|
|
|
definition Prod_category [reducible] (C D : Category) : Category := Mk (prod_category C D)
|
|
|
|
|
end
|
2014-10-09 01:44:01 +00:00
|
|
|
|
end product
|
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
namespace ops
|
|
|
|
|
notation `type`:max := Type_category
|
2014-11-25 01:24:30 +00:00
|
|
|
|
notation 1 := Category_one
|
2014-11-04 00:22:30 +00:00
|
|
|
|
notation 2 := Category_two
|
|
|
|
|
postfix `ᵒᵖ`:max := opposite.Opposite
|
|
|
|
|
infixr `×c`:30 := product.Prod_category
|
2015-01-26 19:31:12 +00:00
|
|
|
|
attribute type_category [instance]
|
|
|
|
|
attribute category_one [instance]
|
|
|
|
|
attribute category_two [instance]
|
|
|
|
|
attribute product.prod_category [instance]
|
2014-11-04 00:22:30 +00:00
|
|
|
|
end ops
|
|
|
|
|
|
2014-10-09 05:57:41 +00:00
|
|
|
|
open ops
|
|
|
|
|
namespace opposite
|
|
|
|
|
section
|
2014-11-25 01:24:30 +00:00
|
|
|
|
open functor
|
|
|
|
|
definition opposite_functor [reducible] {C D : Category} (F : C ⇒ D) : Cᵒᵖ ⇒ Dᵒᵖ :=
|
2014-11-04 00:22:30 +00:00
|
|
|
|
@functor.mk (Cᵒᵖ) (Dᵒᵖ)
|
2014-10-09 06:44:09 +00:00
|
|
|
|
(λ a, F a)
|
|
|
|
|
(λ a b f, F f)
|
2014-11-25 01:24:30 +00:00
|
|
|
|
(λ a, respect_id F a)
|
|
|
|
|
(λ a b c g f, respect_comp F f g)
|
2014-10-09 05:57:41 +00:00
|
|
|
|
end
|
|
|
|
|
end opposite
|
|
|
|
|
|
|
|
|
|
namespace product
|
|
|
|
|
section
|
|
|
|
|
open ops functor
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition prod_functor [reducible] {C C' D D' : Category} (F : C ⇒ D) (G : C' ⇒ D')
|
|
|
|
|
: C ×c C' ⇒ D ×c D' :=
|
2014-10-09 05:57:41 +00:00
|
|
|
|
functor.mk (λ a, pair (F (pr1 a)) (G (pr2 a)))
|
2014-10-09 06:44:09 +00:00
|
|
|
|
(λ a b f, pair (F (pr1 f)) (G (pr2 f)))
|
|
|
|
|
(λ a, pair_eq !respect_id !respect_id)
|
|
|
|
|
(λ a b c g f, pair_eq !respect_comp !respect_comp)
|
2014-10-09 05:57:41 +00:00
|
|
|
|
end
|
|
|
|
|
end product
|
|
|
|
|
|
|
|
|
|
namespace ops
|
|
|
|
|
infixr `×f`:30 := product.prod_functor
|
|
|
|
|
infixr `ᵒᵖᶠ`:max := opposite.opposite_functor
|
|
|
|
|
end ops
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
|
|
|
|
section functor_category
|
2014-11-04 00:22:30 +00:00
|
|
|
|
variables (C D : Category)
|
2014-10-09 01:44:01 +00:00
|
|
|
|
definition functor_category : category (functor C D) :=
|
|
|
|
|
mk (λa b, natural_transformation a b)
|
|
|
|
|
(λ a b c g f, natural_transformation.compose g f)
|
|
|
|
|
(λ a, natural_transformation.id)
|
|
|
|
|
(λ a b c d h g f, !natural_transformation.assoc)
|
|
|
|
|
(λ a b f, !natural_transformation.id_left)
|
|
|
|
|
(λ a b f, !natural_transformation.id_right)
|
|
|
|
|
end functor_category
|
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
namespace slice
|
|
|
|
|
open sigma function
|
|
|
|
|
variables {ob : Type} {C : category ob} {c : ob}
|
|
|
|
|
protected definition slice_obs (C : category ob) (c : ob) := Σ(b : ob), hom b c
|
2015-05-19 05:35:18 +00:00
|
|
|
|
variables {a b : slice.slice_obs C c}
|
|
|
|
|
protected definition to_ob (a : slice.slice_obs C c) : ob := sigma.pr1 a
|
|
|
|
|
protected definition to_ob_def (a : slice.slice_obs C c) : slice.to_ob a = sigma.pr1 a := rfl
|
|
|
|
|
protected definition ob_hom (a : slice.slice_obs C c) : hom (slice.to_ob a) c := sigma.pr2 a
|
2014-11-25 01:24:30 +00:00
|
|
|
|
-- protected theorem slice_obs_equal (H₁ : to_ob a = to_ob b)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- (H₂ : eq.drec_on H₁ (ob_hom a) = ob_hom b) : a = b :=
|
|
|
|
|
-- sigma.equal H₁ H₂
|
|
|
|
|
|
|
|
|
|
|
2015-05-19 05:35:18 +00:00
|
|
|
|
protected definition slice_hom (a b : slice.slice_obs C c) : Type :=
|
|
|
|
|
Σ(g : hom (slice.to_ob a) (slice.to_ob b)), slice.ob_hom b ∘ g = slice.ob_hom a
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
2015-05-19 05:35:18 +00:00
|
|
|
|
protected definition hom_hom (f : slice.slice_hom a b) : hom (slice.to_ob a) (slice.to_ob b) := sigma.pr1 f
|
|
|
|
|
protected definition commute (f : slice.slice_hom a b) : slice.ob_hom b ∘ (slice.hom_hom f) = slice.ob_hom a := sigma.pr2 f
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- protected theorem slice_hom_equal (f g : slice_hom a b) (H : hom_hom f = hom_hom g) : f = g :=
|
|
|
|
|
-- sigma.equal H !proof_irrel
|
|
|
|
|
|
2015-05-19 05:35:18 +00:00
|
|
|
|
definition slice_category (C : category ob) (c : ob) : category (slice.slice_obs C c) :=
|
|
|
|
|
mk (λa b, slice.slice_hom a b)
|
|
|
|
|
(λ a b c g f, sigma.mk (slice.hom_hom g ∘ slice.hom_hom f)
|
|
|
|
|
(show slice.ob_hom c ∘ (slice.hom_hom g ∘ slice.hom_hom f) = slice.ob_hom a,
|
2014-10-09 06:44:09 +00:00
|
|
|
|
proof
|
|
|
|
|
calc
|
2015-05-19 05:35:18 +00:00
|
|
|
|
slice.ob_hom c ∘ (slice.hom_hom g ∘ slice.hom_hom f) = (slice.ob_hom c ∘ slice.hom_hom g) ∘ slice.hom_hom f : !assoc
|
|
|
|
|
... = slice.ob_hom b ∘ slice.hom_hom f : {slice.commute g}
|
|
|
|
|
... = slice.ob_hom a : {slice.commute f}
|
2014-10-09 06:44:09 +00:00
|
|
|
|
qed))
|
2014-12-20 02:23:08 +00:00
|
|
|
|
(λ a, sigma.mk id !id_right)
|
2014-10-09 01:44:01 +00:00
|
|
|
|
(λ a b c d h g f, dpair_eq !assoc !proof_irrel)
|
|
|
|
|
(λ a b f, sigma.equal !id_left !proof_irrel)
|
|
|
|
|
(λ a b f, sigma.equal !id_right !proof_irrel)
|
|
|
|
|
-- We use !proof_irrel instead of rfl, to give the unifier an easier time
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
2014-11-25 01:24:30 +00:00
|
|
|
|
-- definition slice_category {ob : Type} (C : category ob) (c : ob) : category (Σ(b : ob), hom b c)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- :=
|
|
|
|
|
-- mk (λa b, Σ(g : hom (dpr1 a) (dpr1 b)), dpr2 b ∘ g = dpr2 a)
|
|
|
|
|
-- (λ a b c g f, dpair (dpr1 g ∘ dpr1 f)
|
|
|
|
|
-- (show dpr2 c ∘ (dpr1 g ∘ dpr1 f) = dpr2 a,
|
|
|
|
|
-- proof
|
|
|
|
|
-- calc
|
|
|
|
|
-- dpr2 c ∘ (dpr1 g ∘ dpr1 f) = (dpr2 c ∘ dpr1 g) ∘ dpr1 f : !assoc
|
|
|
|
|
-- ... = dpr2 b ∘ dpr1 f : {dpr2 g}
|
|
|
|
|
-- ... = dpr2 a : {dpr2 f}
|
|
|
|
|
-- qed))
|
|
|
|
|
-- (λ a, dpair id !id_right)
|
|
|
|
|
-- (λ a b c d h g f, dpair_eq !assoc !proof_irrel)
|
|
|
|
|
-- (λ a b f, sigma.equal !id_left !proof_irrel)
|
|
|
|
|
-- (λ a b f, sigma.equal !id_right !proof_irrel)
|
|
|
|
|
-- We use !proof_irrel instead of rfl, to give the unifier an easier time
|
|
|
|
|
|
|
|
|
|
definition Slice_category [reducible] (C : Category) (c : C) := Mk (slice_category C c)
|
|
|
|
|
open category.ops
|
2015-01-26 19:31:12 +00:00
|
|
|
|
attribute slice_category [instance]
|
2014-11-04 00:22:30 +00:00
|
|
|
|
variables {D : Category}
|
|
|
|
|
definition forgetful (x : D) : (Slice_category D x) ⇒ D :=
|
2015-05-19 05:35:18 +00:00
|
|
|
|
functor.mk (λ a, slice.to_ob a)
|
|
|
|
|
(λ a b f, slice.hom_hom f)
|
2014-10-09 06:44:09 +00:00
|
|
|
|
(λ a, rfl)
|
|
|
|
|
(λ a b c g f, rfl)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
2014-11-25 01:24:30 +00:00
|
|
|
|
definition postcomposition_functor {x y : D} (h : x ⟶ y)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
: Slice_category D x ⇒ Slice_category D y :=
|
2015-03-13 03:18:49 +00:00
|
|
|
|
functor.mk
|
2015-05-19 05:35:18 +00:00
|
|
|
|
(λ a, sigma.mk (slice.to_ob a) (h ∘ slice.ob_hom a))
|
2015-03-13 03:18:49 +00:00
|
|
|
|
(λ a b f,
|
2015-05-19 05:35:18 +00:00
|
|
|
|
⟨slice.hom_hom f,
|
2015-03-13 03:18:49 +00:00
|
|
|
|
calc
|
2015-05-19 05:35:18 +00:00
|
|
|
|
(h ∘ slice.ob_hom b) ∘ slice.hom_hom f = h ∘ (slice.ob_hom b ∘ slice.hom_hom f) : by rewrite assoc
|
|
|
|
|
... = h ∘ slice.ob_hom a : by rewrite slice.commute⟩)
|
2015-03-13 03:18:49 +00:00
|
|
|
|
(λ a, rfl)
|
|
|
|
|
(λ a b c g f, dpair_eq rfl !proof_irrel)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
|
|
|
|
-- -- in the following comment I tried to have (A = B) in the type of a == b, but that doesn't solve the problems
|
|
|
|
|
-- definition heq2 {A B : Type} (H : A = B) (a : A) (b : B) := a == b
|
|
|
|
|
-- definition heq2.intro {A B : Type} {a : A} {b : B} (H : a == b) : heq2 (heq.type_eq H) a b := H
|
|
|
|
|
-- definition heq2.elim {A B : Type} {a : A} {b : B} (H : A = B) (H2 : heq2 H a b) : a == b := H2
|
2014-11-25 01:24:30 +00:00
|
|
|
|
-- definition heq2.proof_irrel {A B : Prop} (a : A) (b : B) (H : A = B) : heq2 H a b :=
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- hproof_irrel H a b
|
2014-11-25 01:24:30 +00:00
|
|
|
|
-- theorem functor.mk_eq2 {C D : Category} {obF obG : C → D} {homF homG idF idG compF compG}
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- (Hob : ∀x, obF x = obG x)
|
|
|
|
|
-- (Hmor : ∀(a b : C) (f : a ⟶ b), heq2 (congr_arg (λ x, x a ⟶ x b) (funext Hob)) (homF a b f) (homG a b f))
|
|
|
|
|
-- : functor.mk obF homF idF compF = functor.mk obG homG idG compG :=
|
|
|
|
|
-- hddcongr_arg4 functor.mk
|
|
|
|
|
-- (funext Hob)
|
|
|
|
|
-- (hfunext (λ a, hfunext (λ b, hfunext (λ f, !Hmor))))
|
|
|
|
|
-- !proof_irrel
|
2014-10-09 06:44:09 +00:00
|
|
|
|
-- !proof_irrel
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- set_option pp.implicit true
|
|
|
|
|
-- set_option pp.coercions true
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- definition slice_functor : D ⇒ Category_of_categories :=
|
|
|
|
|
-- functor.mk (λ a, Category.mk (slice_obs D a) (slice_category D a))
|
|
|
|
|
-- (λ a b f, postcomposition_functor f)
|
|
|
|
|
-- (λ a, functor.mk_heq
|
|
|
|
|
-- (λx, sigma.equal rfl !id_left)
|
|
|
|
|
-- (λb c f, sigma.hequal sorry !heq.refl (hproof_irrel sorry _ _)))
|
|
|
|
|
-- (λ a b c g f, functor.mk_heq
|
|
|
|
|
-- (λx, sigma.equal (sorry ⬝ refl (dpr1 x)) sorry)
|
|
|
|
|
-- (λb c f, sorry))
|
|
|
|
|
|
|
|
|
|
--the error message generated here is really confusing: the type of the above refl should be
|
|
|
|
|
-- "@dpr1 D (λ (a_1 : D), a_1 ⟶ a) x = @dpr1 D (λ (a_1 : D), a_1 ⟶ c) x", but the second dpr1 is not even well-typed
|
|
|
|
|
|
|
|
|
|
end slice
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
|
-- section coslice
|
|
|
|
|
-- open sigma
|
|
|
|
|
|
|
|
|
|
-- definition coslice {ob : Type} (C : category ob) (c : ob) : category (Σ(b : ob), hom c b) :=
|
|
|
|
|
-- mk (λa b, Σ(g : hom (dpr1 a) (dpr1 b)), g ∘ dpr2 a = dpr2 b)
|
|
|
|
|
-- (λ a b c g f, dpair (dpr1 g ∘ dpr1 f)
|
|
|
|
|
-- (show (dpr1 g ∘ dpr1 f) ∘ dpr2 a = dpr2 c,
|
|
|
|
|
-- proof
|
|
|
|
|
-- calc
|
|
|
|
|
-- (dpr1 g ∘ dpr1 f) ∘ dpr2 a = dpr1 g ∘ (dpr1 f ∘ dpr2 a): symm !assoc
|
|
|
|
|
-- ... = dpr1 g ∘ dpr2 b : {dpr2 f}
|
|
|
|
|
-- ... = dpr2 c : {dpr2 g}
|
|
|
|
|
-- qed))
|
|
|
|
|
-- (λ a, dpair id !id_left)
|
|
|
|
|
-- (λ a b c d h g f, dpair_eq !assoc !proof_irrel)
|
|
|
|
|
-- (λ a b f, sigma.equal !id_left !proof_irrel)
|
|
|
|
|
-- (λ a b f, sigma.equal !id_right !proof_irrel)
|
|
|
|
|
|
|
|
|
|
-- -- theorem slice_coslice_opp {ob : Type} (C : category ob) (c : ob) :
|
|
|
|
|
-- -- coslice C c = opposite (slice (opposite C) c) :=
|
|
|
|
|
-- -- sorry
|
|
|
|
|
-- end coslice
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
|
|
|
|
section arrow
|
|
|
|
|
open sigma eq.ops
|
|
|
|
|
-- theorem concat_commutative_squares {ob : Type} {C : category ob} {a1 a2 a3 b1 b2 b3 : ob}
|
|
|
|
|
-- {f1 : a1 => b1} {f2 : a2 => b2} {f3 : a3 => b3} {g2 : a2 => a3} {g1 : a1 => a2}
|
|
|
|
|
-- {h2 : b2 => b3} {h1 : b1 => b2} (H1 : f2 ∘ g1 = h1 ∘ f1) (H2 : f3 ∘ g2 = h2 ∘ f2)
|
|
|
|
|
-- : f3 ∘ (g2 ∘ g1) = (h2 ∘ h1) ∘ f1 :=
|
|
|
|
|
-- calc
|
|
|
|
|
-- f3 ∘ (g2 ∘ g1) = (f3 ∘ g2) ∘ g1 : assoc
|
|
|
|
|
-- ... = (h2 ∘ f2) ∘ g1 : {H2}
|
|
|
|
|
-- ... = h2 ∘ (f2 ∘ g1) : symm assoc
|
|
|
|
|
-- ... = h2 ∘ (h1 ∘ f1) : {H1}
|
|
|
|
|
-- ... = (h2 ∘ h1) ∘ f1 : assoc
|
|
|
|
|
|
|
|
|
|
-- definition arrow {ob : Type} (C : category ob) : category (Σ(a b : ob), hom a b) :=
|
|
|
|
|
-- mk (λa b, Σ(g : hom (dpr1 a) (dpr1 b)) (h : hom (dpr2' a) (dpr2' b)),
|
|
|
|
|
-- dpr3 b ∘ g = h ∘ dpr3 a)
|
|
|
|
|
-- (λ a b c g f, dpair (dpr1 g ∘ dpr1 f) (dpair (dpr2' g ∘ dpr2' f) (concat_commutative_squares (dpr3 f) (dpr3 g))))
|
|
|
|
|
-- (λ a, dpair id (dpair id (id_right ⬝ (symm id_left))))
|
|
|
|
|
-- (λ a b c d h g f, dtrip_eq2 assoc assoc !proof_irrel)
|
|
|
|
|
-- (λ a b f, trip.equal2 id_left id_left !proof_irrel)
|
|
|
|
|
-- (λ a b f, trip.equal2 id_right id_right !proof_irrel)
|
|
|
|
|
|
|
|
|
|
-- make these definitions private?
|
|
|
|
|
variables {ob : Type} {C : category ob}
|
|
|
|
|
protected definition arrow_obs (ob : Type) (C : category ob) := Σ(a b : ob), hom a b
|
2015-05-19 05:35:18 +00:00
|
|
|
|
variables {a b : category.arrow_obs ob C}
|
|
|
|
|
protected definition src (a : category.arrow_obs ob C) : ob := sigma.pr1 a
|
|
|
|
|
protected definition dst (a : category.arrow_obs ob C) : ob := sigma.pr2' a
|
|
|
|
|
protected definition to_hom (a : category.arrow_obs ob C) : hom (category.src a) (category.dst a) := sigma.pr3 a
|
|
|
|
|
|
|
|
|
|
protected definition arrow_hom (a b : category.arrow_obs ob C) : Type :=
|
|
|
|
|
Σ (g : hom (category.src a) (category.src b)) (h : hom (category.dst a) (category.dst b)),
|
|
|
|
|
category.to_hom b ∘ g = h ∘ category.to_hom a
|
|
|
|
|
|
|
|
|
|
protected definition hom_src (m : category.arrow_hom a b) : hom (category.src a) (category.src b) := sigma.pr1 m
|
|
|
|
|
protected definition hom_dst (m : category.arrow_hom a b) : hom (category.dst a) (category.dst b) := sigma.pr2' m
|
|
|
|
|
protected definition commute (m : category.arrow_hom a b) :
|
|
|
|
|
category.to_hom b ∘ (category.hom_src m) = (category.hom_dst m) ∘ category.to_hom a
|
2014-12-20 02:23:08 +00:00
|
|
|
|
:= sigma.pr3 m
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
2015-05-19 05:35:18 +00:00
|
|
|
|
definition arrow (ob : Type) (C : category ob) : category (category.arrow_obs ob C) :=
|
|
|
|
|
mk (λa b, category.arrow_hom a b)
|
|
|
|
|
(λ a b c g f, sigma.mk (category.hom_src g ∘ category.hom_src f) (sigma.mk (category.hom_dst g ∘ category.hom_dst f)
|
|
|
|
|
(show category.to_hom c ∘ (category.hom_src g ∘ category.hom_src f) = (category.hom_dst g ∘ category.hom_dst f) ∘ category.to_hom a,
|
2014-10-09 06:44:09 +00:00
|
|
|
|
proof
|
|
|
|
|
calc
|
2015-05-19 05:35:18 +00:00
|
|
|
|
category.to_hom c ∘ (category.hom_src g ∘ category.hom_src f) = (category.to_hom c ∘ category.hom_src g) ∘ category.hom_src f : by rewrite assoc
|
|
|
|
|
... = (category.hom_dst g ∘ category.to_hom b) ∘ category.hom_src f : by rewrite category.commute
|
|
|
|
|
... = category.hom_dst g ∘ (category.to_hom b ∘ category.hom_src f) : by rewrite assoc
|
|
|
|
|
... = category.hom_dst g ∘ (category.hom_dst f ∘ category.to_hom a) : by rewrite category.commute
|
|
|
|
|
... = (category.hom_dst g ∘ category.hom_dst f) ∘ category.to_hom a : by rewrite assoc
|
2014-10-09 06:44:09 +00:00
|
|
|
|
qed)
|
2014-10-09 01:44:01 +00:00
|
|
|
|
))
|
2014-12-20 02:23:08 +00:00
|
|
|
|
(λ a, sigma.mk id (sigma.mk id (!id_right ⬝ (symm !id_left))))
|
2015-03-13 03:18:49 +00:00
|
|
|
|
(λ a b c d h g f, ndtrip_eq !assoc !assoc !proof_irrel)
|
2014-11-04 00:22:30 +00:00
|
|
|
|
(λ a b f, ndtrip_equal !id_left !id_left !proof_irrel)
|
|
|
|
|
(λ a b f, ndtrip_equal !id_right !id_right !proof_irrel)
|
2014-10-09 01:44:01 +00:00
|
|
|
|
|
|
|
|
|
end arrow
|
|
|
|
|
|
|
|
|
|
end category
|
|
|
|
|
|
2014-11-25 01:24:30 +00:00
|
|
|
|
-- definition foo : category (sorry) :=
|
2014-10-09 01:44:01 +00:00
|
|
|
|
-- mk (λa b, sorry)
|
|
|
|
|
-- (λ a b c g f, sorry)
|
|
|
|
|
-- (λ a, sorry)
|
|
|
|
|
-- (λ a b c d h g f, sorry)
|
|
|
|
|
-- (λ a b f, sorry)
|
|
|
|
|
-- (λ a b f, sorry)
|