Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.

Slides:



Advertisements
Similar presentations
Substitution & Evaluation Order cos 441 David Walker.
Advertisements

Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
The lambda calculus David Walker CS 441. the lambda calculus Originally, the lambda calculus was developed as a logic by Alonzo Church in 1932 –Church.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Elements of Lambda Calculus Functional Programming Academic Year Alessandro Cimatti
Recap 1.Programmer enters expression 2.ML checks if expression is “well-typed” Using a precise set of rules, ML tries to find a unique type for the expression.
Catriel Beeri Pls/Winter 2004/5 functional-language 1 Substitution Semantics of FL – a simple functional language FL is EL + (non-recursive) function creation.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
Advanced Formal Methods Lecture 2: Lambda calculus Mads Dam KTH/CSC Course 2D1453, Some material from B. Pierce: TAPL + some from G. Klein, NICTA.
Lecture 02 – Structural Operational Semantics (SOS) Eran Yahav 1.
Foundations of Programming Languages: Introduction to Lambda Calculus
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
6. Introduction to the Lambda Calculus. © O. Nierstrasz PS — Introduction to the Lambda Calculus 6.2 Roadmap  What is Computability? — Church’s Thesis.
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
The lambda calculus David Walker CS 441. the lambda calculus Originally, the lambda calculus was developed as a logic by Alonzo Church in 1932 –Church.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
PSUCS322 HM 1 Languages and Compiler Design II Formal Semantics Material provided by Prof. Jingke Li Stolen with pride and modified by Herb Mayer PSU Spring.
Comp 205: Comparative Programming Languages Semantics of Functional Languages Term- and Graph-Rewriting The λ-calculus Lecture notes, exercises, etc.,
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Describing Syntax and Semantics
C. Varela1 Lambda Calculus alpha-renaming, beta reduction, applicative and normal evaluation orders, Church-Rosser theorem, combinators Carlos Varela Rennselaer.
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
Functional Languages. Why? Referential Transparency Functions as first class objects Higher level of abstraction Potential for parallel execution.
CMSC 330: Organization of Programming Languages Lambda Calculus Introduction λ.
10/12/20151 GC16/3C11 Functional Programming Lecture 3 The Lambda Calculus A (slightly) deeper look.
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
Lambda Calculus History and Syntax. History The lambda calculus is a formal system designed to investigate function definition, function application and.
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
Lambda Calculus1 The Untyped Lambda-Calculus Hossein Hojjat University of Tehran Formal Methods Laboratory.
1 ML fun x -> e e 1 e 2 0, 1, 2,..., +, -,... true, false, if e then e else e patterns datatypes exceptions structures functors let f x = e variables These.
Hop Operational Semantics
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
Formal Semantics of Programming Languages 虞慧群 Topic 1: Introduction.
CSE 230 The -Calculus. Background Developed in 1930’s by Alonzo Church Studied in logic and computer science Test bed for procedural and functional PLs.
Types and Programming Languages Lecture 6 Simon Gay Department of Computing Science University of Glasgow 2006/07.
1 Formal Semantics. 2 Why formalize? ML is tricky, particularly in corner cases generalizable type variables? polymorphic references? exceptions? Some.
Lambda Calculus Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 11.
CSE-321 Programming Languages -Calculus (II) POSTECH March 27, 2006 박성우.
-Calculus Kangwon National University 임현승 Programming Languages These slides are based on the slides by Prof. Sungwoo Park at POSTECH.
Lambda Calculus CSE 340 – Principles of Programming Languages Fall 2015 Adam Doupé Arizona State University
CMSC 330: Organization of Programming Languages Operational Semantics a.k.a. “WTF is Project 4, Part 3?”
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
Lesson 3 Formalizing and Implementing Pure Lambda Calculus 1/15/02 Chapters 5.3, 6, 7.
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
CMSC 330: Organization of Programming Languages Operational Semantics.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
CSE-321 Programming Languages -Calculus (II) POSTECH March 26, 2007 박성우.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
6/21/20161 Programming Languages and Compilers (CS 421) Reza Zamani Based in part on slides by Mattox Beckman,
Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L03-1 September 14, 2006http:// -calculus: A Basis for.
Chapter 2: Lambda Calculus
Functional Programming
CS 550 Programming Languages Jeremy Johnson
Unit – 3 :LAMBDA CALCULUS AND FUNCTIONAL PROGRAMMING
Lambda Calculus CSE 340 – Principles of Programming Languages
CS 611: Lecture 9 More Lambda Calculus: Recursion, Scope, and Substitution September 17, 1999 Cornell University Computer Science Department Andrew Myers.
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
Programming Languages and Compilers (CS 421)
Announcements Quiz 6 HW7 due Tuesday, October 30
CS 611: Lecture 10 More Lambda Calculus September 20, 1999
L Calculus.
CSE S. Tanimoto Lambda Calculus
Program correctness Axiomatic semantics
CS 611: Lecture 10 More Lambda Calculus September 20, 1999
Carlos Varela Rennselaer Polytechnic Institute September 6, 2019
Presentation transcript:

Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan

