master parisien de recherche en informatique mod le des
play

Master Parisien de Recherche en Informatique Modle des langages de - PowerPoint PPT Presentation

Master Parisien de Recherche en Informatique Modle des langages de programmation Domaines, Catgories, Jeux (Cours 2.2) Paul-Andr Mellis www.irif.fr/ mellies/mpri.html 1 Modles des langages de programmation Domaines, catgories,


  1. Master Parisien de Recherche en Informatique Modèle des langages de programmation Domaines, Catégories, Jeux (Cours 2.2) Paul-André Melliès www.irif.fr/ ∼ mellies/mpri.html 1

  2. Modèles des langages de programmation Domaines, catégories, jeux Introduction au cours 2

  3. Calendar 2019 September 12 Paul-André Melliès Categories September 19 Paul-André Melliès & Linear logic September 26 Paul-André Melliès October 3 Paul-André Melliès October 10 Paul-André Melliès October 17 No lecture October 24 Paul-André Melliès October 31 Paul-André Melliès November 7 Thomas Ehrhard Realizability November 14 Thomas Ehrhard & Pure λ -calculus November 21 Thomas Ehrhard November 28 Examination period December 5 Examination period December 12 Thomas Ehrhard December 19 Thomas Ehrhard 3

  4. Calendar 2020 January 9 Thomas Ehrhard January 16 Pierre-Louis Curien Game semantics January 23 Pierre-Louis Curien & Abstract machines January 30 Pierre-Louis Curien February 6 Pierre-Louis Curien February 13 Pierre-Louis Curien February 20 Pierre-Louis Curien February 27 No lecture March 5 Examination period March 12 Examination period 4

  5. Semantics A mathematical investigation of programming languages and of their compilation schemes. Functional or imperative languages based on a kernel of λ -calculus: PCF Algol ML OCAML JAVA λ -calculus states exceptions modules concurrence higher order references objets synchronisation typing threads recursion 5

  6. � Semantics Aim — a mathematical theory of programming languages from design to compilation in machine code. . High level program compilation Low level code Required to certify the preservation of meaning during compilation 5

  7. � � � Syntax or semantics ? One should grasp a programming language from its two sides: the syntactic manipulations ⊲ the meaning of these syntactic manipulations ⊲ In the same way, in algebraic topology, one constructs spaces as higher-dimensional triangulations (syntax) ⊲ then computes their homology groups (semantics) ⊲ b � · · a torus a a � · · b ... this leading to a geometry of language and reasoning ! 6

  8. Connections with contemporary algebra A trace in a « monoidal » category C is an operator A ⊗ U −→ B ⊗ U Tr U A , B A −→ B depicted as a « feedback » in string diagrams: 7

  9. Trace operators B B U ( ) Tr U U = f f A,B U A A 8

  10. Sliding B B u V V = f f U U u A A 9

  11. Tightening b b = f f a a 10

  12. Vanishing U U ⊗ V I V = = f f f f 11

  13. Superposition f g = f g f g = 12

  14. Yanking = = U U U 13

  15. Feedback = recursion In a « cartesian » category: U U ∆ Fix : �→ f U f A U A 14

  16. Recursion derived from feedback U ∆ U f A Fix ( f )( a ) 15

  17. Recursion derived from feedback U f f U ∆ ∆ A 16

  18. Recursion derived from feedback U ∆ f U U f A ∆ A 17

  19. Recursion derived from feedback U f U A ∆ U f ∆ A 18

  20. Recursion derived from feedback U f ∆ U A f A ∆ A Fix ( f )( a ) f ( a , Fix ( f )( a )) = 19

  21. A bridge between programming & knot theory 20

  22. Syntax 21

  23. Church 1935 — syntactic invention of the λ -calculus The λ -calculus is a formal calculus of functions. The expressions of the λ -calculus are called λ -terms. In the λ -calculus, every λ -term P is at the same time: a function which takes every λ -term as argument, ⊲ an argument of any other λ -term, including itself. ⊲ For a very long time, people believed that the λ -calculus was a purely formal system without mathematical meaning — until Dana Scott’s discovery of a denotational semantics in 1969. 22

  24. Semantics 23

  25. � � Domain semantics Key idea: The semantics of a program : P : A B −→ is a function : [ P ] : [ A ] [ B ] −→ from the domain of inputs A to the domain of outputs B . Definition: a domain is an ordered set with filtered limits. This defines a category where the interpretation is compositional : [ P ] [ Q ] [ P ; Q ] � [ C ] [ A ] [ B ] [ A ] [ C ] = 24

  26. Game semantics Key idea: A program P : A −→ B is interpreted as an interactive strategy : [ P ] : [ A ] [ B ] ⊸ which plays on the input game A and the output game B . New fact: the meaning of a program is an automaton ! Game semantics = idealized and compositional compilation 25

  27. Game semantics The evaluation of a program P against its environment E Program Environment ←→ may be understood as the interactive exploration/ of the program P by its environment E , and conversely, of E by P . Evaluation is an interactive form of pattern matching . 26

  28. Categories 27

  29. Categories A category C is given by a class of objects [0] a set Hom ( A , B ) of morphisms [1] f : A −→ B for every pair of objects ( A , B ) a composition law [2] : Hom ( B , C ) × Hom ( A , B ) Hom ( A , C ) ◦ −→ an identity morphism [2] id A : A A −→ for every object A , 28

  30. Categories satisfying the following properties: the composition law ◦ is associative: [3] ∀ f ∈ Hom ( A , B ) ∀ g ∈ Hom ( B , C ) f ◦ ( g ◦ h ) = ( f ◦ g ) ◦ h ∀ h ∈ Hom ( C , D ) the morphisms id are neutral elements [3] ∀ f ∈ Hom ( A , B ) f ◦ id A = f = id B ◦ f 29

  31. Examples 1. the category Ens of sets and functions 2. the category Pord of partial orders and monotone functions 3. the category Dom of domains and continuous functions 4. the category Coh of coherence spaces and linear maps 5. every partial order 6. every monoid 30

  32. Linear logic 31

  33. Intuitionistic logic in 1985 A converging constellation of ideas: Cartesian closed categories (algebra) λ -calculus and Scott natural deduction models (geometry) (static) Cut elimination Sequent Concrete calculus data structures (syntax) (dynamic) Krivine machine and CAM (compilation) 32

  34. La secrète noirceur du lait: linear decomposition of the λ -calculus Church numerals 0 = ( λ f .λ x . x ) 1 = ( λ f .λ x . fx ) 2 = ( λ f .λ x . f ( f ( x ))) In the case of the numeral 1 , a series of atomic computations which simply reorganize the term: 1 PQ ( λ x . Px ) Q PQ −→ −→ In the case of 0 and 2 , a series of molecular computations ∗ ∗ 0 PQ −→ ( λ x . x ) Q −→ Q 2 PQ −→ ( λ x . P ( Px )) Q −→ P ( PQ ) ∗ −→ erases or duplicates the argument. where ∗ However, the rewrite −→ is only one step of β -reduction. 33

  35. Linear decomposition of the λ -calculus Main idea – decompose the duplication and erasing mechanisms of the λ -calculus. What for? Extract the syntactic atoms of the existing molecules , and build something like a Mendeleiev table . Ambitious, but it works wonderfully well ! The decomposition of LJ and LK in LL: A ⇒ B ! A ⊸ B = 34

  36. Linear logic Linear logic offers a global reunderstanding of LJ and LK. Monoidal categories (algebra) Proof Denotational nets semantics (geometry) (static) Cut elimination Sequent Game calculus semantics (syntax) (dynamic) Abstract machines (compilation) 35

  37. Benefits of linear logic 1. simplified the models of the λ -calculus, both static domains seen as coherence spaces ◦ −→ dynamic CDSs seen as dialogue games ◦ −→ 2. shed light on optimal implementations of the λ -calculus (Lévy) and opened the study of polynomial time typing, 3. revealed the broken symmetry in intuitionistic logic between Player (Program) and Opponent (Environment). 36

  38. Semantics today semantics of low level languages ⊲ a mathematical theory of concurrency ⊲ resource allocation , side effects and complexity ⊲ a new generation of languages and proof assistants ⊲ realizability models of Zermelo-Frankel set theory ⊲ homotopy type theory ⊲ emerging connections to knot theory and physics ⊲ 37

Recommend


More recommend