Library-Based Scalable Refinement Checking for Contract-Based Design
Total Page:16
File Type:pdf, Size:1020Kb
Library-Based Scalable Refinement Checking for Contract-Based Design Antonio Iannopollo⇤, Pierluigi Nuzzo⇤, Stavros Tripakis⇤†, Alberto Sangiovanni-Vincentelli⇤ ⇤ EECS Department, University of California at Berkeley, Berkeley, CA 94720 † Department of Information and Computer Science, Aalto University, Finland Email: antonio, nuzzo, stavros, alberto @eecs.berkeley.edu { } Abstract—Given a global specification contract and a system An important task for the successful deployment of a described by a composition of contracts, system verification contract-based methodology is refinement checking. In all reduces to checking that the composite contract refines the contract frameworks, given a global specification contract and specification contract, i.e. that any implementation of the com- a system, also described by a composition of contracts, system posite contract implements the specification contract and is able verification reduces to checking that the composite contract to operate in any environment admitted by it. Contracts are refines the specification contract, i.e. that any implementation captured using high-level declarative languages, for example, linear temporal logic (LTL). In this case, refinement checking of the composite contract implements the specification contract reduces to an LTL satisfiability checking problem, which can and is able to operate in any environment admitted by it. Even be very expensive to solve for large composite contracts. This if refinement checking can be carried out compositionally, paper proposes a scalable refinement checking approach that it can still be very expensive to solve for large composite relies on a library of contracts and local refinement assertions. We contracts. For instance, in several applications, contracts can be propose an algorithm that, given such a library, breaks down the captured using high-level declarative languages, such as linear refinement checking problem into multiple successive refinement temporal logic (LTL). In this case, refinement checking reduces checks, each of smaller scale. We illustrate the benefits of the to an LTL satisfiability checking problem, which is PSPACE- approach on an industrial case study of an aircraft electric power complete [4]. Even if contracts are not captured in LTL but system, with up to two orders of magnitude improvement in terms instead are expressed directly in an automata-based formalism of execution time. such as interface automata, for which refinement checking is polynomial [3], the method still suffers from scalability issues due to state explosion. Indeed, the size of the system automaton I. INTRODUCTION is often prohibitive, as the system is formed by composing Contract-Based Design (CBD) has recently emerged as a several sub-systems. paradigm for the design of complex systems, emphasizing the In this paper, we took inspiration by the strong growth concept of interface and requirement formalization to facilitate of library-based design approaches in VLSI where, according system integration and provide formal support to the whole to a recent market survey, more than 50% of components at design flow, including stepwise refinement of specifications the macro-level come from pre-designed Intellectual Property and reuse of pre-designed components [1]. blocks (IP) that are fully characterized, pre-verified, and fully documented. The cost of building a library of IPs is non trivial The notion of contracts originates in the context of com- but is highly compensated by the saving in design time and cost positional assume-guarantee reasoning, which has been known (International Business Strategies (IBS) estimates that design for a long time as a verification method for the design of costs for a chip implemented in the latest technology will hardware and software, but has been advocated only recently in exceed 200Million US$ if IP libraries are not used to the fullest the context of embedded system design. In CBD, components extent). Indeed the market for IP blocks is now above 2Billion are specified by contracts and systems by compositions of US$. Motivated by this trend in semiconductor companies, contracts. In general terms, a contract denotes both a set system companies share a growing interest in design re- of components that implement a specification and a set of use both for hardware and software. To make it possible to environments in which it can operate. The ultimate objective utilize pre-designed blocks with confidence, providing strong is to be able to infer “global” properties of complex system collateral documentation and models is necessary. Along these by appropriately combining “local” properties of components lines, we show how refinement checking can be made more and their environments. Several rigorous contract theories have efficient when a system is described by contracts out of a pre- then been developed over the years, for instance, assume- characterized library of components that carry as collateral guarantee (A/G) contracts [2] and interface theories [3], each a characterization in terms of a set of refinement assertions, using a different formalism to represent the sets of contract which we call a contract library. We propose an algorithm implementations and environments. However, the development which, given such a library, breaks down the refinement of efficient algorithms and tools that can support the algebra checking problem into multiple successive refinement checks, of contracts and its concrete application to system design is each of smaller scale. While our algorithm is not bound to still at its infancy. any specific contract framework, to be concrete, we instantiate and demonstrate it by using A/G contracts to describe both This work was partially supported by the NSF Expeditions in Computing the system and the property to be satisfied. A/G contracts project ExCAPE: Expeditions in Computer Augmented Program Engineering, by IBM and United Technologies Corporation (UTC) via the iCyPhy con- specify the behavior of a component by defining what the sortium, by TerraSwarm, one of six centers of STARnet, a Semiconductor component guarantees, provided that its environment obeys Research Corporation program sponsored by MARCO and DARPA, by the some given assumptions. We formulate both the component Academy of Finland, and by the NSF via project COSMOI: Compositional guarantees and the environment assumptions using LTL for- System Modeling with Interfaces. mulas, a widespread formalism to reason about reactive sys- 978-3-9815370-2-4/DATE14/ c 2014 EDAA tems and perform analysis and synthesis of embedded control software [5], [6], [7]. We illustrate the benefits of the approach Contract composition preserves the saturated form, that is, on a case study of industrial relevance, i.e. the verification of if C1 and C2 are in saturated form, then so is C1 C2. an embedded controller for an aircraft electric power system, Moreover, is associative and commutative and generalizes⌦ showing up to two orders of magnitude improvement in terms to an arbitrary⌦ number of contracts. We therefore can write of execution time. C1 C2 Cn. Refinement is instead a preorder on contracts,⌦ ⌦ which···⌦ formalizes a notion of substitutability. We As in traditional assume-guarantee proof strategies, we say that contract C1 =('e1,'s1) refines contract C2 = decompose the main verification task into smaller sub-tasks, (' ,' ), written C C , if formulas ' ' and where an aggregation of components is replaced by a more e2 s2 1 2 e2 ! e1 's1 's2 are both valid, or equivalently, if ('e2 'e1) abstract representation [8]. However, in most cases, finding the and !(' ' ) are both unsatisfiable. ¬ ! appropriate abstraction is an issue, since no general guidelines ¬ s1 ! s2 are available to the verification engineer. A few approaches In our framework, we aim to specify systems that are have been proposed, which use learning algorithms to automat- built as aggregation and interconnection of components. To ically build such abstractions, e.g., see [9], [10]. In this paper, do so, we also define a set of operations that manipulate the abstraction process is instead guided by the contract library, contract variables. A first operation on contract variables is which systematically encodes the available information on both instantiation. Given a set of contracts , defined on a set of the structural decomposition of the system architecture and the variables V an instance of a contractC C =('e,'s) C 2C relevant system domain knowledge. Based on the library, we is a contract C0 =('e0 ,'s0 ) obtained by C by renaming its provide a mechanism to automatically build abstractions on the variables so that all the variable names v1,...,vn in 'e0 's0 are fly, as we solve the problem by successive refinements. In this unique in V , i.e. they are not used by any other contract_ in . respect, our solution is inspired by the platform-based design We will indicateC the instantiation of a contract C as inst(CC). paradigm [11], where a design at each abstraction layer is also Given three contracts C, C1 and C2, where C1 = inst(C) regarded as a platform instance, i.e. a legal interconnection and C2 = inst(C), C, C1 and C2 will not share any variable. of component out of a pre-characterized library, which also We then define a renaming operator. Given a contract C = includes composition rules. However, in this paper, the concept ('e,'s), where 'e,'s are defined on variables v1,...,vn, then of library is further extended to also include refinement rules. a renaming for C is a set M of pairs of the form (vi,uj), where As in [12], we exploit the relation between decomposition of uj is a new variable or an existing variable vk. The renaming component contracts and system architecture and provide a operator renM (C) returns a new contract C0 =('e0 ,'s0 ) where concrete framework to verify a system architecture relying variables in 'e,'s are renamed according to M. We will say on temporal logic formulas. However, in addition to auto- that two contracts C1 and C2 are isomorphic if there exists a matically generate proof obligations, the contribution of our renaming M such that renM (C1)=C2.