Mercurial > hg > Members > kono > Proof > category
view CCCGraph1.agda @ 858:9d9cba1f831e
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 05 Apr 2020 10:44:40 +0900 |
parents | 8e31f61ab251 |
children | ed0b3d2d1037 |
line wrap: on
line source
open import Level open import Category module CCCgraph1 where open import HomReasoning open import cat-utility open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import CCC open import graph module ccc-from-graph {c₁ c₂ : Level} (G : Graph {c₁} {c₂} ) where open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import Relation.Binary.Core open Graph data Objs : Set (c₁ ⊔ c₂) where atom : (vertex G) → Objs ⊤ : Objs _∧_ : Objs → Objs → Objs _<=_ : Objs → Objs → Objs data Arrow : Objs → Objs → Set (c₁ ⊔ c₂) where --- case i arrow : {a b : vertex G} → (edge G) a b → Arrow (atom a) (atom b) π : {a b : Objs } → Arrow ( a ∧ b ) a π' : {a b : Objs } → Arrow ( a ∧ b ) b ε : {a b : Objs } → Arrow ((a <= b) ∧ b ) a _* : {a b c : Objs } → Arrow (c ∧ b ) a → Arrow c ( a <= b ) --- case v data Arrows : (b c : Objs ) → Set ( c₁ ⊔ c₂ ) where id : ( a : Objs ) → Arrows a a --- case i ○ : ( a : Objs ) → Arrows a ⊤ --- case i <_,_> : {a b c : Objs } → Arrows c a → Arrows c b → Arrows c (a ∧ b) --- case iii iv : {b c d : Objs } ( f : Arrow d c ) ( g : Arrows b d ) → Arrows b c -- cas iv eval : {a b : Objs } (f : Arrows a b ) → Arrows a b eval (id a) = id a eval (○ a) = ○ a eval < f , f₁ > = < eval f , eval f₁ > eval (iv f (id a)) = iv f (id a) eval (iv f (○ a)) = iv f (○ a) eval (iv π < g , h >) = eval g eval (iv π' < g , h >) = eval h eval (iv ε < g , h >) = iv ε < eval g , eval h > eval (iv (f *) < g , h >) = iv (f *) < eval g , eval h > eval (iv f (iv g h)) with eval (iv g h) eval (iv f (iv g h)) | id a = iv f (id a) eval (iv f (iv g h)) | ○ a = iv f (○ a) eval (iv π (iv g h)) | < t , t₁ > = t eval (iv π' (iv g h)) | < t , t₁ > = t₁ eval (iv ε (iv g h)) | < t , t₁ > = iv ε < t , t₁ > eval (iv (f *) (iv g h)) | < t , t₁ > = iv (f *) < t , t₁ > eval (iv f (iv g h)) | iv f1 t = iv f (iv f1 t) idem-<l> : {a b c : Objs} → { f f1 : Arrows a b } { g g1 : Arrows a c } → < f , g > ≡ < f1 , g1 > → f ≡ f1 idem-<l> refl = refl idem-<r> : {a b c : Objs} → { f f1 : Arrows a b } { g g1 : Arrows a c } → < f , g > ≡ < f1 , g1 > → g ≡ g1 idem-<r> refl = refl idem-eval : {a b : Objs } (f : Arrows a b ) → eval (eval f) ≡ eval f idem-eval (id a) = refl idem-eval (○ a) = refl idem-eval < f , f₁ > = cong₂ ( λ j k → < j , k > ) (idem-eval f) (idem-eval f₁) idem-eval (iv f (id a)) = refl idem-eval (iv f (○ a)) = refl idem-eval (iv π < g , g₁ >) = idem-eval g idem-eval (iv π' < g , g₁ >) = idem-eval g₁ idem-eval (iv ε < f , f₁ >) = cong₂ ( λ j k → iv ε < j , k > ) (idem-eval f) (idem-eval f₁) idem-eval (iv (x *) < f , f₁ >) = cong₂ ( λ j k → iv (x *) < j , k > ) (idem-eval f) (idem-eval f₁) idem-eval (iv f (iv g h)) with eval (iv g h) | idem-eval (iv g h) idem-eval (iv f (iv g h)) | id a | m = refl idem-eval (iv f (iv g h)) | ○ a | m = refl idem-eval (iv π (iv g h)) | < t , t₁ > | m = idem-<l> m idem-eval (iv π' (iv g h)) | < t , t₁ > | m = idem-<r> m idem-eval (iv ε (iv g h)) | < t , t₁ > | m = cong ( λ k → iv ε k ) m idem-eval (iv (f *) (iv g h)) | < t , t₁ > | m = cong ( λ k → iv (f *) k ) m idem-eval (iv (arrow x) (iv g h)) | iv f1 (id a) | m = cong ( λ k → iv (arrow x) k ) m idem-eval (iv π (iv g h)) | iv f1 (id a) | m = cong ( λ k → iv π k ) m idem-eval (iv π' (iv g h)) | iv f1 (id a) | m = cong ( λ k → iv π' k ) m idem-eval (iv ε (iv g h)) | iv f1 (id a) | m = cong ( λ k → iv ε k ) m idem-eval (iv (f *) (iv g h)) | iv f1 (id a) | m = cong ( λ k → iv (f *) k ) m idem-eval (iv (f *) (iv g h)) | iv f1 (○ a) | m = cong ( λ k → iv (f *) k ) m idem-eval (iv f (iv g h)) | iv π < t , t₁ > | m = {!!} idem-eval (iv f (iv g h)) | iv π' < t , t₁ > | m = {!!} idem-eval (iv (arrow x) (iv g h)) | iv ε < t , t₁ > | m = cong ( λ k → iv (arrow x) k ) m idem-eval (iv π (iv g h)) | iv ε < t , t₁ > | m = cong ( λ k → iv π k ) m idem-eval (iv π' (iv g h)) | iv ε < t , t₁ > | m = cong ( λ k → iv π' k ) m idem-eval (iv ε (iv g h)) | iv ε < t , t₁ > | m = cong ( λ k → iv ε k ) m idem-eval (iv (f *) (iv g h)) | iv ε < t , t₁ > | m = cong ( λ k → iv (f *) k ) m idem-eval (iv (f *) (iv g h)) | iv (f1 *) < t , t₁ > | m = cong ( λ k → iv (f *) k ) m idem-eval {a} {b} (iv {a} {b} {d} f (iv g h)) | iv {a} {d} {e} f1 (iv {a} {e} {e1} f2 t) | m = lemma f f1 f2 where lemma : (f : Arrow d b ) → (f1 : Arrow e d ) → (f2 : Arrow e1 e ) → eval (iv f ( iv f1 (iv f2 t))) ≡ iv f ( iv f1 (iv f2 t)) lemma f f1 f2 = ? _・_ : {a b c : Objs } (f : Arrows b c ) → (g : Arrows a b) → Arrows a c id a ・ g = g ○ a ・ g = ○ _ < f , g > ・ h = < f ・ h , g ・ h > iv f (id _) ・ h = iv f h iv π < g , g₁ > ・ h = g ・ h iv π' < g , g₁ > ・ h = g₁ ・ h iv ε < g , g₁ > ・ h = iv ε < g ・ h , g₁ ・ h > iv (f *) < g , g₁ > ・ h = iv (f *) < g ・ h , g₁ ・ h > iv f ( (○ a)) ・ g = iv f ( ○ _ ) iv x y ・ id a = iv x y iv f (iv f₁ g) ・ h = iv f ( iv f₁ g ・ h ) _==_ : {a b : Objs } → ( x y : Arrows a b ) → Set (c₁ ⊔ c₂) _==_ {a} {b} x y = eval x ≡ eval y identityR : {A B : Objs} {f : Arrows A B} → (f ・ id A) == f identityR {a} {.a} {id a} = refl identityR {a} {.⊤} {○ a} = refl identityR {a} {.(_ ∧ _)} {< f , f₁ >} = cong₂ (λ j k → < j , k > ) (identityR {_} {_} {f} ) (identityR {_} {_} {f₁}) identityR {a} {b} {iv f (id a)} = refl identityR {a} {b} {iv f (○ a)} = refl identityR {a} {b} {iv π < g , g₁ >} = identityR {_} {_} {g} identityR {a} {b} {iv π' < g , g₁ >} = identityR {_} {_} {g₁} identityR {a} {b} {iv ε < f , f₁ >} = cong₂ (λ j k → iv ε < j , k > ) (identityR {_} {_} {f} ) (identityR {_} {_} {f₁}) identityR {a} {_} {iv (x *) < f , f₁ >} = cong₂ (λ j k → iv (x *) < j , k > ) (identityR {_} {_} {f} ) (identityR {_} {_} {f₁}) identityR {a} {b} {iv {c} {d} {e} π (iv g h)} with inspect eval (iv g h) | eval (iv g h) identityR {.(b ∧ _)} {b} {iv {.(b ∧ _)} {b} {.(b ∧ _)} π (iv g h)} | record {eq = refl } | id .(b ∧ _) = refl identityR {a} {b} {iv {a} {b} {.(b ∧ _)} π (iv g h)} | record {eq = refl } | < t , t₁ > = {!!} identityR {a} {b} {iv {a} {b} {.(b ∧ _)} π (iv g h)} | record {eq = refl } | iv f t = {!!} identityR {a} {b} {iv {c} {d} {e} π' (iv g h)} = {!!} identityR {a} {b} {iv {c} {d} {e} f (iv g h)} with identityR {_} {_} {iv g h} ... | t = {!!} ==←≡ : {A B : Objs} {f g : Arrows A B} → f ≡ g → f == g ==←≡ eq = cong (λ k → eval k ) eq PL : Category (c₁ ⊔ c₂) (c₁ ⊔ c₂) (c₁ ⊔ c₂) PL = record { Obj = Objs; Hom = λ a b → Arrows a b ; _o_ = λ{a} {b} {c} x y → x ・ y ; _≈_ = λ x y → x == y ; Id = λ{a} → id a ; isCategory = record { isEquivalence = record {refl = refl ; trans = trans ; sym = sym } ; identityL = λ {a b f} → identityL {a} {b} {f} ; identityR = λ {a b f} → identityR {a} {b} {f} ; o-resp-≈ = λ {a b c f g h i} → o-resp-≈ {a} {b} {c} {f} {g} {h} {i} ; associative = λ{a b c d f g h } → associative f g h } } where identityL : {A B : Objs} {f : Arrows A B} → (id B ・ f) == f identityL {_} {_} {id a} = refl identityL {_} {_} {○ a} = refl identityL {a} {b} {< f , f₁ >} = cong₂ (λ j k → < j , k > ) (identityL {_} {_} {f}) (identityL {_} {_} {f₁}) identityL {_} {_} {iv f f₁} = {!!} associative : {a b c d : Objs} (f : Arrows c d) (g : Arrows b c) (h : Arrows a b) → (f ・ (g ・ h)) == ((f ・ g) ・ h) associative (id a) g h = {!!} associative (○ a) g h = refl associative (< f , f1 > ) g h = cong₂ ( λ j k → < j , k > ) (associative f g h) (associative f1 g h) associative {a} (iv x f) g h = {!!} -- cong ( λ k → iv x k ) (associative f g h) o-resp-≈ : {A B C : Objs} {f g : Arrows A B} {h i : Arrows B C} → f == g → h == i → (h ・ f) == (i ・ g) o-resp-≈ f=g h=i = {!!}