Interpreting the Full λ-calculus in the π-calculus

Similar documents
On Böhm Trees and Lévy-Longo Trees in π-calculus

A Note on Scope and Infinite Behaviour in CCS-like Calculi p.1/32

Bisimulation and coinduction in higher-order languages

Trace Refinement of π-calculus Processes

Origin in Mathematical Logic

The Lambda-Calculus Reduction System

Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth.

Continuations, Processes, and Sharing. Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca. September 8, 2014

Call-by-value non-determinism in a linear logic type discipline

arxiv: v1 [cs.lo] 16 Apr 2018

Example. Lemma. Proof Sketch. 1 let A be a formula that expresses that node t is reachable from s

Functional Programming with Coq. Yuxin Deng East China Normal University

Origin in Mathematical Logic

Static Program Analysis

Strong bisimilarity can be opened

Advanced Lambda Calculus. Henk Barendregt & Giulio Manzonetto ICIS Faculty of Science Radboud University Nijmegen, The Netherlands

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready.

The π-calculus Semantics. Equivalence and Value-Passing. Infinite Sums 4/12/2004

Concurrency theory. proof-techniques for syncronous and asynchronous pi-calculus. Francesco Zappa Nardelli. INRIA Rocquencourt, MOSCOVA research team

Formal Techniques for Software Engineering: Denotational Semantics

Realisability methods of proof and semantics with application to expansion

Probabilistic Applicative Bisimulation and Call-by-Value Lam

COMP6463: λ-calculus

3.2 Equivalence, Evaluation and Reduction Strategies

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Communication Errors in the π-calculus are Undecidable

Decidable Subsets of CCS

Understanding Process Semantics

Equations, contractions, and unique solutions

RPO, Second-Order Contexts, and λ-calculus

Lambda-Calculus (I) 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010

Lazy Strong Normalization

Diagrams for Meaning Preservation

Beyond First-Order Logic

A π-calculus with preorders

Theories of Programming Languages Assignment 5

Scuola Estiva di Logica Gargnano, August

Formalising the π-calculus in Isabelle

The Safe λ-calculus. William Blum. Joint work with C.-H. Luke Ong. Lunch-time meeting, 14 May Oxford University Computing Laboratory

Counting terms in the binary lambda calculus

Liveness of Communicating Transactions

Local computation of β-reduction A concrete presentation of Game Semantics

EMBEDDED SYSTEMS WILLIAM C. ROUNDS AND HOSUNG SONG

SHARING IN THE WEAK LAMBDA-CALCULUS REVISITED

Review of The π-calculus: A Theory of Mobile Processes

Domain theory and denotational semantics of functional programming

Models of Concurrency

CS 6110 S16 Lecture 33 Testing Equirecursive Equality 27 April 2016

Model Theory of Modal Logic Lecture 5. Valentin Goranko Technical University of Denmark

Modelling Membranes with Brane Calculi

Lazy Functions as Processes

Reducibility proofs in λ-calculi with intersection types

The State Explosion Problem

λ-terms, M Some random examples of λ-terms: L9 105

Equivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why?

Simply Typed λ-calculus

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures

Comp487/587 - Boolean Formulas

The Join calculus A calculus of mobile agents

Lecture Notes on Data Abstraction

Business Process Management

Cartesian closed 2-categories and rewriting

A probabilistic lambda calculus - Some preliminary investigations

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification

Algorithmic Reasoning about Böhm Trees

Propositional Logic: Part II - Syntax & Proofs 0-0

INTEROPERATION FOR LAZY AND EAGER EVALUATION. A Thesis. Presented to. the Faculty of California Polytechnic State University.

λ-terms, M Some random examples of λ-terms: L9 105

Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

On Coinductive Equivalences for Higher-Order Probabilistic Functional Programs

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

A syntactical proof of the operational equivalence of two λ-terms

1. each λ-variable is a λρ-term, called atom or atomic term, 2. if M and N are λρ-term then (MN) is a λρ-term called application,

Modal and Temporal Logics

Introduction to λ-calculus

Using models to model-check recursive schemes

Automata theory and higher-order model-checking

Constructive approach to relevant and affine term calculi

Programming Languages

Non-binary Tree Reconciliation. Louxin Zhang Department of Mathematics National University of Singapore

A Weak Bisimulation for Weighted Automata

Communicating and Mobile Systems

Extending the Lambda Calculus: An Eager Functional Language

Introduction to lambda calculus Part 2

Topics in Concurrency

Functions as Session-Typed Processes

An introduction to process calculi: Calculus of Communicating Systems (CCS)

A Behavioral Congruence for Concurrent Constraint Programming with Nondeterministic Choice

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

Linear Forwarders. 1 Introduction. Philippa Gardner 1, Cosimo Laneve 2, and Lucian Wischik 2

Sequentiality in Kahn- Macqueen nets and the λ-calculus

Normal Form Simulation for McCarthy s Amb

Concurrent Processes and Reaction

CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

Adding Recursion to Dpi

Axiomatizations for probabilistic finite-state behaviors

