Interface-based design Philippe Giabbanelli CMPT 894 – Spring 2008.

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

Chapter 5: Tree Constructions
Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.
Circuit and Communication Complexity. Karchmer – Wigderson Games Given The communication game G f : Alice getss.t. f(x)=1 Bob getss.t. f(y)=0 Goal: Find.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Partial Order Reduction: Main Idea
Interface Theories With Component Reuse Laurent DoyenEPFL Thomas HenzingerEPFL Barbara JobstmannEPFL Tatjana PetrovEPFL.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Closure Properties of CFL's
Determinization of Büchi Automata
January 7, 2015CS21 Lecture 21 CS21 Decidability and Tractability Lecture 2 January 7, 2015.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
Nir Piterman Department of Computer Science TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAA Bypassing Complexity.
Planning under Uncertainty
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
Interface Automata 29-September Modeling Temporal Behavior of Component Component behaves with Environment Traditional (pessimistic) approach –
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Introduction to Computability Theory
Interface-based Design of Embedded Systems Thomas A. Henzinger University of California, Berkeley.
Ordering and Consistent Cuts Presented By Biswanath Panda.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
Type System, March 12, Data Types and Behavioral Types Yuhong Xiong Edward A. Lee Department of Electrical Engineering and Computer Sciences University.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4) David Martin This work is licensed under.
Models and Theory of Computation (MTC) EPFL Dirk Beyer, Jasmin Fisher, Nir Piterman Simon Kramer: Logic for cryptography Marc Schaub: Models for biological.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
Approaches to Reactive System Synthesis J.-H. Roland Jiang.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Introduction to Finite Automata Adapted from the slides of Stanford CS154.
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
System-Level Types for Component-Based Design Paper by: Edward A. Lee and Yuhong Xiong Presentation by: Dan Patterson.
Chapter 8 Asynchronous System Model by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
Called as the Interval Scheduling Problem. A simpler version of a class of scheduling problems. – Can add weights. – Can add multiple resources – Can ask.
Institute for Applied Information Processing and Communications 1 Karin Greimel Semmering, Open Implication.
A summary of our activities about WSI Philippe Giabbanelli CMPT 894 – Spring 2008.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Pushdown Automata (PDAs)
Learning Automata and Grammars Peter Černo.  The problem of learning or inferring automata and grammars has been studied for decades and has connections.
Course: Software Engineering ©Alessandra RussoUnit 2: States and Operations, slide number 1 States and Operations This unit aims to:  Define: State schemas.
1 On Interactions in the RM-ODP Guy Genilloud, Gonzalo Génova WODPEC’2005 Workshop on ODP for Enterprise Computing * Information Engineering Group Departamento.
Natallia Kokash (Accepted for PACO’2011) ACG, 31/05/ Input-output conformance testing for channel-based connectors 1.
Lazy Annotation for Program Testing and Verification Speaker: Chen-Hsuan Adonis Lin Advisor: Jie-Hong Roland Jiang November 26,
Convergence of Model Checking & Program Analysis Philippe Giabbanelli CMPT 894 – Spring 2008.
Copyright © Curt Hill Finite State Automata Again This Time No Output.
Closure Properties Lemma: Let A 1 and A 2 be two CF languages, then the union A 1  A 2 is context free as well. Proof: Assume that the two grammars are.
Systems Analysis and Design in a Changing World, Fourth Edition
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Chapter 8 Asynchronous System Model by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
Lecture 04: Theory of Automata:08 Transition Graphs.
Lecture Notes 
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
I/O & Interface Automata By Josh Lessard, Josh Taylor, Real Xu.
Sequential Flexibility
Alternating tree Automata and Parity games
Theory of Computation Turing Machines.
What Are They? Who Needs ‘em? An Example: Scoring in Tennis
ECE 352 Digital System Fundamentals
Presentation transcript:

Interface-based design Philippe Giabbanelli CMPT 894 – Spring 2008

Brief review of concepts and symbols Assume/guarantee interface We have seen a number of ways to model interfaces for components. Today’s approach is from a more theoretical point of view, providing a solid background. Discussion Interface automata 1

Base and symbols A/G Interface Interface automata Discussion Without much surprises, we are still interesting in the same thing: To see if two components are compatible (i.e. work well together), we use interfaces having protocol information. 2 A component is often an open system: it has some free inputs that will be given by other components throughout the interactions. We want to be able to specify the compatibility of components with their free inputs. Those components have free inputs.We want to be able to say if they are compatible. We do not want to specify the interfaces to close the systems.That’s an incremental design: we can add a specification. We say that two open components are compatible if there exists an environment providing all free inputs so that they are compatible. In other words, interfaces are well-formed if there is a (friendly) environment in which they are compatible.

