Global Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems

Similar documents
Global Session Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

Chapter 2 Finite Automata

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Coalgebra, Lecture 15: Equations for Deterministic Automata

1.4 Nonregular Languages

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

We will see what is meant by standard form very shortly

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

ɛ-closure, Kleene s Theorem,

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Lecture 9: LTL and Büchi Automata

Let's start with an example:

Minimal DFA. minimal DFA for L starting from any other

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Homework 3 Solutions

Closure Properties of Regular Languages

Model Reduction of Finite State Machines by Contraction

Good-for-Games Automata versus Deterministic Automata.

1 Structural induction

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Fundamentals of Computer Science

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Bisimulation. R.J. van Glabbeek

CS 275 Automata and Formal Language Theory

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

CHAPTER 1 Regular Languages. Contents

Lecture 08: Feb. 08, 2019

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Automata and Languages

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CMSC 330: Organization of Programming Languages

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Notes on specifying systems in EST

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

Harvard University Computer Science 121 Midterm October 23, 2012

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

CSC 473 Automata, Grammars & Languages 11/9/10

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

State Minimization for DFAs

Summary: Method of Separation of Variables

Convert the NFA into DFA

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

A tutorial on sequential functions

CS 330 Formal Methods and Models

CS 275 Automata and Formal Language Theory

On Determinisation of History-Deterministic Automata.

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

C. C^mpenu, K. Slom, S. Yu upper boun of mn. So our result is tight only for incomplete DF's. For restricte vlues of m n n we present exmples of DF's

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Nondeterminism and Nodeterministic Automata

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

1 From NFA to regular expression

Learning Moore Machines from Input-Output Traces

CISC 4090 Theory of Computation

Infinite Geometric Series

3 Regular expressions

Finite Automata-cont d

19 Optimal behavior: Game theory

Bypassing no-go theorems for consistent interactions in gauge theories

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Numerical Integration

CSCI FOUNDATIONS OF COMPUTER SCIENCE

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

CS 188: Artificial Intelligence Spring 2007

Refined interfaces for compositional verification

Formal languages, automata, and theory of computation

Regular expressions, Finite Automata, transition graphs are all the same!!

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Parse trees, ambiguity, and Chomsky normal form

1.2. Linear Variable Coefficient Equations. y + b "! = a y + b " Remark: The case b = 0 and a non-constant can be solved with the same idea as above.

Designing finite automata II

COMPUTER SCIENCE TRIPOS

Free groups, Lecture 2, part 1

BIFURCATIONS IN ONE-DIMENSIONAL DISCRETE SYSTEMS

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

1.9 C 2 inner variations

Lecture 09: Myhill-Nerode Theorem

Lexical Analysis Finite Automate

1.3 Regular Expressions

Finite-State Automata: Recap

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

Chapter 5. , r = r 1 r 2 (1) µ = m 1 m 2. r, r 2 = R µ m 2. R(m 1 + m 2 ) + m 2 r = r 1. m 2. r = r 1. R + µ m 1

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

Taylor Polynomial Inequalities

Semantic reachability for simple process algebras. Richard Mayr. Abstract

Heteroclinic cycles in coupled cell systems

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Bernoulli Numbers Jeff Morton

CS 330 Formal Methods and Models

Transcription:

Globl Types for Dynmic Checking of Protocol Conformnce of Multi-Agent Systems (Extended Abstrct) Dvide Ancon, Mtteo Brbieri, nd Vivin Mscrdi DIBRIS, University of Genov, Itly emil: dvide@disi.unige.it, mtteo.brbieri@oniriclbs.com, mscrdi@disi.unige.it 1 Introduction Multi-gent systems (MASs) hve been proved to be n industril-strength technology for integrting nd coordinting heterogeneous systems. However, due to their intrinsiclly distributed nture, testing MASs is difficult tsk. In recent work [1] we hve tckled the problem of run-time verifiction of the conformnce of MAS implementtion to specified protocol by exploiting globl types on top of the Json gent oriented progrmming lnguge [2]. Globl types [3,6,4] re behviorl type nd process lgebr pproch to the problem of specifying nd verifying multiprty interctions between distributed components. Our notion of globl type closely resembles tht of Cstgn, Dezni, nd Pdovni, [4] except for two min differences: our types re interpreted coinductively, rther thn inductively, hence they re possibly infinite sets of possibly infinite sequences of interctions between fixed set of prticipnts; in this wy, protocols tht must not terminte cn be specified. Furthermore, we use globl types for dynmic, rther thn sttic, checking of multiprty interctions; errors cn only be detected t run-time, but checking is simpler nd more flexible, nd no notion of projection nd session type hs to be introduced. Globl types cn be nturlly represented s cyclic Prolog terms (tht is, regulr terms), nd their interprettion cn be given by trnsition function, tht cn be compctly defined by Prolog predicte. With such predicte, Json monitor gent cn be utomticlly implemented to dynmiclly check tht the messge exchnge between the gents of system conforms to specified protocol. In this pper we continue our reserch in two directions: on the one hnd, we investigte the theoreticl foundtions of our frmework; on the other, we extend it by introducing conctention opertor tht llows significnt enhncement of the expressive power of our globl types. As significnt exmples, we show how two non trivil protocols cn be compctly represented in our frmework: ping-pong protocol, nd n lternting bit protocol, in the version proposed by Deniélou nd Yoshid [5]. Both protocols cnnot be specified esily (if t ll) by other globl type frmeworks, while in our pproch they cn be expressed

