BCS-FACS 7Th Refinement Workshop
Total Page:16
File Type:pdf, Size:1020Kb
ELECTRONIC WORKSHOPS IN COMPUTING Series edited by Professor C.J. van Rijsbergen He Jifeng, Oxford University Computing Laboratory, UK, John Cooke, Loughborough University, UK, and Peter Wallis, University of Bath, UK (Eds) BCS-FACS 7th Refinement Workshop Proceedings of the BCS-FACS 7th Refinement Workshop, Bath, 3-5 July 1996 Chopping a Point Zhou Chaochen and Michael R. Hansen Published in Collaboration with the British Computer Society ©Copyright in this paper belongs to the author(s) ISBN 3-540-76104-7 Chopping a Point y Zhou Chaochen Department of Information Technology, Technical University of Denmark DK-2800 Lyngby, Denmark Michael R. Hansen Department of Information Technology, Technical University of Denmark DK-2800 Lyngby, Denmark zcc mrhgitdtudk Emails: f Abstract This paper introduces a super-dense chop modality into the Duration Calculi. The super-dense chop can be used to specify a super-dense computation, where a number of operations happens simultaneously, but in a specific order. With this modality, the paper defines a real-time semantics for an OCCAM-like language. In the semantics, assignments and passing of messages in communications are assumed to be timeless operations. 1 Introduction In a digital control system, a piece of program, hosted in a computer, acts as a controller in order to periodically receive sampled outputs of a plant, and to calculate and send controls to the plant. The program may be written in an OCCAM- like language as a loop of sensor x CALx u actuator u w ait T x u x where CAL stands for a program segment, which decides a current control from the current sampled data and T the previous control u. is the sampling period. Typically, the time spent in the calculation and change of controls is negligible compared with the sampling period T . So control engineers make the comfortable assumption that the x u calculation program (i.e. CAL ) becomes a sequence of statements which are executed one by one, but consume x actuator u no time. Similarly, the receiving and the sending (i.e. sensor and ) are assumed to be a pair of consecu- tive operations which can happen instantaneously, if the partners (i.e. sensor and actuator) are willing to communicate. A computation of a sequence of operations which is assumed to be timeless is called a super-dense computation.A semantic model of super-dense computations is discussed e.g. in [10, Example 6.4.2] and [11], and is e.g. adopted by the languages Esterel [3] and Statecharts [9]. A super-dense computation is an abstraction of a real-time computation within a context with a grand time gran- ularity. For instance, in the digital control system, the cycle time of the computer may be nanoseconds, while the x u sampling period of the plant may be seconds. In other words, the calculation (CAL ) and the communications sensor x actuator u T w ait T and may take micro- or milli-seconds, while the sampling period (in )maytake seconds. A computation time with fine time granularity is only negligible for computations not having infinite loops. Otherwise it is known as Zeno phenomenon, or finite divergence [5]. In this paper, finite divergence will not be taken into account. This work is partially funded by the Danish research councils under the project Codesign. y On leave of absence from International Institute for Software Technology, United Nations University, Macau, and from Software Institute, Academia Sinica, Beijing. BCS-FACS 7th Refinement Workshop 1 Chopping a Point Another motivation to introduce super-dense computations arises from the program refinement area. One of the well-known algebraical laws for untimed programs is the combine law of assignments [16] (called the merge assignment law in [8]). The combine law can conclude that e.g. the two consecutive assignments x x x x are equivalent to the single assignment x x In order to retain the combine law for real-time programs, one may simulate time consumption of assignments by ait w statements, and assume that execution of assignment takes no time. Otherwise the execution time of two assign- ments may be twice the execution time of a single assignment, and the combine law can hardly be maintained. Under the assumption that assignments take no time, the following two consecutive assignments constitute a super-dense com- putation x x x x This paper represents an attempt to treat super-dense computation in the framework of the Duration Calculi. The Duration Calculi [19] are extensions of Interval Temporal Logic [12]. They can be used to specify and reason about real-time systems. The real-time behavior of a system can be specified in terms of its states, where a state S R f g denotes a time dependent property of a system and R denotes the set of real numbers. States are assumed finitely vari- t S t able (i.e. not finitely divergent). Thus, a state can alternate between being present ( S ) and absent ( ) only finitely many times in any finite (bounded) interval. Formulas of the Duration Calculus [20] express properties of the duration of states and can therefore not express t x point properties such as: “the value of variable x is at time ”, since this property of has no duration. The Mean Value Calculus [21] is an extension of Duration Calculus where one can express point properties like the above one. But one t cannot with the Mean Value Calculus express properties like: “the value of variable x is first then at time ”, which are necessary in order to formalize super-dense computations. One approach to cope with this problem is to extend the model to allow several simultaneous events (e.g. assignments to x), thereby getting a model similar to that of [11]. In [15] traces as functions of time are used e.g. to model simultaneous events in a Duration Calculus framework. Another approach is used in this paper, where we will introduce a new modality (called super-dense chop)for expressing super-dense computations without changing the model. The idea, which is elaborated below, is to express state transitions as neighborhood properties and combine state transitions using to specify super-dense computations. We will define state transitions as certain neighborhood properties of a system. The neighborhood properties are designated as S % S and S % S t S t where ( ) holds at time if is stably present to the left (right) side of , i.e. present throughout some small t S S left (right) neighborhood of .Astate transition from to is expressed in terms of neighborhood properties as S % S S S That is, holds before the transition, and holds after the transition. x A variable x of a program can change its value during an execution of the program. One can interpret as a function of time x R Val x where Val stands for all possible values of . The state x v v Val The following notations are taken from [5]. BCS-FACS 7th Refinement Workshop 2 Chopping a Point f g is a time varying property ( R ) of the program. It is reasonable to assume that the program is timely progres- sive, and thus a program variable can only change its value finitely many times in any finite period. Thus, the property x v ) ( is finitely variable. The assignment x x can be defined as the state transition v (x v ) % (x v ) x This formula defines that the assignment first inherits a value (v )of from its predecessor in the left neighborhood, and then passes the new value (v ) to its successor in the right neighborhood. Similarly, the assignment x x can be defined as v (x v ) % (x v ) The stability assumption is against the concept of super-dense computation. A super-dense computation of the program x x x x x x x x assumes that the value passing of x from ( )to( ) takes no time. Thus, the intermediate state x v ) ( of the program is just unstable and invisible. In order to define super-dense computations in the Duration Calculi, one needs a new modality which can map a time instant in a grand time space into a non-point interval in a fine time space, so that an instant action (such as the value passing of x) in a grand time space can take some time in x v ) a fine one. In other words, an unstable intermediate state (such as ( ) of a super-dense computation in the grand time space can become stable in the fine one. We call the new modality for super-dense chop and designate it as . Consider two state transitions of the special S % S S % S forms: and . The super-dense computation of these two state transitions can be modelled by ( S % S ) ( S % S ) I I (S ) R f g S i i Suppose that an interpretation is given which associates a function i with each state t I . Then, this formula holds at a point ,iffthereexistsarefined interpretation of states (designated ), where t I [t t d]d > I I S % S t the point of is expanded into an interval ,of , such that satisfies at time and S % S t d S (t t d) I at time ,and holds throughout the interval , which links up the two transitions in . This situation is sketched in the following picture t S S I S S S S S S Sw S S S . I t d t Thus, a super-dense computation of the two consecutive assignments x x x x BCS-FACS 7th Refinement Workshop 3 Chopping a Point can be modelled by (v (x v ) % (x v )) (v (x v ) % (x v )) In this paper, a set of axioms and rules for the super-dense chop is developed, so that one can reason about super- dense computations, and prove, for example (v (x v ) % (x v )) (v (x v ) % (x v )) (v (x v ) % (x v )) x which formalizes the equivalence of the two consecutive assignments above and the single assignment x .