Base and symbols A/G Interface Interface automata Discussion 3 If have a compatibility ~, then we can define a composition ||. Let F and G be interfaces. If F ~ G then F || G is well defined. Compatible components can be put together in any order. Let F, G, H, I be interfaces. If F ~ G, H ~ I and F || G ~ H || I then F ~ H, G ~ I, F || H ~ G || I. We have the refinement. As usual, if F F’ and F is compatible with G, then F’ is compatible with G. The interfaces defined in the paper are called Assume/Guarantee (A/G). The language for interfaces is interface automata.

Base and symbols A/G Interface Interface automata Discussion 4 An A/G interface has: ∙ A set X I of input variables ∙ A precondition φ I on the inputs (input assumption) Remember that the environments is providing the free inputs. So, the predicate φ I constraints the environment to provide variables satisfying it. ∙ A set X O of output variables ∙ A postcondition φ O on the outputs (output guarantee) The interface tells the environment what it will return with φ O. As φ I is a constraint on the environnement, it might not be satisfied by all environnements. In other words, there are contexts to use an A/G. In a division component with x and y, we might require y ≠ 0 as an input assumption, and a trivial TREE as output guarantee.

Base and symbols A/G Interface Interface automata Discussion 5 To compose two A/G interfaces: ∙ Their output variables have to be disjoint. ∙ If an interface provides F input to G, then the output guarantee of F implies the input assumption or G (or the other way around). In the case where all inputs of G are outputs of F, or vise versa, they are compatible if the following formula ψ is true: If some inputs are free, ψ has free input variables. So, the interfaces are compatible if there is a good context, i.e. if ψ is satisfiable.

Base and symbols A/G Interface Interface automata Discussion 6 It asks the environment to satisfy the formula so that the composition works. As that’s what we want from the environnement, this is the input assumption.

Base and symbols A/G Interface Interface automata Discussion 7 Let’s go for a simple example from the paper. No input. Output x, with guarantee TRUE. F G Inputs x and y, with assumption x = 0 → y = 0. No output. The formula for compatibility becomes: For all x, TRUE → (x = 0 → y = 0) Which simplifies to y = 0, that an environnement can provide. As F doesn’t put any restriction on x, it might provide x = 0 or not. F G We can do the composition F || G. It has: ∙ input variable y (weakest condition provided by the context) ∙ input assumption y = 0 ∙ output variable x ∙ output guarantee TRUE

Base and symbols A/G Interface Interface automata Discussion 8 As usual we are interested in composition and… refinements! We have an A/G interface F. To refine it, an A/G interface F’ must: ∙ Accept all the inputs of F. ∙ Produce only outputs of F. L. de Alfaro and T.A. Henzinger, Interface theories for component- based design, Proc. Embedded Software, Lecture Notes in Computer Science 2211, pages 148 – 165. Springer-Verlag, This short explanation on A/G interfaces is mainly a summary of:

Base and symbols A/G Interface Interface automata Discussion 9 As classical automaton, an interface automata can be seen as a directed graph with labels on the edges. ∙ Vertices are states ∙ Labels are the names of actions ∙ Edges are transitions (on actions) Actions are partitionned in three sets (think of visibly context-free) : ∙ input ∙ output ∙ internal (cannot be seen by the environnement) On a given state with an input, it can go to only one state (deterministic).

Base and symbols A/G Interface Interface automata Discussion 10 Let’s illustrate those automata with an example from the paper. A component offers a service « send » to send messages. ∙ the components returns either « ok » or « fail »∙ The components relies on ‘trnsmt’ to send the message.∙ trnsmit can succeed (ack) or fail (nack). We try it twice. Input. Output.

Base and symbols A/G Interface Interface automata Discussion 11 Before going any further, we need to establish the usual definitions. If there is an action a at a state q, we say that a is enabled at q. a q The set of input actions available (i.e. enabled) at q is A I (q). Respectively, output actions are A O (q) and hidden are A H (q). A I (q) for ‘?’ A O (q) for ‘!’ A H (q) for ‘;’ We assume than when we are in state q then the environnement will not provide an input action that is not enabled (otherwise we can’t do it!). An automata than has absolutely no interaction with its environnement is called closed. We have A I = A O = Ø.

Base and symbols A/G Interface Interface automata Discussion 12 An execution is an alternating sequence of states and actions q 0, a 0 … A state q’ is reachable from q if there is an execution q, …, q’. If all actions in an execution are output or hidden (i.e. we don’t need any input), then the execution is autonomous. If all actions are hidden then the execution is invisible. (it can be autonomously reachable or invisibly reachable) A state q’ is reachable in an automaton F if it is reachable from q 0. …

