string diagrams
play

String Diagrams Paul-Andr Mellis Oregon Summer School in - PowerPoint PPT Presentation

Programming Languages in String Diagrams [ one ] String Diagrams Paul-Andr Mellis Oregon Summer School in Programming Languages June 2011 String diagrams A diagrammatic account of logic and programming 2 Semantics in the 1980s


  1. Programming Languages in String Diagrams [ one ] String Diagrams Paul-André Melliès Oregon Summer School in Programming Languages June 2011

  2. String diagrams A diagrammatic account of logic and programming 2

  3. Semantics in the 1980’s Cartesian-Closed Categories Intuitionistic λ -calculus Logic 3

  4. Semantics in the 1990’s Monoidal-Closed Categories Linear Logic Proof-Nets 4

  5. Where is the flow of logic? o Ideography (Frege) o Sequent calculus (Gentzen) o Natural deduction (Prawitz) o Proof nets (Girard) Looking for a purely mathematical notation for proofs... 5

  6. Guide : the algebra of Feynman diagrams We want to see the flow inside our proofs and programs !

  7. String Diagrams Categorical Algebra Logic and String Diagrams Language An algebraic investigation of logic and programming 7

  8. String Diagrams Categorical Algebra Logic and String Diagrams Language A bridge between algebra, physics and low level languages 8

  9. Compositionality in logic The reason for introducing categories 9

  10. Sequent calculus of linear logic Axiom A ⊢ A Γ ⊢ A Υ 1 , A , Υ 2 ⊢ B Cut Υ 1 , Γ , Υ 2 ⊢ B Υ 1 , A , B , Υ 2 ⊢ C Left ⊗ Υ 1 , A ⊗ B , Υ 2 ⊢ C Γ ⊢ A ∆ ⊢ B Right ⊗ Γ , ∆ ⊢ A ⊗ B Γ ⊢ A Υ 1 , B , Υ 2 ⊢ C Left ⊸ Υ 1 , Γ , A ⊸ B , Υ 2 ⊢ C A , Γ ⊢ B Right ⊸ Γ ⊢ A ⊸ B 10

  11. Modus Ponens If the property A is true and the property A B ⇒ is true, then the property B is true. 11

  12. Modus ponens in the sequent calculus π 1 π 2 . . . . . . ⊢ A A ⊢ B Cut ⊢ B 12

  13. Modus ponens in the type system π 1 π 2 . . . . . . ⊢ P : A x : A ⊢ M : B ⊢ ( λ x . M ) P : B 13

  14. Modus Ponens If the property A B ⇒ is true and the property B C ⇒ is true, then the property A C ⇒ is true. 14

  15. Modus ponens in the sequent calculus π 1 π 2 . . . . . . A ⊢ B B ⊢ C Cut A ⊢ C 15

  16. Modus ponens in the type system π 1 π 2 . . . . . . x : A ⊢ P : B y : B ⊢ M : C x : A ⊢ ( λ y . M ) P : C 16

  17. � The logical graph Its vertices are the logical formulas and its edges π A B are the logical proofs π . . . A ⊢ B 17

  18. � � � Modus ponens in the logical graph Every pair of edges π 1 π 2 A B C induces an edge π 3 A C which may be denoted as π 3 = π 2 π 1 ◦ 18

  19. � � � Associativity Given a path π 1 π 2 π 3 A B C D one would like that the order of composition does not matter: π 3 ◦ ( π 2 ◦ π 1 ) ( π 3 ◦ π 2 ) ◦ π 1 = 19

  20. Associativity in the sequent calculus π 1 π 2 π 2 π 3 . . . . . . . . . . π 3 π 1 . . . . . . . . A ⊢ B B ⊢ C B ⊢ C C ⊢ D = A ⊢ C C ⊢ D A ⊢ B B ⊢ D A ⊢ D A ⊢ D 20

  21. The identity proof Axiom A ⊢ A 21

  22. � � � Identity Given id A id B π A A B B one would like that id A ◦ π π ◦ id B = π = 22

  23. Identity in the sequent calculus π . . . Axiom A ⊢ A A ⊢ B Cut A ⊢ B is equal to π . . . A ⊢ B is equal to π . . . Axiom A ⊢ B B ⊢ B Cut A ⊢ B 23

  24. � The logical graph (bis) Its vertices are the logical formulas and its edges π A B are the logical proofs π . . . A ⊢ B modulo symbolic execution . 24

  25. Definition of a category A graph equipped with a composition operation f g g ◦ f � B � C � C A A �→ and an identity edge for every vertex of the graph id A � A A satisfying the associativity h ◦ ( g ◦ f ) ( h ◦ g ) ◦ f = and identity equations: id A ◦ f f f ◦ id B = = 25

  26. What about the conjunction? Given two proofs π 1 π 2 . . . . . . A 1 ⊢ A 2 B 1 ⊢ B 2 one is able to construct the proof: π 1 π 2 . . . . . . A 1 ⊢ A 2 B 1 ⊢ B 2 Right ⊗ A 1 , B 1 ⊢ A 2 ⊗ B 2 Left ⊗ A 1 ⊗ B 1 ⊢ A 2 ⊗ B 2 26

  27. � Tensor product So, every pair of edges π 1 π 1 � B 1 � B 2 A 1 A 2 induces an edge π 3 A 1 ⊗ A 2 B 1 ⊗ B 2 which may be denoted as π 3 = π 1 π 2 ⊗ 27

  28. Monoidal Categories A monoidal category is a category C equipped with a functor: ⊗ : C × C −→ C an object: I and three natural transformations: α ( A ⊗ B ) ⊗ C A ⊗ ( B ⊗ C ) −→ ρ λ I ⊗ A A A ⊗ I A −→ −→ satisfying a series of coherence properties. 28

  29. String Diagrams A notation by Roger Penrose 29

  30. String Diagrams A morphism is depicted as: f : A ⊗ B ⊗ C −→ D ⊗ E D E f C A B 30

  31. Composition f g The morphism A −→ C is depicted as −→ B C C g g ◦ f = B f A A A Vertical composition 31

  32. Tensor product f g The morphism ( A −→ D ) is depicted as −→ B ) ⊗ ( C D B ⊗ D B f ⊗ g g = f C A ⊗ C A Horizontal tensor product 32

  33. Example D B f D A f ⊗ id D 33

  34. Example D B f g C A ( f ⊗ id D ) ◦ ( id A ⊗ g ) 34

  35. Example D B g f C A ( id B ⊗ g ) ◦ ( f ⊗ id C ) 35

  36. Meaning preserved by deformation D D B B g f = g f C C A A = ( f ⊗ id D ) ◦ ( id A ⊗ g ) ( id B ⊗ g ) ◦ ( f ⊗ id C ) 36

  37. Application to knot theory A tensor algebra of knots 37

  38. Braided categories A monoidal category equipped with braid maps γ − 1 γ A , B A , B A ⊗ B −→ B ⊗ A B ⊗ A −→ A ⊗ B B A A B B A A B 38

  39. � � � � Coherence diagram for braids γ � ( B ⊗ C ) ⊗ A A ⊗ ( B ⊗ C ) α α ( A ⊗ B ) ⊗ C B ⊗ ( C ⊗ A ) B ⊗ γ γ ⊗ C α � B ⊗ ( A ⊗ C ) ( B ⊗ A ) ⊗ C 39

  40. Topological deformation in string diagrams B C B C A A = A B C A B C 40

  41. � � � � Coherence diagram for braids γ � C ⊗ ( A ⊗ B ) ( A ⊗ B ) ⊗ C α − 1 α − 1 A ⊗ ( B ⊗ C ) ( C ⊗ A ) ⊗ B γ ⊗ B A ⊗ γ α − 1 � ( A ⊗ C ) ⊗ B A ⊗ ( C ⊗ B ) 41

  42. Topological deformation in string diagrams C A B C A B = A B C A B C 42

  43. Duality A duality A ⊣ B is a pair of morphisms η ǫ B ⊗ A −→ I I −→ A ⊗ B A A ∗ ǫ A η A A ∗ A 43

  44. Duality satisfying the two “zig-zag” equalities: A B B A = = A B A B In that case, A is called a left dual of B . 44

  45. Ribbon category A braided category in which every object A has a dual A ∗ satisfying: A A A A ∗ A ∗ = = A ∗∗ A ∗∗ A ∗ A ∗ A A A 45

  46. � � Knot invariants Every ribbon category D induces a knot invariant [ [ − ] ] free-ribbon ( C ) � D C The free ribbon category is a category of framed tangles 46

  47. Jones polynomial invariant � x 4 + y 2 2 x 2 − x 4 + x 2 y 2 x 2 + 1 2 x 2 A compositional semantics of knots 47

  48. Can we apply this to proofs and programs? The topic of the next session... 48

  49. Monoidal categories with feedback A definition by Joyal, Street and Verity (1996) 49

  50. Trace operator A trace in a symmetric monoidal category C is an operator A ⊗ U −→ B ⊗ U Tr U A , B A −→ B depicted as feedback in string diagrams: 50

  51. Trace operator B B U ( ) Tr U U = f f A,B U A A 51

  52. Sliding (naturality in U ) B B u V V = f f U U u A A 52

  53. Tightening (naturality in A , B ) b b = f f a a 53

  54. Vanishing (monoidality in U ) U U ⊗ V I V = = f f f f 54

  55. Superposing f g = f g f g = 55

  56. Yanking = = U U U 56

  57. Fixpoint operator Given a map f : A ⊗ U U −→ we want to compute a map Fix [ f ] : A U −→ such that f ( a , Fix [ f ] ( a ) ) Fix [ f ] ( a ) = Enables to compute recursive definitions 57

  58. Fixpoints computed from traces Suppose given a diagonal map U U ⊗ U −→ Then, U U ∆ Fix : �→ f U f A U A defines a well-behaved fixpoint operator. 58

  59. Traces = parametric fixpoints (1) U ∆ U f A 59

  60. Traces = parametric fixpoints (2) U f f U ∆ ∆ A 60

  61. Traces = parametric fixpoints (3) U ∆ f U U f A ∆ A 61

  62. Traces = parametric fixpoints (4) U f U A ∆ U f ∆ A 62

  63. Traces = parametric fixpoints (5) U f ∆ U A f A ∆ A 63

  64. Traces = parametric fixpoints (6) U f U ∆ ∆ U U = f f ∆ A A 64

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend