A probabilistic lambda calculus - Some preliminary investigations

Similar documents
Ugo Dal Lago 1 and Margherita Zorzi 2

Probabilistic Applicative Bisimulation and Call-by-Value Lam

Bisimulation and coinduction in higher-order languages

A Lambda Calculus Foundation for Universal Probabilistic Programming

Equivalence of Algebraic λ -calculi extended abstract

Dana S. Scott. University Professor, Emeritus Carnegie Mellon University. Visiting Scholar in Mathematics University of California, Berkeley

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

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

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

Origin in Mathematical Logic

Logic and Probability Lecture 3: Beyond Boolean Logic

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

About Typed Algebraic Lambda-calculi

Lazy Strong Normalization

A lambda calculus for quantum computation with classical control

Intersection Types and Lambda Theories

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

A Monad For Randomized Algorithms

CBV and CBN. Eduardo Bonelli. TP para LP 2012C1 1/55

CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT

Relational Graph Models, Taylor Expansion and Extensionality

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

Functional Programming with Coq. Yuxin Deng East China Normal University

Coinductive big-step semantics and Hoare logics for nontermination

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University

Normalization by Evaluation

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

Origin in Mathematical Logic

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

The Lambda-Calculus Reduction System

Introduction to Kleene Algebras

summer school Logic and Computation Goettingen, July 24-30, 2016

3.2 Equivalence, Evaluation and Reduction Strategies

Monotonic Learning, Interactive Realizers and Monads

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

Domain theory and denotational semantics of functional programming

arxiv: v1 [cs.lo] 29 May 2014

Models of computation

A lambda calculus for quantum computation with classical control

An Implicit Characterization of PSPACE

A lambda calculus for quantum computation with classical control

Lambda Calculus, Linear Logic and Symbolic Computation

Safety Analysis versus Type Inference

On the Semantics of Parsing Actions

On Coinduction and Quantum Lambda Calculi

Programming Language Concepts: Lecture 16

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

Graph lambda theories

On Coinductive Equivalences for Higher-Order Probabilistic Functional Programs

Denotational semantics

Preciseness of Subtyping on Intersection and Union Types

Coinductive big-step operational semantics

Lecture 6: Formal Syntax & Propositional Logic. First: Laziness in Haskell. Lazy Lists. Monads Later. CS 181O Spring 2016 Kim Bruce

Formal Techniques for Software Engineering: Denotational Semantics

Handout: Proof of the completeness theorem

COMP6463: λ-calculus