Base and symbols A/G Interface Interface automata Discussion 13 Prior to define the composition, we need to define the usual restrictions. A (very!) simplified way to think of compositions is with two situations: F GG F So, the inputs of G might have been sent by outputs of F, or vice-versa. shared(F, G) = (A input,G ∩ A output,F ) U (A output,F ∩ A input,G )

Base and symbols A/G Interface Interface automata Discussion 14 First, we define the product automaton F x G. Basically, it is the union of F and G, synchronizing on actions in shared(F, G) and allowed to do their own things asynchronously in between. We hide shared actions in the product. i.e. everything that is shared is taken out of A I and A O and goes into A H (hidden). If an action is not synchronized, then it is the business of only one of the automaton. Otherwise, they can both move.

Base and symbols A/G Interface Interface automata Discussion 15 Remember the component that will try twice to send a message. Now, let’s think of a component that calls it… …and let’s take the product. We identify the shared parts. send; ok; They become hidden. 6

Base and symbols A/G Interface Interface automata Discussion 16 Let’s consider a state (q, r) where q comes from an automaton F and r from the other G. If there is a shared action that it is an output of q but not an input of r (or vice-versa), we call it an error state. If there is no reachable error state (think of the liveness assumption in the previous presentation), we can do the composition F || G. If there is a reachable error state but F x G is not closed (i.e. there are some free inputs), it is a bit more tricky… By providing « good inputs », the environment of F x G might ensure that no error state will ever be encountered. Thus, incompatible compositions are not only when there is a reachable error state but when there is no good context against it.

Base and symbols A/G Interface Interface automata Discussion 17 Thus, incompatible compositions are not only when there is a reachable error state but when there is no good context against it. More formally, if F and G are composable, then we have an environment E such that: ∙ E is composable with F x G ∙ (F x G) x E is closed (i.e. the environment provides all free inputs if any) ∙ E prevents error states of F x G from being entered (i.e. by providing ‘good inputs’ it avoids reachable errors) ∙ E accepts all outputs of F x G Such environment E is called a legal environment. There is always a legal environment for an F and G (hint: trivial empty closure).

Base and symbols A/G Interface Interface automata Discussion 18 To go from the product F x G to the composition F || G, we remove all transitions leading to incompatible states. The ‘caller’ component does not tolerate any error, thus it is not compatible with fail. Fail can only happen if the context gives us nack. Thus, we can compose under a good context giving ack. The composition removes only transitions, but as a result some states might become unreachable and they can be removed as well. The states left over after the deletion process are the relevant ones. They can be found in linear time thus we can check and do the composition in linear time.

Base and symbols A/G Interface Interface automata Discussion 19 As usual, after the composition comes the refinement. This component can try to send a message twice (when receiving send) or once (when receiving once). Thus, it clearly refines the component that just receives send and tries twice. However, ‘once’ is only an input for this component! F’ refines F if all input transitions of F can be simulated by F’, and each output transition of F’ can be simulated by F (more input, less outputs). (more details in Alternating refinement relations by Alur, Henzinger, Kupferman and Vardi, Proc. Concurrency Theory 1998)

Base and symbols A/G Interface Interface automata Discussion 20 There are some limitations on environments: the assumption of an automaton says which inputs may occur but not which ones must occur. The better context to show compatibility is the one that provides no input. It cannot reach any error… If we want to specify inputs that must occur, there is a number of ways. (see Synchronous and bidirectional component interfaces, from Chakrabarti, De Alfaro, Henzinger and Mang, 2002) An environment is found as a winning strategy in a two-player game. F and G are compatible if the environment has a strategy to avoid errors. The 1st player is the environment, providing inputs to F x G. The 2nd player is the ‘team’ F x G of interfaces, choosing internal transitions and outputs.

Base and symbols A/G Interface Interface automata Discussion 21 An environment is found as a winning strategy in a two-player game. If we have hidden transitions, then the state of an interface cannot be known completely by the environment. In other words, it has only partial information. Winning strategies in games with partial information is in general exponential (constructs all possibles subsets of states) thus inpractical for synchronous interfaces (remember that here we chose asynchronous!). (see The complexity of two-player games of incomplete information by J. Reif, Journal of Computer and System Sciences 1984) The idea of game is flexible enough. Different goals/meanings can be created by modifying the objective function of the game.

Article used for this presentation Interface-based Design (Luca de Alfaro, Thomas A. Henzinger, Engineering Theories of Software-intensive Systems, Springer 2005)