home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.yorku.ca 2015 / ftp.cs.yorku.ca.tar / ftp.cs.yorku.ca / pub / ostroff / papers.98 / tose4.txt < prev   
Text File  |  1998-07-23  |  113KB  |  2,137 lines

  1.  
  2.  
  3. Composition and Refinement of 
  4. Discrete Real-Time Systems
  5.  
  6.  
  7.  
  8. Jonathan S. Ostroff
  9.  
  10. Department Of Computer Science, York University,
  11.  
  12. 4700 Keele Street, North York Ontario, Canada, M3J 1P3.
  13.  
  14. Email: jonathan@cs.yorku.ca áááTel: 416-736-2100 X77882áááFax: 416-736-5872.
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. Abstract: Reactive systems exhibit ongoing, possibly non-terminating, interaction with 
  23. the environment. Real-time systems are reactive systems that must satisfy quantitative tim-
  24. ing constraints. This paper presents a structured compositional design method for discrete 
  25. real-time systems that can be used to combat the combinatorial explosion of states in the 
  26. verification of large systems. A composition rule describes how the correctness of the sys-
  27. tem can be determined from the correctness of its modules, without knowledge of their 
  28. internal structure. The advantage of compositional verification is clear. Each module is 
  29. both simpler and smaller than the system itself. Composition requires the use of both 
  30. model-checking and deductive techniques. A refinement rule guarantees that specifications 
  31. of high-level     modules are preserved by their implementations. The StateTime toolset is 
  32. used to automate parts of compositional designs using a combination of model-checking 
  33. and simulation. The design method is illustrated using a reactor shutdown system that can-
  34. not be verified using the StateTime toolset (due to the combinatorial explosion of states) 
  35. without compositional reasoning. The reactor example also illustrates the use of the refine-
  36. ment rule.
  37.  
  38.  
  39.  
  40. Keywords: Real-time reactive systems, formal methods tools, statecharts, temporal 
  41. logic, modules, abstraction, refinement, composition, model checking.
  42.  
  43. Table of Contents
  44.  
  45. 1.0    Introduction    3
  46.  
  47. 2.0    Background    6
  48.  
  49. 2.1    Real Time Temporal Logic (RTTL)    6
  50.  
  51. 2.2    Timed Transition Models (TTMs)    8
  52.  
  53. 2.3    Parallel composition of TTMs    12
  54.  
  55. 2.4    Overview of the StateTime toolset    12
  56.  
  57. 3.0    Modules and module composition    15
  58.  
  59. 3.1    Parallel composition of modules    16
  60.  
  61. 3.2    Modes of interface variables    19
  62.  
  63. 3.3    A small example of compositional reasoning    20
  64.  
  65. 4.0    Module refinement    23
  66.  
  67. 4.1    Observation equivalence of TTMs    23
  68.  
  69. 4.2    Observation equivalence of modules    27
  70.  
  71. 5.0    Modular Design of the delay reactor trip (DRT)    28
  72.  
  73. 5.1    Informal description of the problem    28
  74.  
  75. 5.2    Formal requirements    30
  76.  
  77. 5.3    Problem to be solved    33
  78.  
  79. 5.4    Controller design    34
  80.  
  81. 5.5    Refining the controller    36
  82.  
  83. 5.6    The design method    38
  84.  
  85. 6.0    Conclusions and related work    39
  86.  
  87. 7.0    References    42
  88.  
  89.  
  90.  
  91.  
  92.  
  93. Figure
  94.  
  95. FIGURE 1.    Structure diagram for compositional design method    5
  96.  
  97. FIGURE 2.    Plant module    14
  98.  
  99. FIGURE 3.    The relay module    20
  100.  
  101. FIGURE 4.    Module for majority voting logic    21
  102.  
  103. FIGURE 5.    Observably equivalent TTMs    24
  104.  
  105. FIGURE 6.    Analog implementation of the delay relay trip timing.    29
  106.  
  107. FIGURE 7.    The observable inputs and outputs of the DRT    30
  108.  
  109. FIGURE 8.    Architecture of the controller based on majority voting control    32
  110.  
  111. FIGURE 9.    Structure diagram for the DRT    34
  112.  
  113. FIGURE 10.    Control module    35
  114.  
  115. FIGURE 11.    Refinement of microprocessor control module    37
  116.  
  117.  
  118.  
  119.  
  120.  
  121. 1.0  Introduction
  122.  
  123. Reactive systems exhibit ongoing, possibly non-terminating, interaction with the envi-
  124. ronment. Real-time systems are reactive systems that must satisfy quantitative timing con-
  125. straints. This paper presents a structured compositional design method for discrete real-
  126. time systems that can be used to combat the combinatorial explosion of states in the verifi-
  127. cation of large systems. 
  128.  
  129. A system is decomposed into parallel components called modules. A composition rule 
  130. describes how the correctness of the system can be determined from the correctness of its 
  131. modules, without knowledge of their interior structure. The advantage of compositional 
  132. verification is clear. Each module is both simpler and smaller than the system itself. 
  133.  
  134. In addition to system decomposition, an abstract specification of a module may need to 
  135. be refined into implementations closer to code. A refinement rule guarantees that specifi-
  136. cations of abstract modules are preserved by their implementations. 
  137.  
  138. The StateTime toolset is used to automate parts of compositional designs using a com-
  139. bination of model-checking and simulation. The design method is illustrated using a reac-
  140. tor shutdown system that involves the use of three microprocessors, each independently 
  141. checking sensor readings, with the final decision to shut down based on a majority vote. 
  142. The single microprocessor version can be checked in the StateTime toolset without com-
  143. positional reasoning. However, the three-microprocessor system suffers from a combina-
  144. torial explosion of states and a compositional approach is thus needed. The reactor 
  145. example also illustrates the use of the refinement rule.
  146.  
  147. The compositional design method is based on the TTM/RTTL framework [36,37,40] 
  148. which consists of the following:
  149.  
  150. Ç    A constructive description language called timed transition models (TTMs) for 
  151. describing reactive systems. A TTM is a guarded transition system with lower and 
  152. upper time bounds on the transitions that relate to the occurrence of a special clock 
  153. transition tick. Concurrent real-time programs, nondeterministic timed Petri nets and 
  154. diverse mechanisms for timing, synchronization and communication constructs can be 
  155. converted into TTMs in a straightforward manner.
  156.  
  157. Ç    A declarative specification language called real-time temporal logic (RTTL) for 
  158. describing the requirements that a TTM should satisfy without discussing how the TTM 
  159. is constructed. RTTL is a timed extension of linear temporal logic augmented with a 
  160. transition variable for describing TTM events. 
  161.  
  162. Ç    Analysis techniques for demonstrating that a TTM conforms to its specification. Model-
  163. checking and a proof system for theorem proving are the main analysis techniques. 
  164. Model-checking is a method for automatically verifying concurrent systems in which a 
  165. finite-state model of the system (TTM) is compared with a correctness requirement 
  166. (RTTL). Since time is a monotonically increasing variable, the state-space of naive 
  167. timed systems is automatically infinite state. Hence, special care is taken in the model-
  168. checking algorithms to keep the state space finite provided the data types are finite.
  169.  
  170. Ç    A toolset called StateTime [38] which has a visual statechart-like executable language 
  171. for representing TTMs hierarchically. An automatic translator to the model-checker and 
  172. theorem prover STeP [31] allows for analysis. Although STeP is designed for untimed 
  173. systems, the automatic translation is done in such a way so as to allow for the use of 
  174. STeP╣s model-checking facilities. The STeP theorem prover can also be used for simpli-
  175. fying properties.
  176.  
  177. The TTM/RTTL framework was initially conceived for the analysis of closed systems 
  178. whose behaviour is completely determined by the state of the system itself [17]. In a 
  179. closed system, we assume that the environment may set the initial values of input vari-
  180. ables, but, once the system starts running the environment cannot modify any of the sys-
  181. tem variables. Thus, all changes to the system variables are accounted for by the 
  182. transitions of the program. By contrast, reactive systems are best thought of as open sys-
  183. tems whose behaviour depends on continuous interaction with the environment. We pro-
  184. vide below an informal sketch of how the framework is extended to the open setting. The 
  185. concepts will be made precise in the sequel.
  186.  
  187. This paper defines the notion of an open real-time reactive module  where i 
  188. is the module interface stub (e.g. variables or channels shared with the environment), b its 
  189. body (a TTM) and s the module specification (an RTTL formula in the interface variables). 
  190. The module specification s must hold for all module computations including arbitrary 
  191. changes that the environment might make at any time to the interface variables. The com-
  192. position of two modules  is also a module.
  193.  
  194. Not all parts of a module are always determined. For example, the interface stub and 
  195. specification may be given, but not the body. We denote a module with an unspecified 
  196. body by . A Composition Rule (justified in the sequel) given by
  197.  
  198. Composition Rule:ááááááá 
  199.  
  200. states that if each of the modules satisfy their respective specifications, then the system 
  201. satisfies its global requirement  provided the requirement can be derived from the con-
  202. junction of the module specifications. The composition rule allows for both bottom-up and 
  203. top-down design. In the bottom-up method, the independently designed and implemented 
  204. modules (with respective specifications ) when brought together exhibit the emergent 
  205. property r provided .
  206.  
  207. In top-down development, the system under design (sud) that is required to conform to 
  208. a global system requirement r can be decomposed into modules  and 
  209.  provided . At this stage, we have not yet committed to module 
  210. implementations. Each of these modules can then be given to a programmer whose job it 
  211. is to develop a body that satisfies the module specification. 
  212.  
  213. The body of module , whose variables can be reduced to finite ranges, can be shown 
  214. to satisfy its module specification (i.e. ) by model-checking provided the effects of 
  215. the environment are taken into account. The proof of , except in the simplest 
  216. of cases, requires the use of deductive techniques (RTTL theorem proving). Thus the com-
  217. position rule usually involves a combination of algorithmic and deductive techniques.
  218.  
  219. It is advisable that the programmer design and code the body of a module at as high a 
  220. level as possible (using TTMs). This keeps the body simple and small which makes it 
  221. understandable and prevents state explosion. There is then a need to refine the high-level 
  222. module body into a TTM that is closer to implementation. For example, an abstract TTM 
  223. may directly specify a delay of 50 ticks, but the implementation on a microprocessor 
  224. might be a loop construct that increments a counter every traversal of the loop. The inter-
  225. nal loop and counter are unobservable to an external agent interacting with the module as 
  226. the agent can only observe changes in the interface variables.
  227.  
  228. Two modules with the same interface are observationally equivalent (written: ) 
  229. if they agree on timed observations of their interface variables. Under suitable conditions 
  230. (presented in the sequel) a Refinement Rule states that:
  231.  
  232. Refinement Rule:ááááááá ááfor any module specification s.
  233.  
  234. Hence, if  is observationally equivalent to , then  can replace  wherever it 
  235. occurs with a guarantee that any module specification  will be preserved. There are effi-
  236. cient polynomial algorithms for checking observational equivalence of finite state sys-
  237. tems, and equivalence preserving transformations are available for refining infinite state 
  238. systems.
  239.  
  240. Given a requirement r that a system sud must satisfy, the composition and refinement 
  241. rules allow for a systematic modular development method represented by the tree in 
  242. Fig.á1. Each step imposes a proof obligation as shown in the right hand column of the fig-
  243. ure. The process continues until all the modules have bodies that can be directly coded 
  244. into the given program language. We need not adhere to the ordering suggested by the fig-
  245. ure. For example, the complete implementation of  can take place before the other 
  246. modules are designed. It is also possible to reverse-engineer already implemented code 
  247. and move bottom-up.
  248.  
  249. FIGURE 1. Structure diagram for compositional design method
  250.  
  251.  
  252.  
  253. We proceed as follows in the rest of this paper. In sectioná2 we provide background 
  254. information needed to understand the TTM/RTTL framework and the StateTime toolset. 
  255. Sectioná3 defines the notion of a module, modular validity and the composition rule. It 
  256. also describes how conditional specifications can be used to constrain module environ-
  257. ments. Sectioná4 presents the refinement rule for modules based on the notion of observa-
  258. tional equivalence of TTMs developed in [26]. Observational equivalence of TTMs will be 
  259. defined precisely in the sequel, but the reader is referred to [27] for a set of TTM equiva-
  260. lence preserving transformations and to [28] for an efficient polynomial time algorithm to 
  261. check TTM observational equivalence. Module observational equivalence is defined in 
  262. such a way that the TTM results can be applied directly to module equivalence as well. In 
  263. Sectioná5, we use the composition and refinement rules for the structured design of a reac-
  264. tor shutdown system. The design method is also discussed in some detail (Sect.á5.6). Com-
  265. parisons to other approaches and concluding remarks are presented in Sectioná6.
  266.  
  267. 2.0  Background
  268.  
  269. In the sequel, we use relative quantification  where Q is a quantifier (" or 
  270. $), T is the type of the dummy variable x, R is the range of the dummy variable and P a 
  271. predicate [14]. For example,  means │for all values of an integer variable i, 
  272. if i is at least as large as 3 then i has property P▓. If no range is supplied then it is true. The 
  273. notation  generally means that . For example,  means 
  274. that we are defining  by . In TTM update functions (see 
  275. sequel),  denotes assignment, i.e. .
  276.  
  277. 2.1  Real Time Temporal Logic (RTTL)
  278.  
  279. Linear time temporal logic [32] uses temporal connectives such as h (henceforth),  áá 
  280. (next), e (eventually), U (until) and past operators such as  (previous state) to represent 
  281. qualitative temporal properties. The standard connectives are applied to state-formulas 
  282. (which are the atomic predicates) to obtain temporal logic formulas. 
  283.  
  284. Real-time temporal logic (RTTL) is obtained by adding a fair tick transition and the 
  285. ability to refer to system transitions via a distinguished transition variable. We refer the 
  286. reader to [32] for a precise discussion of standard temporal logic and to [37,40] for real-
  287. time temporal logic. We now provide a brief review of some of the basic concepts. 
  288.  
  289. Let  and  be the system variables where the type of  is the integers and  has a set 
  290. type. An example of a state-formula f is . In this formula, the 
  291. bound variable  is just a dummy variable and is not considered a system variable. A state 
  292. is a mapping from the system variables to values in their relevant types. Since  evaluates 
  293. to true in the state given by , we write  (state s satisfies f), and we 
  294. call s an f-state.
  295.  
  296. A temporal logic formula such as  (│eventually  is true▓) cannot be interpreted in a 
  297. single state; rather it is evaluated in an infinite sequence of states  given by 
  298.  where  (│ satisfies │) will mean that there is at least one 
  299. state subsequent to the initial state that is an f-state. An inductive definition of the satisfac-
  300. tion relation  can then be given. Let  denote the satisfaction of temporal for-
  301. mula f at a position  of the sequence . For a state-formula , . 
  302.  
  303. We can then give the appropriate inductive definitions for the propositional connectives 
  304. (e.g. negation, conjunction, implication) followed by the usual definition of the temporal 
  305. operators. For example, for temporal logic formulas g and h, the until operator is defined 
  306. by . For an arbitrary tem-
  307. poral logic formula ,  is an abbreviation for . A formula  is generally-
  308. valid iff .
  309.  
  310. The implication () states only that │f implies eventually g▓ at the initial posi-
  311. tion of the computation, i.e. if  holds at the initial position then there is a subsequent posi-
  312. tion where  holds. As a notational convenience, we will write  for  
  313. which states that the implication holds at all positions of the sequence. In general, the dou-
  314. ble arrow entails operator is defined by á for any temporal logic for-
  315. mulas p and q.
  316.  
  317. We need the notion of timed transition sequences for the description of real-time sys-
  318. tems. Since we envisage that a transition  causes a transfer from state  to state , 
  319. we may rewrite the infinite sequence of states  as:
  320.  
  321. (Eq. 1)
  322.  
  323. The start transition  (e.g. a computer reboot) puts the system in state . The transition 
  324.  takes the system from state  to  and so on. We give the initial transition  the spe-
  325. cial name start. The distinguished variable  (the transition variable) is always part of the 
  326. state. The transition variable is used to record the last event taken, i.e. for the sequence 
  327.  we have that  and . The reason 
  328. we need a start transition is so that , like all other state variables, has an initial value. 
  329.  
  330. The transition variable can be used to refer directly to event occurrences. For example, 
  331. for a traffic system, the temporal logic formula  
  332. asserts that anytime the light turns red, it must eventually turn green.
  333.  
  334. In order to represent time, we introduce the special transition tick. A timed sequence  
  335. must satisfy the ticking constraint which asserts that there are an infinite number of ticks 
  336. occurring in the sequence, i.e. . Thus, time must progress irrespective of 
  337. what happens in a system or its environment. It is possible for any finite number of transi-
  338. tions to occur between two ticks of the clock.
  339.  
  340. We may use quantified Manna-Pnueli temporal logic to define the bounded real-time 
  341. until operator, , which in turn can be used to express a variety of important real-
  342. time properties. Informally, the meaning of the bounded until operator is that eventually 
  343.  will occur at a time between  and  ticks from now; until then  must hold. Other 
  344. bounded operators can then be defined as follows:
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352. Bounded response: p must hold after the l-th tick but 
  353. before the -th tick.
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  must hold before the -th tick.
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369. Bounded invariance:  must hold until the -th tick.
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377. Exact time:  is true in exactly  ticks.
  378.  
  379. The formula  asserts that p will hold before the next tick of the clock. Several state 
  380. changes can occur before p occurs without the clock advancing. The  operator can 
  381. often be used in place of the next operator where there is a need for stuttering-invariant for-
  382. mulas, i.e. formulas that are │robust▓ with respect to unobservable moves of the environ-
  383. ment. Some further examples of clocked properties are:
  384.  
  385. Ç    : If  holds initially, then eventually between 3 and 7 ticks  holds, and 
  386.  must hold continuously until then. This property is asserted only at the initial posi-
  387. tion.    
  388.  
  389. Ç    : Every position satisfying  is followed within 4 ticks by , and  
  390. holds continuously until then.
  391.  
  392. Ç    : If p holds at a position, then at some subsequent position before the next 
  393. clock tick there should be the start of an interval of duration 2 ticks during which q 
  394. holds continuously.
  395.  
  396. Ç    : The property  cannot become true sooner than 3 ticks after any 
  397. occurrence of the property .
  398.  
  399. We often need to compare expressions in consecutive states. We therefore introduce an 
  400. abbreviation for the next value of a variable , written . For example, the formula 
  401.  asserts that the value of  is greater in every successor state that it is in its 
  402. immediate predecessor (see [32] for the precise details).
  403.  
  404. 2.2  Timed Transition Models (TTMs)
  405.  
  406. TTMs are timed extensions of the fair transition systems of Manna and Pnueli [32]. The 
  407. extension involves lower and upper time bound constraints on transitions, that refer to the 
  408. number of occurrences of the special transition tick. A TTM M is defined as a 4-tuple 
  409.  as follows:
  410.  
  411. Ç    : a finite set of typed system variables. The distinguished transition variable  is 
  412. always in V, where . The variables set also include control and data vari-
  413. ables that are used to describe the various parts of M. Each state of M is a map from V to 
  414. its types; the set of all states is denoted by  (or just  when it is clear what the TTM 
  415. is).
  416.  
  417. Ç    I: the initial condition. This is a satisfiable boolean valued expression in the system 
  418. variables that characterizes the states at which the execution of the TTM can begin. A 
  419. state s satisfying I is called an initial state.
  420.  
  421. Ç    T: a finite set of transitions which includes the distinguished transitions start and tick. 
  422. Each transition  is a function  that maps a prestate s in  to a 
  423. (possibly empty) set of -successor states . An empty successor set means that 
  424. the transition is disabled (i.e. cannot be taken from the prestate). A successor state  is 
  425. also called a poststate of  from s. If the set of successor states consists of a single post-
  426. state, then the transition is deterministic. If there is more than one poststate, then the 
  427. transition is nondeterministic.
  428.  
  429. Ç    F: a fairness set where . Informally, the fairness constraint for each transition 
  430.  disallows computations in which  is enabled infinitely often but is taken only 
  431. finitely many times.
  432.  
  433. Since, in general, we do not need nondeterministic transitions, we can also describe a 
  434. transition  by its enabling condition  (the condition under which the transition 
  435. becomes eligible to be taken), and a simultaneous update function
  436.  
  437.  
  438.  
  439. where  and  are expressions in the system variables, which indicates that the values of 
  440.  in the poststate  are  respectively, where  is the prestate. No other sys-
  441. tem variables (e.g. ) are changed. The transition  is enabled in a state s (written: 
  442. ) if  ï otherwise  is said to be disabled. 
  443.  
  444. The transition  can be fully characterized by a transition relation  given by 
  445.  which is a predicate in the primed and 
  446. unprimed system variables. Primed variables refer to the value of the variables in the post-
  447. state, and unprimed variables refer to values in the prestate (see [32] for precise details). 
  448. By convention, we leave out conjuncts such as  for which there is no change.
  449.  
  450. In addition to the enabling condition and update function, we associate with each non-
  451. tick transition  a lower time bound  and an upper time bound , where 
  452. . We allow bounds  and  but not . The meaning 
  453. of these bounds will be defined formally in the sequel, but we first provide an informal 
  454. overview.
  455.  
  456. A timed transition  with lower time bound  ticks and upper time bound  ticks, 
  457. must delay l ticks before being taken, but must be taken by u ticks of the clock, provided it 
  458. remains continuously enabled, and is not disabled by the occurrence of another transition 
  459. that might have the effect of disabling . 
  460.  
  461. The operational semantics of TTMs will be described by the set of all its behaviours 
  462. called trajectories. Informally, a trajectory is a timed sequence of states that starts in an 
  463. initial state satisfying the initial condition of the TTM. From any state of the computation, 
  464. any enabled transition is taken in one atomic step. Either a tick transition is taken at each 
  465. step, in which case time advances, or a non-tick transition is taken, in which case time 
  466. stays the same. The resulting interleaving of enabled transitions allows us to model con-
  467. current processes. When the transitions are taken, they update the variables according to 
  468. the transition update function. The clock must tick infinitely often in any computation, and 
  469. an arbitrary but finite number of (non-tick) transitions can be taken between any two ticks 
  470. of the clock. The lower and upper time bounds of transitions must be respected.
  471.  
  472. A computation  of a TTM , where  for 
  473.  and , is a timed sequence satisfying the three constraints below. In each 
  474. case, we show how to write the constraint as a temporal logic formula.
  475.  
  476. 1.    Initialization constraint: The first state of the computation satisfies the initial condition, 
  477. i.e. . The initialization constraint is thus represented by the tempo-
  478. ral logic formula . The transition start occurs 
  479. once at the beginning of the computation and never again.
  480.  
  481. 2.    Succession constraint: , i.e. every prestate at position i must 
  482. have as its successor a poststate according to the update function of  (the transition 
  483. taken at position i). The succession constraint can be expressed in RTTL as 
  484. , where  is the transition relation for .
  485.  
  486. 3.    Fairness constraint: For each transition  in the fairness set, it is not the case that  is 
  487. infinitely often enabled beyond some position in the trajectory, but taken at only finitely 
  488. many positions in the trajectory.The fairness constraint can be written in temporal logic 
  489. as .
  490.  
  491. A timed sequence that satisfies the above three constraints is called a computation of . A 
  492. computation describes the behaviour of a Manna-Pnueli fair transition system (enhanced 
  493. with the tick of timed sequences). To describe the behaviour of timed transition models, 
  494. we further constrain computations by lower and upper time bound constraints and call the 
  495. resulting computations trajectories.
  496.  
  497. 4.    Lower bound constraint: for every transition  with lower bound , if  is taken at 
  498. position j of the computation, then there must exist a prior position  so that there 
  499. are at least  ticks of the clock between  and , and , 
  500. i.e.  is enabled but not taken in the states .
  501.  
  502. 5.    Upper bound constraint: for every transition  with upper bound , if  is enabled 
  503. at position j of the computation, then there must exist a subsequent position  with 
  504. no more than  ticks of the clock between  and , such that either  is taken or dis-
  505. abled at position k.
  506.  
  507. As with the initialization, succession, and fairness constraints, both the bound constraints 
  508. can also be described in RTTL. For a non-tick transition  with lower time bound  
  509. (where ) and upper time bound , the bound constraint is:
  510.  
  511. (Eq. 2)
  512.  
  513. where , and where  (the previous tem-
  514. poral operator) holds at a position  of a trajectory provided  is not the first position of the 
  515. trajectory and  holds at position . If , then the left conjunct  is 
  516. replaced by true. If , then the right conjunct of the consequent in (Eq.á2) is replaced 
  517. by true. The bound constraint (for both lower and upper bounds) can be written in tempo-
  518. ral logic as:
  519.  
  520. (Eq. 3).
  521.  
  522. The moment of enablement  describes the relevant positions of a computation at 
  523. which the bound constraint for a transition  (that is enabled at that position) must be 
  524. asserted. A relevant position is either the initial position , or a position at which 
  525. the transition has just been taken  and is re-enabled, or a position where  has just 
  526. become enabled .
  527.  
  528. Once a transition  becomes enabled at some position, it begins to │mature▓ but cannot 
  529. be taken until its lower time bound number of ticks has been taken, at which point the tran-
  530. sition becomes │ripe▓ for execution. If the transition is continuously enabled during matu-
  531. ration, then it can be taken any time after it becomes ripe, but it must be taken or become 
  532. disabled before the upper time bound number of ticks has expired. Thus, transitions 
  533. │mature▓ together as time advances but execute separately in an interleaving manner.
  534.  
  535. As noted above, the initialization, succession, fairness and bound constraints can be 
  536. expressed in RTTL. The formula  defined by
  537.  
  538. (Eq. 4)
  539.  
  540. fully describes the set of all trajectories of the TTM M. 
  541.  
  542. Since a trajectory of a TTM  is a timed sequence, the trajectory must also satisfy the 
  543. ticking constraint . However, there is the possibility of a conflict 
  544. between the upper bound and the ticking constraint (in which case no timed sequence will 
  545. satisfy  and the ticking constraint simultaneously). This happens in the presence of 
  546. immediate transitions of the type  that are self-loops ï such a  is taken repeatedly 
  547. yet the tick transition is delayed indefinitely. This is called a Zeno computation and the 
  548. TTM is said to exhibit Zeno behaviour. Any cycle of transitions whose elements are all 
  549. immediate may also exhibit Zeno behaviour. A TTM that exhibits Zeno behaviour cannot 
  550. be implemented, and hence we must find ways to ensure that our systems are non-Zeno.
  551.  
  552. The problem of Zeno computations can be avoided by disallowing self-looping imme-
  553. diate transitions. However, immediate transitions are useful for modelling │instantaneous▓ 
  554. (i.e. before the clock ticks) reactions. If immediate transitions are used in a TTM M, then 
  555. we must check for the validity of  in every single computation that satisfies 
  556. the bound constraints. Fortunately, for those systems where model-checking can be used, 
  557. the ticking property can be verified automatically (e.g. see Tableá1 in Sect.á5.5). In the 
  558. sequel, we assume that all TTMs are non-Zeno. This is not restrictive at all for the exam-
  559. ples of this paper because all TTMs can be model-checked to ensure that they are non-
  560. Zeno.
  561.  
  562. The set of all trajectories of a TTM  is denoted by . If a trajectory  satisfies 
  563. a temporal logic formula , then we write . If an RTTL formula  is satisfied in all 
  564. trajectories of  (i.e. ), then we write , and the formula  is 
  565. said to be M-valid. Any generally-valid formula is also M-valid. Any trajectory in  
  566. always satisfies ; hence, the transition system M and the temporal logic formula 
  567.  are two equivalent ways of describing .
  568.  
  569. Theoremá1: For any (non-Zeno) TTM M and RTTL formula p in the variables of :
  570. (a) , and (b) .
  571.  
  572. If we treat  as an axiom of the RTTL logic, then (Th.á1)(a) describes the relative 
  573. completeness of the logic for proving M-validities. An oracle is a device that is guaranteed 
  574. to provide a proof of any generally-valid RTTL formula. Hence to prove the M-validity of 
  575. p it is sufficient to submit to the oracle the formula . While the axiom  
  576. is theoretically adequate it is not very practical. In practice the special proof rules in [36] 
  577. and model-checking (Sect.á2.4) are the preferred methods for proving M-validities.
  578.  
  579. 2.3  Parallel composition of TTMs
  580.  
  581. The parallel composition  of two TTMs  
  582. and  is defined in [40] by:
  583.  
  584. Ç    ,
  585.  
  586. Ç     provided  is satisfiable,
  587.  
  588. Ç     where  and hence , and
  589.  
  590. Ç     where . We call  the composite TTM.
  591.  
  592. The above definition holds for shared variables but must be slightly modified for synchro-
  593. nized transitions or channels as described in [40]. Both  and  synchronize with 
  594. respect to the start and tick transitions. The tick transition thus provides the composed sys-
  595. tem with a uniform notion of time.
  596.  
  597. 2.4  Overview of the StateTime toolset
  598.  
  599. The StateTime toolset assists the user (a) to describe devices and systems using a 
  600. graphical structured language, (b) to execute the description so as to validate that the 
  601. description is a reasonable model of the actual system, and (c) to check that the description 
  602. conforms to its requirements using model-checking. We give a brief description below of 
  603. the main features of the toolset needed for the sequel. The reader is referred to [38] for a 
  604. more complete description.
  605.  
  606. The main parts of the toolset of interest to us are the Build tool and its translator to the 
  607. theorem prover and model-checker STeP [31]. The Build tool is a window-based front end 
  608. for constructing compact visual models of real-time systems called TTMcharts. TTM-
  609. charts resemble statecharts, but with a simpler semantics and with the additional feature 
  610. that transitions may have time bounds. We often use the terms TTMcharts, charts and 
  611. TTMs interchangeably as the semantics of TTMcharts is based on TTMs.
  612.  
  613. A chart is a hierarchy of objects. Objects describe control information and impose 
  614. structure on the operation of the system. An object is either primitive, parallel (called 
  615. AND in statecharts) or serial (XOR in statecharts). A primitive object has no internal 
  616. structure. A parallel object is constructed from a collection of child objects (or sub-
  617. objects) by parallel composition. The parallel composition of child objects operates in all 
  618. of these child objects simultaneously. The entry into a parallel object via an event causes 
  619. the simultaneous entry into each of the child objects. The exit from the object causes the 
  620. simultaneous exit from all its children. A serial object is constructed from a collection of 
  621. child objects such that only one of the children operates at a time. The entry and exit from 
  622. a serial object via an event causes the simultaneous entry and exit of the currently operat-
  623. ing child object.
  624.  
  625. Charts may have data variables which are tested and set by events. Each non-primitive 
  626. serial (XOR) object has an object variable which is used to indicate which of its children 
  627. is currently operating. As an example, consider the plant chart (Fig.á2) which will be 
  628. described in more detail in Sect.á5.2. The plant is the parallel composition of two children 
  629. called relay and output which we write as . The serial object relay has 
  630. two children closed and open which are primitive. Zooming in to the output object indicates 
  631. that it is the serial composition of the primitive object wait and the sub-object update. The 
  632. update object is the parallel composition of the pressure and power sub-objects which is 
  633. where the pressure and power sensor values are updated. 
  634.  
  635. FIGURE 2. Plant module
  636.  
  637. module plant(C;P,W)
  638.  
  639. in C: {0,1} where     /* relay activation.  causes the relay to open */
  640.  
  641. out R: {closed, open} where     /* Relay position variable */
  642.  
  643. out P: {0,1} where      /* pressure variable where  is high pressure*/
  644.  
  645. out W: {0,1} where      /* power variable where  is high power*/
  646.  
  647.  
  648.  
  649. Body
  650.  
  651. private D: {wait,update}
  652.  
  653. Specification
  654.  
  655. (Eq. 5):  
  656.  
  657. The above module specification, inherited from Fig.á3 for the relay, is modularly-valid.
  658.  
  659. end module plant
  660.  
  661. The top-level objects relay and output have object variables  and  respectively where 
  662.  and . The state-formula defined by 
  663.  describes a state in which the relay is closed and the next sensor 
  664. update is two ticks away. The pressure  and power  are examples of data variables.
  665.  
  666. A serial object begins execution at its default indicated in bold; e.g. the default for the 
  667. output object is wait (Fig.á2). Once a cycle[0,0] event is taken in the output object, nothing 
  668. else can happen until two ticks of the clock are taken. After two but before the third clock 
  669. tick, the endupdate[2,2] event must occur (in this case, there are no other events to preempt 
  670. its occurrence). Before endupdate occurs, the pressure and power, or just one of them, or 
  671. no update at all may occur. The source of the endupdate event is the structured object 
  672. update; hence endupdate can be taken, no matter where execution in update currently 
  673. resides, and preempts the internal events of update.
  674.  
  675. A user can describe systems incrementally by composing sub-objects together to form 
  676. a super-object (bottom-up), or by decomposing a object into further sub-objects (top-
  677. down). A chart can be executed at any point in the development cycle even before it is 
  678. finally fixed using the interactive simulation tool. The simulation tool displays chart trajec-
  679. tories, and requires user interaction to select the transition to be taken at nondeterministic 
  680. selection points. The Build tool automatically translates TTMcharts into fair transition 
  681. systems according to the algorithm presented in [39]; STeP [31] can then be used to 
  682. model-check the chart for conformance to its specification. 
  683.  
  684. The current StateTime toolset was not meant for modular systems. It suffers from vari-
  685. ous deficiencies including the fact that it does not support interface stubs, automatic gener-
  686. ation of module environments (Sect.á3.0) and refinement. It is easy to verify standard 
  687. temporal properties, but an observer must be constructed for real-time properties. How-
  688. ever, the tool is used in this paper for the construction of modules, their environments 
  689. (done manually) and model-checking module properties. In principal, a chart when loaded 
  690. into STeP can also be verified using theorem proving ï however, theorem proving real-
  691. time properties proved tedious (especially on account of the need to use quantifiers). We 
  692. are currently updating StateTime to fully support real-time modules and real-time formu-
  693. las for both model-checking and theorem proving in a seamless fashion, based on the 
  694. results of this paper.
  695.  
  696. 3.0  Modules and module composition
  697.  
  698. Our notion of a module is based on the untimed reactive modules of Manna and Pnueli 
  699. [32]. Although the Manna Pnueli framework has been used for real-time systems [23], the 
  700. extension to their system for modules as delineated by Chang [8] is different to ours. The 
  701. main differences are: (a) our modules are supported by a model-checker, (b) we provide a 
  702. state-event refinement relation for modules, and (c) the reactive modules of [32] are not 
  703. fully compositional as their parallel composition yields a transition system, not another 
  704. module (composition of our modules yields another module). We now explain these differ-
  705. ences in more detail.
  706.  
  707. Chang [8] advocates a restricted assumption/guarantee style, wherein the environmen-
  708. tal assumption is stated as a restriction on the environment╣s next-state relation. He also 
  709. presents a decision procedure in the propositional case and a deductive system for the dis-
  710. crete time metric temporal logic used for transition modules. Although Chang provides a 
  711. deductive framework for real-time modules, he does not present model-checking algo-
  712. rithms and tools (which are crucial for the needs of this paper).
  713.  
  714. Chang╣s temporal operators are new; they are not expressed in ordinary untimed tempo-
  715. ral logic. The transition modules of [8] must be self-disabling, i.e. once a transition is 
  716. taken it cannot be again enabled (as in a self-loop). The TTM semantics of modules in this 
  717. paper does not impose this restriction on module descriptions.
  718.  
  719. The untimed refinement relation of [32] will not work for real-time modules (as will be 
  720. explained in Sect.á4.0). Hence, in Sect.á4.0, we introduce the necessary framework needed 
  721. for real-time module refinement.
  722.  
  723. The reactive modules of [32] are not fully compositional as their parallel composition 
  724. yields a transition system, not another module. In this section, we provide the notion of a 
  725. fully compositional discrete time transition module (like [8]). This requires a more com-
  726. plete treatment of the notion of the interface stub and modes of variables in a module. It 
  727. also allows our treatment to deduce the trajectories of the composite module given its sub-
  728. modules (Lemma 1), from which we obtain the notion that a module specification must be 
  729. satisfied independently of the behaviour of the environment (Lemma 2), and finally yields 
  730. the Composition Rule (Th.á2). By contrast, [32] starts with the notion of a module as given 
  731. in Lemma 2 and then proceeds from there to obtain the Composition Rule.
  732.  
  733. A module  is defined by its interface stub , body  
  734. and RTTL specification :
  735.  
  736. 1.    The interface stub consists of the declaration of all the variables that are shared 
  737. between module m and other modules in its environment (defined more precisely in 
  738. Sect.á3.2). The stub also declares the initial values of all the shared variables. We let 
  739.  denote the set of shared variables.
  740.  
  741. 2.    The body  is a program whose statements may refer only to variables declared 
  742. private to the body, or to variables in the interface. The set of private variables is 
  743. denoted . In the sequel, the body is a TTM, in which case we let  denote the 
  744. TTM with variables set . The initial condition  is the conjunction 
  745. of all the initial conditions declared on both the private and interface variables. 
  746.  
  747. 3.    The specification  of the module is an RTTL formula in the shared interface vari-
  748. ables. The specification asserts the required visible behaviour of the module.
  749.  
  750. In order to describe the behaviour of a module in an environment that may arbitrarily 
  751. modify the interface variables , we adjoin to the module TTM a spontane-
  752. ous environmental transition  defined by the update function  
  753. (i.e. the interface variables can take on arbitrary values) while all the private variables 
  754. remain unchanged, i.e. . Thus the environmental transition may exhibit 
  755. arbitrary behaviour, except that it may not modify any private variables of the module. 
  756. However, shared interface variables may be changed at any point to any value in their 
  757. respective types.
  758.  
  759. Definition 1: [The TTM associated with a module] The TTM  associated with the 
  760. module  is defined as  where  and 
  761.  where  is the set of transitions of the body TTM, and  is 
  762. the set of fair transitions of the body (note that ). Since  is a TTM, 
  763. we define  and  where  is the set of all pri-
  764. vate variables, i.e variables in . (As before, we require that the timed transition 
  765. model  be non-Zeno).
  766.  
  767. The succession constraint of  allows the body transitions to be interleaved in an arbitrary 
  768. fashion with the environmental transition. The environmental transition thus simulates the 
  769. behaviour of the module in an arbitrary context and allows the module to take stuttering 
  770. steps in which none of the module private variables change from the prestate to the post-
  771. state.
  772.  
  773. The existentially quantified formula  in (Dfn.á1) describes the same system 
  774. as  except with the private variables  hidden, and thus this existential formula can 
  775. be considered a description of  by abstract implementation [32, p.340]. In this style of 
  776. description, we may choose the most straightforward implementation of the module  
  777. and describe its operational behaviour using a TTM (e.g. if  is a buffer, then a private list 
  778. variable may be used to remember sequences of messages). What makes the implementa-
  779. tion abstract is the existential quantification of the private variables. This means that we do 
  780. not require or imply in any way that the real implementation of the module should contain 
  781. any of these private variables (e.g. the list variable in the case of a buffer need not be 
  782. used).
  783.  
  784. Definition 2: [Modular-validity] The RTTL formula p is modularly-valid for the mod-
  785. ule m (written ) iff .
  786.  
  787. 3.1  Parallel composition of modules
  788.  
  789. Modules  (with variable sets ) for  are said to be compatible with each 
  790. other if:
  791.  
  792. Ç    each module has private variables that are not variables of the other module, i.e. 
  793.  and , and
  794.  
  795. Ç    the conjunction of their initial conditions is satisfiable, i.e.  is satisfi-
  796. able, and
  797.  
  798. Ç    the conjunction  is satisfiable. 
  799.  
  800. Compatible module composition, , is defined by  
  801. where , i.e. some of the interface variables of the sub-modules may 
  802. be hidden at the parent level.  is ordinary TTM composition 
  803. (Sect.á2.2). Finally .
  804.  
  805. The private variables of the composite is , and the initial con-
  806. dition is defined by . The super-module  is itself a 
  807. module; the TTM associated with this super-module is just the TTM obtained from 
  808.  together with the environmental transition that may change only variables 
  809. in  (i.e. it may not change any private variables).
  810.  
  811. In the next lemma, we assume that we have two modules  and . If an environmen-
  812. tal transition in a trajectory of module  has the same effect on its interface variables as a 
  813. transition  of , then we relabel the environmental transition in the trajectory to , 
  814. and the set of all the relabelled trajectories of  we call . A symmetric definition 
  815. also provides us with the set  of relabelled trajectories of .
  816.  
  817. Lemmaá1: If  then .
  818.  
  819. Proof: Let . Trivially  and hence the initialization constraint of 
  820.  is satisfied. For the succession constraint, consider any position  of . Either the 
  821. environment transition is taken at position  or some transition of  is taken. The environ-
  822. ment transition of  may not modify any private variables of m and hence may also not 
  823. modify private variables of , so any environment step of  is also an environment step 
  824. of . If some transition of  is taken at position , then it is either a transition of  or 
  825. of  that is taken. Since no transition of  may modify private variables of , a step 
  826. taken by a transition of  (say ) is the same as an environment step relative to  (the 
  827. transition  must be renamed to an environmental transition). Thus at any position either 
  828. a transition of  is taken or an environment transition of  is taken, and hence the suc-
  829. cession constraint  holds. The fairness constraint of  is also satis-
  830. fied, as any transition of  that is enabled infinitely often but not taken would also violate 
  831. the fairness constraint of . The ticking constraint of  is also satisfied, for suppose 
  832. there is a position of  beyond which there is no tick of the clock for , then the ticking 
  833. constraint for  would also be violated. If a transition of  violates its bound constraint, 
  834. then the bound constraint on transitions of  will also be violated. Hence  must also sat-
  835. isfy the bound constraint of . Since  satisfies the initialization, succession, fairness, 
  836. ticking and bound constraints of , it follows that  holds. By symmetry it 
  837. also follows that  holds. Thus . 
  838.  
  839. For the converse, let . At any position of  either a transition of 
  840.  or of  is taken, in which case the same transition belonging  is taken, or an envi-
  841. ronment transition that is an environment transition of both  and  is taken. This envi-
  842. ronment step must also be an environment step of  as no private variables of  and  
  843. could have been changed. We can make similar arguments as before for the other con-
  844. straints but in the converse direction. Hence . n
  845.  
  846. Lemmaá2: Let modules  and  be compatible. Then
  847.  
  848. (a) , and 
  849.  
  850. (b) For a module m,  for any compatible module  and 
  851. RTTL property .
  852.  
  853. Proof: Follows directly from Lemmaá1. n
  854.  
  855. Recall that a property is modularly-valid only if it is satisfied by all trajectories of the 
  856. module. Lemma 1 tells us that the trajectories of the super-module are always a subset of 
  857. those of its sub-modules. This means that a valid specification of a sub-module must also 
  858. be valid for the super-module (Lemma 2a), and that a module specification remains valid 
  859. no matter what the behaviour of its environment is, provided the environment respects the 
  860. compatibility constraints (Lemma 2b).
  861.  
  862. Theoremá2: [Composition Rule]. 
  863. Let  and  be any two compatible modules and let the general-validity given by 
  864.  hold. Then .
  865.  
  866. Proof: Follows directly from Lemmaá2 and temporal logic. n
  867.  
  868. As mentioned in the introduction, the Composition Rule can be used bottom-up or top-
  869. down. In the bottom-up method, pre-existing implemented │off the shelf▓ modules can be 
  870. combined into a super-module that satisfies a system requirement r. In the top-down 
  871. method, we proceed as follows:
  872.  
  873. 1.    The system architect decomposes the system under design () into modules  and 
  874.  by:
  875.  
  876. (a) designing compatible interface stubs  and , and 
  877. (b) designing module specifications such that .
  878.  
  879. 2.    The architect gives each module interface and specification to a programmer. It is the 
  880. job of the programmer to develop the module body so that the specification is modu-
  881. larly-valid. For example, if the programmer is given  and  for the first 
  882. module, he must design a body  so that  where the module  is 
  883. fully described by . 
  884.  
  885. 3.    The required system is then  which is guaranteed by the Composition 
  886. Rule to conform to the requirement .
  887.  
  888. Parts of the development method can be automated by using a combination of model-
  889. checking for proving modular-validity (stepá2), and deductive theorem proving techniques 
  890. can be used for proving that the system requirement is a consequence of the module spec-
  891. ifications (stepá1b). 
  892.  
  893. A compositional proof has the following outline:
  894.  
  895. 1.         is modularly-valid for  (by model-checking)
  896.  
  897. 2.         is modularly-valid for  (by model-checking)
  898.  
  899. 3.        general-validity (deductive theorem proving)
  900.  
  901. 4.        1, 2, 3 and the Composition Rule where 
  902.  
  903. In the sequel, we will leave out the module satisfaction symbol (except for its appearance 
  904. in the last line) and write the above proof as:
  905.  
  906. 1.         is modularly-valid for 
  907.  
  908. 2.         is modularly-valid for 
  909.  
  910. 3.        general-validity
  911.  
  912. 4.        1, 2, 3 and the Composition Rule where 
  913.  
  914. By Lemmaá2 (b), once we know that the context of the proof is the module , then any 
  915. specification of a sub-module of  will also hold for , and hence there is no need to 
  916. indicate which sub-module specification we are dealing with.
  917.  
  918. 3.2  Modes of interface variables
  919.  
  920. The interface stub of a module defined in the previous subsection consists of a set of 
  921. typed shared variables with their initial conditions. We can provide more structure and 
  922. flexibility to the interface specification which will enhance the user╣s ability to understand 
  923. a module.
  924.  
  925. The additional structuring mechanism is provided by describing the modes of the 
  926. shared variables. A variable in the interface stub is either in (the module body can read the 
  927. variable but not write to it), out (the environment can read the variable but not write to it), 
  928. or share (both the body and the environment have write access):
  929.  
  930. interface_stub ::= {mode {variables}+ : type [where init]}*
  931. mode ::= {in | out | share}
  932.  
  933. If a module m has a declaration │out ▓, then no other module in the environment of m 
  934. may have a writing reference to the variable . If two (or more) modules each write to y, 
  935. then they must each have the declaration │share ▓, thus indicating that the external envi-
  936. ronment may also change . 
  937.  
  938. Let the variables in the interface stub be , where  are 
  939. the │in▓ and │share▓ variables (i.e. all variables whose value may be changed by the envi-
  940. ronment), and where  are the remaining interface variables (the │out▓ variables 
  941. that the environment does not change). We often refer to the module by 
  942. , where the semicolon separates the out variables from those that 
  943. the environment can read and modify (the in and share variables).
  944.  
  945. Definition 5: Two modules  and  are interface compatible, provided each vari-
  946. able  satisfies the following constraints: the types declared for  in 
  947. both interfaces match, the conjunction of their where clauses (supposed true when not 
  948. specified) is satisfiable, and if one of the declarations specifies an out mode, then the 
  949. other specifies an in mode.
  950.  
  951. The reactor trip relay module relay (taken from the example in Sect.á5.2) is shown in 
  952. Fig.á3. When the command to open the relay () comes from the environment, then 
  953. the relay is immediately opened () before the next clock tick, thus shutting 
  954. down the reactor. The specification of the relay (see (Eq.á6) in Fig.á3) does not contain the 
  955. next operator  in the consequent; instead, the operator  is used. This is because the 
  956. trajectories of a module may have environmental steps that leave the state unchanged. 
  957. Specifications must therefore allow such │stuttering▓ steps otherwise the specification will 
  958. not be modularly-valid.
  959.  
  960. FIGURE 3. The relay module
  961.  
  962. module relay(C;R)
  963.  
  964. in C: {0,1} where initially 
  965.  
  966. /* when the input command  is given, the relay is opened, and when  the relay is closed */
  967.  
  968. out R: {open, closed} where initially  
  969.  
  970. /* R is the relay object variable that is exported as readonly output */
  971.  
  972. Body TTMchart (using the StateTime Build tool)
  973.  
  974. Specification:
  975.  
  976. (Eq. 6):  
  977.  
  978. /* Informal description: The operator  is needed in the consequent. Although the relay responds to a 
  979. stimulus (i.e. a change in C) before the next clock tick, the reponse is not immediate but may occur a few 
  980. states later (as actions of the environment are interleaved with actions of the relay). The above 
  981. specification is modularly-valid */
  982.  
  983. end module relay.
  984.  
  985. 3.3  A small example of compositional reasoning
  986.  
  987. The module  (Fig.á4) is part of the DRT controller which will 
  988. be discussed in the sequel. The controller consists of three independent microprocessors, 
  989. each one with independent sensors of reactor power and pressure. Each microprocessor 
  990. controller  signals through a variable  whether to open the relay (which shuts 
  991. down the reactor), or to close the relay (allowing the reactor to be started up again). The in 
  992. variables of majorVote are thus , and the out variable is , which is set to 1 
  993. when the majority of the microprocessor vote for opening the relay (i.e. when 
  994. ). The specification  can be shown to be modularly-valid 
  995. by model-checking.
  996.  
  997. FIGURE 4. Module for majority voting logic
  998.  
  999. module majorVote(C1,C2,C3;C)
  1000.  
  1001. with bitType={0,1}    
  1002.  
  1003. in : bitType; áá/* 1 stands for a vote to open the relay, and 0 to close the relay. */
  1004.  
  1005. out : bitType where initially       á/* Only majorVote can write to  to set the relay*/
  1006.  
  1007.  
  1008.  
  1009. Body
  1010.  
  1011. private : bitType where initially     /* majority vote object variable*/.
  1012.  
  1013. Specification
  1014.  
  1015. (EQ 7): 
  1016.  
  1017. /*Informal description
  1018.  
  1019. The first line of the specification states that once the majority of microprocessor controllers vote to 
  1020. open the relay, and this vote remains in place for time 20 ticks, then within one tick of the clock, 
  1021. the output variable  will be set so as to command the relay to open, and will remain set for 20 
  1022. ticks of the clock. The second line states a similar specification for the command to close the relay. 
  1023. */
  1024.  
  1025. end module majorVote
  1026.  
  1027. The relay module (Fig.á3) and the voting module (Fig.á4) are interface compatible. We 
  1028. may therefore use the modularly-valid module specifications (Eq.á6) and (Eq.á7), and the 
  1029. Composition Rule to prove the validity of
  1030.  
  1031. (Eq. 8) 
  1032.  
  1033. where p is defined by:
  1034.  
  1035. (Eq. 9)p: 
  1036.  
  1037. The proof of the first conjunct of (Eq.á9) is as follows:
  1038.  
  1039. 1.        by modular-validity of (Eq.á7)
  1040.  
  1041. 2.        by modular-validity of (Eq.á6)
  1042.  
  1043. 3.        (2) and RTTL 
  1044.  
  1045. 4.        (3) and RTTL
  1046.  
  1047. 5.        (1), (4) and Composition Rule
  1048.  
  1049. The temporal logic reasoning is performed in the RTTL proof system. For example, the 
  1050. RTTL theorem used in step (3) is: .
  1051.  
  1052. The Composition Rule provides a powerful technique for beating combinatorial explo-
  1053. sion of states. To verify a global requirement r of a system composed of modules, it is not 
  1054. necessary to deal with the complete system (e.g. by generating its global reachability 
  1055. graph). Instead, we need only verify the specification of each of its objects one at a time, 
  1056. provided we can show that the object specifications entail the global requirement.
  1057.  
  1058. The modular-validity of module specifications for a module  can be determined by 
  1059. applying the model-checking and theorem proving tools of StateTime (Sect.á2.4) to the 
  1060. TTM  that corresponds to . For example, the relay module specification  in 
  1061. Fig.á3 can be proved modularly-valid by model-checking the set of transitions associated 
  1062. with the body together with the nondeterministic environmental transition with update 
  1063. function choose(C), which allows the input variable C to vary arbitrarily.
  1064.  
  1065. In the above relay example, an unrestricted environment was used to check the modu-
  1066. lar-validity of the module specification. This is not always possible as an unrestricted envi-
  1067. ronment can sometimes generate larger intermediate reachability graphs than the 
  1068. reachability graph obtained when the environment is limited to a known set of fixed mod-
  1069. ules. This is because certain states of the module in an unrestricted environment may be 
  1070. unreachable in the composite. There are two ways to address this issue: either (a) decom-
  1071. pose the module into smaller sub-modules where an unrestricted environment will not be 
  1072. problematic, or (b) restrict the environment of the module to the actual environment in 
  1073. which the module is expected to operate.
  1074.  
  1075. The easiest way to restrict the environment involves the use of conditional specifica-
  1076. tions for the module of the form  which asserts that if the environment is assumed 
  1077. to behave according to the RTTL formula  then the module is guaranteed to behave 
  1078. according to the RTTL formula . In other frameworks, such conditional specifications are 
  1079. called assumption/guarantee properties [22], and special rules are provided for reasoning 
  1080. about them. In our framework, conditional specifications are no different from any other 
  1081. module specifications. Our purpose will be to show that  is modularly-valid for 
  1082. the module , i.e. . This does not contradict our definition that a module 
  1083. specification should hold independently of what the environment does. The property  
  1084. will indeed hold true only if the module environment behaves according to . However, 
  1085.  holds for the module in any environment; this is because if the environment does 
  1086. not satisfy , then  need not hold true [32, p.356].
  1087.  
  1088. In the sequel, we deal with modules that are intended to work in fixed environments. 
  1089. For example, the environment of the DRT controller module (Sect.á5.0) is the plant which 
  1090. will remain fixed throughout the design. Consider a conditional specification 
  1091.  for one of the controller sub-modules  which asserts that if the plant 
  1092. (which is the environment of m) behaves according to  then m will behave 
  1093. according to . To verify the modular-validity  in an unrestricted envi-
  1094. ronment in which the plant output variables can take on any value at any moment, will 
  1095. generate a larger reachability graph than necessary because there will be states that are not 
  1096. reachable in practice. The actual plant sensors are filtered and hence change only every 
  1097. two ticks of the clock. Thus we do not need to consider all the possibilities generated by 
  1098. continuously changing sensor values. Instead, we can verify  which will 
  1099. involve a smaller reachability graph in which plant changes occur only every two ticks. 
  1100. The following theorem justifies this procedure.
  1101.  
  1102. Theoremá3: Let  and  be two compatible modules and p an RTTL formula in the 
  1103. interface variables. Then .
  1104.  
  1105. Proof:
  1106.  
  1107.  
  1108.  
  1109. < (Th.á1)(a) á>
  1110.  
  1111.  
  1112.  
  1113. < propositional temporal logic >
  1114.  
  1115.  
  1116.  
  1117. < Composition Rule and  holds for  by (Th.á1)(b) >
  1118.  
  1119. . n
  1120.  
  1121. 4.0  Module refinement
  1122.  
  1123. If a module m has been implemented with a given body, under what conditions can we 
  1124. replace the body with a new one while still retaining the same observed timed behaviour at 
  1125. the interface stub? One possibility is to use the notion of program equivalence of untimed 
  1126. concurrent programs developed in [32, p46]. However, this notion of equivalence will not 
  1127. work for our real-time reactive modules. 
  1128.  
  1129. Consider a program with two variables  and . In [32, p46], a sub-sequence 
  1130.  is reduced to 
  1131.  if we want to observe variable . We have thus lost a 
  1132. record of one of the clock ticks, because in the refinement relation of [32], program states 
  1133. that are identical to their predecessors are omitted from the sequence. But, in real time sys-
  1134. tems, it is essential that the reduced system show the same timed behaviour as the original 
  1135. system. We will thus need to define a notion of observational equivalence that takes into 
  1136. account state (data such as the value of ) as well as events (ticks of the clock). In this sec-
  1137. tion, we adapt the state-event notion of observational equivalence developed in [26,27,28] 
  1138. to the needs of real-time reactive modules. Because we need to deal with both states and 
  1139. events, we also cannot just use the standard event-based notion of bisimulation [33], as 
  1140. will be explained in this section.
  1141.  
  1142. Consider two modules that have the same interface stub but different bodies. For such 
  1143. modules we will define a notion of module observational equivalence that is composition-
  1144. ally consistent and preserves any stuttering invariant RTTL module specification (detailed 
  1145. explanation follows below). Thus the first body can be replaced by the second with a guar-
  1146. antee that any module specification that holds for the first will also hold for the second, 
  1147. and vice versa. Observational equivalence will allow us to refine an abstract module into 
  1148. one closer to code implementation. The abstract module may have a substantially smaller 
  1149. state space than the refinement and hence will be more amenable to model-checking.
  1150.  
  1151. Informally, if a module  is equivalent to a module  having the same interface stub 
  1152. (written ) then  preserves the timed behavior of  over the interface variables. 
  1153. We want a notion of observational equivalence that only distinguishes between the two 
  1154. modules if the distinction can be detected by an external agent interacting with each of 
  1155. them. The agent can observe any of the interface variables and the start transition and tick 
  1156. of the conceptual global clock, but not any of the private variables or internal transitions 
  1157. which are unobservable to the external agent. We call such internal unobservable actions 
  1158. -transitions. Although an external agent may not be able to observe an internal transition 
  1159. itself, it may be able to observe the effects of the internal transition (e.g. if the internal 
  1160. transition changes one of the interface variables).
  1161.  
  1162. 4.1  Observation equivalence of TTMs
  1163.  
  1164. In [37], an algorithm is given for constructing the reachability graph of a TTM. The 
  1165. reachability graph is used as the basis for model-checking RTTL formulas, as maximal 
  1166. fair paths in the reachability graph correspond to TTM trajectories. 
  1167.  
  1168. We illustrate the concept of a reachability graph by referring the reader to the sample 
  1169. TTM  with variables set  as shown in Fig.á5. The reachability graph of  
  1170. is also shown in Fig.á5. The reachability graph is a labelled transi-
  1171. tion system with state set , transition label set ,  is a set 
  1172.  of binary relations on , and the initial state is . 
  1173.  
  1174. If  and  then  holds precisely when  (i.e.  is a -suc-
  1175. cessor of ) where  are the restrictions of  respectively, and  both occur in tra-
  1176. jectories of the TTM . Let  be an abbreviation for  which is called a -
  1177. step from  to . The notation  denotes a sequence of 
  1178. steps in the graph. Any maximal sequence of steps in the reachability graph corresponds to 
  1179. a trajectory of the TTM respecting the initialization, succession, fairness, and bound con-
  1180. straints (Sect.á2.2).
  1181.  
  1182. The timed behaviour of the TTM  in Fig.á5 is equivalent to  with respect to the 
  1183. observable variable  (in a sense to be made precise in the sequel). In this weakly observ-
  1184. able setting, the  and  transitions are observable but no other transitions are visi-
  1185. ble to an external agent. The observable variables set is ; we require that the 
  1186. variable  be in the variables set of both TTMs. The TTM  is much simpler than  
  1187. and has a smaller reachability graph (Fig.á5). We therefore call  an abstract specifica-
  1188. tion of the concrete refinement .
  1189.  
  1190. FIGURE 5. Observably equivalent TTMs
  1191.  
  1192. TTMs  and  are observationally equivalent, i.e. .
  1193.  
  1194.  
  1195.  
  1196. For the precise definition of observation equivalence, we need the concepts of state pro-
  1197. jection operators and unobservable -transitions. For a set of observable variables  of a 
  1198. given TTM, the observable state projection operator  tells us when states  and  
  1199. agree when restricted to their observable variables. For example, if we are given the states 
  1200. ,  and the observable variables set , then
  1201.  
  1202.  
  1203.  
  1204. as they agree on the  component of the state.
  1205.  
  1206. An external agent interacting with the TTM  can observe the start and tick transi-
  1207. tions; but the other transitions  and  are unobservable. Similarly, the transition  in  
  1208. is unobservable. We will relabel the edges of reachability graphs so that all unobservable 
  1209. transitions are called . Although the -transition itself is unobservable to an external 
  1210. agent, its effect may be observable (e.g. when the transition is taken it may change an 
  1211. observable variable); however, the external agent is unable to tell which transition caused 
  1212. that effect. 
  1213.  
  1214. Definition 6: [State-event labelled transitions systems SELTS] Let  be 
  1215. a TTM, and let  be a given set of observable variables. Let the reachability graph 
  1216. of  be  where  is a countable set of states and  is the 
  1217. initial state. Then  is a labelled transition system, called a state-
  1218. event labelled transition system (or SELTS), where  and 
  1219.  where:
  1220.  
  1221. (Eq. 10)
  1222.  
  1223. (Eq.á10) achieves the required relabelling, i.e. all transitions in the reachability graph other 
  1224. than start and tick are now relabelled to the unobservable -transition in the corresponding 
  1225. SELTS. The following definition is needed for the weak state-event bisimulation:
  1226.  
  1227. Definition 7: The unobservable move  is defined by: 
  1228.  
  1229.  
  1230.  
  1231. The action of taking an observable step  (i.e.  is either start or tick) in a SELTS 
  1232. that has (possibly empty) sequences of unobservable steps on both sides is defined by:
  1233.  
  1234.  
  1235.  
  1236. We also define a similar move for the unobservable -transition (which may or may 
  1237. not cause a change in the observable variables) by:
  1238.  
  1239.  
  1240.  
  1241. We are now ready to define the notion of a weak state-event bisimulation relation. In 
  1242. the weakly observable setting with unobservable -steps, the steps  and  are 
  1243. indistinguishable, producing the same observations (or possibly lack of observation in the 
  1244. case of a  move).
  1245.  
  1246. Definition 8: [Weak state-event bisimulation] Let  be state 
  1247. event labelled transition systems for the TTMs  for  with a common observ-
  1248. able variables set . Then the relation  is a weak state-event bisimulation 
  1249. relation if :  and 
  1250.  
  1251. Ç     implies 
  1252.  
  1253. Ç     implies 
  1254.  
  1255. The above definition of bisimulation can be paraphrased by saying that two states are 
  1256. weakly bisimilar if any move from one of the states to a new state can be matched by the 
  1257. other state making a move, or sequence of moves, producing the same observations on 
  1258. both the observable variables and the observable transitions (start and tick) and reaching a 
  1259. state that is weakly bisimilar to the state reached from the first state. 
  1260.  
  1261. The standard notion of bisimulation [33] is defined with respect to the events of a 
  1262. labelled transition system. While it is possible to describe systems using only state infor-
  1263. mation or event information, there are many applications where the use of both state and 
  1264. event information is quite natural. The above notion of (weak) bisimulation is defined not 
  1265. only with respect to the observable events of the labelled transition system (needed to 
  1266. maintain a global notion of time via the clock tick), but also with respect to the states of the 
  1267. labelled transition system (needed for dealing with properties involving the observable 
  1268. variables). For TTMs that must synchronize with each other via shared events (in addition 
  1269. to start and tick), the set  in (Dfn.á6) can be expanded quite naturally to include any such 
  1270. additional synchronized events without the need to change the definition of bisimulation.
  1271.  
  1272. Since weak bisimulations are closed under union, there is always a largest weak bisim-
  1273. ulation relation (which we denote by the infix operator ) relating the states of  to that 
  1274. of  for an observable set of variables . Thus if  (respectively ) is a state of the 
  1275. reachability graph of  (respectively ) then we can write  whenever 
  1276. . This leads to the notion of state-event equivalence of TTMs:
  1277.  
  1278. Definition 9: [] Let  (with initial state ) and  (with initial state 
  1279. ) be two TTMs with variables sets  and  respectively. Let  be a 
  1280. given observable set of variables. Then  and  are called state-event equivalent 
  1281. over  (written: ) provided .
  1282.  
  1283. Where the observable set of variables is fixed from the context to , we write . 
  1284. For the example TTMs in Fig.á5 with observable variables set , we have that 
  1285. .
  1286.  
  1287. For finite state TTMs, [28] provides an efficient polynomial time algorithm for check-
  1288. ing the equivalence of two TTMs. For possibly infinite state TTMs, [27] presents equiva-
  1289. lence preserving transformations. The following theorems indicate the usefulness of state-
  1290. event equivalence [26]. 
  1291.  
  1292. Lemmaá3: (corollary of Lemma 2 in [26]) 
  1293. Given TTMs  all having the same observable variables set, then 
  1294.  
  1295.  
  1296. Thus, state-event equivalence of TTMs is compositionally consistent, i.e. the designer can 
  1297. replace a TTM with an equivalent refinement with a guarantee that the observed time 
  1298. behavior will be unchanged.
  1299.  
  1300. The set of SESI (state-event stuttering invariant) temporal logic formulas is defined in 
  1301. [26]. We will only need a subset of SESI formulas for the sequel, which we now define. An 
  1302. atomic SESI formula atomic_sesi of a module m is any state-formula, having no occur-
  1303. rences of the transition variable , and whose free variables are the observable variables, 
  1304. i.e. the variables in . A SESI formula is defined by:
  1305.  
  1306. (Eq. 11)sesi ::= atomic_sesi |  |  |  |  | 
  1307.  
  1308. The formula  is SESI as it is derived from the bounded until operator which itself is 
  1309. SESI. Also  is SESI because all the other temporal logic operators, except 
  1310. for next, can be obtained from the until operator. The  operator can usually replace the 
  1311. next operator. It is shown in [26] that some formulas involving the next operator are also 
  1312. SESI, but we will not need these for the sequel.
  1313.  
  1314. Lemmaá4: (corollary of Theorem 3 in [26]) Let  be a SESI formula with a given 
  1315. observable variables set . If  and  are TTMs such that  then: 
  1316. .
  1317.  
  1318. The above lemma is significant for model-checking. We may check an abstraction  
  1319. for conformance to  rather than its more complex refinement , with a guarantee that  
  1320. will also hold for the refinement, provided the TTMs are non-Zeno.
  1321.  
  1322. 4.2  Observation equivalence of modules
  1323.  
  1324. The behaviour of a module  was defined in Sect.á3.0 with the help of an associated 
  1325. TTM , which is the composition of the body TTM and an environment transition that 
  1326. arbitrarily changes interface variables .
  1327.  
  1328. Definition 10: [state-event equivalence of modules] Let  and  be two modules 
  1329. having precisely the same interface variables (i.e. ). The observable 
  1330. variables set  of these modules is defined as . The corresponding 
  1331. reachability graph of each of these modules is  for  from 
  1332. which their corresponding SELTS can be obtained as in (Dfn.á6). The state event equiv-
  1333. alence of these modules is then defined by: . 
  1334.  
  1335. As with TTMs, one may check the conformance of an abstract module for conformance 
  1336. to its specification with the guarantee that the refinement will also satisfy its specification, 
  1337. as stated in the following theorem.
  1338.  
  1339. Theoremá4: [Refinement Rule] Let  be an arbitrary SESI formula for non-Zeno mod-
  1340. ules  and  having the same interface variables such that . Then: 
  1341. .
  1342.  
  1343. Proof: Since  we have that  where  is the TTM corresponding 
  1344. to the module (Dfn.á1) for  and . By Lemmaá4, it follows 
  1345. that . Since the modules are non-
  1346. Zeno,  holds. Hence, by the definition of modular-validity (Dfn.á2) 
  1347.  holds as required. n
  1348.  
  1349. 5.0  Modular Design of the delay reactor trip (DRT)
  1350.  
  1351. Industrial reactive systems are often specified using a combination of timing diagrams, 
  1352. pseudocode and careful English narrative. This has the considerable advantage that it is 
  1353. accessible and intelligible to a wide community. It has the disadvantage that even the most 
  1354. lucid informal descriptions are prone to omissions and ambiguities. More importantly, 
  1355. conformance analysis can only be undertaken in a more precise setting.
  1356.  
  1357. In this section we describe an example taken from the actual requirements document 
  1358. for the shutdown system of an industrial nuclear reactor. We translate the informal descrip-
  1359. tions and requirements into precise counterparts in the TTM/RTTL framework, and then 
  1360. use the modular development method developed in this paper to design the system and 
  1361. check its conformance to requirements. The abstract design so obtained can then be 
  1362. refined down to a format close to pseudocode suggested in the original requirements docu-
  1363. ment. This is not the way the original problem was presented. Originally, the pseudocode 
  1364. was a given, and the engineers wanted to know if the pseudocode satisfied the informal 
  1365. requirements as presented in the timing diagram. This reverse engineering problem can be 
  1366. solved using the same compositional and abstraction techniques but working bottom-up 
  1367. (see [38] for the reverse engineering problem).
  1368.  
  1369. 5.1  Informal description of the problem
  1370.  
  1371. In early nuclear reactors, the shutdown systems were constructed of analog devices. 
  1372. The analog control had the virtue of being simple to understand but inflexible, unable to 
  1373. perform system checks and not always reliable. It was felt that the situation could be 
  1374. improved by installing computerized control with at least two independent shutdown sys-
  1375. tems, designed by different teams, each shutdown system itself having 3-version control 
  1376. and majority voting logic [43].
  1377.  
  1378. The delayed reactor trip (DRT) problem was first described by Lawford et. al. [27]. 
  1379. Lawford developed behaviour preserving transformations for timed transition models 
  1380. (TTMs) with which he was able to discover a flaw in the proposed design [25] involving a 
  1381. single controller. However, the transformational theory cannot be fully automated as no set 
  1382. of transformations is complete for proving observation equivalence between the actual 
  1383. implementation and its abstract specification. In [38], the StateTime toolset was used to 
  1384. verify the single controller case, where it also helped to find a bug in the original specifica-
  1385. tion. A corrected version of the pseudocode was shown to conform to its requirements by 
  1386. model-checking.
  1387.  
  1388. In this paper we consider the case of 3-version control using a majority voting circuit to 
  1389. determine control actions. The StateTime toolset was not able to model-check the com-
  1390. plete system due to a combinatorial explosion of states. However, using a combination of 
  1391. model-checking and deductive techniques in the modular framework, the conformance of 
  1392. the systems to its requirements can be demonstrated.
  1393.  
  1394. The DRT for nuclear reactors used to be implemented in hardware using timers, com-
  1395. parators and logic gates similar to the timing diagram shown in Fig.á6. The new DRT sys-
  1396. tem is implemented on microprocessors. Digital control systems provide cost savings and 
  1397. flexibility over the hardware implementation. However, the question now is whether the 
  1398. new microprocessor based software controller satisfies the same specifications as the old 
  1399. hardware implementation. 
  1400.  
  1401. FIGURE 6. Analog implementation of the delay relay trip timing.
  1402.  
  1403.  
  1404.  
  1405. The hardware version of the controller implements the following informal require-
  1406. ments:
  1407.  
  1408.     [R1] When the power and pressure of the reactor exceed acceptable 
  1409. safety limits, the comparators which feed in to the first AND gate 
  1410. cause Timer1 to start. After 3 seconds, Timer1 sends a message to 
  1411. one of the inputs of the second AND gate indicating that the time-
  1412. out has occurred. If after this first time-out the power is still greater 
  1413. than its safety limit, then the relay is tripped (opened), and Timer2 
  1414. starts. The relay must remain open until Timer2 times out which 
  1415. happens after 2 seconds. 
  1416.  
  1417. Requirement [R1] ensures that the relay is opened and remains open for two seconds 
  1418. thus shutting down the nuclear reactor in a timely fashion. If the controller fails to shut 
  1419. down the reactor properly, then catastrophic results might follow including danger to life. 
  1420. By the same token, each time the reactor is unnecessarily shut down, the utility operating 
  1421. the reactor loses money because it must bring additional fossil fuel generating stations on 
  1422. line to meet demand. The next informal requirement states:
  1423.  
  1424.             [R2] If the power reduces to an acceptable level then the relay 
  1425. should be closed as soon as possible (thus allowing the reactor to 
  1426. operate once more).
  1427.  
  1428. In the actual DRT, there are three identical microprocessors that have independent sensors 
  1429. for power and pressure. The final decision on when to shut down the reactor is based on a 
  1430. majority vote of the three microprocessors. 
  1431.  
  1432. The code is to be implemented on a microprocessor with a cycle time of 100ms. The 
  1433. microprocessor samples the inputs (pressure  and power ) and passes through a block 
  1434. of code every 0.1 seconds. It is assumed that the input signals have been properly filtered 
  1435. and that the sampling rate is sufficient to ensure adequate control. In the formal model, 
  1436. one tick of the clock will represent 100ms.
  1437.  
  1438. 5.2  Formal requirements
  1439.  
  1440. The first step is to decompose the drt into two parallel modules the plant and the control-
  1441. ler, i.e. . The plant corresponds to the part of the system that is 
  1442. fixed and known. The controller is the part of the system that must be designed.
  1443.  
  1444. The observable variables of the DRT are shown in the data flow diagram of Fig.á7. The 
  1445. plant outputs are the relay position (), power () and pressure () variables. The input 
  1446. to the plant () is a relay activation variable that can be used to force the relay to open or 
  1447. close. In the absence of control, the plant can behave unsafely. For example, if pressure 
  1448. and power both go to unsafe levels, there is nothing to force the relay to trip. 
  1449.  
  1450. FIGURE 7. The observable inputs and outputs of the DRT
  1451.  
  1452.  
  1453.  
  1454. The plant (Fig.á2) was described previously in Sect.á2.4 in the discussion of the 
  1455. StateTime toolset and in the description of the relay module (Fig.á3). The output object of 
  1456. the plant updates the pressure and power readings at most every two ticks of the clock. If 
  1457. the endupdate event is deleted with only the update object remaining, then pressure and 
  1458. power would be forced to change their values. With endupdate included, the sensor updates 
  1459. can be preempted thus leaving open the possibility that pressure or power (or both) remain 
  1460. unchanged for an additional two ticks.
  1461.  
  1462. The output object for power and pressure updates could have been included in the con-
  1463. troller as it represents the filtered sensor readings not the generation of power and pressure 
  1464. in the plant itself which are continuously changing. Since the output object behaviour is 
  1465. fixed and known a priori, it is more convenient to include it with the plant.
  1466.  
  1467. In contrast to the plant, parts of the controller are initially unknown. It is known that 
  1468. there will be 3 microprocessors together with a majority voting circuit, i.e. the controller 
  1469. can be decomposed into sub-modules (Fig.á8) described by:
  1470.  
  1471. FIGURE 8. Architecture of the controller based on majority voting control
  1472.  
  1473. module controller
  1474.  
  1475. in W, P         /* power and pressure variables from the plant */
  1476.  
  1477. out C : {0,1} where     /* relay activation variable based on majority vote.  
  1478. means send a signal to the relay to request it to open */
  1479.  
  1480. out : {fail, normal} where  for 
  1481.  
  1482.     /* failure variables needed for specifying failed behaviour */
  1483.  
  1484. out : {0,1} where  for  áááá/*  means the j-th microprocessor is at 
  1485. or has returned to the beginning of a timing cycle where it 
  1486. waits for unsafe power or pressure signals*/
  1487.  
  1488. Body
  1489.  
  1490. private  : {0,1} where for 
  1491.  
  1492. /* The j-th microprocessor outputs a relay activation variable  as input to the majority voting cir-
  1493. cuit. The majority voter must decide, based on the microprocessor relay activation variables, whether 
  1494. to send an actual command to the relay of the plant via . The interconnection diagram between the 
  1495. modules of the controller is shown below: */
  1496.  
  1497. Specification :
  1498.  
  1499. (Eq. 12)
  1500.  
  1501. The formulas bothHi, powerHi and powerLo are defined in (Eq.á17). The module specification 
  1502. (Eq.á12) is similar to the DRT requirement R but with the controller output variable C playing the 
  1503. same role for the controller specification that the relay variable plays in R. The specification is stated 
  1504. under the proviso that at least two of the microprocessors work normally, as the majority voting logic 
  1505. is only robust with respect to a single failure. The last conjunct of the consequent asserts that the con-
  1506. troller cycle is at most 52 ticks of the clock, after which it is guaranteed to be back at its initial posi-
  1507. tion (it is not 50 ticks as it may take up to two ticks to detect a change in the plant). Since the 
  1508. environment of the controller is the (fixed) plant, the controller specification can be weakened to:
  1509.  
  1510. (Eq. 13)á(Eq.á12)
  1511.  
  1512. end controller
  1513.  
  1514. (Eq. 14)
  1515.  
  1516. The microprocessors can either be in a normal or failed mode. The j-th microprocessor 
  1517. thus has an observable out variable  with  (Fig.á7). However, 
  1518. the precise nature of the normal behaviour is initially unknown, although the informal tim-
  1519. ing diagram (Fig.á6) does provide some guidance.
  1520.  
  1521. It is necessary to be able to tell when a microprocessor is at the initial point of a timing 
  1522. cycle where it checks for unsafe pressure and power levels (before invoking the two timers 
  1523. described in Fig.á6). Once a timing cycle is initiated in response to unsafe power or pres-
  1524. sure levels, a new timing cycle cannot be initiated until the controller returns to its initial 
  1525. point. Hence, the j-th microprocessor also has an observable out variable  with 
  1526.  where  means that the microprocessor is at its initial point. We 
  1527. require that a microprocessor timing cycle take no longer than the combination of the two 
  1528. timers which is 50 ticks with an additional two ticks to cover controller reaction times, i.e. 
  1529. .
  1530.  
  1531. We are now in a position to state the DRT requirements for 3-version control. The 
  1532. informal requirements [R1] and [R2] can be stated in temporal logic for any two function-
  1533. ing microprocessors  and  as:
  1534.  
  1535. (Eq. 15)R1: 
  1536.  
  1537. (Eq. 16)R2: 
  1538.  
  1539. where the predicates bothHi, powerHi and powerLo are defined as:
  1540.  
  1541. (Eq. 17)
  1542.  
  1543. The controller can only react to changes in the pressure and power that persist long 
  1544. enough for the controller to be guaranteed to detect them (2 ticks of the clock). The con-
  1545. troller microprocessors can sample pressure and power only once every tick of the clock. 
  1546. Hence, we require that the pressure and power both remain high for at least two ticks of 
  1547. the clock for the relay to open [R1]. Similar considerations apply when closing the relay 
  1548. [R2].
  1549.  
  1550. The requirements as stated above do not take into account the possibility of micropro-
  1551. cessor failures. R1 and R2 can only be required to hold if at least two of the microproces-
  1552. sors are functioning normally. The final requirement R is therefore:
  1553.  
  1554. (Eq. 18)R: 
  1555.  
  1556. where the integer variables i and j range over the three microprocessor controllers, i.e. 
  1557. .
  1558.  
  1559. 5.3  Problem to be solved
  1560.  
  1561. We must prove that the DRT conforms to its requirements. Formally, this means we 
  1562. must prove that  holds where  and R is the formula given 
  1563. in (Eq.á18). Using the Composition Rule, a proof outline is:
  1564.  
  1565. 1.        modular-validity of (Eq.á5) in Fig.á2 for the plant by model-checking
  1566.  
  1567. 2.        modular-validity of (Eq.á12) in Fig.á8 for the controller by model-checking
  1568.  
  1569. 3.        general-validity (similar to the proof of (Eq.á8))
  1570.  
  1571. 4.        1, 2, 3 and the Composition Rule
  1572.  
  1573. 5.        
  1574.  
  1575. The body of the plant module is given in Fig.á2. The only input variable to the plant is 
  1576. the relay activation variable , which can be altered arbitrarily by the environment transi-
  1577. tion without generating too large a reachability graph. Hence stepá1 in the above proof out-
  1578. line was verified using StateTime model-checking. 
  1579.  
  1580. The only part of the above proof that cannot be verified is stepá2, as the controller body 
  1581. is only partially defined at this point in the development. Thus we must complete the 
  1582. design of the controller by designing its body, and demonstrate the modular validity of the 
  1583. controller specification. Then the above proof outline guarantees that the DRT conforms 
  1584. to its requirements.
  1585.  
  1586. In checking the modular-validity of the controller specification (Eq.á12), it is sufficient 
  1587. replace stepá2 above with the weaker specification (Eq.á13). Instead of using an unre-
  1588. stricted environment transition, (Th.á3) allows us to check sub-modules of the controller in 
  1589. the environment . The resultant reachability graphs of the sub-modules are much 
  1590. smaller than if an unrestricted environment transition is used. The above proof that the 
  1591. DRT conforms to its requirements then becomes:
  1592.  
  1593. 1.        modular-validity of the plant specification
  1594.  
  1595. 2.        modular-validity of (Eq.á13) in Fig.á8 for the controller
  1596.  
  1597. 3.        (Th.á1)(b)
  1598.  
  1599. 4.        2,3 and temporal logic
  1600.  
  1601. 5.        general-validity via deductive theorem proving
  1602.  
  1603. 6.        1, 4, 5 and the Composition Rule
  1604.  
  1605. The design of the DRT controller will be performed using the structured compositional 
  1606. approach described by the structure diagram (Fig.á1) as outlined in the introduction. The 
  1607. structure diagram for the DRT is given in Fig.á9.
  1608.  
  1609. FIGURE 9. Structure diagram for the DRT
  1610.  
  1611. See Fig.á1 in the introduction for the interpretation of the structure diagram
  1612.  
  1613. 5.4  Controller design
  1614.  
  1615. A partial description of the controller was provided in Fig.á8. The majorityVote sub-
  1616. module of the controller was described in Sect.á3.3 (Fig.á4). We must now design the 
  1617. microprocessor sub-modules. The body of the module  is shown in Fig.á10, with 
  1618. the other two microprocessors having symmetric descriptions. 
  1619.  
  1620. FIGURE 10. Control module 
  1621.  
  1622. module micro1
  1623.  
  1624. in W,P     /* power and pressure from the plant */
  1625.  
  1626. out : {0,1} where      /* the fail variable */
  1627.  
  1628. out : {0,1} where     /* relay activation variable*/
  1629.  
  1630. out : {0,1} where     /* initial condition variable for start of timing cycle */
  1631.  
  1632.  
  1633.  
  1634. Body
  1635.  
  1636. private  where         /* object variable of normal */
  1637.  
  1638. Specification:
  1639.  
  1640.  
  1641. where: áá
  1642.  
  1643. end module
  1644.  
  1645. The normal object of the controller (Fig.á10) is a more thorough description of the infor-
  1646. mal timing diagram of the analog controller (Fig.á6). The lower and upper time bounds of 
  1647. 1 in the transitions of normal indicate that the microprocessor samples the sensor inputs 
  1648. and passes through a block of control code every tick of the clock (0.1 seconds). Once 
  1649. unsafe power and pressure levels are detected by the transition mu, the normal object waits 
  1650. in activity n1 for 29 clock ticks (2.9 seconds) before proceeding to activity n2. If the power 
  1651. is still high then the relay activity variable  is set via transition alpha, else the system 
  1652. resets via transition rho1. The second timer Timer2 of the analog controller is described by 
  1653. the delay20 transition. The beta transition resets the control activation variable when power 
  1654. returns to normal levels.
  1655.  
  1656. It is obvious from the foregoing that TTMs can provide precise convenient descriptions 
  1657. of timing information. The normal object can be seen as a high level specification of the 
  1658. microprocessor. The microprocessors do not have delay and time-out constructs; rather, 
  1659. timing variables must be incremented every pass through the block of code to keep track 
  1660. of the passage of time. In Sect.á5.5, normal will be refined closer to code that can be imple-
  1661. mented on the microprocessors.
  1662.  
  1663. Once the body of the microprocessor module is known, the modular-validity of 
  1664.  in Fig.á10 can then be verified via StateTime model-checking. As explained at 
  1665. the end of Sect.á5.3, the controller will be used in the constrained environment of the plant. 
  1666. Hence we need not consider an environment transition that can arbitrarily modify power 
  1667. and pressure. The output object of the plant (Fig.á2) allows updates of power and pressure 
  1668. at most once every two ticks of the clock; this constrained environment will produce a 
  1669. smaller reachability graph. Hence, instead of showing the modular-validity of  
  1670. (Eq.á12), we can verify the weaker validity (Eq.á13) given by
  1671.  
  1672.  
  1673.  
  1674. by model checking .
  1675.  
  1676. Since the microprocessor and majority vote modules satisfy their module specifica-
  1677. tions, we can now show that  is modularly-valid. Let  be integer vari-
  1678. ables that range over the three microprocessors (). Then
  1679.  
  1680. 1.        Assume
  1681.  
  1682. 2.        modular validity 
  1683.  
  1684. 3.        modular validity of     
  1685.  
  1686. 4.        2,3 and the Composition Rule
  1687.  
  1688. 5.        1, 4 and temporal logic (see Fig.á10 for the micro specifications )
  1689.  
  1690. 6.        general-validity
  1691.  
  1692. 7.        integer reasoning
  1693.  
  1694. 8.             1,5,6,7 and temporal logic
  1695.  
  1696. 9.        modular-validity of majorityVote module
  1697.  
  1698. 10.            8,9 and the Composition Rule
  1699.  
  1700. Line (10) of the above proof produces the first conjunct in the consequent of the controller specification 
  1701. (Eq.á12). The other conjuncts are obtained by similar (and much simpler) reasoning. We thus have:
  1702.  
  1703. 11.        discharging 1.
  1704.  
  1705. 12.        i and j were arbitrary; a constrained environment was used
  1706.  
  1707. As shown in Sect.á5.3, the above result implies that the DRT conforms to its require-
  1708. ments. The proof of conformance used a combination of model checking (for verifying 
  1709. modular-validity) and deduction (e.g. for proving the general validity in stepá6).
  1710.  
  1711. 5.5  Refining the controller
  1712.  
  1713. The abstract module  (Fig.á10) is observationally equivalent to its refinement 
  1714.  (Fig.á11), i.e. . The refinement  is closer to the final 
  1715. pseudocode [38]. As mentioned in Sect.á4.0, two methods have been developed for show-
  1716. ing observational equivalence: 
  1717.  
  1718. FIGURE 11. Refinement of microprocessor control module
  1719.  
  1720. /* Body of  with same interface stub and module specification as  (Fig.á10) Ç/
  1721.  
  1722. private Ta: {0 ... 30} where (Ta = 0)    /* Timer1 variable in timing diagram */
  1723.  
  1724. private Tb: {0 ... 20} where (Tb = 0)    /* Timer2 variable in timing diagram */
  1725.  
  1726. Ç    The designer can interactively apply equivalence preserving transformations to derive 
  1727.  from . The reader may consult [25] where this transformation is done 
  1728. for a TTM body the same as that of  but without the additional failure transition 
  1729. and the initial condition variable . The proof used in [25] can be used as is for 
  1730. . The transformation rules can be applied to infinite state systems, but 
  1731. it can be shown that there is no complete set of transformations, i.e. there is no finite set 
  1732. of transformations such that it is always possible to prove TTM equivalence by using 
  1733. that set of transformations [27].
  1734.  
  1735. Ç    For TTMs that can be reduced to finite state reachability graphs, there is an efficient 
  1736. polynomial time algorithm for showing observational equivalence [28]. The equiva-
  1737. lence of  and  can be shown with this algorithm as the data types are 
  1738. finite.
  1739.  
  1740. The abstract module  satisfies the non-Zeno condition (Tableá1). Since 
  1741.  is SESI (state event stuttering invariant) over the interface variables, (Th.á4) 
  1742. guarantees that  also holds for the refinement . Thus there is no need to 
  1743. redo the proofs of controller module specifications, and we remain with the guarantee that 
  1744. the DRT conforms to its requirements.
  1745.  
  1746. The module  is a high level description of a microprocessor controller. It is eas-
  1747. ier to understand than  because it is close to the informal timing diagram of the 
  1748. analog controller (Fig.á6). It does not have the two timer variables that  has, and as 
  1749. a result the guards on its transitions are simplified relative to those of . Its reach-
  1750. ability graph is smaller (Tableá1). 
  1751.  
  1752. TABLE 1. Improved model checking times for the module  compared to 
  1753.  
  1754. Modularly valid specifications
  1755.  
  1756. Abstraction 
  1757.  
  1758. Refinement 
  1759.  
  1760.  (Fig.á10)
  1761.  
  1762. 13785 states in 26 seconds
  1763.  
  1764. 59452 states in 297 seconds
  1765.  
  1766.  (non-Zeno constraint)
  1767.  
  1768. 15248 states in 61 seconds
  1769.  
  1770. 69059 states in 261 seconds
  1771.  
  1772. Tableá1 shows the result for checking the most complex module. However, all the mod-
  1773. ule specifications were verified using the model-checker. The deductive parts of the proof 
  1774. were done by hand. In principal the deductive part could have been done using the theo-
  1775. rem prover, but it proved too tedious as explained at the end of Sect.á2.4.
  1776.  
  1777. We refer the reader to [38] for a discussion of the reverse engineering problem, i.e. how 
  1778. one goes from the pseudocode described in the original requirements document to the 
  1779. refinement presented in Fig.á11.
  1780.  
  1781. 5.6  The design method
  1782.  
  1783. Although top-down design by stepwise refinement was de rigueur until the 1980╣s, it 
  1784. has subsequently come under attack. As Jackson has written [20]: │It was one thing to 
  1785. impose a single hierarchical structure on a sequential program of the programmer╣s own 
  1786. devising; it was quite another to impose it on a given, inconveniently ill-structured, real 
  1787. world domain▓. In fact, real-systems such as the DRT often have no single │top▓ function. 
  1788.  
  1789. Our design method uses both top-down as well as bottom-up techniques. We have 
  1790. stressed in previous sections that the Composition and Refinement Rules can be used both 
  1791. ways. Our top-down methodology differs from the classic notion of stepwise refinement. 
  1792. In classic top-down design, a program is a single sequential process; concurrency and par-
  1793. allelism was │exotic▓ or unknown [20]. By contrast, TTM modules allows for nondeter-
  1794. minism, and serial as well as parallel constructs in any mixture and to any depth. This 
  1795. allows for adequate descriptions of real systems that have no │top▓ in the functional sense. 
  1796. Furthermore, at the top level, we do have requirements describing the safety and correct-
  1797. ness of the overall system consisting of different parts (such as the plant and the control-
  1798. ler). Such system requirements (e.g. the DRT requirements R1 and R2) are often emergent 
  1799. properties, i.e. they arise out of the combined interaction of the system modules taken 
  1800. together. There is thus still an urgent need to describe systems in a layered modular fash-
  1801. ion, but without the sequential restrictions of the earlier methods.
  1802.  
  1803. We now describe in outline the basic design method. The notions of a module, compo-
  1804. sition and refinement developed in this paper, provide the precise theoretical underpin-
  1805. nings for the method which was originally sketched in [36, pages 4-6]. We also borrow 
  1806. concepts from the insightful description of requirements in [20, p169].
  1807.  
  1808. The basic design procedure starts with requirements R. Requirements are about the 
  1809. phenomena of the application domain (the relay, pressure and power of the DRT plant), 
  1810. not about the machine (the controller). Our first step in requirements is to divide the sys-
  1811. tem into the two parallel objects: (a) the plant which can be described as it already exists 
  1812. and (b) the controller which must be designed. This division proceeds by describing their 
  1813. relevant interfaces and connections, as well as some of the internal phenomena and entities 
  1814. of the plant ï this is the body of the plant which is a model of plant behaviour. The plant 
  1815. model cannot be too abstract because then it is not about the real problem anymore. It is a 
  1816. mistake to rush to the solution (by coding the controller) before delineating the problem to 
  1817. be solved (the plant requirements). The requirements are temporal logic formulas in plant 
  1818. entities such as pressure, power and the state of the relay. Therefore, the requirements do 
  1819. not describe the internal phenomena of the controller, although they might describe enti-
  1820. ties at the boundary of the controller and the plant (the shared phenomena).
  1821.  
  1822. It is the job of the controller to ensure that the requirements are satisfied, which it can 
  1823. do due to fact that it shares some phenomena with the plant (as described by the plant-con-
  1824. troller interface). The controller might not be able to react to a shared phenomenon imme-
  1825. diately (e.g. a change in reactor pressure), but the shared phenomenon happens in both the 
  1826. plant and controller simultaneously. 
  1827.  
  1828. Because the controller does not always know all the plant phenomena (or at least can-
  1829. not react to them immediately), there is always the possibility of a gap between the 
  1830. requirements and what the controller can achieve (as described in the controller specifica-
  1831. tion). The progression from requirements to controller implementation is a way of bridg-
  1832. ing the gap between them. From the requirements expressed in terms of the plant, you 
  1833. derive a specification S of the controller in terms of the shared phenomena of the plant and 
  1834. controller. Then you derive the body of the controller from the controller specification. 
  1835. The Composition Rule justifies the eventual claim that the controller implementation satis-
  1836. fies the requirements by reasoning as follows: (a) the body of the controller satisfies the 
  1837. specification S and (b) the specification S together with the description of the plant entails 
  1838. the truth of requirements R.
  1839.  
  1840. In the case of the DRT controller, once the top-level interface stub was described, the 
  1841. parts of the controller were developed bottom-up component by component. A generic 
  1842. microprocessor controller was designed which was then instantiated three times to obtain 
  1843. 3-version control. Then the majority voting logic was designed. Bottom level modules 
  1844. were developed, simulated and verified to conform to their local specifications long before 
  1845. the modules were combined together. The plant description was quite simple and could be 
  1846. encapsulated in a single module. In more complicated application domains, the plant 
  1847. might also benefit from a bottom-up development. 
  1848.  
  1849. 6.0  Conclusions and related work
  1850.  
  1851. This paper has presented a structured compositional method for the deliberate design of 
  1852. real-time systems, and applied the method to an industrial example with partial support 
  1853. provided by the StateTime toolset. The main novelty of the approach is to provide a fully 
  1854. compositional definition of real-time reactive modules compatible with existing model-
  1855. checking tools (Sect.á3.0) and a refinement relation (Sect.á4.0). This allows for the system-
  1856. atic development and verification of real-time systems. 
  1857.  
  1858. There are four main areas where mechanical support is needed: (1) system simulation 
  1859. for validating models, (2) model-checking for modular-validity, (2) deductive theorem 
  1860. proving for the composition rule, and (3) proving observational equivalence for the refine-
  1861. ment rule. 
  1862.  
  1863. StateTime was used for simulation and model-checking all module specifications of the 
  1864. DRT example. Although, in principal, we could have used the toolset for the deductive 
  1865. part, it proved too unwieldy due to the proliferation of quantifiers. The toolset has no sup-
  1866. port for refinement, and this had to be done by hand using behaviour preserving transfor-
  1867. mations. So too, there is a need to directly supports modules with interface stubs and 
  1868. automatic generation of environments.
  1869.  
  1870. This leads us to the main conclusion of this paper. StateTime, as it currently stands, 
  1871. needs to be enhanced in a variety of ways if it is to support more seamless compositional 
  1872. verification. I am therefore currently working, together with Lewis Lo, on a new version of 
  1873. StateTime that builds on the reactive modules introduced in this paper, and allows for the 
  1874. complete spectrum of automated simulation, model-checking and theorem proving tools. 
  1875.  
  1876. The enhanced StateTime will also support modules (interface stubs and automatic gen-
  1877. eration of environments). We use count-up and count-down clock variables with ordinary 
  1878. temporal logic (rather than the bounded operators of RTTL) for specification, but it is yet 
  1879. to early to tell to what extent this will simplify deductive reasoning. 
  1880.  
  1881. The proof of observation equivalence (both algorithmically for finite state modules and 
  1882. via equivalence preserving transformations) for use in the refinement rule needs to be 
  1883. implemented and incorporated into the StateTime toolset, but we have not yet decided how 
  1884. to implement these techniques. Because our bisimulation relation involves both states and 
  1885. events (Sect.á4.0), we may not be able to directly use existing tools such as Concurrency 
  1886. Workbench [9]. The Concurrency Workbench allows for the testing of equivalences and 
  1887. preorders and the verification of systems in the modal mu-calculus; real-time CCS style 
  1888. front-ends are available.
  1889.  
  1890. Other tools such as Modechart [21], Statemate [16] and ObjectTime [45] also use state-
  1891. charts for visual system descriptions. Modechart allows for both simulation and algorith-
  1892. mic analysis techniques for a subset of properties expressed in a predicate real-time logic 
  1893. [34]. Statemate can be used to do reachability analysis and ObjectTime is object-oriented 
  1894. which is useful in design, but it cannot deal with hard real-time systems. None of these 
  1895. tools have theorem provers, nor do they allow for modular verification.
  1896.  
  1897. RTTL is based on the linear time temporal logic LTL rather than on branching time log-
  1898. ics such as CTL. It is commonly accepted that while specifying is easier in LTL, model-
  1899. checking is more efficient in CTL. Both linear and branching time languages now have 
  1900. efficient model-checkers using either partial orders or BDD methods: SPIN [18] is one of 
  1901. the few LTL based model-checkers. SMV is a good example of a CTL based model-
  1902. checker [5], with an extension to real-time systems called Verus which uses a branching 
  1903. time real-time language called RTCTL [6]. Verus also has the facility for specifying task 
  1904. priorities. The hybrid tool HyTech [2] extends branching time model-checking to continu-
  1905. ous real-time systems using stop watches and symbolic fixpoint computation (the current 
  1906. version of the tool supports reachability analysis via monitor automatons and not directly 
  1907. the full set of CTL formulas). HyTech and Verus both allow for parametric analysis (e.g. 
  1908. determining the latest possible moment a controller can wait before issuing a command).
  1909.  
  1910. The STeP [31] model-checker and theorem prover was chosen as the back-end to 
  1911. StateTime rather than tools such as SPIN, SMV and HyTech for a number of reasons. 
  1912. Tools that use a non-interleaving synchronous execution step algorithm (e.g. SMV, the 
  1913. PVS model-checker [42] and COSPAN [15]) are efficient for dealing with hardware 
  1914. designs, but do not seem to be as efficient as SPIN when it comes to dealing with inter-
  1915. leaved sequential code and integer variables. There is also another problem associated 
  1916. with modularity when it comes to branching time model-checkers. Although branching 
  1917. time is usually more efficient than linear time logics, the branching time algorithms 
  1918. become EXPTIME-complete for module checking which is worse than the PSPACE com-
  1919. plexity of linear time logics [24]. This analysis seems to suggest that the accepted trade-off 
  1920. between LTL and CTL for modules is not as simple as it is for closed systems. We were 
  1921. not able to use SPIN because it only supports justice (weak fairness) not compassion 
  1922. (strong fairness) needed for the tick transition. More importantly, we hope to use the theo-
  1923. rem proving components of STeP in future versions of our tool. None of the aforemen-
  1924. tioned tools (except PVS) have theorem provers.
  1925.  
  1926. Hooman [19] extends Hoare logic to real-time programs by freely mixing programs 
  1927. and assumption/guarantee assertions leading to a top-down derivation method. The theory 
  1928. is implemented using the interactive proof checker PVS [42]. The embedding of the proof 
  1929. system in PVS provides powerful mechanical support for compositional reasoning (but 
  1930. not model checking). The only timing construct is the precise delay; there are no time 
  1931. bounds on transitions as in TTMs.
  1932.  
  1933. There is a growing interest in compositional and refinement methods for reactive sys-
  1934. tems [1,7,22,35,41,46,48]. The field is somewhat less developed in the case of real-time 
  1935. systems especially in methods that also have tool support.
  1936.  
  1937. ASTRAL [10] is based on the framework of [11] that uses Petri Nets for system 
  1938. descriptions and a timed temporal logic called TRIO for specifications. ASTRAL provides 
  1939. structuring mechanisms that allow the designer to build modularized specifications that 
  1940. are translated into TRIO. Proofs in ASTRAL are either interlevel or intralevel. The former 
  1941. deals with proving that the specification at a higher level is consistent with a specification 
  1942. at a lower level. The latter deals with proving that a description at a level satisfies its spec-
  1943. ification. A tool is currently under development.
  1944.  
  1945. The frameworks mentioned thus far have specification languages that are based on 
  1946. logic, usually modal logic. Other approaches are based on algebra or automata. Discrete 
  1947. real-time process algebras [4,44] can describe systems compositionally at different levels 
  1948. of abstraction. The semantics of process algebras is usually defined in terms of labelled 
  1949. transition systems. An algorithm based on observation (bisimulation) equivalence is used 
  1950. to show that an implementation satisfies its specification. These bisimulation relations are 
  1951. usually event-based [33], whereas the bisimulation relation used in this paper is both event 
  1952. and state-based (Sect.á4.1). It is event-based in order to ensure a global notion of time via 
  1953. the tick transition. It is state-based so that module specifications can be written as temporal 
  1954. logic properties in the observable variables. Continuous time extensions to process alge-
  1955. bras [47] lack the abstracting power of a congruence relation of the discrete event case, 
  1956. due to technical difficulties associated with their infinite branching continuous time 
  1957. semantics.
  1958.  
  1959. The real-time CSR language [13] provides a layered approach to dealing with shared 
  1960. resources. [12] presents hierarchical multistate machines for multilevel specifications. The 
  1961. automata based tool COSPAN has recently been extended to deal with real-time [3]. 
  1962. COSPAN supports top-down development through successive refinements and homomor-
  1963. phic reduction [15]. Timed automata [30] (see also the input/output automata described in 
  1964. [29]) have visible actions, a time passage action (analogous to our clock tick) and a special 
  1965. internal action. Dense upper bounds can be imposed between actions, but not lower time 
  1966. bounds. A refinement from one timed automaton to another is a time-preserving function 
  1967. similar to the classical notion of a homomorphism between automata.
  1968.  
  1969. In single language frameworks (e.g. automata based COSPAN or the logic based TLA 
  1970. [1]), both the implementation and specification are expressed in the same formalism 
  1971. (automata or logic). Conformance is proved by demonstrating that each fair trace of the 
  1972. implementation is also a fair trace of the specification. There is a certain elegance and sim-
  1973. plicity associated with using a single language for both specifications and implementa-
  1974. tions. We have pursued the dual TTM/RTTL framework in this paper as it provides us with 
  1975. the flexibility of using the most appropriate analysis technique in each case. For TTM 
  1976. refinement, we use the algebraic notion of observation equivalence, and for TTM compo-
  1977. sition the logical conjunction of RTTL specifications.
  1978.  
  1979. Acknowledgments
  1980.  
  1981. I would like to thank Mark Lawford for his help with all aspects of this paper. I also 
  1982. thank the anonymous referees for their helpful criticisms, comments and suggestions.
  1983.  
  1984. 7.0  References
  1985.  
  1986. [1]    Abadi, M. and L. Lamport. │Conjoining Specifications.▓ ACM Trans. on Programming Languages and 
  1987. Systems, 17(3): 507-534, 1995.
  1988.  
  1989. [2]    Alur, R., T.A. Henzinger, and P.-H. Ho. │Automatic Symbolic Verification of Embedded Systems.▓ 
  1990. IEEE Transactions on Software Engineering, 22(3): 181-201, 1996.
  1991.  
  1992. [3]    Alur, R. and R.P. Kurshan. │Timing Analysis with Cospan.▓ In Hybrid Systems III, ed. R. Alur, T.A. 
  1993. Henzinger, and E. Sontag. LNCS 1066 Springer Verlag, 1996.
  1994.  
  1995. [4]    Baeten, J.C.M. and J.A. Bergstra. │Discrete Time Process Algebra.▓ Formal Aspects of Computing, 
  1996. 8(2): 188-208, 1996.
  1997.  
  1998. [5]    Burch, J.R., E.M. Clarke, K.L. MacMillan, D.L. Dill, and L.J. Hwang. │Symbolic Model Checking: 
  1999. 10^20 States and Beyond.▓ Information and Computation, 98(2): 142-170, 1992.
  2000.  
  2001. [6]    Campos, S.V. and E.M. Clark. │ Real-Time Symbolic Model Checking for Discrete Time Models.▓ In 
  2002. Theories and Experiences for Real-Time System Development, ed. T. Rus and C. Rattray. AMAST 
  2003. Series in Computing, Vol. 2. World Scientific Press, 1994.
  2004.  
  2005. [7]    Chandy, K.M. and J. Misra. Parallel Program Design. Addison-Wesley, 1988.
  2006.  
  2007. [8]    Chang, E. │Compositional Verification of Reactive and Real-Time Systems.▓ Ph.D, Stanford University, 
  2008. 1995.
  2009.  
  2010. [9]    Cleaveland, R. and S. Sims. │The NCSU Concurrency Workbench.▓ In Computer-Aided Verification 
  2011. (CAV '96), New Brunswick, NJ, edited by R. Alur and T. Henzinger, Springer-Verlag, LNCS 1102, 394-
  2012. 397, 1996.
  2013.  
  2014. [10]    Coen-Porisini, A., R. Kemmerer, and D. Mandrioli. │A formal framework for ASTRAL intralevel proof 
  2015. obligations.▓ IEEE Transactions on Software Engineering, 20(8): 548-560, 1994.
  2016.  
  2017. [11]    Felder, M., D. Mandrioli, and A. Morzenti. │Proving properties of real-time systems through logical 
  2018. specifications and Petri Net models.▓ IEEE Transactions on Software Engineering, 20(2): 127-141, 
  2019. 1994.
  2020.  
  2021. [12]    Gabrielian, A. and M. Franklin. │Multilevel specifications of real-time systems.▓ Communications of 
  2022. the ACM, 34(5): 51-60, 1991.
  2023.  
  2024. [13]    Gerber, R. and I. Lee. │A layered approach to automating the verification of real-time systems.▓ IEEE 
  2025. Transactions on Software Engineering, 18(9): 768-784, 1992.
  2026.  
  2027. [14]    Gries, D. and F.B. Schneider. A Logical Approach to Discrete Math. Springer Verlag, 1993.
  2028.  
  2029. [15]    Hardin, R.H., Z. Harel, and R.P. Kurshan. │COSPAN.▓ In 8th International Conference on Computer 
  2030. Aided Verification CAV'96, LNCS 1102 Springer-Verlag, 421-427, 1996.
  2031.  
  2032. [16]    Harel, D., H. Lachover, A. Naamad, A. Pnueli, M. Politi, R. Sherman, and M. Trachtenbrot. │Statemate: 
  2033. a working Environment for the Development of Complex Reactive Systems.▓ IEEE Transactions on 
  2034. Software Engineering, 16:403¡414, 1990.
  2035.  
  2036. [17]    Harel, D. and A. Pnueli. │On the Development of Reactive Systems.▓ In Logics and Models of Concur-
  2037. rent Systems, ed. K. Apt. 477-498. F-13 of NATO Advanced Summer Institutes. Springer-Verlag, 1985.
  2038.  
  2039. [18]    Holzmann, G. │The Model Checker Spin.▓ IEEE Trans. on Software  Engineering, 23(5): 279-295, 
  2040. 1997.
  2041.  
  2042. [19]    Hooman, J. │Correctness of Real-Time Systems by Construction.▓ In Proc. Symposium on Formal tech-
  2043. niques in Real-Time and Fault-Tolerant Systems, 19-40. LNCS 863 Springer-Verlag, 1994.
  2044.  
  2045. [20]    Jackson, M. Software Requirements & Specifications. Addison-Wesley, 1995.
  2046.  
  2047. [21]    Jahanian, F. and A.K. Mok. │Modechart: A Specification Language for Real-Time Systems.▓ IEEE 
  2048. Transactions on Software Engineering, 20(12): 933-947, 1994.
  2049.  
  2050. [22]    Jones, C.B. │Specification and design of parallel programs.▓ In IFIP 9th World Congress, 321-323, 
  2051. 1983.
  2052.  
  2053. [23]    Kesten, Y., Z. Manna, and A. Pnueli. │Verifying Clocked Transition Systems.▓ In Hybrid Systems III, 
  2054. Springer-Verlag, LNCS, 1996.
  2055.  
  2056. [24]    Kupferman, O. and M.Y. Vardi. │Module Checking.▓ In 8th International Conference on Computer 
  2057. Aided Verification CAV'96, LNCS 1102 Springer-Verlag, 75-86, 1996.
  2058.  
  2059. [25]    Lawford, M. │Transformational Equivalence of Timed Transition Models.▓ Systems Control Group, 
  2060. Department of Electrical Engineering, University of Toronto. TR-9202 (M.A.Sc. thesis), 1992.
  2061.  
  2062. [26]    Lawford, M., J.S. Ostroff, and W.M. Wonham. │Model Reduction of Modules for State-Event Temporal 
  2063. Logics.▓ In IFIP Joint International Conference on Formal Description Techniques (FORTE-PSTV'96), 
  2064. Chapman & Hall, 1996.
  2065.  
  2066. [27]    Lawford, M. and W.M. Wonham. │Equivalence Preserving Transformations for Timed Transition Mod-
  2067. els.▓ IEEE Trans. on Automatic Control, 40(7): 1167-1179, 1995.
  2068.  
  2069. [28]    Lawford, M., W.M. Wonham, and J.S. Ostroff. │State-Event Labels for Labelled Transition Systems.▓ In 
  2070. Proc. 33rd IEEE Conference on Decision and Control, Orlando, FL, IEEE Control System Society, 
  2071. 3642-3648, 1994.
  2072.  
  2073. [29]    Lynch, N. and R. Segala. │A Comparison of Simulation Techniques and Algebraic  Techniques for Ver-
  2074. ifying Concurrent Systems.▓ Formal Aspects of Computing, 7(3): 231-265, 1995.
  2075.  
  2076. [30]    Lynch, N. and F. Vaandrager. │Forward and Backward Simulations for Timing-Based Systems.▓ In REX 
  2077. Workshop ï Real-Time: Theory in Practice, 397-446. LNCS 600 Springer-Verlag, 1992.
  2078.  
  2079. [31]    Manna, Z. │STeP: The Stanford Temporal Prover.▓ Dep. of Computer Science, Stanford University. 
  2080. STAN-CS-TR-94-1518, 1994.
  2081.  
  2082. [32]    Manna, Z. and A. Pnueli. The Temporal Logic of Reactive and Concurrent Systems. Springer-Verlag, 
  2083. New York, 1992.
  2084.  
  2085. [33]    Milner, R. Communication and Concurrency. Prentice Hall, 1989.
  2086.  
  2087. [34]    Mok, A. and D. Stuart. │Simulation vs. Verification: Getting the Best of Both Worlds.▓ In 11th Annual 
  2088. IEEE Conference on Computer Assurance (COMPASS), Washington D.C, 1995.
  2089.  
  2090. [35]    Mokkedem, A. and D. Mery. │On Using Temporal Logic for Refinement and Compositional Verifica-
  2091. tion of Concurrent Systems.▓ Theoretical Computer Science, 140:95-138, 1995.
  2092.  
  2093. [36]    Ostroff, J.S. Temporal Logic for Real-Time Systems. Advanced Software Development Series, ed. J. 
  2094. Kramer. Research Studies Press Limited (distributed by John Wiley and Sons), England, 1989.
  2095.  
  2096. [37]    Ostroff, J.S. │Deciding properties of Timed Transition Models.▓ IEEE Transactions on Parallel and 
  2097. Distributed Systems, 1(2): 170-183, 1990.
  2098.  
  2099. [38]    Ostroff, J.S. │A Visual Toolset for the Design of Real-Time Discrete Event Systems.▓ IEEE Trans. on 
  2100. Control Systems Technology, 5(3): 320-337, 1997.
  2101.  
  2102. [39]    Ostroff, J.S. and H.K. Ng. │The Design of Real-Time Systems Using Standard Untimed Theories.▓ In 
  2103. Preprints Third AMAST Workshop on Real-Time Systems, Salt Lake City, Utah, ONR and Iowa Univer-
  2104. sity, 1996.
  2105.  
  2106. [40]    Ostroff, J.S. and W.M. Wonham. │A Framework for Real-Time Discrete Event Control.▓ IEEE Transac-
  2107. tions on Automatic Control, 35(4): 386¡397, 1990.
  2108.  
  2109. [41]    Owicki, S. and D. Gries. │Verifying properties of parallel programs: an axiomatic approach.▓ Communi-
  2110. cations of the ACM, 19(5): 279-285, 1976.
  2111.  
  2112. [42]    Owre, S., J. Rushby, N. Shankar, and F.v. Henke. │Formal Verification for Fault-Tolerant Architectures: 
  2113. Prolegomena to the Design of PVS.▓ IEEE Trans. on Software Engineering, 21(2): 107-125, 1995.
  2114.  
  2115. [43]    Parnas, D.L., G.J.K. Asmis, and J. Madey. │Assessment of Safety-Critical Software in Nuclear Power 
  2116. Plants.▓ Nuclear Safety, 32(2): 189-198, 1991.
  2117.  
  2118. [44]    Schneider, S., J. Davies, D.M. Jackson, G.M. Reed, J.N. Reed, and A.W. Roscoe. │Timed CSP: Theory 
  2119. and Practice.▓ In REX Workshop --- Real-Time: Theory in Practice, 640-675.  LNCS 600, Springer-Ver-
  2120. lag, 1992.
  2121.  
  2122. [45]    Selic, B., G. Gullekson, J. McGee, and I. Engelberg. │ROOM: An Object-Oriented Methodology for 
  2123. Developing Real-Time Systems.▓ In CASE╣92 Fifth International Workshop on Computer-Aided Soft-
  2124. ware Engineering, Montreal, IEEE Computer Society Press, 230-240, 1992.
  2125.  
  2126. [46]    Stolen, K., F. Dederichs, and R. Weber. │Specification and refinmenent of networks of asynchronously 
  2127. communicating agents using the assumption/commitment paradigm.▓ Formal Aspects of Computing, 
  2128. 8(2): 127-161, 1996.
  2129.  
  2130. [47]    Yi, W. │CCS + Time = an Interleaving Model for Real Time Systems.▓ In Proceedings of ICALP'91, 
  2131. 217-228. LNCS 510 Springer-Verlag, 1991.
  2132.  
  2133. [48]    Zwiers, J. and W.P.d. Roever. │Compositionality and modularity in process specification and design.▓ In 
  2134. Temporal logic in specification, ed. B. Banieqbal, H. Barringer, and A. Pnueli. 351-374. LNCS 398 
  2135. Springer-Verlag, 1989.
  2136.