Your SlideShare is downloading. ×
0
Math::Category
id:hiratara

2009-11-21
Math::Category   (1)


✤   Perl

✤




✤




✤
Math::Category           (2)

✤




    ✤   dom, cod, comp

✤




    ✤        Hom

✤
(1)

✤




✤




✤   Morphism                      interface

    ✤   source: dom           Morphism

    ✤   target: cod ...
(2)

✤




    ✤   target source

    ✤   composition

✤




    ✤




    ✤
(1): SimpleMorphism

✤   2                      1

✤   simple_morph ‘1’ => ‘2’;                           ‘1’

    ✤   sou...
(2): SubroutineMorphism(1)

✤   Perl

✤   Perl

    ✤


                                                           print
✤...
(2): SubroutineMorphism(2)


✤       $sub2 . $sub1   $sub1   $sub2

    ✤




    ✤




✤
(1)

✤   f.(g.h)        (f . g) . h    f       g       h

    ✤




    ✤   id                            (       )

✤



...
(2)

A×B              πA πB                          C
( f, g ): f, g                       2

                         f ...
(3):

✤          : bi_morph $morph1, $morph2;   (A1, A2)
    ✤   source target                            (f, g)

        ...
(1)


✤   Functor

    ✤




    ✤   Morphism         Morphism

✤


    (                               )
(2)


✤            functor { ... };

    ✤


        (Morphism                  OK)

    ✤




✤                          ...
(1): $BI_FUNCTOR


✤   Hom(-, -)

    ✤   C^op × C      Sets

    ✤   C^op × C

    ✤   Sets    SubroutineMorphism
       ...
(1)



✤   NaturalTransformation

    ✤




    ✤                             (Morphism)
(2)

✤               nat { };

    ✤




    ✤




    ✤       (      )

        ✤
(3)


✤




    ✤   $nat2 . $nat1

    ✤   $funct . $nat


    ✤   $nat . $funct
(4): FunctorMorphism

✤