Model Theory of XPath on Data Trees. Part II: Binary Bisimulation and Definability

Transcription:

Interpreting the Full λ-calculus in the π-calculus Xiaojuan Cai Joint work with Yuxi Fu BASICS Lab October 12, 2009

Motivation The λ-calculus: sequential model; The π-calculus: concurrent model A deep comparison between them is necessary; to reveal the expressiveness of π-calculus; to study the λ-calculus in a concurrent context; Encoding from the lazy λ-calculus to the π-calculus [Milner, 1992][Sangiorgi, 1994] Comparisons between the full λ-calculus and the π-calculus are still absent.

1 Technical background 2 Encoding the full λ-calculus into the π-calculus Tree structure in the π-calculus 3 How does the encoding work? 4 Conclusion

The λ-calculus Full λ-calculus M := x λx.m MM 1 2 3 (λx.m)n M{N/x} M M MN M N N N MN MN β-rule structure rule eager evaluation 4 M M λx.m λx.m Lazy λ-calculus 1 + 2 partial evaluation

The π-calculus Syntax P := i I ϕ i µ i.p i P P (x)p D( x) µ := a(b) a b τ ϕ := x = y x y ϕ ϕ D 1 ( x) = P 1 D n ( x) = P n.

Some abbreviations a x 1,.., x n.p a(x 1,.., x n ).P def = a(v).vx 1...vx n.p def = a(v).v(x 1 )...v(x n ).P begin case ϕ 1 µ 1.P 1 ϕ n µ n.p n end case. def = i {1,,n} ϕ i µ i.p i

Lazy λ-calculus to π-calculus by Milner x (u) λx.m (u) MN (u) def = xu def = u(x).u(v). M (v) def = (xv)( M (v) vx.vu!x(w). N (w)) Which part must be changed in order to interpret ALL FOUR reduction rules?

Lazy λ-calculus to π-calculus by Milner x (u) λx.m (u) MN (u) def = xu def = u(x).u(v). M (v) def = (xv)( M (v) vx.vu!x(w). N (w)) Which part must be changed in order to interpret ALL FOUR reduction rules?

Lazy λ-calculus to π-calculus by Milner x (u) λx.m (u) MN (u) def = xu def = u(x).u(v). M (v) def = (xv)( M (v) vx.vu!x(w). N (w)) Which part must be changed in order to interpret ALL FOUR reduction rules?

1 Technical background 2 Encoding the full λ-calculus into the π-calculus Tree structure in the π-calculus 3 How does the encoding work? 4 Conclusion

λ-terms as trees x x variable node λx.m λx abstraction node M MN M N application node

An example (λx.(λy.y)(xx))((λz.z)(λw.w)) λx λz λw λy z w y x x

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) β-rule (λx.m)n M{N/x} λx λz λw λy z w y x x

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λy.y)(((λz.z)(λw.w))((λz.z)(λw.w))) λx λz λw λy z w y x x β-rule (λx.m)n M{N/x}

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λy.y)(((λz.z)(λw.w))((λz.z)(λw.w))) λx λy y x x λz λw z w β-rule (λx.m)n M{N/x}

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λy.y)(((λz.z)(λw.w))((λz.z)(λw.w))) β-rule (λx.m)n M{N/x} λy y x x λz λw z w

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λy.y)(((λz.z)(λw.w))((λz.z)(λw.w))) λy y λz λw λz λw λz λw z β-rule (λx.m)n M{N/x} w z w z w

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) Eager evaluation N N MN MN λx λz λw λy z w y x x

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.(λy.y)(xx))(λw.w) λx λz λw λy z w y x x Eager evaluation N N MN MN

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.(λy.y)(xx))(λw.w) λx λz λy z y x x λw w Eager evaluation N N MN MN

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.(λy.y)(xx))(λw.w) λx z Eager evaluation N N MN MN λy y x x λw w

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.(λy.y)(xx))(λw.w) λx λw Eager evaluation N N MN MN λy y x x w λw w

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) Partial evaluation M M λ.m λ.m λx λz λw λy z w y x x

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.xx)((λz.z)(λw.w)) λx λz λw λy z w y x x Partial evaluation M M λ.m λ.m

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.xx)((λz.z)(λw.w)) λx λz λw λy z w y x x Partial evaluation M M λ.m λ.m

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.xx)((λz.z)(λw.w)) λx y λz λw Partial evaluation M M λ.m λ.m x x z w

λ-rules (λx.(λy.y)(xx))((λz.z)(λw.w)) (λx.xx)((λz.z)(λw.w)) λx λz λw x x z w x x Partial evaluation M M λ.m λ.m

Redex node (λx.(λy.y)(xx))((λz.z)(λw.w)) λx λz λw λy z w y x x

λ-term = tree β-reduction = manipulation of trees Let s program in π!

Tree structure in the π-calculus Outline design Tree := Node 1 Node 2 Node n Node := n info + Operations Operations := reduction if the node is a redex node substitution reduction := (change the structure). substitution := x info if the node is a variable node (freeze and backup the disconnected subtree) info := name, parent, leftchild, rightchild,