Formal Methods Lecture 6. (B. Pierce's slides for the book Types and Programming Languages )

Call-by-Value Non-determinism in a Linear Logic Type Discipline

Scuola Estiva di Logica Gargnano, August

Lecture 2: Self-interpretation in the Lambda-calculus

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

CSCI 490 problem set 6

A lambda calculus for quantum computation with classical control

Extensional Models of Untyped Lambda-mu Calculus

Classes and conversions

The lambda calculus with constructors

Tutorial on Semantics Part I

Typed Arithmetic Expressions

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

Truth-Functional Logic

Simply Typed λ-calculus

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

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

Consistency of a Programming Logic for a Version of PCF Using Domain Theory

Computation Theory, L 9 116/171

Non-Idempotent Typing Operators, beyond the λ-calculus

Operational Semantics Using the Partiality Monad

Introduction to lambda calculus Part 6

Variations on a theme: call-by-value and factorization

Towards a quantum calculus

Completeness Theorems and λ-calculus

Orthogonality and Algebraic Lambda-Calculus

Environmental Bisimulations for Probabilistic Higher-Order Languages

Advances in the theory of fixed points in many-valued logics

ALGEBRAIC METHODS OF AUTOMATED REASONING IN MONADIC LOGIC by José A. Alonso in Sevilla (Spain)

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3.

Semantics of Higher-Order Functional Programming

Step-Indexed Logical Relations for Probability

Characterizing Polynomial and Exponential Complexity Classes in Elementary Lambda-Calculus

THE STRONG INVARIANCE THESIS

Decomposition of Computation via Linear Logic

Diagrams for Meaning Preservation

The Locally Nameless Representation

A REWRITING VIEW OF SIMPLE TYPING

A brief introduction to Logic. (slides from

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

Introduction to λ-calculus

Algorithmic Reasoning about Böhm Trees

TYPED LAMBDA CALCULI. Andrzej S. Murawski University of λeicester.

Transcription:

A probabilistic lambda calculus - Some preliminary investigations Ugo Dal Lago, Margherita Zorzi Università di Bologna, Università di Verona June, 9-11, 2010, Torino

Introduction: Λ P We present some results about probabilistic type-free λ-calculus Λ P. We will focus on the operational behavior of lambda terms, giving basic results about operational semantics and reduction strategies. The syntax of Λ P is a simply extension of the syntax of lambda calculus with a choice operator : x λx.m M(N) M N where M N rewrites to M or to N with the same probability 1/2.

State of Art Probabilistic functional paradigm has been taken into account in last years. The related investigations are oriented to programming languages. Probability distributions are useful for expressing the meanings of probabilistic languages, which support formal modeling of and reasoning about uncertainty... (Ramsey-Pfeffer). Moreover, in general, the monadic approach is considered. In the literature, there is still a lack of investigation about foundational results.

State of Art: three fundamental papers Our investigation is inspired, in several aspects, by the following works: Call-by-Value, Call-by-Name and the λ-calculus Plotkin, 1974 Nondeterministic Extensions of Untyped λ-calculus De Liguoro & Piperno, 1995 Coinductive big step semantics Leroy & Grall 2008

Syntax of Λ P where x λx.m M(N) M N M N 1/2 1/2 M N A term is a value iff it is a variable or a lambda-abstraction. We have considered and defined both Call-by-Value and Call-by-Name strategies; here we will focus our attention on CbV one.

Leftmost reduction (CbyV) We define a probabilistic version of leftmost reduction, between Λ P and Λ P, where Λ P is the set of the sequences M M 1,..., M n of lambda terms. Some rules: (λx.m)v v M[V /x] V W v V, W M N v L N if M v L where V, W Val and L N is L N 1,..., L N n whenever L is L 1,..., L n Note: we are working in a weak setting.

Distributions Definition (i) A probabilistic distribution is a function D : Val R [0,1] for which there exists a set Q Val with D(V ) = 0 except when V Q and moreover v V D(V ) = 1. (ii) A probabilistic sub-distribution is defined as probabilistic distribution but v V D(V ) 1. where Val is the set of values in Λ P.

Distributions In the following, we will use distributions of observable results in the definition of semantics. Informally, in Λ P a computation of a term M reduces in a distribution of possible observables: in the evaluation we take into account the outputs of all probabilistic choices, i.e. all the possible results of a computation from M Λ P. We will use the linear notation {V p1 1,..., V p k k } to denote the probabilistic distribution and sub-distribution attributing p i to V i (for every i).

Towards operational semantics We would to deal with both finite and infinite computations. We would like to capture, in an elegant way, the operational behavior of all kind of computations. Some terms are, in fact, critical. Example z } R { G Y (λf.λx. if (0 1) then x else f (succ(x))) G(0) = Y (R)(0) = R(YR)(0) ( if (0 1) then 0 else (YR)(succ(0)))... 1 then G(0) evaluates to the distribution {0 1/2, 1 1/4, 2 1/8 2,...} = {n (n+1) } n N Co-induction is an useful instrument in order to characterize divergence and infinite computations.

Small-step semantics... We define an inductive binary relation between Λ P and sub-distributions. M V {V 1 } M v N M n i=1 N i D i 1 n D i S (M) is the sub-distribution sup M D D.

... and small steps semantics for divergence We define also a coinductive binary relation p R [0,1] capturing divergence. between Λ P and ===== V 0 M v N N i p i ============== M P n i=1 1 n p i The relation p is related to our definition of observational equivalence M N: C[M] p iff C[N] p.

Big-step semantics rules There is a coinductively defined binary relation between Λ P and sub-distributions: ======= V {V } M {λx i.m p i i } i N {V q j j } j (M i [V j /x i ] {W r ijk ijk }) i,j ========================================= MN {W p i q j r ijk ijk } i,j,k M {V p i i } N {W q j } ========================== M N {V 1 2 p P i j q j, W 1 2 q P j i p i B(M) is the sub-distribution inf M D D. i j } i,j

Relating different semantics: Convergence and Divergence in Small-step The following theorem relates Small-step semantics and divergence relation... Theorem For each M Λ P, M p iff S (M) = D = {v p1 1,..., v p k k...} with i p i = q and p + q = 1.

Relating different semantics: Small-step vs Big-step... and the following one states the relationship between Small-step and Big-step semantics: Theorem For each M Λ P, B(M) = S (M).

Simulation CbyV-CbyN Let us consider the following example (Selinger, 2004): Example M (λx.x plus x).((λxy.x) (λxy.y)), where plus is a xor-like function. Choosing a call-by name strategy, the computation gives the distribution {(λxy.x) 1/2, (λxy.y) 1/2 } as result, whereas call-by name strategy gives (λxy.y) with probability 1. CbyV and CbyN are not equivalent strategies, not even on ground values. In general, the order in which probabilistic choices and duplications are performed is relevant.

Simulation CbyV-CbyN We are able to extend Plotkin s simulation between Call-by-Value and Call-by-Name in the case of finite computations, following the same CPS approach. We define recursively the term simulation maps [ ], which sends terms in the Call-by-Value language L v, into terms in the call Call-by-Name language L n. For example, for the choice, the map is defined as [M N] = (λɛ.[m](λα.[n](λβ.(α β))ɛ)

Simulation CbyV-CbyN The following theorem holds: Theorem (Simulation) For each closed term M, Ψ(B v (M)) = B n ([M](λx.x)) where Ψ is a function which maps distributions of values in L v into distributions of values in L n. We proved also the reverse simulations CbyN CbyV.

Future directions Simulation for infinite computations Probabilistic Böhm Trees Separability for Λ P Relationship between algebraic distance and separability (?)

Grazie! Merci! Thanks! Vic toor e smursma