by two deterministic types (in sense mde precise in the sequel) tht cn be effectively employed for dynmic checking of the conformnce to the protocol. 2 Globl type interprettion A globl type τ represents set of possibly infinite sequences of sending ctions, nd is defined on top of the following type constructors: λ (empty sequence), representing the singleton set {ɛ} contining the empty sequence ɛ. :τ (seq), representing the set of ll sequences obtined by dding the sending ction t the beginning of ny sequence in τ. τ 1 + τ 2 (choice), representing the union of the sequences of τ 1 nd τ 2. τ 1 τ 2 (fork), representing the set obtined by shuffling the sequences in τ 1 with the sequences in τ 2. τ 1 τ 2 (conct), representing the set of sequences obtined by conctenting ny sequence of τ 1 with ny sequence of τ 2. As n exmple, ((( 1 :λ) ( 2 :λ)) + (( 3 :λ) ( 4 :λ))) (( 5 : 6 :λ) ( 7 :λ)) denotes the set of messge sequences { 1 2 5 6 7, 1 2 5 7 6, 1 2 7 5 6, 2 1 5 6 7, 2 1 5 7 6, 2 1 7 5 6, 3 4 5 6 7, 3 4 5 7 6, 3 4 7 5 6, 4 3 5 6 7, 4 3 5 7 6, 4 3 7 5 6 } Globl types re regulr terms, tht is, cn be cyclic: more bstrctly, they re finitely brnching trees (where nodes re type constructors) whose depth cn be infinite, but tht cn only hve finite set of subtrees. A regulr term cn be represented by finite set of syntctic equtions, s hppens, for instnce, in Json nd in most modern Prolog implementtions. For instnce, the two equtions T 1 = (λ + ( 1 :T 1 )) T 2, nd T 2 = (λ + ( 2 :T 2 )) represent the following infinite, but regulr, globl types (λ+( 1 :(λ+( 1 :...)))) (λ+( 2 :(λ+( 2 :...)))) nd (λ + ( 2 :(λ + ( 2 :...)))), respectively. To ensure termintion of dynmic checking of protocol conformnce, we only consider contrctive (or gurded) types. Definition 1. A globl type τ is contrctive if it does not contin pths whose nodes cn only be constructors in {+,, } (such pths re necessrily infinite). The type represented by the eqution T 1 = (λ+( 2 :T 1 )) is contrctive: its infinite pth contins infinite occurrences of +, but lso of the : constructor; conversely, the type represented by the eqution T 2 = (λ + ((T 2 T 2 ) + (T 2 T 2 ))) is not contrctive. Trivilly, every finite type (tht is, non cyclic) is contrctive. The interprettion of globl type depends on the notion of trnsition, totl function δ:t A P fin (T), where T nd A denote the set of contrctive globl types nd of sending ctions, respectively. As it is customry, we write τ 1 τ2 to men τ 2 δ(τ 1, ). Figure 1 (in the Appendix) defines the inductive rules for the trnsition function. The uxiliry function ɛ, inductively defined in Figure 2 (in the Appendix), specifies the globl types whose interprettion is equivlent to λ.

Proposition 1. Let τ be contrctive type. Then τ τ for some nd τ if nd only if ɛ(τ) does not hold. Note tht the proposition bove does not hold if we drop the hypothesis requiring τ to be contrctive; for instnce, if τ is defined by T = T + T, then neither ɛ(τ) holds, nor there exist, τ s.t. τ τ. Proposition 2. If τ is contrctive nd τ τ for some, then τ is contrctive s well. The two propositions bove ensures termintion when the rules defined in Figures 1 nd 2 re turned into n lgorithm (implemented, for instnce, in Prolog cluses, s done for Json [1]). Definition 2. Let τ 0 be contrctive type. A run ρ for τ 0 is sequence τ 0 0 τ 1 n 1 1... τn n n+1 τn+1... such tht either the sequence is infinite, or there exists k such tht ɛ(τ k ); for ll τ i, i, nd τ i+1 in the sequence, τ i i τi+1 holds. We denote by α(ρ) the possibly infinite sequence of sending ctions 0 1... n... contined in ρ. The interprettion τ 0 of τ 0 is the set {α(ρ) ρ is run for τ 0 } if τ 0 dmits t lest one run, {ɛ} otherwise. Note tht, differently from other pproches [4], globl types re interpreted coinductively: for instnce, the globl type defined by T = :T denotes the set { ω } (tht is, the singleton set contining the infinite sequence of sending ction ), nd not the empty set. Furthermore, wheres globl types re regulr trees, in generl their interprettion is not regulr lnguge, since it my contin strings of infinite length. Finlly, we introduce the notion of deterministic globl type, which ensures tht dynmic checking cn be performed efficiently without bcktrcking. Definition 3. A contrctive globl type τ is deterministic if for ny possible run ρ of τ nd ny possible τ in ρ, if τ τ, τ τ, nd =, then τ = τ. 3 Exmples In this section we provide two exmples to show the expressive power of our formlism. 3.1 Ping-pong Protocol This protocol requires tht first Alice sends n (with n 1, but lso possibly infinite) consecutive ping messges to Bob, nd then Bob replies with exctly

