Semantics and Verification of Software



Similar documents
A Propositional Dynamic Logic for CCS Programs

Software Model Checking. Equivalence Hierarchy

Software Verification and Testing. Lecture Notes: Temporal Logics

Andrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer

Simulation-Based Security with Inexhaustible Interactive Turing Machines

A Distributed Calculus for Role-Based Access Control

Software Modeling and Verification

CHAPTER 7 GENERAL PROOF SYSTEMS

Rigorous Software Development CSCI-GA

Observational Program Calculi and the Correctness of Translations

Path Querying on Graph Databases

6.080/6.089 GITCS Feb 12, Lecture 3

Formal Verification and Linear-time Model Checking

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Temporal Logics. Computation Tree Logic

Lecture 2 Introduction to Data Flow Analysis

Fixed-Point Logics and Computation

Verification of hybrid dynamical systems

Regular Languages and Finite Automata

ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Chapter 7: Functional Programming Languages

Reading 13 : Finite State Automata and Regular Expressions

Deterministic Discrete Modeling

Omega Automata: Minimization and Learning 1

The Model Checker SPIN

Informatique Fondamentale IMA S8

Non-deterministic Semantics and the Undecidability of Boolean BI

On strong fairness in UNITY

Testing LTL Formula Translation into Büchi Automata

Automata and Formal Languages

Algorithmic Software Verification

Class notes Program Analysis course given by Prof. Mooly Sagiv Computer Science Department, Tel Aviv University second lecture 8/3/2007

OPERATIONAL TYPE THEORY by Adam Petcher Prepared under the direction of Professor Aaron Stump A thesis presented to the School of Engineering of

Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan

Schedule. Logic (master program) Literature & Online Material. gic. Time and Place. Literature. Exercises & Exam. Online Material

MATH 304 Linear Algebra Lecture 9: Subspaces of vector spaces (continued). Span. Spanning set.

TRINITY COLLEGE DUBLIN

logic language, static/dynamic models SAT solvers Verified Software Systems 1 How can we model check of a program or system?

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Introduction to Software Verification

Basic Proof Techniques

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

The Software Development Process

Model Checking II Temporal Logic Model Checking

INTRODUCTORY SET THEORY

COMPUTER SCIENCE TRIPOS

Scheduling Shop Scheduling. Tim Nieberg

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Understanding Basic Calculus

INF5140: Specification and Verification of Parallel Systems

The Halting Problem is Undecidable

Chapter ML:IV. IV. Statistical Learning. Probability Basics Bayes Classification Maximum a-posteriori Hypotheses

ML for the Working Programmer

Development of dynamically evolving and self-adaptive software. 1. Background

