1 Type-Directed Concurrency Deepak Garg, Frank Pfenning {dg+, Carnegie Mellon University.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

1 Programming Languages (CS 550) Mini Language Interpreter Jeremy R. Johnson.
Programming in Occam-pi: A Tutorial By: Zain-ul-Abdin
Inference of progress properties for (multi party) sessions Mario Coppo (Universita’ di Torino) joint work with Mariangiola Dezani, Nobuko Yoshida Lisbon,
Architecture Representation
1 Dependent Types for Termination Verification Hongwei Xi University of Cincinnati.
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
A Logic of Secure Systems and its Application to Trusted Computing Anupam Datta, Jason Franklin, Deepak Garg, and Dilsun Kaynar Carnegie Mellon University.
Knowledge Representation Methods
Fall Semantics Juan Carlos Guzmán CS 3123 Programming Languages Concepts Southern Polytechnic State University.
Type Checking Compiler Design Lecture (02/25/98) Computer Science Rensselaer Polytechnic.
CLF: A Concurrent Logical Framework David Walker Princeton (with I. Cervesato, F. Pfenning, K. Watkins)
An Associative Broadcast Based Coordination Model for Distributed Processes James C. Browne Kevin Kane Hongxia Tian Department of Computer Sciences The.
What’s left in the course. The course in a nutshell Logics Techniques Applications.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
A Concurrent Logical Framework (Joint work with Frank Pfenning, David Walker, and Kevin Watkins) Iliano Cervesato ITT Industries,
Language Specfication and Implementation - PART II: Semantics of Procedural Programming Languages Lee McCluskey Department of Computing and Mathematical.
Overview of Programming Paradigms
1 Ivan Lanese Computer Science Department University of Bologna Roberto Bruni Computer Science Department University of Pisa A mobile calculus with parametric.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
Focusing in Proof-search and Concurrent Synchronization Deepak Garg Carnegie Mellon University (Based on joint work with Frank Pfenning)
Concurrency CS 510: Programming Languages David Walker.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Administrative stuff On Thursday, we will start class at 11:10, and finish at 11:55 This means that each project will get a 10 minute presentation + 5.
A Type System for Expressive Security Policies David Walker Cornell University.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
Modeling a Service and Session Calculus with Hierarchical Graph Transformation Roberto Bruni, Andrea Corradini, Ugo Montanari (based on joint work with.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
The Structure of the “THE” -Multiprogramming System Edsger W. Dijkstra Jimmy Pierce.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Knowledge Mediation in the WWW based on Labelled DAGs with Attached Constraints Jutta Eusterbrock WebTechnology GmbH.
Syntax & Semantic Introduction Organization of Language Description Abstract Syntax Formal Syntax The Way of Writing Grammars Formal Semantic.
Dynamic Choreographies Safe Runtime Updates of Distributed Applications Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Joint.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
WSMX Execution Semantics Executable Software Specification Eyal Oren DERI
Linear Type Systems for Concurrent Languages Eijiro Sumii Naoki Kobayashi University of Tokyo.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
An Ontological Framework for Web Service Processes By Claus Pahl and Ronan Barrett.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Logic in Computer Science - Overview Sep 1, 2009 박성우.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
ASPfun: A Distributed Object Calculus and its Formalization in Isabelle Work realized in collaboration with Florian Kammüller and Henry Sudhof (Technische.
Non-interference in Constructive Authorization Logic Deepak Garg and Frank Pfenning Carnegie Mellon University.
Types and Programming Languages Lecture 12 Simon Gay Department of Computing Science University of Glasgow 2006/07.
May University of Glasgow Generalising Feature Interactions in Muffy Calder, Alice Miller Dept. of Computing Science University of Glasgow.
Predicate Abstraction. Abstract state space exploration Method: (1) start in the abstract initial state (2) use to compute reachable states (invariants)
Λ-Calculus & Intuitionistic Logic Project Aims Cartesian Closed Categories Correspondence between CCC & λ unit, →, × 1© CHUANGJIE XU 2010.
Just Enough Type Theory or, Featherweight Java A Simple Formal Model of Objects Jonathan Aldrich
A Generalized Deadlock-Free Process Calculus Eijiro Sumii Naoki Kobayashi University of Tokyo.
What’s Ahead for Embedded Software? (Wed) Gilsoo Kim
A Mechanized Model of the Theory of Objects 1.Functional  -calculus in Isabelle 2.Confluence Proof in Isabelle 3.Ongoing Work, Applications, Conclusion.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
CSE-321 Programming Languages -Calculus (II) POSTECH March 26, 2007 박성우.
Agenda  Quick Review  Finish Introduction  Java Threads.
Types and Programming Languages Lecture 16 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
1 Maximality Properties Dr. Mikhail Nesterenko Presented By Ibrahim Motiwala.
Model Checking Early Requirements Specifications in Tropos Presented by Chin-Yi Tsai.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
1 Interactive Computer Theorem Proving CS294-9 October 19, 2006 Adam Chlipala UC Berkeley Lecture 9: Beyond Primitive Recursion.
Language-Based Security: Overview of Types Deepak Garg Foundations of Security and Privacy October 27, 2009.
Parallel Programming By J. H. Wang May 2, 2017.
Deadlock Freedom by Construction
Program Synthesis is a Game
Automating Induction for Solving Horn Clauses
A Refinement Calculus for Promela
Presentation transcript:

1 Type-Directed Concurrency Deepak Garg, Frank Pfenning {dg+, Carnegie Mellon University

Type-Directed Concurrency. CONCUR Design Goals Build a language starting from a logic Functional and concurrent features should arise from logical principles Write precise specifications for functions in the types –Functional reduction should be type-safe Concurrent computation should not interfere with functional type-safety

Type-Directed Concurrency. CONCUR Outline Design goals Computation-as-proof reduction, Computation-as-proof search, Computation-as-proof search and reduction Introduction to CLL fCLL: Functional core lCLL: Concurrent core Related Work and Conclusion

Type-Directed Concurrency. CONCUR Computation-as-proof reduction Curry-Howard isomorphism Strong guarantees about values computed by a program (type-safety) Captures behavior of full programs, not their interacting components Works very well for functional programs Unsuited for concurrent languages, and reactive systems in general

Type-Directed Concurrency. CONCUR Computation-as-proof search Logic programming languages (Prolog, …) Programs are sets of logic formulae (Rules, facts and a goal) Computation is proof-search (Proving the goal from the rules and facts) Captures dynamics of concurrent programs (FCP, Concurrent Prolog, …) Hard to capture functional features

Type-Directed Concurrency. CONCUR Computation-as-proof search and reduction Add proof-terms to a logic programming language Interpret proof-terms as programs Synthesize proofs-terms on the fly Alternate proof search with reduction of synthesized proof-terms Captures both concurrent and functional features!

Type-Directed Concurrency. CONCUR W: B?: B Example (N: A!B), (M: A) (V: A!B), (U: A) (V U): B Functional reduction, parallelism Synchronization Functional reduction Proof reduction Proof search Proof reduction FACTS GOAL

Type-Directed Concurrency. CONCUR Where we are … Design goals Computation-as-proof reduction, Computation-as-proof search, Computation-as-proof search and reduction Introduction to CLL fCLL: Functional core of CLL lCLL: Concurrent core of CLL Related Work and Conclusion

Type-Directed Concurrency. CONCUR Introduction to CLL Typed programming language Logical design –Functional features from proof reduction –Concurrent features from proof synthesis Type system based on a variant of intuitionistic linear logic

Type-Directed Concurrency. CONCUR What CLL is and isn’t Foundational/conceptual language –Prototype implementation –Not a full-fledged language yet Functional part: –Type-safety Concurrent part: –Preserves well-typedness of terms –No progress guarantee: Computations may deadlock

Type-Directed Concurrency. CONCUR CLL: Layered design Three layer design fCLL: Functional language lCLL: Concurrent + Functional language –Concurrent computation can call functional computation full-CLL: Concurrent + Functional language –Functional computation can call upon concurrent computation –Omitted from this talk

Type-Directed Concurrency. CONCUR Underlying Logic Intuitionistic –captures functional specifications Linear –captures concurrency in lCLL Equipped with a monad –captures effects (deadlocks) in full-CLL –used in communication First-order (dependent types) –precise functional specifications –model communication channels, process ids, etc. in lCLL

Type-Directed Concurrency. CONCUR Where we are … Design Goals Computation-as-proof reduction, Computation-as-proof search, Computation-as-proof search and reduction Introduction to CLL fCLL: Functional core of CLL lCLL: Concurrent core of CLL Related Work and Conclusion

Type-Directed Concurrency. CONCUR fCLL: Type Syntax

Type-Directed Concurrency. CONCUR fCLL: Program Syntax Programs (P) divided into syntactic classes

Type-Directed Concurrency. CONCUR fCLL: Semantics Call-by-value reduction semantics Typing judgments: Non-linear variables: Linear variables:

Type-Directed Concurrency. CONCUR fCLL: Type-Safety Type-preservation: If P : T and P reduces to P’, then P’ : T. Progress: If P : T, then P is a value or P reduces.

Type-Directed Concurrency. CONCUR Where we are … Design Goals Computation-as-proof reduction, Computation-as-proof search, Computation-as-proof search and reduction Introduction to CLL fCLL: Functional core of CLL lCLL: Concurrent core of CLL Related Work and Conclusion

Type-Directed Concurrency. CONCUR lCLL: Concurrent Core of CLL Computation-as-proof search and reduction Functional part: –Includes all of fCLL directly Concurrent part: –Arises from proof-synthesis –Resembles asynchronous  calculus in communication primitives CHAM presentation

Type-Directed Concurrency. CONCUR lCLL: Syntax fCLL values with types fCLL programs with types ReplicableLinear

Type-Directed Concurrency. CONCUR Type Constructs in lCLL Each construct has an intuitive meaning

Type-Directed Concurrency. CONCUR Interaction Example Server: Listens on channel k Computes factorials Client: Listens on channel k’ k Compute factorial(6) = 720 k’ Return 720 and terminate Objective: compute factorial(6)

Type-Directed Concurrency. CONCUR Modeling messages in lCLL Channels k, k’,… modeled as index terms mess int : type constructor of arity 1 ( mess int k) is the type of integer messages on channel k

Type-Directed Concurrency. CONCUR Server Process 1. Wait for message “ y ” on channel k 2. Extract content of y and compute its factorial 3. Send computed result on channel k’

Type-Directed Concurrency. CONCUR Client Process Send message 6 on channel k Wait for message “ x ” on channel k’, and return content of x Parallel composition

Type-Directed Concurrency. CONCUR lCLL: Semantics Type-directed rewrite semantics Three alternating rewrite phases: 1.fCLL’s functional reduction (proof-term reduction) 2.Structural decomposition 3.Synchronization (proof-term synthesis)

Type-Directed Concurrency. CONCUR Functional reduction Applies to all non-values in a configuration If P : T, then P’ : T by fCLL’s type-preservation theorem!

Type-Directed Concurrency. CONCUR Structural decomposition Resemble  -calculus structural decomposition

Type-Directed Concurrency. CONCUR Synchronization Takes several values in a configuration and links them to form a larger program Site of all communication Directed by types Three golden rules: –Applies to asynchronous types only –Applies to values only –Result must have type {S}

Type-Directed Concurrency. CONCUR Synchronization examples

Type-Directed Concurrency. CONCUR Incorrect Synchronizations Not of type {S} Not a value

Type-Directed Concurrency. CONCUR Why have a monad {…} Atomicity - {…} determines how far each synchronization will go

Type-Directed Concurrency. CONCUR Interaction Example Server: Listens on channel k Computes factorials Client: Listens on channel k’ k Compute factorial(6) = 720 k’ Return 720 and terminate Objective: compute factorial(6)

Type-Directed Concurrency. CONCUR Example: Execution in lCLL

Type-Directed Concurrency. CONCUR Example: Execution in lCLL

Type-Directed Concurrency. CONCUR Are the rewrite rules ad-hoc? No! Rewrite rules obtained from a proof search procedure by adding proof-terms See paper for details

Type-Directed Concurrency. CONCUR What does lCLL give us? A “well-typedness” preservation result: If every program in a lCLL configuration is well-typed with the type indicated, then after any number of rewrite steps, the same property still holds. Concurrent computation does not interfere with functional type-safety!

Type-Directed Concurrency. CONCUR What lCLL lacks … Concurrent computations in lCLL may deadlock Reason: Linear logic is not expressive enough

Type-Directed Concurrency. CONCUR Where we are … Design Goals Computation-as-proof reduction, Computation-as-proof search, Computation-as-proof search and reduction Introduction to CLL fCLL: Functional core of CLL lCLL: Concurrent core of CLL Related Work and Conclusion

Type-Directed Concurrency. CONCUR Closely Related Work Facile, CML, Concurrent Haskell, JOCaml –Combine functional and concurrent prog. Type Systems for  -calculus [Kobayashi ’03], [Igarashi, Kobayashi ’03], [Yoshida ’04], [Kobayashi, Pierce, Turner ’95], … –Properties like type-safety, deadlock freedom Computational Interpretations of Linear Logic [Abramsky ’93] –Classical linear logic and concurrency

Type-Directed Concurrency. CONCUR Closely Related Work MSR Framework [Cervesato ’04] –Rewriting as logical rules CLF [Cervesato, Pfenning, Walker, Watkins ’03], LolliMon [ Lopez, Pfenning, Polakow, Watkins’05] –Share the same underlying logic Lots more …

Type-Directed Concurrency. CONCUR Future Work A realistic implementation Challenges –Low level of concurrency in CLL –Linear functional programming –Type inference Reasoning about deadlock freedom and program correctness

Type-Directed Concurrency. CONCUR Conclusion CLL –Built from a logic –Functional part arises from proof reduction –Concurrent part arises from proof search –Type-safety for functional reduction Concurrency does not interfere with functional type-safety

Type-Directed Concurrency. CONCUR In the paper … Multi-sorted index terms Existential types –Creating channel names Encoding the asynchronous  -calculus A three phase classification of fCLL programs –Terms, expressions and monadic terms

Type-Directed Concurrency. CONCUR Why have a monad? Result of synchronization must have type {S} The monad {…} determines where synchronization ends

Type-Directed Concurrency. CONCUR Synchronization Exactly one rule

Type-Directed Concurrency. CONCUR A proof-search procedure on types