✤   functor_morph nat {               F
      my $id = shift;
      ...  ...
         return $...
(2): $YONEDA_EMBEDDING


✤




    ✤   C^op           Sets^C

    ✤          Hom(g, -)
: CPS   (1)

✤   uc   CPS
: CPS            (2)




                                 Sets
      Hom(        , -)    Hom(          , undef)
          ...
Monad                            (1)

✤             functor            eta   mu

    ✤   eta: I → T, mu: TT → T

    ✤



...
Monad                      (2)

✤           1.
    $monad->mu . (funct_nat $monad->functor, $monad->eta)
    $monad->mu . ...
Monad                     (1): $LIST_MONAD


✤




✤


    [v1_1, v1_2, v1_3], [v2_1, v2_2], [v3_1, v3_2, v3_3, v3_4]


✤ ...
Monad                     (2): $STATE_MONAD


✤




✤


    sub { my @states = @_; ..    .. return ¥@values, ¥@new_states ...
Monad           (3): Maybe



✤   Maybe           nothing

✤           (   )             null

✤   List
(5): KleisliMorphism

✤        m       f: a -> m b        b


mma                            mmb            mmc
          ...
(5): KleisliMorphism

✤        m       f: a -> m b        b


mma                            mmb            mmc
          ...
Kleisli                                   : Maybe                    (1)


✤                               HTML
    get_nu...
Kleisli   : Maybe   (2)

✤
Kleisli
 
                                  : Maybe   (2)
    
    
    
       
    
       
✤
    
       
       
    
...
Kleisli               : Maybe   (2)

✤   Maybe   Kleisli
Kleisli                   : Maybe   (2)

✤       Maybe   Kleisli
✤




✤




    ✤




    ✤       (   )

        ✤
Upcoming SlideShare
Loading in...5
×

Math::Category

1,236

Published on

Perlを使って圏論概念をシミュレーション。

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,236
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Math::Category"

  1. 1. Math::Category id:hiratara 2009-11-21
  2. 2. Math::Category (1) ✤ Perl ✤ ✤ ✤
  3. 3. Math::Category (2) ✤ ✤ dom, cod, comp ✤ ✤ Hom ✤
  4. 4. (1) ✤ ✤ ✤ Morphism interface ✤ source: dom Morphism ✤ target: cod Morphism ✤ composition:
  5. 5. (2) ✤ ✤ target source ✤ composition ✤ ✤ ✤
  6. 6. (1): SimpleMorphism ✤ 2 1 ✤ simple_morph ‘1’ => ‘2’; ‘1’ ✤ source simple_morph ‘1’ => ‘1’ ‘2’ ✤ target simple_morph ‘2’ => ‘2’ ‘3’ ✤ (simple_morph ‘2’ => ‘3’) . (simple_morph ‘1’ => ‘2’) = (simple_morph ‘1’ => ‘3’)
  7. 7. (2): SubroutineMorphism(1) ✤ Perl ✤ Perl ✤ print ✤ sub_morph { $_[0] * 2 } undef ✤ source target sub_morph { @_ } ( ) ✤ ( )
  8. 8. (2): SubroutineMorphism(2) ✤ $sub2 . $sub1 $sub1 $sub2 ✤ ✤ ✤
  9. 9. (1) ✤ f.(g.h) (f . g) . h f g h ✤ ✤ id ( ) ✤ ✤ f×g: x → ( f(x), g(x) )
  10. 10. (2) A×B πA πB C ( f, g ): f, g 2 f g ( f, g ) A πA A×B πB B (f,g) f g (f,g) (g,f)
  11. 11. (3): ✤ : bi_morph $morph1, $morph2; (A1, A2) ✤ source target (f, g) (B1, B2) ✤ : op $morph; B ✤ source targe f ✤ op op $morph; $morph A
  12. 12. (1) ✤ Functor ✤ ✤ Morphism Morphism ✤ ( )
  13. 13. (2) ✤ functor { ... }; ✤ (Morphism OK) ✤ ✤ ( $functor2 . $functor1 )
  14. 14. (1): $BI_FUNCTOR ✤ Hom(-, -) ✤ C^op × C Sets ✤ C^op × C ✤ Sets SubroutineMorphism ( Sets )
  15. 15. (1) ✤ NaturalTransformation ✤ ✤ (Morphism)
  16. 16. (2) ✤ nat { }; ✤ ✤ ✤ ( ) ✤
  17. 17. (3) ✤ ✤ $nat2 . $nat1 ✤ $funct . $nat ✤ $nat . $funct
  18. 18. (4): FunctorMorphism ✤ ✤ functor_morph nat { F my $id = shift; ... ... return $sum_morph τ }; ✤ source target source G target
  19. 19. (2): $YONEDA_EMBEDDING ✤ ✤ C^op Sets^C ✤ Hom(g, -)
  20. 20. : CPS (1) ✤ uc CPS
  21. 21. : CPS (2) Sets Hom( , -) Hom( , undef) ∈ print uc $fun_morph $cps_uc $cps_uc->(print) ∈ Hom( , -) Hom( , undef)
  22. 22. Monad (1) ✤ functor eta mu ✤ eta: I → T, mu: TT → T ✤ ✤ Haskell Monad ✤
  23. 23. Monad (2) ✤ 1. $monad->mu . (funct_nat $monad->functor, $monad->eta) $monad->mu . (nat_funct $monad->eta, $monad->functor) T→T ✤ 2. $monad->mu . (funct_nat $monad->functor, $monad->mu) $monad->mu . (nat_funct $monad->mu, $monad->functor) ( TTT → T )
  24. 24. Monad (1): $LIST_MONAD ✤ ✤ [v1_1, v1_2, v1_3], [v2_1, v2_2], [v3_1, v3_2, v3_3, v3_4] ✤ map eta [] mu concat
  25. 25. Monad (2): $STATE_MONAD ✤ ✤ sub { my @states = @_; .. .. return ¥@values, ¥@new_states } 1 ✤ functor, eta, mu Haskell ( )
  26. 26. Monad (3): Maybe ✤ Maybe nothing ✤ ( ) null ✤ List
  27. 27. (5): KleisliMorphism ✤ m f: a -> m b b mma mmb mmc mg μc ma mb mc f g ηa ηb ηc a b c
  28. 28. (5): KleisliMorphism ✤ m f: a -> m b b mma mmb mmc mg μc ma mb mc f g ηa ηb ηc a b c
  29. 29. Kleisli : Maybe (1) ✤ HTML get_number: HTML (<span>3/10</span>) cut_tag: (3/10) parse_number: (3, 10) div: (0.3) ✤ NG
  30. 30. Kleisli : Maybe (2) ✤
  31. 31. Kleisli : Maybe (2) ✤
  32. 32. Kleisli : Maybe (2) ✤ Maybe Kleisli
  33. 33. Kleisli : Maybe (2) ✤ Maybe Kleisli
  34. 34. ✤ ✤ ✤ ✤ ( ) ✤
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×