(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.

Baltic Way Västerås (Sweden), November 12, Problems and solutions

Determination of the normalization level of database schemas through equivalence classes of attributes

Theoretical Computer Science (Bridging Course) Complexity

MA651 Topology. Lecture 6. Separation Axioms.

Linear Types for Continuations

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Bindings, mobility of bindings, and the -quantifier

A first step towards modeling semistructured data in hybrid multimodal logic

Specification and Analysis of Contracts Lecture 1 Introduction

it is easy to see that α = a

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Static Program Transformations for Efficient Software Model Checking

1 Operational Semantics for While

Process Mining Using BPMN: Relating Event Logs and Process Models

Degrees of Truth: the formal logic of classical and quantum probabilities as well as fuzzy sets.

Which Semantics for Neighbourhood Semantics?

24 Uses of Turing Machines

Runtime Verification - Monitor-oriented Programming - Monitor-based Runtime Reflection

A Framework for the Semantics of Behavioral Contracts

Jim Lambers MAT 169 Fall Semester Lecture 25 Notes

8 Divisibility and prime numbers

Open Access to Call and Session Control in Mobile Networks

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Left-Handed Completeness

Finite Automata. Reading: Chapter 2

Monitoring Metric First-order Temporal Properties

GROUPS ACTING ON A SET

Regular Expressions and Automata using Haskell

Transcription:

Semantics and Verification of Software Lecture 21: Nondeterminism and Parallelism IV (Equivalence of CCS Processes & Wrap-Up) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://www-i2.informatik.rwth-aachen.de/i2/svsw11/ Winter Semester 2011/12

Outline 1 Repetition: Calculus of Communicating Systems 2 Equivalence of CCS Processes 3 Strong Bisimulation 4 Further Topics in Formal Semantics 5 Upcoming Courses Semantics and Verification of Software Winter Semester 2011/12 21.2

Syntax of CCS I Definition (Syntax of CCS) Let N be a set of (action) names. N := {a a N} denotes the set of co-names. Act := N N {τ} is the set of actions where τ denotes the silent (or: unobservable) action. Let Pid be a set of process identifiers. The set Prc of process expressions is defined by the following syntax: P ::= nil (inaction) α.p (prefixing) P 1 + P 2 (choice) P 1 P 2 (parallel composition) new a P (restriction) A(a 1,..., a n ) (process call) where α Act, a, a i N, and A Pid. Semantics and Verification of Software Winter Semester 2011/12 21.3

Semantics of CCS I Definition (Semantics of CCS) A process definition (A i (a i1,..., a ini ) = P i 1 i k) determines the labeled transition system (LTS) (Prc, Act, ) whose transitions can be inferred from the following rules (P, P, Q, Q Prc, α Act, λ N N, a, b N, A Pid): λ P Q λ Q (Act) α.p α P (Com) P P Q P α P Q (Sum 1) P + Q α P (Sum 2) P + Q P α P (Par 1) P Q α P Q τ P Q α Q α Q Q α Q (Par 2) P Q α P Q P α P (α / {a, a}) P[ a α b] P (New) new a P α new a P (Call) A( if A( a) = P α b) P (Here P[ a b] denotes the replacement of every a i by b i in P.) Semantics and Verification of Software Winter Semester 2011/12 21.4

Semantics of CCS II Example (on the board) 1 One-place buffer: 2 Sequential two-place buffer: 3 Parallel two-place buffer: B(in, out) = in.out.b(in, out) B 0 (in, out) = in.b 1 (in, out) B 1 (in, out) = out.b 0 (in, out) + in.b 2 (in, out) B 2 (in, out) = out.b 1 (in, out) B (in, out) = new com (B(in, com) B(com, out)) B(in, out) = in.out.b(in, out) Semantics and Verification of Software Winter Semester 2011/12 21.5

Semantics of CCS III Example (continued) Complete LTS of parallel two-place buffer (=: LTS(B (in, out))): B (in, out) new com (B(in, com) B(com, out)) empty in in out new com (com.b(in, com) B(com, out)) τ new com (B(in, com) out.b(com, out)) 1 entry out in new com (com.b(in, com) out.b(com, out)) full Semantics and Verification of Software Winter Semester 2011/12 21.6

Outline 1 Repetition: Calculus of Communicating Systems 2 Equivalence of CCS Processes 3 Strong Bisimulation 4 Further Topics in Formal Semantics 5 Upcoming Courses Semantics and Verification of Software Winter Semester 2011/12 21.7

Equivalence of CCS Processes Generally: two syntactic objects are equivalent if they have the same meaning Here: two processes are equivalent if they have the same behavior (i.e., communication potential) Communication potential described by LTS First idea: define (for P, Q Prc) P, Q are called LTS equivalent if LTS(P) = LTS(Q) But: yields too many distinctions Example 21.1 LTS: X (a) = a.x (a) a Y (a) = a.a.y (a) a a although both processes can (only) execute infinitely many a-actions, and should therefore be considered equivalent Semantics and Verification of Software Winter Semester 2011/12 21.8

Trace Equivalence I Second idea: reduce process to its action sequences Definition 21.2 (Trace language) For every P Prc, let Tr(P) := {w Act ex. P Prc such that P be the trace language of P (where w := a 1... a 1 for w = a 1... a n ). P, Q Prc are called trace equivalent if Tr(P) = Tr(Q). w P } Example 21.3 (One-place buffer) B(in, out) = in.out.b(in, out) Tr(B(in, out)) = (in out) (in + ε) Semantics and Verification of Software Winter Semester 2011/12 21.9

Trace Equivalence II Remarks: The trace language of P Prc is accepted by the LTS of P, interpreted as an automaton with initial state P and where every state is final. Trace equivalence is obviously an equivalence relation (i.e., reflexive, symmetric, and transitive). Trace equivalence identifies processes with identical LTSs: the trace language of a process consists of the (finite) paths in the LTS. Thus: LTS(P) = LTS(Q) Tr(P) = Tr(Q) Semantics and Verification of Software Winter Semester 2011/12 21.10

Trace Equivalence III Are we satisfied with trace equivalence? No! Example 21.4 P : a a b and Q : a b are trace equivalent (Tr(P) = Tr(Q) = {ε, a, ab}) But P and Q are distinguishable: both can execute ab but P can deny b after a while Q always has to offer b after a (e.g., consider a model of vending machine with a = insert coin, b = return coffee ) take into account such deadlock properties Semantics and Verification of Software Winter Semester 2011/12 21.11

Outline 1 Repetition: Calculus of Communicating Systems 2 Equivalence of CCS Processes 3 Strong Bisimulation 4 Further Topics in Formal Semantics 5 Upcoming Courses Semantics and Verification of Software Winter Semester 2011/12 21.12

Definition of Strong Bisimulation I Observation: equivalence should be sensitive to deadlocks needs to take branching structure of processes into account This is guaranteed by a definition according to the following scheme: Bisimulation scheme P, Q Prc are equivalent iff, for every α Act, every α-successor of P is equivalent to some α-successor of Q, and vice versa. Strong version ignores special function of silent action τ (alternative: weak bisimulation; not considered here) Unidirectional version: simulation (not considered here) Semantics and Verification of Software Winter Semester 2011/12 21.13

Definition of Strong Bisimulation II Definition 21.5 (Strong bisimulation) A relation ρ Prc Prc is called a strong bisimulation if PρQ implies, for every α Act, 1 P α P ex. Q Prc such that Q α Q and P ρq 2 Q α Q ex. P Prc such that P α P and P ρq P, Q Prc are called strongly bisimilar (notation: P Q) if there exists a strong bisimulation ρ such that PρQ. Theorem 21.6 is an equivalence relation. Proof. omitted Semantics and Verification of Software Winter Semester 2011/12 21.14

Examples Example 21.7 (on the board) 1 Bisimilar but not LTS equivalent (cf. Example 21.1): P a Q 1 a a Q 2 2 Trace equivalent (cf. Example 21.4) but not bisimilar: P a P 1 b P 2 Q a a Q 1 Q 3 b Q 2 Semantics and Verification of Software Winter Semester 2011/12 21.15

Bisimulation vs. LTS/Trace Equivalence Theorem 21.8 For every P, Q Prc, LTS(P) = LTS(Q) P Q Tr(P) = Tr(Q) Proof. LTS(P) = LTS(Q) P Q: clear as Definition 21.5 (of ) is directly based on LTS(p) and LTS(Q) P Q LTS(p) = LTS(Q): see Example 21.7(1) P Q Tr(P) = Tr(Q): by contradiction (show: w Tr(P) \ Tr(Q) P Q by induction on w ) Tr(P) = Tr(Q) P Q: see Example 21.7(2) Semantics and Verification of Software Winter Semester 2011/12 21.16

More Examples I Example 21.9 Binary semaphore (controls exclusive access to two instances of a resource) Sequential definition: Sem 0 (get, put) = get.sem 1 (get, put) Sem 1 (get, put) = get.sem 2 (get, put) + put.sem 0 (get, put) Sem 2 (get, put) = put.sem 1 (get, put) Parallel definition: S(get, put) = S 0 (get, put) S 0 (get, put) S 0 (get, put) = get.s 1 (get, put) S 1 (get, put) = put.s 0 (get, put) Proposition: Sem 0 (get, put) S(get, put) Semantics and Verification of Software Winter Semester 2011/12 21.17

More Examples II Example 21.10 Two-place buffer Sequential definition: B 0 (in, out) = in.b 1 (in, out) B 1 (in, out) = out.b 0 (in, out) + in.b 2 (in, out) B 2 (in, out) = out.b 1 (in, out) Parallel definition: B (in, out) = new com (B(in, com) B(com, out)) B(in, out) = in.out.b(in, out) Proposition: B 0 (in, out) B (in, out) Semantics and Verification of Software Winter Semester 2011/12 21.18

Outline 1 Repetition: Calculus of Communicating Systems 2 Equivalence of CCS Processes 3 Strong Bisimulation 4 Further Topics in Formal Semantics 5 Upcoming Courses Semantics and Verification of Software Winter Semester 2011/12 21.19

Semantics of Functional Languages I Program = list of function definitions Simplest setting: first-order function definitions of the form f (x 1,..., x n ) = t function name f formal parameters x 1,..., x n term t over (base and defined) function calls and x 1,..., x n Operational semantics (only function calls) call-by-value case: call-by-name case: t 1 z 1... t n z n t[x 1 z 1,..., x n z n ] z f (t 1,..., t n ) z t[x 1 t 1,..., x n t n ] z f (t 1,..., t n ) z Semantics and Verification of Software Winter Semester 2011/12 21.20

Semantics of Functional Languages II Denotational semantics program = equation system (for functions) induces call-by-value and call-by-name functional monotonic and continuous w.r.t. graph inclusion semantics := least fixpoint (Tarski/Knaster Theorem) coincides with operational semantics Extensions: higher-order types, data types,... see [Winskel 1996, Sct. 9] and Functional Programming course [Giesl] Semantics and Verification of Software Winter Semester 2011/12 21.21

Outline 1 Repetition: Calculus of Communicating Systems 2 Equivalence of CCS Processes 3 Strong Bisimulation 4 Further Topics in Formal Semantics 5 Upcoming Courses Semantics and Verification of Software Winter Semester 2011/12 21.22

Courses Summer 2012 Course Advanced Model Checking [Katoen] Course Compiler Construction [Noll] ( Hiwi jobs available!) Semantics and Verification of Software Winter Semester 2011/12 21.23