Mac Lane’s Comparison Theorem for the (co)Kleisli construction in Coq Burak Ekici University of Innsbruck, Austria August 13, 2018
� � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion The statement C F ⊢ G D B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 2 / 20
� � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion The statement T C F ⊢ G D B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 2 / 20
� � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion The statement T C C T F ⊢ G D B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 2 / 20
� � � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion The statement T F T C C T ⊥ G T F ⊢ G D B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 2 / 20
� � � � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion The statement T F T C C T ⊥ G T F ⊢ L G D B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 2 / 20
� � � � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion The statement T F T C C T ⊥ G T = F ⊢ ! L G D ∃ ! L : C T → D , L ◦ F T = F ∧ G ◦ L = F T B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 2 / 20
� � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Adjunctions F C D ⊥ G η : Id ⇒ GF ε : FG ⇒ Id F ⊣ G Definition Let C and D be two categories. The functors F : C → D and G : D → C form an adjunction F ⊣ G : D → C iff there exists natural transformations η : Id C ⇒ GF and ε : FG ⇒ Id D such that: ε FX ◦ F η X = id FX for each X in C (1) G ε X ◦ η GX = id GX for each X in D (2) B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 3 / 20
� � � � � � � � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Adjunctions ε FX ◦ F η X = id FX for each X in C F F ( Idf ) � Idf X Y FX FY η X = η Y F η X = F η Y GFf � GFY FGFf � GFX = FGFX FGFY = Id ( FX ) Id ( FY ) ε FX = ε FY � FY FX Ff B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 3 / 20
Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Adjunctions: an example In CIC, the logical ∧ and = ⇒ are adjoint operations when Coq’s Prop universe is defined as a category. The proof is in the library comes with this talk. B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 4 / 20
Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Adjunctions: an example In CIC, the logical ∧ and = ⇒ are adjoint operations when Coq’s Prop universe is defined as a category. The proof is in the library comes with this talk. B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 4 / 20
� � � � � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Monads Definition A monad T = ( T , η, µ ) in a category C consists of an endofunctor T : C → C with two natural transformations µ : T 2 ⇒ T η : Id C ⇒ T (3) such that the following diagrams commute: µ T η T T 3 T 2 T 2 T = µ µ T µ = T η id T = T 2 � T T 2 � T µ µ B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 5 / 20
Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Monad: quick examples A monoid is a monad in the category of endo-functors In CIC, the triple (fmapM, etaM, muM) forms a monad when Coq’s Type universe is defined as a category. Inductive maybe (A: Type ) � just: A → maybe A | nothing: maybe A. B) (i: maybe A): maybe B � Definition fmapM {A B: Type} (f: A → match i with | just _ a ⇒ just _ (f a) | nothing _ ⇒ nothing _ end . Definition etaM {A: Type} (a: A): maybe A � just A a. Definition muM {A : Type} (i: maybe (maybe A)): maybe A � match i with | just _ a ⇒ a | nothing _ ⇒ nothing _ end . B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 6 / 20
� � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every adjunction gives a monad F C D ⊥ G η : Id ⇒ GF ε : FG ⇒ Id F ⊣ G B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 7 / 20
� � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every adjunction gives a monad T D F C D ⊥ G η : Id ⇒ T ε : D ⇒ Id F ⊣ G Proposition An adjunction F ⊣ G : D → C determines a monad on C and a comonad on D as follows: The monad ( T , η, µ ) on C T = GF : C → C , µ X = G ( ε FX ) . The comonad ( D , ε, δ ) on D D = FG : D → D , δ A = F ( η GA ) . B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 7 / 20
� Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every (co)monad gives a (co)Kleisli adjunction T C B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 8 / 20
� Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every (co)monad gives a (co)Kleisli adjunction T C C T Proposition Each monad ( T , η, µ ) on a category C determines a Kleisli category C T , B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 8 / 20
� � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every (co)monad gives a (co)Kleisli adjunction T F T C C T ⊥ G T Proposition Each monad ( T , η, µ ) on a category C determines a Kleisli category C T , and an associated adjunction F T ⊣ G T : C T → C . B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 8 / 20
� Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every (co)monad gives a (co)Kleisli adjunction T C C T The categories C and C T have the same objects and there is a morphism f ♭ : X → Y in C T for each f : X → TY in C . For each object X in C T , the identity arrow is id X = h ♭ : X → X in C T where h = η X : X → TX in C . The composition of a pair of morphisms f ♭ : X → Y and g ♭ : Y → Z in C T is given by the Kleisli composition: g ♭ ◦ f ♭ = h ♭ : X → Z where h = µ Z ◦ Tg ◦ f : X → TZ in C . B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 9 / 20
� � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Every (co)monad gives a (co)Kleisli adjunction T F T C C T ⊥ G T The functor F T : C → C T is the identity on objects. On morphisms, F T f = ( η Y ◦ f ) ♭ , for each f : X → Y in C . (4) The functor G T : C T → C maps each object X in C T to TX in C . On morphisms, G T ( g ♭ ) = µ Y ◦ Tg , for each g ♭ : X → Y in C T . (5) B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 9 / 20
� � � � � � Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion Sketch of the proof T F T C C T ⊥ G T = F ⊢ ! L G D 1 Characterize some map L : C T → D by � = LX FX ε FY ◦ Ff , for each f ♭ : X → Y in C T Lf ♭ = 2 Prove that L is a functor satisfying GL = G T and LF T = F . 3 Show that L is unique B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 10 / 20
Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion L is a functor Proof: For each X in C T , id X = ( η X ) ♭ in C T , we have L ( id X ) = L ( η X ) ♭ = ε FX ◦ F η X . We get ε FX ◦ F η X = id FX = id LX . For each pair of morphisms f ♭ : X → Y and g ♭ : Y → Z in C T , by Kleisli composition, we obtain L ( g ♭ ◦ f ♭ ) = ε FZ ◦ FG ε FZ ◦ FGFg ◦ Ff . Since ε is natural, we have ε FZ ◦ Fg ◦ ε FY ◦ Ff which is L ( g ♭ ) ◦ L ( f ♭ ) in D . Hence L : C T → D is a functor. B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 11 / 20
Comparsion Theorem Comparsion Theorem in Coq Conlcusion and Discussion L satisfies ... Proof: 1 For each object X in C T , LX = FX in D and For each morphism f ♭ : X → Y in GLX = GFX = TX = G T X in C . C T , Lf ♭ = ε FY ◦ Ff in D by definition. Hence, GLf ♭ = G ε FY ◦ GFf . Similarly, by definition G T f ♭ = µ Y ◦ Tf . Since µ Y = G ( ε FY ) , we get G T f ♭ = G ε FY ◦ GFf . We get GLf ♭ = G T f ♭ for each mapping f ♭ . Thus GL = G T . F T is the identity on objects, thus LF T X = LX = FX . 2 For each morphism f : X → Y in C , we have F T f = ( η Y ◦ f ) ♭ in C T , by definition. So that LF T f = L ( η Y ◦ f ) ♭ = ε FY ◦ F η Y ◦ Ff . Due to ε and η being natural, we have ε FY ◦ F η Y = id FY yielding LF T f = Ff for each mapping f . Therefore LF T = F . B. Ekici (Uni. of Innsbruck) Comparison Theorem in Coq August 13, 2018 12 / 20
Recommend
More recommend