Mercurial > hg > Members > kono > Proof > category
comparison CCChom.agda @ 815:bb9fd483f560
simpler proof of CCC from graph
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 27 Apr 2019 12:17:49 +0900 |
parents | e4986625ddd7 |
children | 4e48b331020a |
comparison
equal
deleted
inserted
replaced
814:e4986625ddd7 | 815:bb9fd483f560 |
---|---|
59 nat-2 : {a b c : Obj A} → {f : Hom A (b * c) (b * c) } → {g : Hom A a (b * c) } | 59 nat-2 : {a b c : Obj A} → {f : Hom A (b * c) (b * c) } → {g : Hom A a (b * c) } |
60 → (A × A) [ (A × A) [ IsoS.≅→ ccc-2 f o (g , g) ] ≈ IsoS.≅→ ccc-2 ( A [ f o g ] ) ] | 60 → (A × A) [ (A × A) [ IsoS.≅→ ccc-2 f o (g , g) ] ≈ IsoS.≅→ ccc-2 ( A [ f o g ] ) ] |
61 nat-3 : {a b c : Obj A} → { k : Hom A c (a ^ b ) } → A [ A [ IsoS.≅→ (ccc-3) (id1 A (a ^ b)) o | 61 nat-3 : {a b c : Obj A} → { k : Hom A c (a ^ b ) } → A [ A [ IsoS.≅→ (ccc-3) (id1 A (a ^ b)) o |
62 (IsoS.≅← (ccc-2 ) (A [ k o (proj₁ ( IsoS.≅→ ccc-2 (id1 A (c * b)))) ] , | 62 (IsoS.≅← (ccc-2 ) (A [ k o (proj₁ ( IsoS.≅→ ccc-2 (id1 A (c * b)))) ] , |
63 (proj₂ ( IsoS.≅→ ccc-2 (id1 A (c * b) ))))) ] ≈ IsoS.≅→ (ccc-3 ) k ] | 63 (proj₂ ( IsoS.≅→ ccc-2 (id1 A (c * b) ))))) ] ≈ IsoS.≅→ (ccc-3 ) k ] |
64 | |
65 -------- | |
66 -- CCC satisfies hom natural iso | |
67 -- | |
68 -- ccc-1 : Hom A a 1 ≅ {*} | |
69 -- ccc-2 : Hom A c (a × b) ≅ (Hom A c a ) × ( Hom A c b ) | |
70 -- ccc-3 : Hom A a (c ^ b) ≅ Hom A (a × b) c | |
71 -- | |
72 -------- | |
64 | 73 |
65 open import CCC | 74 open import CCC |
66 | 75 |
67 | 76 |
68 record CCChom {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) : Set ( c₁ ⊔ c₂ ⊔ ℓ ) where | 77 record CCChom {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) : Set ( c₁ ⊔ c₂ ⊔ ℓ ) where |
237 < ( g o π ) o < ( f o π ) , π' > , π' o < ( f o π ) , π' > > | 246 < ( g o π ) o < ( f o π ) , π' > , π' o < ( f o π ) , π' > > |
238 ≈↑⟨ IsCCC.distr-π isc ⟩ | 247 ≈↑⟨ IsCCC.distr-π isc ⟩ |
239 < ( g o π ) , π' > o < ( f o π ) , π' > | 248 < ( g o π ) , π' > o < ( f o π ) , π' > |
240 ∎ where open ≈-Reasoning A | 249 ∎ where open ≈-Reasoning A |
241 | 250 |
251 ------- | |
252 --- U_b and F_b is an adjunction Functor | |
253 ------- | |
254 | |
242 CCCtoAdj : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) ( ccc : CCC A ) → (b : Obj A ) → coUniversalMapping A A (F_b A ccc b) | 255 CCCtoAdj : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) ( ccc : CCC A ) → (b : Obj A ) → coUniversalMapping A A (F_b A ccc b) |
243 CCCtoAdj A ccc b = record { | 256 CCCtoAdj A ccc b = record { |
244 U = λ a → a <= b | 257 U = λ a → a <= b |
245 ; ε = ε' | 258 ; ε = ε' |
246 ; _*' = solution | 259 ; _*' = solution |
277 ≈⟨ IsCCC.e4b isc ⟩ | 290 ≈⟨ IsCCC.e4b isc ⟩ |
278 g | 291 g |
279 ∎ where open ≈-Reasoning A | 292 ∎ where open ≈-Reasoning A |
280 | 293 |
281 | 294 |
282 | 295 ---------- |
283 | 296 --- Hom A 1 ( c ^ b ) ≅ Hom A b c |
284 c^b=b<=c : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) ( ccc : CCC A ) → {a b c : Obj A} → -- Hom A 1 ( c ^ b ) ≅ Hom A b c | 297 ---------- |
298 | |
299 c^b=b<=c : {c₁ c₂ ℓ : Level} (A : Category c₁ c₂ ℓ) ( ccc : CCC A ) → {a b c : Obj A} → | |
285 IsoS A A (CCC.1 ccc ) (CCC._<=_ ccc c b) b c | 300 IsoS A A (CCC.1 ccc ) (CCC._<=_ ccc c b) b c |
286 c^b=b<=c A ccc {a} {b} {c} = record { | 301 c^b=b<=c A ccc {a} {b} {c} = record { |
287 ≅→ = λ f → A [ CCC.ε ccc o CCC.<_,_> ccc ( A [ f o CCC.○ ccc b ] ) ( id1 A b ) ] --- g ’ (g : 1 → b ^ a) of | 302 ≅→ = λ f → A [ CCC.ε ccc o CCC.<_,_> ccc ( A [ f o CCC.○ ccc b ] ) ( id1 A b ) ] --- g ’ (g : 1 → b ^ a) of |
288 ; ≅← = λ f → CCC._* ccc ( A [ f o CCC.π' ccc ] ) --- ┌ f ┐ name of (f : b ^a → 1 ) | 303 ; ≅← = λ f → CCC._* ccc ( A [ f o CCC.π' ccc ] ) --- ┌ f ┐ name of (f : b ^a → 1 ) |
289 ; iso→ = iso→ | 304 ; iso→ = iso→ |
508 ∎ where open ≈-Reasoning A | 523 ∎ where open ≈-Reasoning A |
509 *-cong : {a b c : Obj A} {f f' : Hom A (a ∧ b) c} → A [ f ≈ f' ] → A [ f * ≈ f' * ] | 524 *-cong : {a b c : Obj A} {f f' : Hom A (a ∧ b) c} → A [ f ≈ f' ] → A [ f * ≈ f' * ] |
510 *-cong eq = cong← ( ccc-3 (isCCChom h )) eq | 525 *-cong eq = cong← ( ccc-3 (isCCChom h )) eq |
511 | 526 |
512 open import Category.Sets | 527 open import Category.Sets |
528 | |
529 -- Sets is a CCC | |
513 | 530 |
514 postulate extensionality : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) → Relation.Binary.PropositionalEquality.Extensionality c₂ c₂ | 531 postulate extensionality : { c₁ c₂ ℓ : Level} ( A : Category c₁ c₂ ℓ ) → Relation.Binary.PropositionalEquality.Extensionality c₂ c₂ |
515 | 532 |
516 data One' {l : Level} : Set l where | 533 data One' {l : Level} : Set l where |
517 OneObj' : One' -- () in Haskell ( or any one object set ) | 534 OneObj' : One' -- () in Haskell ( or any one object set ) |
641 amap {G} {a} {.(_ <= _)} (f *) x = λ y → amap f ( x , y ) | 658 amap {G} {a} {.(_ <= _)} (f *) x = λ y → amap f ( x , y ) |
642 fmap : {G : SM} { a b : Objs (graph G) } → Hom (DX G) a b → fobj {G} a → fobj {G} b | 659 fmap : {G : SM} { a b : Objs (graph G) } → Hom (DX G) a b → fobj {G} a → fobj {G} b |
643 fmap {G} {a} {a} (id a) = λ z → z | 660 fmap {G} {a} {a} (id a) = λ z → z |
644 fmap {G} {a} {b} (next x f ) = Sets [ amap {G} x o fmap f ] | 661 fmap {G} {a} {b} (next x f ) = Sets [ amap {G} x o fmap f ] |
645 | 662 |
663 -- CS is a map from Positive logic to Sets | |
664 -- Sets is CCC, so we have a cartesian closed category generated by a graph | |
665 -- as a sub category of Sets | |
666 | |
646 CS : (G : SM ) → Functor (DX G) (Sets {Level.zero}) | 667 CS : (G : SM ) → Functor (DX G) (Sets {Level.zero}) |
647 FObj (CS G) a = fobj a | 668 FObj (CS G) a = fobj a |
648 FMap (CS G) {a} {b} f = fmap {G} {a} {b} f | 669 FMap (CS G) {a} {b} f = fmap {G} {a} {b} f |
649 isFunctor (CS G) = isf where | 670 isFunctor (CS G) = isf where |
650 _++_ = Category._o_ (DX G) | 671 _++_ = Category._o_ (DX G) |
651 ++idR = IsCategory.identityR ( Category.isCategory ( DX G ) ) | 672 ++idR = IsCategory.identityR ( Category.isCategory ( DX G ) ) |
652 distr : {a b c : Obj (DX G)} { f : Hom (DX G) a b } { g : Hom (DX G) b c } → (z : fobj {G} a ) → fmap (g ++ f) z ≡ fmap g (fmap f z) | 673 distr : {a b c : Obj (DX G)} { f : Hom (DX G) a b } { g : Hom (DX G) b c } → (z : fobj {G} a ) → fmap (g ++ f) z ≡ fmap g (fmap f z) |
653 distr {a} {b} {e ∧ e1} {f} {next {b} {d} {e ∧ e1} < x , y > g} z = begin | 674 distr {a} {b} {c} {f} {next {b} {d} {c} x g} z = adistr (distr {a} {b} {d} {f} {g} z ) x where |
654 fmap (next < x , y > g ++ f) z | 675 adistr : fmap (g ++ f) z ≡ fmap g (fmap f z) → |
655 ≡⟨⟩ | 676 ( x : Arrow (graph G) d c ) → fmap ( next x (g ++ f) ) z ≡ fmap ( next x g ) (fmap f z ) |
656 amap x (fmap (g ++ f) z) , amap y (fmap (g ++ f) z) | 677 adistr eq x = cong ( λ k → amap x k ) eq |
657 ≡⟨ cong ( λ k → ( amap x k , amap y k )) (distr {a} {b} {d} {f} {g} z) ⟩ | |
658 amap x (fmap g (fmap f z)) , amap y (fmap g (fmap f z)) | |
659 ≡⟨⟩ | |
660 fmap (next < x , y > g) (fmap f z) | |
661 ∎ where open ≡-Reasoning | |
662 distr {a} {b} {c <= d} {f} {next {b} {e} {c <= d} (x *) g} z = begin | |
663 fmap (next (x *) g ++ f) z | |
664 ≡⟨⟩ | |
665 (λ y → amap x (fmap (g ++ f) z , y) ) | |
666 ≡⟨ extensionality Sets ( λ y → cong ( λ k → (amap x (k , y )) ) (distr {a} {b} {e} {f} {g} z) ) ⟩ | |
667 (λ y → amap x (fmap g (fmap f z) , y)) | |
668 ≡⟨⟩ | |
669 fmap (next (x *) g) (fmap f z) | |
670 ∎ where open ≡-Reasoning | |
671 distr {a} {b} {c} {f} {next {.b} {.c ∧ x} {.c} π g} z = begin | |
672 fmap (DX G [ next π g o f ]) z | |
673 ≡⟨⟩ | |
674 fmap {G} {a} {c} (next {PL G} {a} {c ∧ x} {c} π ( g ++ f)) z | |
675 ≡⟨⟩ | |
676 proj₁ ( fmap {G} {a} {c ∧ x} (g ++ f ) z ) | |
677 ≡⟨ cong ( λ k → proj₁ k ) ( distr {a} {b} {(c ∧ x)} {f} {g} z ) ⟩ | |
678 proj₁ ( fmap g ( fmap f z )) | |
679 ≡⟨⟩ | |
680 (Sets [ fmap (next π g) o fmap f ]) z | |
681 ∎ where open ≡-Reasoning | |
682 distr {a} {b} {c} {f} {next {b} {x ∧ c} π' g} z = begin | |
683 fmap (DX G [ next π' g o f ]) z | |
684 ≡⟨⟩ | |
685 fmap (next π' (g ++ f)) z | |
686 ≡⟨⟩ | |
687 proj₂ (fmap (g ++ f) z) | |
688 ≡⟨ cong ( λ k → proj₂ k ) ( distr {a} {b} {x ∧ c} {f} {g} z ) ⟩ | |
689 ( Sets [ fmap (next π' g) o fmap f ] ) z | |
690 ∎ where open ≡-Reasoning | |
691 distr {a} {b} {c} {f} {next {b} {(c <= x) ∧ x} {c} ε g} z = begin | |
692 fmap (DX G [ next ε g o f ] ) z | |
693 ≡⟨⟩ | |
694 fmap (next ε (g ++ f)) z | |
695 ≡⟨⟩ | |
696 proj₁ (fmap (g ++ f) z) ( proj₂ (fmap (g ++ f) z) ) | |
697 ≡⟨ cong ( λ k → proj₁ k ( proj₂ k)) (distr {a} {b} {(c <= x) ∧ x} {f} {g} z) ⟩ | |
698 proj₁ (fmap g (fmap f z)) ( proj₂ (fmap g (fmap f z))) | |
699 ≡⟨⟩ | |
700 fmap (next ε g) (fmap f z) | |
701 ≡⟨⟩ | |
702 ( Sets [ fmap (next ε g) o fmap f ] ) z | |
703 ∎ where open ≡-Reasoning | |
704 distr {a} {.a} {.a} {id a} {id .a} z = refl | |
705 distr {a} {.a} {c} {id a} {next {a} {b} x g} z = begin | |
706 fmap (DX G [ next x g o Chain.id a ]) z | |
707 ≡⟨⟩ | |
708 fmap ( next x ( g ++ (Chain.id a))) z | |
709 ≡⟨ cong ( λ k → fmap ( next x k ) z ) ( ++idR {a} {b} {g} ) ⟩ | |
710 fmap ( next x g ) z | |
711 ≡⟨ refl ⟩ | |
712 ( Sets [ fmap (next x g) o fmap (Chain.id a) ] ) z | |
713 ∎ where open ≡-Reasoning | |
714 distr {a} {b} {b} {f} {id b} z = refl | 678 distr {a} {b} {b} {f} {id b} z = refl |
715 distr {a} {b} {atom z} {f} {next {.b} {atom y} {atom z} (arrow x) g} w = begin | |
716 fmap (DX G [ next (arrow x) g o f ]) w | |
717 ≡⟨⟩ | |
718 fmap ( next (arrow x) (g ++ f ) ) w | |
719 ≡⟨⟩ | |
720 smap G x ( fmap (g ++ f) w ) | |
721 ≡⟨ cong ( λ k → smap G x k ) (distr {a} {b} {atom y} {f} {g} w) ⟩ | |
722 smap G x (fmap g (fmap f w)) | |
723 ≡⟨⟩ | |
724 fmap (next (arrow x) g) ( fmap f w ) | |
725 ≡⟨⟩ | |
726 (Sets [ fmap (next (arrow x) g) o fmap f ]) w | |
727 ∎ where open ≡-Reasoning | |
728 distr {a} {b} {.⊤} {f} {next (○ a₁) g} z = begin | |
729 fmap (DX G [ next (○ a₁) g o f ]) z | |
730 ≡⟨⟩ | |
731 (Sets [ fmap (next (○ a₁) g) o fmap f ]) z | |
732 ∎ where open ≡-Reasoning | |
733 isf : IsFunctor (DX G) Sets fobj fmap | 679 isf : IsFunctor (DX G) Sets fobj fmap |
734 IsFunctor.identity isf = extensionality Sets ( λ x → refl ) | 680 IsFunctor.identity isf = extensionality Sets ( λ x → refl ) |
735 IsFunctor.≈-cong isf refl = refl | 681 IsFunctor.≈-cong isf refl = refl |
736 IsFunctor.distr isf {a} {b} {c} {g} {f} = extensionality Sets ( λ z → distr {a} {b} {c} {g} {f} z ) | 682 IsFunctor.distr isf {a} {b} {c} {g} {f} = extensionality Sets ( λ z → distr {a} {b} {c} {g} {f} z ) |
737 | 683 |