Chair of Software Engineering 2 Lecture 6: Tutorial on Formal Logics for Computation and Concurrency.

Chair of Software Engineering 3 Formal Logics  Have a syntax defining (legal) terms.  Allow reasoning by providing:  Axioms defining equality on terms, and/or  A semantics defining the meaning of terms accompanied by a semantic equivalence.  Soundness/Completeness properties may relate the two approaches.

Chair of Software Engineering 4 Example: Integer Calculus  Syntax in (Enhanced) Backus-Naur Form.  Digit ::= 0 | 1 | … |9  Integer ::= |  Term ::=  Equality is symmetric, transitive, reflexive.  Operators can be associative, commutative, distributive.  Allows axiomatic reasoning, by tautology.  How to define “reasonable” equality? + | - | *

Chair of Software Engineering 5 Formalisms are Useful for…  Understanding (precise definitions).  Documentation.  Static analysis:  protocol verification,  code optimization (e.g. partial evaluation),  code validation.  Code generation.  Test case generation.  Execution monitoring.

Chair of Software Engineering 6 Functions and Functional Programming  Mathematical function:  taking (positional) parameters,  potentially calling other functions,  returning a result.  The result depends only on.  Calls with same parameters yield same result.  A function defines an input-output relation.  Functional programming:  Functions are 1 st -class entities,  Extensional equivalence with termination.  Programs are more concrete than functions!

Chair of Software Engineering 7 Lambda-Calculus [Church 1934]  Calculus of (sequential) functional programs.  Two constructions (operators):  lambda-abstraction,  function application.  Infinite but enumerable set of variables.  Lambda acts as a binding operator.  The scope of a lambda abstraction extends as far to the right as possible.

Chair of Software Engineering 8 Syntactical Aspects (1)  Occurrences of a variable under a lambda are bound.  Other occurrences are free.

Chair of Software Engineering 9 Syntactical Aspects (2)  The substitution of by in is noted :  Alpha-conversion (renaming) is defined as:  We shall assume from now that all terms are considered modulo alpha-conversion.

Chair of Software Engineering 10 Operational Semantics  Given as a set of rewriting rules.  Only 1 rule, Beta-reduction:  Defines a transition relation.  Repeatedly convert and reduce a term to have its semantics given by transitive closure.  A reducible part of a term is called a redex.  Functional application associates to the left.  Values are non-reducible terms (terminated computations).

Chair of Software Engineering 11 Encoding Booleans (1)

Chair of Software Engineering 12 Encoding Booleans (2)

Chair of Software Engineering 13 Encoding Pairs (or lists, records…)  A encloses two items and.  There exists two projection functions and.  and.  where ?

Chair of Software Engineering 14 Encoding Naturals (1) A natural just applies times a given function to an argument

Chair of Software Engineering 15 Encoding Naturals (2)

Chair of Software Engineering 16 What Can You Do?  Reason exactly about naturals.  Encode objects! (almost with what we have seen)  Write any sequential program (Church-Turing)  Haskell, ML, Lisp, Scheme, etc.  Prove properties?

Chair of Software Engineering 17 Imperative Programming  Problem: encoding a state.  Similar to semantic function for lambda terms.  Operational semantics:  give a function from states to states.  Repeat it as long as possible.  Computation finished when:  semantic function not applicable, or  Function yields always the same state (fixpoint).  The result is contained in variable Result.  In practice: becomes where associates variables to values.

Chair of Software Engineering 18 Example of State Encoding function fact (int n) is int result := 1; while n > 1 do result := result * n; n := n – 1; od; return result; end; function fact (int n) is return fact_rec (n, 1) function fact_rec (int n, int result) is if (n > 1) then return fact_rec (n - 1, n * result); else return result; end

Chair of Software Engineering 19 Modeling Concurrency  The choice operator can be used for expansion: x := 1 y := 1 Cobegin x := y + 1 || y := x + 1 Coend

Chair of Software Engineering 20 Non-Determinism in Lambda

Chair of Software Engineering 21 Encoding Non-Determinism?  It does not work!  Because of one property named either diamond, Church-Rosser, or confluence.  In short: the order of reductions does not matter.

Chair of Software Engineering 22 Example  Although a lambda-term can have more than one redex:  One can hardly say this models concurrency!

Chair of Software Engineering 23 Calculi for Concurrency  Have (internal) non-deterministic operators:  CCS,  CSP,  Pi-Calculus,  Ambients…  Next Time!