Tree structure in the π-calculus Node info name parent lchild rchild var fun lchild = rchild =. variable node lchild = rchild. abstraction node lchild rchild. application node lchild = rchild fun =. redex node

Tree structure in the π-calculus Node operations - move n l r n r λx N M N n M Move(n, n ) def = n(p, l, r, v, f ).n (p, l, r, v, f ). (Node(n, p, l, r, v, f ) begin case l = r l(p, l, r, v, f ).Node(l, n, l, r, v, f ) l r l(p, l, r, v, f ).r(p, l, r, v, f ). (Node(l, n, l, r, v, f ) Node(r, n, l, r, v, f )) end case)

Tree structure in the π-calculus Node operations - freeze and backup n l r n r n r λx N M N M N n M Freeze(r, x) def = r(p, l, r, v, f ).(x 0 x 1 ) begin case l r Freeze(l, x 0 ) Freeze(r, x 1 )!x(p, n, f ).(l r )(Node(n, p, l, r, v, f ) l = r Freeze(l, x 0 )!x(p, n, f ). l=r=!x(p, n, f ).Node(n, p,,, v, f ) end case

Tree structure in the π-calculus Node operations - freeze and backup n l r n r n r λx N M N M N n M Freeze(r, x) Tree(r, N) = Replica(x, N) def = (x 0 x 1 x n )!x(p, n, f ).(l r )(Node(n, p, l, r, v, f ) x 0 n, l, x 1 n, r, )!x 0 (p, n, f ).(l r )...!x 1 (p, n, f ).(l r )......

Tree structure in the π-calculus Node operations - substitute n l r n r n r n r λx N M N M N M N n M N N N Substitution(m, p, x, f ) def = x p, m, f Substitution(m, p, x, f ) Replica(x, N) = Tree(m, N) Replica(x, N)

Tree structure in the π-calculus The encoding M λ x f n,p λx.m f n,p MN f n,p def = (n, s, )( M n,λ Sem(s)) def = L(n, p,,, x, f ) def = (m, x)(l(n, p, m, m, x, f ) M m,n) def = (l, r)(l(n, p, l, r,, f ) M l,n N r,n) Sem(s) def = s.s.sem(s)

Tree structure in the π-calculus The encoding the definition of node process

1 Technical background 2 Encoding the full λ-calculus into the π-calculus Tree structure in the π-calculus 3 How does the encoding work? 4 Conclusion

Correctness full abstraction Theorem 1. For all closed λ-terms M, N, M = a N if and only if M λ N λ. Definition A symmetric binary relation R on Λ 0 is an applicative bisimulation if the following properties hold whenever MRN: If M λx.m then N λx.n for some N such that M {L/x}RN {L/x} for every L Λ 0. The applicative bisimilarity = a is the largest applicative bisimulation.

Correctness operational correspondence Theorem 2. There is a subbisimilarity R from the set of closed λ-terms to the set of π-processes. Preservation If M M, then M = M ; Reflection τ If M P, then there exists some M such that M M and P = M ; Termination M iff M ; τ

1 Technical background 2 Encoding the full λ-calculus into the π-calculus Tree structure in the π-calculus 3 How does the encoding work? 4 Conclusion

Conclusion What we have done An encoding from the full λ-calculus to the π-calculus with mismatch and parametric definition is proposed; It is proved to be good. Question Can the encoding be implemented in the π-calculus without guarded choice?

Thank you! Questions?

Some definitions Operational semantics of π-calculus I Prefix Composition a(x).p ay P{y/x} ax.p ax P P µ P P Q µ P Q P ax P Q ax Q P Q τ P Q Restriction ax P P Q P Q τ (x)(p Q ) Q a(x) P ax P (x)p a(x) P P µ P x not in µ (x)p µ (x)p

Some definitions Operational semantics of π-calculus II Replication Case P!P µ P!P µ P µ ϕ i µ i.p i i P i i I ϕ µ iµ i.p i i P i Definition P i {ỹ i / x i } µ P µ D i (ỹ i ) P

Some definitions Definition: subbisimilarity R Λ 0 P is a subbisimilarity if : 1 M Λ 0. P.MRP; 2 If MRP and M M then P = τ P and M RP for some P ; 3 If MRP τ P then MRP or M M RP for some M ; 4 τ τ If MRP 0 and P 0 P 1 P i τ is an infinite sequence of τ-actions, then there must be some k 1 and M, such that M M RP k ; 5 If (λx.m)rp, then P = P λz P for some P, P and some fresh z such that λx.mrp and M{N/x}R(z)(P T (z, N)) for every closed λ-term N. 6 If MRP and P λz P for some fresh z, then M λx.m for some x, M such that M {N/x}R(z)(P T (z, N)) for every closed λ-term N.

Some definitions References 1 R. Milner. Functions as Processes. Mathematical Structures in Computer Science, 2:119C146, 1992. 2 D. Sangiorgi. The Lazy λ-calculus in a Concurrency Scenario. Information and Computation, 111:120C 153, 1994.