n pong messges. The converstion continues forever in this wy, but t ech itertion Alice is llowed to chnge the number of sent ping messges. For simplicity we encode with ping nd pong the only two possible sending ctions; then, the protocol cn be specified by the following contrctive nd deterministic globl type (defined by the vrible Forever): Forever = PingPong Forever PingPong = ping:((pong:λ) + ((PingPong) (pong:λ))) 3.2 Alternting Bit Protocol We consider the Alternting Bit protocol, in the version defined by Deniélou nd Yoshid [5]. Four different sending ctions my occur: Alice sends msg1 to Bob (sending ction msg 1 ), Alice sends msg2 to Bob (sending ction msg 2 ), Bob sends ck1 to Alice (sending ction ck 1 ), Bob sends ck2 to Alice (sending ction ck 2 ). Also in this cse the protocol is n infinite itertion, but the following constrints hve to be stisfied for ll occurrences of the sending ctions: The n-th occurrence of msg 1 must precede the n-th occurrence of msg 2. The n-th occurrence of msg 1 must precede the n-th occurrence of ck 1, which, in turn, must precede the (n + 1)-th occurrence of msg 1. The n-th occurrence of msg 2 must precede the n-th occurrence of ck 2, which, in turn, must precede the (n + 1)-th occurrence of msg 2. We first show non deterministic contrctive type specifying such protocol (defined by the vrible AltBit 1 ). AltBit 1 = msg 1 :M 2 AltBit 2 = msg 2 :M 1 M 1 = (((msg 1 :λ) (ck 2 :λ)) M 2 ) + (((msg 1 :ck 1 :λ) (ck 2 :λ)) AltBit 2 ) M 2 = (((msg 2 :λ) (ck 1 :λ)) M 1 ) + (((msg 2 :ck 2 :λ) (ck 1 :λ)) AltBit 1 ) Since the type is not deterministic, it would require bcktrcking to perform the dynmic checking of the protocol. The corresponding miniml deterministic type (defined by the vrible AltBit 1 ) is the following: References AltBit 1 = msg 1 :M 2 AltBit 2 = msg 2 : M 1 M 1 = (msg 1 : A 2 ) + (ck 2 : AltBit 1 ) A 1 = (ck 1 : M 1 ) + (ck 2 : ck 1 : AltBit 1 ) M 2 = (msg 2 : A 1 ) + (ck 1 : AltBit 2 ) A 2 = (ck 2 : M 2 ) + (ck 1 : ck 2 : AltBit 2 ) 1. D. Ancon, S. Drossopoulou, nd V. Mscrdi. Automtic Genertion of Self- Monitoring MASs from Multiprty Globl Session Types in Json. In Declrtive Agent Lnguges nd Technologies (DALT 2012). Workshop Notes., pges 1 17, 2012.

2. R. H. Bordini, J. F. Hübner, nd M. Wooldridge. Progrmming Multi-Agent Systems in AgentSpek Using Json. John Wiley & Sons, 2007. 3. M. Crbone, K. Hond, nd N. Yoshid. Structured communiction-centred progrmming for web services. In ESOP 07 (prt of ETAPS 2007), volume 4421 of LNCS, pges 2 17. Springer, 2007. 4. G. Cstgn, M. Dezni-Cincglini, nd L. Pdovni. On globl types nd multiprty session. Logicl Methods in Computer Science, 8(1), 2012. 5. P.-M. Deniélou nd N. Yoshid. Multiprty session types meet communicting utomt. In ESOP 12 (prt of ETAPS 2012), LNCS. Springer, 2012. 6. K. Hond, N. Yoshid, nd M. Crbone. Multiprty synchronous session types. In POPL 2008, pges 273 284. ACM, 2008. A Appendix (seq) :τ τ τ 1 τ 1 (choice-l) τ 1 + τ 2 τ 1 τ 2 τ 2 (choice-r) τ 1 + τ 2 τ 2 τ 1 τ 1 τ 2 τ 2 (fork-l) τ 1 τ (fork-r) 2 τ 1 τ2 τ 1 τ 2 τ 1 τ 2 τ 1 τ 1 τ 2 τ 2 (ct-l) τ 1 τ 2 τ 1 (ct-r) τ2 τ 1 τ 2 τ 2 ɛ(τ 1) Fig. 1. Rules defining the trnsition function ɛ(τ1) ɛ(τ2) (ɛ-seq) (ɛ-choice) ɛ(λ) ɛ(τ 1 + τ 2) (ɛ-fork) ɛ(τ1) ɛ(τ2) ɛ(τ 1 τ 2) (ɛ-ct) ɛ(τ1) ɛ(τ2) ɛ(τ 1 τ 2) Fig. 2. Rules defining globl types equivlent to λ