Introduction to CSP Alexandre Mota

Slides:



Advertisements
Similar presentations
Automata Theory Part 1: Introduction & NFA November 2002.
Advertisements

Dates for term tests Friday, February 07 Friday, March 07
COMMUNICATING SEQUENTIAL PROCESSES C. A. R. Hoare The Queen’s University Belfast, North Ireland.
1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
Models of Concurrency Manna, Pnueli.
Formal Semantics of Programming Languages 虞慧群 Topic 6: Advanced Issues.
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
Formal Modelling of Reactive Agents as an aggregation of Simple Behaviours P.Kefalas Dept. of Computer Science 13 Tsimiski Str Thessaloniki Greece.
1.6 Behavioral Equivalence. 2 Two very important concepts in the study and analysis of programs –Equivalence between programs –Congruence between statements.
8. Introduction to Denotational Semantics. © O. Nierstrasz PS — Denotational Semantics 8.2 Roadmap Overview:  Syntax and Semantics  Semantics of Expressions.
CSC321 §6 Modelling Processes using FSP 1 Section 6 Modelling Processes using FSP.
Compiling Communicating Processes into Delay-Insensitive VLSI Circuits Alain J. Martin Department of Computer Science California Institute of Technology.
1 Lecture 3 The CSP approach to the specification and analysis of Security protocols Communicating Sequential Processes [Hoare 78] Mathematical framework.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Lecture 11: An introduction to CSP.
An Introduction to Markov Decision Processes Sarah Hickmott
Spin Tutorial (some verification options). Assertion is always executable and has no other effect on the state of the system than to change the local.
Synthesis of Embedded Software Using Free-Choice Petri Nets.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Ordering and Consistent Cuts Presented By Biswanath Panda.
Programming Language Semantics Denotational Semantics Chapter 5 Based on a lecture by Martin Abadi.
An Introduction to Input/Output Automata Qihua Wang.
Marakas: Decision Support Systems, 2nd Edition © 2003, Prentice-Hall Chapter Chapter 4: Modeling Decision Processes Decision Support Systems in the.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Lecture 11: An introduction to CSP.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
Copyright © Cengage Learning. All rights reserved.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 8 Linear Algebraic Equations PowerPoint to accompany Copyright © 2010.
Chapter 10 State Machine Diagrams
PYTHON PROGRAMMING Week 10 – Wednesday. TERMS – CHAPTER 1 Write down definitions for these terms:  Computation  Computability  Computing  Artificial.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Introduction Random Process. Where do we start from? Undergraduate Graduate Probability course Our main course Review and Additional course If we have.
Concurrency: processes & threads1 ©Magee/Kramer Chapter 2 Processes & Threads.
Grammars CPSC 5135.
Reactive systems – general
CS5204 – Operating Systems 1  -Calculus Reasoning about concurrency and communication (Part 1).
1 TABLE OF CONTENTS PROBABILITY THEORY Lecture – 1Basics Lecture – 2 Independence and Bernoulli Trials Lecture – 3Random Variables Lecture – 4 Binomial.
CSC321 §6 Modelling Processes using FSP 1 Chapter 6 Modelling Processes using FSP.
CSP: Communicating Sequential Processes. Overview Computation model and CSP primitives Refinement and trace semantics Automaton view Refinement checking.
Week 11 What is Probability? Quantification of uncertainty. Mathematical model for things that occur randomly. Random – not haphazard, don’t know what.
Internet Security CSCE 813 Communicating Sequential Processes.
Interactive proof systems Section 10.4 Giorgi Japaridze Theory of Computability.
CPS 506 Comparative Programming Languages Syntax Specification.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
States.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Introduction to simple functions.
Hwajung Lee. Why do we need these? Don’t we already know a lot about programming? Well, you need to capture the notions of atomicity, non-determinism,
Lecture 4 Introduction to Promela. Promela and Spin Promela - process meta language G. Holzmann, Bell Labs (Lucent) C-like language + concurrency dyamic.
Classical Control in Quantum Programs Dominique Unruh IAKS, Universität Karlsruhe Founded by the European Project ProSecCo IST
Model Checking Lecture 1. Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Model Checking Lecture 1: Specification Tom Henzinger.
JAVA: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
Agenda  Quick Review  Finish Introduction  Java Threads.
1 Theoretical Foundations of Concurrency A formal study of concurrency enables: understanding the essential nature of concurrency reasoning about the behavior.
Theory of Computation Automata Theory Dr. Ayman Srour.
Internet Security CSCE 813 Communicating Sequential Processes.
Unit – 3 :LAMBDA CALCULUS AND FUNCTIONAL PROGRAMMING
Turing Machines Acceptors; Enumerators
States.
Theory of Computation Languages.
States.
Chapter8: Statement-Level Control Structures April 9, 2019
Instructor: Aaron Roth
COMPILER CONSTRUCTION
Presentation transcript:

