sequential and parallel abstract machines for optimal
play

Sequential and Parallel Abstract Machines for Optimal Reduction - PowerPoint PPT Presentation

Sequential and Parallel Abstract Machines for Optimal Reduction Marco Pedicini (Roma Tre University) in collaboration with Mario Piazza (Univ. of Chieti) and Giulio Pellitta (Univ. of Bologna) DEIK TCS Seminar 2014 DEIK, Debrecen (HU),


  1. Sequential and Parallel Abstract Machines for Optimal Reduction Marco Pedicini (Roma Tre University) in collaboration with Mario Piazza (Univ. of Chieti) and Giulio Pellitta (Univ. of Bologna) DEIK – TCS Seminar 2014 DEIK, Debrecen (HU), November 11, 2014

  2. Lambda Calculus Alonzo Church in 1930’s introduced lambda-calculus as an alternative (with respect to recursive functions) model of computation .

  3. Lambda Calculus Alonzo Church in 1930’s introduced lambda-calculus as an alternative (with respect to recursive functions) model of computation . • Lambda Terms (3 rules): • Variables : x , y , . . . (discrete, denumerable-infinite set)

  4. Lambda Calculus Alonzo Church in 1930’s introduced lambda-calculus as an alternative (with respect to recursive functions) model of computation . • Lambda Terms (3 rules): • Variables : x , y , . . . (discrete, denumerable-infinite set) • Application : if T and U are lambda-terms then ( T ) U is a lambda-term

  5. Lambda Calculus Alonzo Church in 1930’s introduced lambda-calculus as an alternative (with respect to recursive functions) model of computation . • Lambda Terms (3 rules): • Variables : x , y , . . . (discrete, denumerable-infinite set) • Application : if T and U are lambda-terms then ( T ) U is a lambda-term • Abstraction : if x ia a variable and U is a lambda term then λ x . U is a lambda term

  6. Lambda Calculus Alonzo Church in 1930’s introduced lambda-calculus as an alternative (with respect to recursive functions) model of computation . • Lambda Terms (3 rules): • Variables : x , y , . . . (discrete, denumerable-infinite set) • Application : if T and U are lambda-terms then ( T ) U is a lambda-term • Abstraction : if x ia a variable and U is a lambda term then λ x . U is a lambda term • Term reduction as computing device:

  7. Lambda Calculus Alonzo Church in 1930’s introduced lambda-calculus as an alternative (with respect to recursive functions) model of computation . • Lambda Terms (3 rules): • Variables : x , y , . . . (discrete, denumerable-infinite set) • Application : if T and U are lambda-terms then ( T ) U is a lambda-term • Abstraction : if x ia a variable and U is a lambda term then λ x . U is a lambda term • Term reduction as computing device: ( λ x . U ) V → β U [ V / x ]

  8. Turing Completeness • Lambda Definability of Recursive Functions: by encoding of integers as lambda-terms; • 0 = λ f .λ x . x 1 = λ f .λ x . ( f ) x 2 = λ f .λ x . ( f )( f ) x . . . n = λ f .λ x . ( f ) n x

  9. History • At the beginning of digital computers in the 1950’s one of the first language was lisp by Mc Carthy (MIT)

  10. History • At the beginning of digital computers in the 1950’s one of the first language was lisp by Mc Carthy (MIT) • Then in the 1960’s functional programming languages exploiting formal proofs of correctness were studied: ML , erlang , scheme , clean , caml , …

  11. History • At the beginning of digital computers in the 1950’s one of the first language was lisp by Mc Carthy (MIT) • Then in the 1960’s functional programming languages exploiting formal proofs of correctness were studied: ML , erlang , scheme , clean , caml , … • Nowdays functional languages are enriched with many special constructs which imperative languages cannot support (i.e. clojure , scala , F# ).

  12. GOI and PELCR • Geometry of Interaction is the base of (a familiy of) semantics for programming languages (game semantics). • GOI is (a kind of) operational semantics. • GOI realized an algebraic theory for the sharing of sub-expressions and permitted the development of optimal lambda calculus reduction and a parallel evaluation mechanism based on a local and asynchronous calculus. ⊤ λ @ X Optimal reduction was defined by J. Lamping in 1990.

  13. TERMS as GRAPHS We use to interpret a lambda term M as its syntactic graph [ M ] : ⊤ AX @ CUT λ [( λ x . x ) λ x . x ] = λ AX AX

  14. Reduction Example ⊤ @ λ Syntactic tree of ( λ xx ) λ xx (with binders). λ

  15. Reduction Example ⊤ @ λ We orient edges in accord to the five types of nodes and λ we introduce explicit nodes for variables. We also added sharing ope- rators in order to manage du- plications (even if unneces- sary in this example for the linearity of x in λ xx ).

  16. Reduction Example ⊤ AX @ CUT λ We introduce axiom and cut nodes to reconcile edge λ AX orientations. AX

  17. Reduction Example ⊤ AX @ CUT λ We show one reduction step (the one corresponding to λ AX the beta-rule) the cut-node configuration must be re- AX moved and replaced by di- rect connections among the neighborhood nodes.

  18. Reduction Example ⊤ AX CUT λ A reduction step may intro- CUT duce new cuts (trivial ones in AX this case) but it consists es- sentially of the composition AX of paths in the graph.

  19. Reduction Example ⊤ ⊤ ⊤ ⊤ ⊤ ⊤ AX CUT AX AX AX AX AX CUT CUT CUT λ λ λ λ AX AX AX CUT CUT CUT λ λ CUT CUT AX AX AX AX AX AX AX AX CUT CUT

  20. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid ,

  21. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid

  22. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) ,

  23. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗

  24. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero,

  25. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero, generated by the following constants:

  26. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero, generated by the following constants: p , q , and a family W = ( w i ) i of exponential generators

  27. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero, generated by the following constants: p , q , and a family W = ( w i ) i of exponential generators such that for any u ∈ Λ ∗ : x ∗ y ( annihilation ) = δ xy for x , y = p , q , w i ,

  28. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero, generated by the following constants: p , q , and a family W = ( w i ) i of exponential generators such that for any u ∈ Λ ∗ : x ∗ y ( annihilation ) = δ xy for x , y = p , q , w i , w i ! e i ( u ) , ( swapping ) !( u ) w i =

  29. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero, generated by the following constants: p , q , and a family W = ( w i ) i of exponential generators such that for any u ∈ Λ ∗ : x ∗ y ( annihilation ) = δ xy for x , y = p , q , w i , w i ! e i ( u ) , ( swapping ) !( u ) w i = where δ xy is the Kronecker operator, e i is an integer associated with w i called the lift of w i , i is called the name of w i and we will often write w i , e i to explicitly note the lift of the generator.

  30. LAMBDA STAR The so-called Girard dynamic algebra Λ ∗ is the so-called GOI monoid , i.e., the free monoid with a morphism !( . ) , an involution ( . ) ∗ and a zero, generated by the following constants: p , q , and a family W = ( w i ) i of exponential generators such that for any u ∈ Λ ∗ : x ∗ y ( annihilation ) = δ xy for x , y = p , q , w i , w i ! e i ( u ) , ( swapping ) !( u ) w i = where δ xy is the Kronecker operator, e i is an integer associated with w i called the lift of w i , i is called the name of w i and we will often write w i , e i to explicitly note the lift of the generator. Iterated morphism ! represents the applicative depth of the target node. The lift of an exponential operator corresponds to the difference of applicative depths between the source and target nodes.

  31. STABLE FORMS and EXECUTION FORMULA • Orienting annihilation and swapping equations from left to right, we get a rewriting system which is terminating and confluent. • The non-zero normal forms, known as stable forms , are the terms ab ∗ where a and b are positive (i.e., written without ∗ s). • The fact that all non-zero terms are equal to such an ab ∗ form is referred to as the “ AB ∗ property”. From this, one easily gets that the word problem is decidable and that Λ ∗ is an inverse monoid. Definition (Execution Formula) � EX ( R T ) = W ( φ ij ) φ ij ∈P ( R T ) where φ ij is the formal sum of all possible paths from node i to node j .

Recommend


More recommend