Introduction to CSP Alexandre Mota

Agenda Fundamental concepts Process Communication Alphabet Basic behaviour State Alternating behaviour

Fundamental Concepts

Process Basic unit to capture behaviour In general, we use a set of processes to get modularity It is defined by equation(s) P = (behaviour) Similar to functional programming [although it is not a function!!!] Process names denote interesting system states/modules

Process Processes …

Communication Term ‘communication’ comes from the notion of interaction/observation/synchronisation It occurs between at least two parts [Which are?] A sequence of communications tells us a history (possible behaviour of a system  trace) A communication can be: Event (no data communication  synchronisation) Channel (a typed value is communicated) data

Alphabet Each process has its own alphabet [Hoare 85] – (  P) The whole specification determines the alphabet [Roscoe 98] – (  ) Alphabet is the union of all communications present in the body of all processes Determines the abstraction level

Abstraction Level It depends on what one is interested in observing someDigit vs digit_0, digit_1, …, digit_9 Thus, a communication can represent a set of more basic observations It dictates the success of a tool-based analysis The problem of state explosion

STOP It is a terminal process The most basic non-communicating and non-progressing process Interaction is forbidden In general, it is only used to denote broken functionality Exercises (broken car and light) When it surprisingly appears we have a deadlock situation

STOP 

SKIP Similarly to STOP, SKIP is a terminal process However, its occurrence means a successful termination Exercises (Turning off car and light) It only communicates a special event (  ) After that, no communication and progress is possible Curiosity about FDR (STOP vs SKIP)

SKIP  

Useful Behaviour The most basic construct to model behaviour is the prefix operator (->) Communication -> Process The process a -> P waits indefinitely by a, and then behaves like P Example: TwoSteps = leftFoot -> rightFoot -> SKIP (Exercises) Turning off the light and light is broken…

Prefix (a -> P) P a

A Complete Specification It is a combination of Alphabet declarations channel up, down Function and set definitions Odd(n) = (n % 2 == 1) T = {0, 1, 2} And process definitions P = up -> down -> up -> down -> STOP And, in general, following this ordering

Continuous Behaviour Various systems have a series of repetitive behaviour And these repetitions can be infinite Infinite behaviour becomes recursion P = (sequence of communications) -> P Right-side process name is replaced by a left-side process definition The processes can be different

Channels Communications that carry data Declaration needs an associated type channel a: T And the correct use needs one of the three operators: ? (input), ! (output) and. (simple separator) Example: a?var, a!exp, a.exp

Events vs Channels They are conceptually distinct But, in practice, a channel is indeed a set of events Thus, the channel a:{0,1} is the set of events {a.0, a.1} Note the use of the. operator as a separator Channels simply have a more elegant and readable presentation than events

State When deadling with dynamic data structures It is captured by process parameters Parameters are not typed (Dynamic type checking occurs) This can yield polymorphic solutions Assignment is represented by recursive calls P(n) = addOne -> P(n + 1) Parametrised processes must be instantiated We need P(0), or P(10) to exploit P(n)

Conditional Behaviour Data can be used to exhibit different behaviours P(y) = a?x -> if x == y then equal -> P else diff -> P The process b & P (guard) is a shorthand of if b then P else STOP

Conditional (if b then P else Q) P b Q  b

Alternative Behaviour If the environment can interfere then we use P [ ] Q (Deterministic or external choice) Otherwise P |~| Q (Non-deterministic or internal choice)

External Choice P = a -> Q [ ] b -> R P ab ab OR

External Choice (P [ ] Q) P a Q b Provided that a is a starting event of P and b a starting event of Q

Input and External Choice c?x -> P c.e 0 -> P[e 0 / x] [ ] … [ ] c.e N -> P[e N / x] Let c be a channel of type {e 0, …, e N }

Exercise Present a CSP process which captures the first screen of an ATM machine

Internal Choice P = a -> Q |~| b -> R P ab

Internal Choice (P |~| Q) P  Q 

Exercise Present a CSP process which captures the first screen of an ATM machine After selecting one of the possible services, the process can succeed/fail to satisfy it

Tool Support ProBE CSP animator (Useful for self-learning) FDR CSP model-checker (Useful for property/refinement analysis) Casper CSP protocol design (Abstract protocol design)

References Roscoe, A.W. The Theory and Practice of Concurrency. Prentice-Hall, Hoare, C.A.R. Communicating Sequential Processes. Prentice-Hall, 1985.Communicating Sequential Processes