The Generalized Railroad Crossing: A Case Study in Formal. Abstract

Save this PDF as:

Size: px
Start display at page:

Transcription

1 The Generalized Railroad Crossing: A Case Study in Formal Verication of Real-Time Systems Constance Heitmeyer Nancy Lynch y Abstract A new solution to the Generalized Railroad Crossing problem, based on timed automata, invariants and simulation mappings, is presented and evaluated. The solution shows formally the correspondence between four system descriptions: an axiomatic specication, an operational specication, a discrete system implementation, and a system implementation that works with a continuous gate model. The details of the proofs, omitted from the conference paper due to lack of space, are included. 1 Introduction During the last decade, a large collection of formal methods have been invented for specifying, designing, and analyzing real-time systems. To compare these methods and to better understand their use in developing practical real-time systems, one of us (Heitmeyer) has dened a benchmark problem, called the Generalized Railroad (GRC) Crossing [7]. The problem is as follows. The system to be developed operates a gate at a railroad crossing. The railroad crossing I lies in a region of interest R, i.e., I R. A set of trains travel through R on multiple tracks in both directions. A sensor system determines when each train enters and exits region R. To describe the system formally, we dene a gate function g(t) 2 [0; 90], where g(t) = 0 means the gate is down and g(t) = 90 means the gate is up. We also dene a set f i g of occupancy intervals, where each occupancy interval is a time interval during which one or more trains are in I. The ith occupancy interval is represented as i =[ i ; i ], where i is the time of the ith entry of a train into the crossing when no other train is in the crossing and i is the rst time since i that no train is in the crossing (i.e., the train that entered at i has exited as have any trains that entered the crossing after i ). Given two constants 1 and 2, 1 > 0; 2 >0;the problem is to develop a system to operate the crossing gate that satises the following two properties: Safety Property: t 2[ i i )g(t)=0 (The gate is down during all occupancy intervals.) Utility Property: t 62 [ i [ i, 1 ; i + 2 ]) g(t)=90 (The gate is up when no train is in the crossing.) To solve the GRC problem, real-time researchers have applied a variety of formal methods, including process algebraic [9, 3, 1], event-based [10], and logic-based approaches [19, 11]. They have also used various mechanical proof systems, including PVS [18], EVES [11], and FDR [2], to Code 5546, Naval Research Laboratory, Washington, D.C y Laboratory for Computer Science, Massachusetts Institute of Technology, Cambridge, MA

2 formally analyze and verify their solutions. Reference [5] describes three early eorts to solve the GRC problem. This paper describes a new solution of the GRC based on the Lynch-Vaandrager timed automaton model [16, 15], using invariant and simulation mapping techniques [12, 15, 14]. To develop the solution, a \formal methods expert" (Lynch) and an \applications expert" (Heitmeyer) worked closely together to rene the GRC problem statement and to design and verify an implementation. Our close collaboration was in sharp contrast to the limited interaction between the Naval Research Laboratory (NRL) group that originated the GRC problem and the formal methods groups that developed earlier solutions. In the earlier work, the NRL group limited interaction both to encourage original solutions and to prevent some groups from having more information and thus unfair advantage over other groups. While these early eorts produced a variety of solutions and many insights into the relative strengths and weaknesses of the dierent formalisms, they suered from two limitations. First, because the original problem statement was somewhat ambiguous, each group solved a slightly dierent problem, which caused diculties in comparing the solutions. Second, the limited interaction meant that deciencies in the GRC problem statement went uncorrected. Our collaboration allowed us quickly to identify and correct these deciencies. It also led us to represent the problem and its solution in a form that is both understandable to applications experts and usable by formal methods experts for verication. The rest of the paper is organized as follows. Section 2 describes our approach: general principles for applying formal methods to specify and verify real-time systems, our formal model and proof techniques, and an outline of how we applied the formal methods to the GRC problem. Section 3 presents our highest-level problem specication, intended to be understood by applications experts; it improves over the original problem statement given above by resolving some ambiguities. Section 4 contains a secondary operational specication, intended to be useful in formal verication. Section 5 contains our system implementation. Section 6 contains the main correctness proof. Section 7 describes extensions to more realistic, continuous models of the real world components. Section 8 evaluates our solution and method. Several appendices provide background on the formal methods we use, plus two proofs about the high-level specication. A concise version of this report, which omits the details of the proofs, appears in [8]. 2 Our Approach In this section, we describe our approach to solving the GRC problem. Section 2.1 contains some general principles for applying formal methods to real-time systems. Section 2.2 contains a description of the timed automaton model and of invariant and simulation mapping proof methods. Section 2.3 contains an overview of how we apply these formal methods to the GRC problem. 2.1 Formal Methods for Real-Time Systems Applying formal methods to real-time systems involves three steps: system requirements specication, design of an implementation, and verication that the implementation satises the specication. This process has feedback loops. Once specied, the requirements must be revised when later steps expose omissions and errors. The same is true of the designed implementation. 2

3 All three steps require close collaboration between the formal methods expert and the applications expert. The role of the formal methods expert is to produce formal descriptions of both the system requirements and the selected implementation and to prove formally that the latter satises the former. The role of the applications expert is to work closely with the formal methods expert to identify the \real" requirements and to ensure that the specied implementation is acceptable. In our collaboration, much of the dialogue focused on the system requirements. Once the requirements specication was acceptable, dening and verifying an implementation, while labor-intensive and time-consuming, was relatively straightforward. A system requirements specication describes all acceptable system implementations [6]. It has two parts: (1) A set of formal models describing the computer system at an abstract level, the environment (here, the trains and the gate), and the interface between them. (2) Formal statements of the properties that the system must satisfy. In developing the GRC solution, we applied the following seven software engineering principles. The rst ve concern the requirements specication. The sixth concerns the implementation and its verication, and the seventh is applicable to all three steps. 1. Avoid underspecifying system requirements. The original problem statement lacked necessary information about the various constants. For example, the statement did not constrain the constant 1. A simple analysis shows that we should assume that 1 > down + 2, 1, where 2 is the maximum time and 1 the minimum time that a train requires to travel from entry into R to the crossing and down is the maximum time needed to lower the gate. 2. Avoid overspecifying system requirements. For example, while the function g is an acceptable gate model, the GRC problem can be solved using a simpler, discrete model { one that represents the gate as being in one of four states { up, going-down, down, and going-up. Our solution uses the simpler model, but we show in Section 7 how to extend our results to the original gate model. For another example, the Utility Property stated above does not rule out solutions in which the last train leaves the crossing at time t but within the interval [t; t+ 2 ] the gate goes rst up and then down rapidly before the gate is raised for the second (and nal) time. Such solutions, though not to be encouraged, should not be excluded. The essential system properties are that the gate must be down when a train is in the crossing and that the gate must be up during the specied intervals when no train is in the vicinity. During other times, we do not care what the gate does. 3. Make sure the specied system behavior is reasonable. For example, suppose a train exits the crossing at time t and another train is scheduled to enter the crossing by time t + up + down. Then there is insucient time for even one car to travel through the crossing, and thus the Utility Property fails to achieve its practical purpose. To rule out such useless activity, we modify the original problem statement to only require the gate to be raised if sucient time,, exists for at least one car to travel through the crossing. A trivial modication of the original problem statement to include appears in Appendix D. 4. Specify the system requirements axiomatically rather than operationally. In the original problem statement, both the Safety Property and the Utility Property are expressed as axioms. Each axiom describes a relationship that is supposed to hold between the two components of the 3

4 system environment, namely, the trains and the crossing gate. Thus the required system properties are properties of the environment. Neither axiom mentions the computer system. Also, the two axioms are stated independently, making it easy to modify the individual properties. In the present study, we initially reformulated the requirements specication operationally, as a timed automaton. This reformulation incorporated both the Safety and Utility Properties into a single automaton description, thus losing the advantage of independence. Also, our reformulation was stronger than the original, specifying some aspects of what the computer system should do rather than just describing properties that the system needed to guarantee in the environment. Finally, the operational style of the reformulation was harder for applications experts to understand. Our nal version of the specication, which appears in Section 3, is axiomatic. Like the original formulation, it describes the two properties as independent axioms about the environment. 5. Provide an operational secondary specication plus a formal proof that the operational specication implements the axiomatic specication. Although it is desirable to start with an axiomatic specication, the types of proofs we do rest on operational, automaton versions of the speci- cation and implementation. Therefore, we present a secondary requirements specication in terms of timed automata and prove that the operational requirements specication implements the original axiomatic specication. As in many applications of formal methods, we initially neglected to provide a formal proof of the correspondence between the original specication and the reformulation within our framework. Without such a proof, there is no assurance that the properties satised by the system implementation are the ones that are really required. In our case, while it was immediately obvious that the statement of the Safety Property in our operational specication was equivalent to the original statement of the Safety Property, the correspondence between the two versions of the Utility Property was not so clear. 6. Provide a formal model for the implementation and a proof that it implements the operational specication. The implementation should be described using the same model that is used for the operational specication, or at least one that is compatible. The proof that the implementation meets the specication can be done using a variety of methods. It might be done by hand, as in this paper, or with computer assistance. 7. Express the system requirements specication, the implementation, and the formal proofs so that they are understandable to applications experts. If the requirements specication and the specication of the implementation are dicult to understand, the applications expert cannot be condent that the right requirements have been specied and that the implementation is acceptable. The same holds for the formal proofs: the applications expert must be able to understand the proofs. This gives him/her a deep understanding of how and why the system works and how future changes are likely to aect system behavior. To increase their understandability, both the formal specications and the proofs should be based on standard models such as automaton models, standard notations, and standard proof techniques such as invariants and simulation mappings. To the extent feasible, applications experts should not be required to learn new notations or proof techniques. 4

5 2.2 The Formal Framework The formal method we used to specify the GRC problem and to develop and verify a solution represents both the computer system and the system environment as timed automata, according to the denitions of Lynch and Vaandrager [16, 15]. A timed automaton is a very general automaton, i.e., a labeled transition system. It is not nite-state: for example, the state can contain realvalued information, such as the current time or the position of a train or crossing gate. This makes timed automata suitable for modeling not only computer systems but also real-world entities such as trains and gates. We base our work directly on an automaton model rather than on any particular specication language, programming language, or proof system, so that we may obtain the greatest exibility in selecting specication and proof methods. The formal denition of a timed automaton appears in Appendix A. The timed automaton model supports description of systems as collections of timed automata, interacting by means of common actions. In our example, we dene separate timed automata for the trains, the gate, and the computer system; the common actions are sensors reporting the arrival of trains and actuators controlling the raising and lowering of the gate. An important special case of the model, describable in a particularly simple way, is the MMT automaton model [17], developed by Merritt, Modugno and Tuttle. An MMT automaton consists of a collection of \tasks" (i.e., \processes") sharing common data, where each task has an upper bound and a lower bound on the time between its events. This special case is sucient for describing several of our components; in particular, the trains and the discrete version of the gate. Formal denitions of the MMT model are given in Appendix B. Our other components, e.g., the computer system, cannot be expressed in the MMT style, so we describe them directly in terms of the general model. Instead of thinking of the MMT model as a dierent model, we often nd it useful to regard it as simply a way of describing a large subclass of timed automata. 2.3 Applying Formal Methods to GRC Our solution contains four system descriptions: AxSpec, the axiomatic requirements specication; OpSpec, the operational requirements specication; SystImpl, the discrete system implementation; and SystImpl 0, a system implementation with a continuous gate model. Figure 1 illustrates the four specications and how they are related. The top-level requirements specication, AxSpec, contains timed automata describing the computer system and its environment (the trains and gate), and axioms expressing the Safety and Utility AxSpec Trains OpSpec Trains SystImpl Trains SystImpl' Trains Gate CompSpec Gate CompSpec Gate CompImpl Gate' CompImpl Safety Utility OpProps OpProps OpProps Figure 1: The four system descriptions and how they are related. In OpSpec, OpProps incorporates the Safety and Utility properties into the automaton that results from composing Trains, Gate, and CompSpec. 5

6 Properties. The Safety Property states that any time there is a train in the crossing, the gate must be down. The Utility Property states that the gate is up unless there is a train in the vicinity. Formally, these axioms are properties added to the composition of three timed automata: Trains, Gate, and CompSpec, a trivial specication of the computer system interface. Figure 2 illustrates AxSpec. Next, because it is easier to use in proving correctness, we produce a secondary, more operational requirements specication in the form of a timed automaton OpSpec. We show that OpSpec implements AxSpec. Next, we describe our computer system implementation as a timed automaton, CompImpl. Correctness means that CompImpl, when it interacts with Trains and Gate, guarantees the Safety and Utility Properties. To show this, we prove that SystImpl, the composition of CompImpl, Trains and Gate, provides the same view to the environment components, Trains and Gates, as the operational specication OpSpec. This part of the proof follows well-established, stylized invariant and simulation mapping methods, which iswhywemoved from the axiomatic style of specication to the operational style. All of these proofs can be veried using current mechanical proof technology. In both specication automata, AxSpec and OpSpec, and also in the implementation automaton SystImpl, time information is built into the state. Timing information consists of the current time plus some deadline information, such as the earliest and latest times that a train that has entered R will actually enter the crossing. The correctness proof proceeds by rst proving by induction some invariants about the reachable states of SystImpl. The main work in the proof of the Safety Property is done by means of these invariants. An interesting feature of the proofs is that the invariants involve time deadline information. Next, we show a \simulation mapping" between the states of SystImpl and OpSpec, again by induction; this is enough to prove the Utility Property. Appendix C contains formal denitions for simulation mappings and the correctness properties they guarantee. Like the invariants, the simulations involve time deadline information, in particular, they include inequalities between time deadlines. Finally, we observe that our main proofs yield a weaker result that what we really want. Namely, we haveworked with an abstract, discrete model of the trains and gate rather than with a realistic model that allows continuous behavior. And we have only shown that the \admissible timed traces", i.e., the sequences of externally visible actions, together with their times of occurrence, are preserved, rather than all aspects of the environment's behavior. We conclude by showing that we have not lost any generality by proving the weaker results. In particular, preservation of admissible timed traces AxSpec Trains enteri(r) enterr(r) exit(r) CompSpec raise lower Gate Safety Utility Figure 2: AxSpec is the composition of Trains, Gate, and CompSpec, constrained by the Safety and Utility properties. 6

7 actually implies preservation of all aspects of the environment's behavior. Further, the results extend to SystImpl 0, a system implementation with a more realistic environment model. Both extensions are obtained as corollaries of the results for admissible timed traces of the discrete model, using general results about composition of timed automata. 3 Axiomatic Specication We begin with a high level axiomatic specication, AxSpec, describing the problem in terms most easily understood by application experts. We express the axioms solely in terms of the environment. We rst dene two timed automata, Trains and Gate, which are abstract representations of the trains and gate, respectively. These two components do not interact directly. We then dene a trivial automaton CompSpec, which interacts with both Trains and Gate via actions representing sensors and actuators. CompSpec describes nothing more than the interface that the computer system must have with the environment. AxSpec is obtained by composing these three automata and then imposing the Safety and Utility Properties on the composition; see Figure 2. Formally, the two properties are restrictions on the executions of the composition. The Safety Property is just a restriction on the states that occur in the execution, while the Utility Property is a more complex temporal condition. 3.1 Parameters and Other Notation We use the notation r, r 0, etc. to denote (railroad) trains. We use I to denote the railroad crossing, R to denote the region from where a train passes a sensor until it exits the crossing, and P to denote the portion of R prior to the crossing. We dene some positive real-valued constants: 1,alower bound on the time from when a train enters R until it reaches I. 2, an upper bound on the time from when a train enters R until it reaches I., the minimum useful time for the gate to be up. (For example, this might represent the minimum time for a car to pass through the crossing safely.) down, an upper bound on the time to lower the gate completely. up, an upper bound on the time to raise the gate completely. 1, an upper bound on the time from the start of lowering the gate until some train is in I. 2, an upper bound on the time from when the last train leaves I until the gate is up (unless the raising is interrupted by another train getting \close" to I)., an arbitrarily small constant used to take care of some technical race conditions. 1 We need some restrictions on the values of the various constants: > down. (The time from when a train arrives until it reaches the crossing is suciently large to allow the gate to be lowered.) 3. 1 down + + 2, 1. (The time allowed between the start of lowering the gate and some train reaching I is sucient to allow the gate to be lowered in time for the fastest train, and then to accommodate the slowest train. The time down is needed to lower the gate in time for the fastest train, but the slowest train could take an additional time 2, 1. The is a technicality.) 4. 2 up. (The time allowed for raising the gate is sucient.) 1 These arise because the model allows more than one event to happen at the same real time. 7

8 3.2 Trains We model the Trains component as an MMT automaton with no input or internal actions, and three types of outputs, enterr(r), enteri(r), and exit(r), for each train r. Actions: Input: none Output: enterr(r), r a train enteri(r), r a train exit(r), r a train The state consists of a status component for each train, just saying where it is. State: for each train r: r:status 2fnot-here;P;Ig, initially not-here The state transitions are described by specifying the \preconditions" under which each action can occur and the \eect" of each action. We use s to denote the state before the event occurs and s 0 the state afterwards. We use the convention that if a state component is not mentioned, it is unchanged (although sometimes, to resolve ambiguities or for emphasis, we say explicitly that a component is unchanged). Transitions: enterr(r) Precondition: s:r:status = not-here s 0 :r:status = P exit(r) Precondition: s:r:status = I s 0 :r:status = not-here enteri(r) Precondition: s:r:status = P s 0 :r:status = I In this automaton (and for all the other MMT automata in this paper), we make each non-input action a task by itself. We only specify trivial bounds (that is, [0; 1]) for the enterr(r) and exit(r) actions. For each enteri(r) action, we use bounds [ 1 ; 2 ]. This means that from the time when any train r has reached R, it is at least time 1 and at most time 2 until the train reaches I. We use the general construction described in Appendix B to convert this automaton to a timed automaton. This construction involves adding some components to the state { a current time component now, and rst and last components for each task, giving the earliest and latest times at which an action of each task can occur, once the task is enabled. The transition relation is augmented with conditions to enforce the bound assumptions, that is, that an event cannot happen before its rst time, and that time cannot pass beyond any last time. In this case, only the state components now, and rst(enteri(r)) and last(enteri(r)) for each r contain nontrivial information, so we ignore the other cases. Applying this construction yields the timed automaton with the same actions and the 8

9 following states and transitions. (In this automaton description, as well as elsewhere in the paper, we sometimes omit mention of the state where there is no ambiguity.) State: now, a nonnegative real, initially 0 for each train r: r:status 2fnot-here;P;Ig, initially not-here rst(enteri(r)), a nonnegative real, initially 0 last(enteri(r)), a nonnegative real or 1, initially 1. Transitions: enterr(r) Precondition: s:r:status = not-here s 0 :r:status = P s 0 :rst(enteri(r)) = now + 1 s 0 :last(enteri(r)) = now + 2 enteri(r) Precondition: s:r:status = P now s:rst(enteri(r)) s 0 :r:status = I s 0 :rst(enteri(r))=0 s 0 :last(enteri(r)) = 1 exit(r) Precondition: s:r:status = I s 0 :r:status = not-here (t) Precondition: for all r, s:now + ts:last(enteri(r)) s 0 :now = s:now +t Lemma 3.1 In any reachable state of Trains: For any r such that r:status = P, rst(enteri(r)) + 2, 1 = last(enteri(r)). Proof: By induction on the length, i.e., the total number of non-time-passage and time-passage steps, of an execution. Because 2, 1 is a constant, we need only consider actions that change rst(enteri(r)), last(enteri(r)) or make r:status = P, namely, enterr(r) and enteri(r). The actions exit(r) and (t) do not aect the statement. After 0 steps, the claim is vacuously satised. Assume the claim is true after m steps. We must prove it is true after m + 1 steps. For enteri(r), the claim is vacuously satised. For enterr(r), the eect is s 0 :r:status = P. Then, s 0 :rst(enteri(r)) = now + 1 and s 0 :last(enteri(r)) = now + 2, which implies that s 0 :rst(enteri(r)) + 2, 1 = s 0 :last(enteri(r)) as required. 3.3 Gate We model the gate as another MMT automaton, this one with inputs lower and raise and outputs down and up. Actions: Input: lower raise Output: down up 9

10 The state consists of a single status component: State: status 2fup; down; going-up; going-downg, initially up Transitions: lower if s:status 2 fup; going-upg then s 0 :status = going-down else unchanged status down Precondition: s:status = going-down s 0 :status = down raise if s:status 2 fdown; going-downg then s 0 :status = going-up else unchanged status up Precondition: s:status = going-up s 0 :status = up The time bounds are down: [0; down ], and up: [0;up], where up and down are upper bounds on the time required for the gate to be raised and lowered. To build time into the state, the state components now, last(up), and last(down) are added to produce the following states and transitions. State: status 2fup; down; going-up; going-downg, initially up now, a nonnegative real, initially 0 last(down), a nonnegative real or 1, initially 1 last(up), a nonnegative real or 1, initially 1 Transitions: lower if s:status 2 fup; going-upg then s 0 :status = going-down s 0 :last(down) =now + down s 0 :last(up) =1 else unchanged status, last(down), last(up) raise if s:status 2 fdown; going-downg then s 0 :status = going-up s 0 :last(up) =now + up s 0 :last(down) =1 else unchanged status, last(down), last(up) down Precondition: up s:status = going-down s 0 :status = down s 0 :last(down) =1 Precondition: s:status = going-up s 0 :status = up s 0 :last(up) =1 (t) Precondition: s:now +ts:last(up) s:now +ts:last(down) s 0 :now = s:now +t 10

11 3.4 CompSpec We model the computer system interface as a trivial MMT automaton CompSpec with inputs enterr(r) and exit(r) for each train r, and outputs lower and raise. Actions: Input: enterr(r), r a train exit(r), r a train Output: lower raise CompSpec receives sensor information when a train arrives in the region R and when it leaves the crossing I. Note that CompSpec does not have an input action enteri(r); this expresses the assumption that there is no sensor that informs the system when a train actually enters the crossing. CompSpec has just a single state. Inputs and outputs are always enabled, and cause no state change. There are no timing requirements. Transitions: enterr(r) none exit(r) none lower Precondition: true none raise Precondition: true none 3.5 AxSpec To get the full specication, we compose the three MMT automata given above, Trains, Gate and CompSpec, yielding a new MMT automaton. But this is not enough: we then add constraints to express the correctness properties in which we are interested. Formally, these constraints are axioms about an admissible timed execution of the composition automaton: 1. Safety Property All the states in satisfy the following condition: If Trains:r:status = I for any r, then Gate:status = down. 2. Utility Property If s is a state in with s:gate:status 6= up, then at least one of the following conditions holds. (a) There exists s 0 preceding (or equal to) s in with s 0 :Trains:r:status = I for some r and s 0 :now s:now, 2. (b) There exists s 0 following (or equal to) s in with s 0 :Trains:r:status = I for some r and s 0 :now s:now+ 1. (c) There exist two states s 0 and s 00 in, with s 0 preceding or equal to s, s 00 following or equal to s, s 0 :Trains:r:status = I for some r, s 00 :Trains:r:status = I for some r, and s 00 :now, s 0 :now

12 The Safety and Utility properties are stated independently. The Safety Property is an assertion about all the states reached in, saying that they all satisfy the critical safety property. In contrast, the Utility Property is a temporal property with a somewhat more complicated structure, which says that if the gate is not up, then either there is a recent preceding state or an imminent following state in which a train is in I. The third condition takes care of the special case where there is both a recent state and an imminent state in which some train is in I; although these states are not quite as recent or imminent as required by the rst two cases, there is insucient time for a car to pass through the crossing. In Appendix D, we show that the above statement of the Safety and Utility Properties is equivalent to a trivial modication of the original problem statement. We dene the admissible timed executions of AxSpec, atexces(axspec), to be the set of admissible timed executions of the composition automaton that satisfy the Safety and Utility axioms. Also, we dene the admissible timed traces of AxSpec, attraces(axspec), to be the set of timed traces of such executions. These are analogous to the notions of admissible timed execution and admissible timed traces used for timed automata. 3.6 Implementation Requirements An implementation of AxSpec uses a new timed automaton, called CompImpl, with the same interface as CompSpec. CompImpl will be composed with the same Trains and Gate automata given above, yielding a new system SystImpl. The system SystImpl should produce executions that, when projected on the environment (Trains composed with Gate), yields behavior that is also produced by the system specication AxSpec. More precisely, for every admissible timed execution of SystImpl, there should be a corresponding admissible timed execution 0 of AxSpec such that 0 jtrains Gate = jtrains Gate. That is, the two executions project identically on the Trains and Gate automata. 4 Operational Spec In contrast to AxSpec, which consists of a timed automaton together with some axioms that describe restrictions on the automaton's executions, the secondary operational specication, OpSpec, is simply a timed automaton { all required properties are built into the automaton itself as restrictions on the state set and on the actions that are permitted to occur. As a result, OpSpec is probably harder for an application expert to understand than AxSpec. But it is easier to use in proofs (at least for the style of verication we are using). Thus we regard OpSpec as an intermediate specication rather than a true problem specication; we only require that OpSpec implement AxSpec, not necessarily vice versa, and that all implementations of interest satisfy OpSpec. The two types of specications are also dierent in another respect: while AxSpec preserves the independence of the Safety and Utility Properties, OpSpec does not. When a collection of separate properties are specied by an automaton, the properties usually become intertwined. 4.1 The Specication To obtain OpSpec, we rst compose Trains, Gate, and CompSpec, and then incorporate the Safety and Utility Properties into the automaton itself. Formally, the modied automaton is obtained from the composition by restricting it to a subset of the state set, then adding some additional state components, and nally modifying the denitions of the steps to describe their dependence on 12

13 and their eects on the new state components. Although the composition of the three component automata is an MMT automaton, the modied version is not { it is a timed automaton. First, to express the Safety Property, we restrict the states to be those states of the composition that satisfy the following invariant: \If Trains:r:status = I for any r, then Gate:status = down." Second, the time-bound restrictions expressed by the Utility Property are encoded as restrictions on the steps. The strategy is similar to that used in Appendix B to encode MMT time bound restrictions into the steps of a timed automaton { it involves adding explicit deadline components. We describe the modications in two pieces: 1. The time from when the gate starts going down until some train enters I is bounded by 1.To express this restriction formally, we add to the state of the composed system a new deadline last 1, representing the latest time in the future that a train is guaranteed to enter I. Initially, this is set to 1, meaning that there is no such scheduled requirement. To add this new component toopspec, we include the following new eects in two of the actions: Transitions: lower if s:gate:status 2fup; going-upg and s:last 1 = 1 then s 0 :last 1 = now + 1 else unchanged last 1 enteri(r) s 0 :last 1 = 1 There is also a new precondition added: the time-passage action cannot cause time to pass beyond last 1. This means that whenever the gate starts moving down, some train must enter I within time 1. The new eect being added to the lower action just \schedules" the arrival of a train in I. 2. From when the crossing becomes empty, either the time until the gate is up is bounded by 2 or else the time until a train is in I is bounded by Again, we express the condition by adding deadlines, only this time the situation is trickier since there are two alternative bounds rather than just one. We add two new components, last 2 (up) and last 2 (I), both initially 1. The rst represents a milestone to be noted { whether or not the gate reaches the up position by the designated time { rather than an actual deadline. In contrast, the second represents a real deadline { a time by which a new train must enter I, unless the gate reached the up position by the milestone time last 2 (up). To add these new components to OpSpec, we include the following additional eects in three of the actions: Transitions: exit(r) if s:trains:r 0 :status 6= I for all r 0 6= r then s 0 :last 2(up) =now + 2 s 0 :last 2(I) =now else unchanged last 2(up) unchanged last 2(I) up if now s:last 2(up) then s 0 :last 2(up) =1 s 0 :last 2(I) =1 else unchanged last 2(up) unchanged last 2(I) enteri(r) s 0 :last 2(up) =1 s 0 :last 2(I) =1 13

14 Also, as with last 1, an implicit precondition is placed on the time-passage action, saying that time cannot pass beyond last 2 (I). But no such limitation is imposed for time passing beyond last 2 (up), because this is just a milestone to be recorded, not a time-blockage. 4.2 Properties We make some simple claims about OpSpec: Lemma 4.1 In all reachable states of OpSpec: 1. If Trains:r:status = I for any r, then Gate:status = down. 2. last 2 (up)++ 1 =last 2 (I). Proof: The rst property isby denition of OpSpec. The second property is proved by induction. We need only consider actions that aect last 2 (up) and last 2 (I), namely, up, enteri(r), and exit(r) for some r. For the action up, the only case in which the last 2 components are aected is where now s:last 2 (up). In this case, the eect of up is s 0 :last 2 (up) =s 0 :last 2 (I) =1, and the claim is satised. The eect of enteri(r)iss 0 :last 2 (up) =s 0 :last 2 (I) =1, and thus the claim is satised. For exit(r), the only case in which the last 2 components are aected is where r's exit leaves I empty. Then the eect is s 0 :last 2 (up) =now+ 2 and s 0 :last 2 (I) =now , which implies that s 0 :last 2 (up)++ 1 = s 0 :last 2 (I), as needed. Lemma 4.2 In all reachable states of OpSpec: 1. now last now last 2 (I). 3. If last 1 6= 1 then last 1 now If last 2 (I) 6= 1 then last 2 (I) now If last 2 (up) 6= 1 then last 2 (up) now + 2. Proof: By induction. Note that the only actions that can aect the truth of 1 or 3 are time passage, lower and enteri actions, and only time passage and lower actions could falsify 1 or 3. Also, the only actions that can aect the truth of 2, 4, or 5 are time passage, exit, up and enteri actions, and only time passage actions and exit actions that leave I empty could falsify 2, 4 or The precondition for time passage prevents s 0 :now from exceeding s:last 1 = s 0 :last 1. The eect of lower is s 0 :last 1 = now + 1. By denition of the constants, 1 > 0, which implies that s 0 :last 1 now. 2. The precondition for time passage prevents s 0 :now from exceeding s:last 2 (I) =s 0 :last 2 (I). If r's exit leaves I empty, then an eect of exit(r) iss 0 :last 2 (I) =now By denition of the constants, > 0, which implies that s 0 :last 2 (I) now. 14

15 3. If lower causes a change, then its eect is s 0 :last 1 = now + 1, which implies s 0 :last 1 now + 1 as needed. For the time passage action, suppose that s 0 :last 1 6= 1. Since s:last 1 = s 0 :last 1,we have s:last 1 6= 1. Then by inductive hypothesis, s:last 1 s:now + 1. But s:now <s 0 :now, so s:now + 1 <s 0 :now + 1. Therefore, s 0 :last 1 s 0 :now + 1 as needed. 4. Time passage causes time to increase, so it cannot cause the claim to be violated. For an exit(r) action that leaves I empty, an eect is s 0 :last 2 (I) =now , which suces. 5. Similar to Relationship Between OpSpec and AxSpec We show that OpSpec implements AxSpec in the following sense: Lemma 4.3 For any admissible timed execution of OpSpec, there is an admissible timed execution 0 of AxSpec such that 0 jtrainsgate = jtrainsgate. (This is the same as saying that satises the two properties given explicitly for AxSpec.) We leave the proof of Lemma 4.3 to Appendix E. Note that the relationship between OpSpec and AxSpec is only one-way: there are admissible timed executions of AxSpec that have no executions of OpSpec yielding the same projection. Consider, for example, the following example. Suppose that after I becomes empty, the system does a very rapid raise, lower, raise. These could conceivably all happen within time 2 after the previous time there was a train in I, which would make this \waing" behavior legal according to AxSpec. However, when this lower occurs, there is no following entry of a train into I, which means that this does not satisfy OpSpec. As a simple corollary, we obtain: Corollary 4.4 attraces(opspec) attraces(axspec). 4.4 Proof Strategy The relationship between OpSpec and AxSpec immediately suggests a strategy for showing that an implementation SystImpl, based on a particular computer system implementation CompImpl, satises AxSpec. The strategy is to show that every admissible timed execution of SystImpl has a corresponding admissible timed execution of OpSpec that projects identically on the Trains and Gate automata. Then use Lemma 4.3. A simpler approach, which we use for our example, is to show that attraces(sysimpl) attraces(opspec), which implies by Corollary 4.4 that attraces(sysimpl) attraces(axspec). Then general properties of composition can be used to infer the needed result. 5 Implementation To describe our implementation SystImpl, we use the same Trains and Gate automata but replace the CompSpec component in OpSpec and AxSpec with a new component CompImpl, a computer system implementation. 15

16 5.1 CompImpl CompImpl is not an MMT automaton but a timed automaton with the same interface as CompSpec. It keeps track of the trains in R, together with the earliest possible time that each might enter I. (This time could be in the past.) It also keeps track of the latest operation that it has performed on the gate and the current time. State: for each train r: r:status 2fnot-here;Rg, initially not-here r:sched-time, a nonnegative real number or 1, initially 1 gate-status 2fup; downg, initially up now, initially 0 Transitions: enterr(r) s 0 :r:status = R exit(r) s 0 :r:sched-time = now + 1 s 0 :r:status = not-here s 0 :r:sched-time = 1 lower Precondition: s:gate-status = up 9r : s:r:sched-time now + down + s 0 :gate-status = down raise Precondition: s:gate-status = down 69r:s:r:sched-time now + up + + down s 0 :gate-status = up (t) Precondition: t = s:now +t if s:gate-status = up then t < s:r:sched-time, down for all r if s:gate-status = down then 9r : s:r:sched-time s:now + up + + down s 0 :now = t Observe that the fact that CompImpl:gate-status = up does not mean that Gate:status = up but just that Gate:status 2fup; going-upg. A similar remark holds for CompImpl:gate-status = down. Note that r:sched-time keeps track of the earliest time that train r might enter I. The system lowers the gate if the gate is currently up (or going up) and some train might soon arrive ini. Here \soon" means by the time the computer system can lower the gate plus a little bit more { this is where we consider the technical race condition mentioned earlier. The system raises the gate if the gate is currently down (or going down) and no train can soon arrive ini. This time, \soon" means by the time the gate can be raised plus the time for a car to pass through the crossing plus the time for the system to lower the gate. The system allows time to pass subject to two conditions. First, if gate-status = up, then real time is not allowed to reach a time at which it is necessary to lower the gate. Second, if gate-status = down and the gate should be raised, then time cannot increase at all (until the gate is raised). 5.2 The Full System Implementation, SystImpl The full system implementation, SystImpl, is just the composition of the Trains, Gate and CompImpl components. Here, we give some useful basic invariants about SystImpl; the next two lemmas say that CompImpl has accurate information about the trains and gate, respectively. 16

17 Lemma 5.1 The following are true in any reachable state of SystImpl: 1. CompImpl:r:status = R i Trains:r:status 2fP; Ig. 2. If Trains:r:status = P, then CompImpl:r:sched-time = Trains:rst(enterI(r)). 3. If CompImpl:r:status = R and CompImpl:r:sched-time > now, then Trains:r:status = P. 4. If Trains:r:status = I, then CompImpl:r:sched-time now. 5. If CompImpl:r:sched-time 6= 1, then Trains:r:status 2fP; Ig. Proof: By induction. 1. The only actions that can cause a violation are actions that change the truth values of either CompImpl:r:status = R or Trains:r:status 2fP; Ig, namely, enterr(r) and exit(r). But, enterr(r) makes both sides of the equivalence true, and exit(r) makes both sides false. Hence, the property is true. 2. The only actions that can cause a violation are actions that make Trains:r:status = P, or else change CompImpl:r:sched-time or Trains:rst(enterI(r)), namely, enterr(r), exit(r), and enteri(r). But exit(r) and enteri(r) cause Trains:r:status 6= P, so the claim is vacuously satised. Further, the eect of enterr(r) ensures that s 0 :Trains:rst(enterI(r)) = now+ 1, and s 0 :CompImpl:r:sched-time = now + 1. Hence, s 0 :Trains:rst(enterI(r)) = s 0 CompImpl:r:sched-time, as required. 3. The only actions that can cause a violation are those that can make CompImpl:r:status = R, increase CompImpl:r:sched-time, or make Trains:r:status 6= P, namely, enterr(r), exit(r), and enteri(r). The eect of exit(r) iscompimpl:r:status 6= R, and thus the claim is vacuously satised. The eect of enterr(r) istrains:r:status = P, and thus the claim is satised. Now consider enteri(r). By the precondition of enteri(r), s:trains:r:status = P and now s:trains:rst(enteri(r)). Part 2 of this lemma implies that now s:compimpl:r:sched-time. Since s:compimpl:r:sched-time = s 0 :CompImpl:r:sched-time, wehave now s 0 :CompImpl:r:sched-time, and the claim is vacuously satised. 4. Suppose s 0 :Trains:r:status = I. Then Part 1 implies that s 0 :CompImpl:r:status = R. If s 0 :CompImpl:r:sched-time > s 0 :now, then Part 3 implies that s 0 :Trains:r:status = P, a contradiction. So, s 0 :CompImpl:r:sched-time s 0 :now as needed. 5. The only action that could cause a violation, enterr(r), sets s 0 :CompImpl:r:sched-time 6= 1. In this case, we haves 0 :CompImpl:r:status = R. Then Part 1 implies s 0 :Trains:r:status 2fP; Ig as needed. Lemma 5.2 The following are true in any reachable state of SystImpl: 1. CompImpl:gate-status = up if and only if Gate:status 2fup; going-upg. 2. CompImpl:gate-status = down if and only if Gate:status 2fdown; going-downg. 17

18 Proof: By induction. 1. We need only consider actions that change the truth values of CompImpl:gate-status = up and Gate:status 2fup; going-upg, namely, lower and raise. For a lower action, s 0 :CompImpl:gate-status = down and s 0 :Gate:status 2fdown; going-downg, which suces. For a raise action, s 0 :CompImpl:gate-status = up and s 0 :Gate:status 2fup; going-upg, which again suces. 2. Follows from Part 1. 6 Correctness Proof The main correctness proof shows that every admissible execution of SystImpl projects on the external world like some admissible execution of OpSpec. We rst prove a collection of invariants, leading to a proof of the safety property. All of the invariants are proved by induction on the length of an execution. Then we give a simulation mapping to show the Utility Property. Technically speaking, the simulation mapping only preserves timed traces, not the complete view of the environment components. However, standard composition techniques for timed automata show that the view is also preserved. 6.1 Invariants In this section, we prove the main safety invariant, namely: \If Trains:r:status = I for any r, then Gate:status = down." We do this with the help of two preliminary invariants. The rst invariant says that if a train is in the region and the gate is either up or going up, then the train must still be far from the crossing. Lemma 6.1 In all the reachable states of SystImpl, if Trains:r:status = P and Gate:status 2fup; going-upg, then Trains:rst(enterI(r)) > now + down. Proof: By induction. Fix any particular train r. We need only consider actions that cause Trains:r:status to become equal to P, cause Gate:status to change to be in fup; going-upg, decrease Trains:rst(enterI(r)), or increase now, namely enterr(r), raise, and. 1. enterr(r) An eect is s 0 :Trains:rst(enterI(r)) = now + 1. Since 1 > down by an assumption on the constants, we haves 0 :Trains:rst(enterI(r)) > now + down, as needed. 2. raise Assume that s 0 :Trains:r:status = P. The precondition implies that s:compimpl:r:sched-time > now + up + + down, so that s:compimpl:r:sched-time > now + down and therefore s 0 :CompImpl:r:sched-time > now + down. By Lemma 5.1, Part 2, s 0 :CompImpl:r:sched-time = s 0 :Trains:rst(enterI(r)). So s 0 :Trains:rst(enterI(r)) > now + down, as needed. 18

19 3. (t) Assume s 0 :Trains:r:status = P and s 0 :Gate:status 2fup; going-upg. Then, Lemma 5.2 implies that s 0 :CompImpl:gate-status = up, and the precondition for time passage implies that s 0 :now <s:compimpl:r:sched-time, down. By Lemma 5.1, Part 2, s:compimpl:r:sched-time = s:trains:rst(enteri(r)). So, s:trains:rst(enteri(r)) >s 0 :now + down, which implies s 0 :Trains:rst(enterI(r)) >s 0 :now + down, as needed. The second invariant says that if a train is nearing I and the gate is going down, then the gate is nearing the down position. In particular, the earliest time at which the train might enter I is strictly after the latest time at which the gate will be down. Lemma 6.2 In all reachable states of SystImpl, if Trains:r:status = P and Gate:status = going-down, then Trains:rst(enterI(r)) > Gate:last(down). Proof: Another inductive argument. Fix any particular train r. We need only consider actions that make Trains:r:status = P or Gate:status = going-down, decrease Trains:rst(enterI(r)) or increase Gate:last(down), namely, enterr(r), lower, enteri(r), raise and down. 1. enteri(r), raise, ordown. In each case, the claim is vacuously satised. 2. enterr(r) Assume s 0 :Trains:r:status = P and s 0 :Gate:status = going-down. Then, Part 2 of Lemma B.1 implies that s 0 :Gate:last(down) now + down. The eect of enterr(r) is s 0 :Trains:rst(enterI(r)) = now + 1. By an assumption about the constants, 1 > down, and so now + 1 > now + down.sos 0 :Trains:rst(enterI(r)) >s 0 :Gate:last(down) as needed. 3. lower Suppose s 0 :Trains:r:status = P. We only need to consider the case where s:gate:status 2 fup; going-upg, since otherwise the lower doesn't change anything. By Lemma 6.1, this implies that s:trains:rst(enteri(r)) > now + down, which implies that s 0 :Trains:rst(enterI(r)) > now + down. Since now + down = s 0 :Gate:last(down), the needed inequality follows. These invariants yield the main safety result: Lemma 6.3 In all reachable states of SystImpl, if Trains:r:status = I for any r, then Gate:status = down. Proof: By induction again. This time, the interesting cases are enteri and raise. Fix r. 19

20 1. enteri(r) By the precondition, s:trains:r:status = P. If s:gate:status 2fup; going-upg, then Lemma 6.1 implies that s:trains:rst(enteri(r)) > now+ down,sos:trains:rst(enteri(r)) > now. But, the precondition for enteri(r) is s:trains:rst(enteri(r)) now. This means that it is impossible for this action to occur, a contradiction. If s:gate:status = going-down, then Lemma 6.2 implies that s:trains:rst(enteri(r)) > s:gate:last(down). By Lemma B.1, s:gate:status = going-down implies s:gate:last(down) now. This implies that s:trains:rst(enteri(r)) > now, which again means that it is impossible for this action to occur. The only remaining case is s:gate:status = down. This implies s 0 :Gate:status = down, which suces. 2. raise We need to show that the gate doesn't get raised when a train is in I. So suppose that s:trains:r:status = I. The precondition of raise states that 69r: s:compimpl:r:sched-time now + up + + down, which implies that, for all r, s:compimpl:r:sched-time > now. But Parts 1 and 3 of Lemma 5.1 imply that in this case, s:trains:r:status = P, a contradiction. 6.2 Simulation Mapping Now, in order to show the Utility Property, we present the simulation mapping from SystImpl to OpSpec. Specically, if s and u are states of SystImpl and OpSpec, respectively, then we dene s and u to be related by relation f provided that: 1. u:now = s:now. 2. u:trains = s:trains u:gate = s:gate. 4. u:last 1 minfs:trains:last(enteri(r))g. 5. Either u:last 2 (I) minfs:trains:last(enteri(r))g, or u:last 2 (up) now + up and the raise precondition holds in s, or u:last 2 (up) s:gate:last(up) and s:gate:status = going-up. The rst three parts of the denition are self-explanatory. The last two parts provide connections between the time deadlines in the specication and implementation. In the typical style for this approach, the connections are expressed as inequalities. The fourth condition bounds the latest time for some train to enter I, a bound mentioned in the specication, in terms of the actual time it could take in the implementation, namely, the minimum of the latest times for all the trains in P. The fth condition is slightly more complicated { it bounds the time for either some train to enter I or 2 By this we mean that the entire state of the Trains automaton, including the time components, is preserved. 20

A simple algorithm with no simple verication

A simple algorithm with no simple verication Laszlo Csirmaz Central European University Abstract The correctness of a simple sorting algorithm is resented, which algorithm is \evidently wrong" at the rst

Software development process

OpenStax-CNX module: m14619 1 Software development process Trung Hung VO This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 2.0 Abstract A software development

Chapter 6 Finite sets and infinite sets. Copyright 2013, 2005, 2001 Pearson Education, Inc. Section 3.1, Slide 1

Chapter 6 Finite sets and infinite sets Copyright 013, 005, 001 Pearson Education, Inc. Section 3.1, Slide 1 Section 6. PROPERTIES OF THE NATURE NUMBERS 013 Pearson Education, Inc.1 Slide Recall that denotes

Virtual Time and Timeout in Client-Server Networks

Virtual Time and Timeout in Client-Server Networks Jayadev Misra July 13, 2011 Contents 1 Introduction 2 1.1 Background.............................. 2 1.1.1 Causal Model of Virtual Time...............

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

Combinatorial PCPs with ecient veriers

Combinatorial PCPs with ecient veriers Or Meir Abstract The PCP theorem asserts the existence of proofs that can be veried by a verier that reads only a very small part of the proof. The theorem was originally

MA651 Topology. Lecture 6. Separation Axioms.

MA651 Topology. Lecture 6. Separation Axioms. This text is based on the following books: Fundamental concepts of topology by Peter O Neil Elements of Mathematics: General Topology by Nicolas Bourbaki Counterexamples

Practice Problems Solutions

Practice Problems Solutions The problems below have been carefully selected to illustrate common situations and the techniques and tricks to deal with these. Try to master them all; it is well worth it!

Verication by Finitary Abstraction Weizmann Institute of Sciences and Universite Joseph Fourier, Grenoble Fourth International Spin Workshop (SPIN'98) Paris 2.11.98 Joint work with: Y. Kesten Ben Gurion

CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e.

CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e. This chapter contains the beginnings of the most important, and probably the most subtle, notion in mathematical analysis, i.e.,

CHAPTER 7 GENERAL PROOF SYSTEMS

CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

Unraveling versus Unraveling: A Memo on Competitive Equilibriums and Trade in Insurance Markets

Unraveling versus Unraveling: A Memo on Competitive Equilibriums and Trade in Insurance Markets Nathaniel Hendren January, 2014 Abstract Both Akerlof (1970) and Rothschild and Stiglitz (1976) show that

136 CHAPTER 4. INDUCTION, GRAPHS AND TREES

136 TER 4. INDUCTION, GRHS ND TREES 4.3 Graphs In this chapter we introduce a fundamental structural idea of discrete mathematics, that of a graph. Many situations in the applications of discrete mathematics

Subsets of Euclidean domains possessing a unique division algorithm

Subsets of Euclidean domains possessing a unique division algorithm Andrew D. Lewis 2009/03/16 Abstract Subsets of a Euclidean domain are characterised with the following objectives: (1) ensuring uniqueness

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT? introduction Many students seem to have trouble with the notion of a mathematical proof. People that come to a course like Math 216, who certainly

Chapter 1: Key Concepts of Programming and Software Engineering

Chapter 1: Key Concepts of Programming and Software Engineering Software Engineering Coding without a solution design increases debugging time - known fact! A team of programmers for a large software development

each college c i C has a capacity q i - the maximum number of students it will admit

n colleges in a set C, m applicants in a set A, where m is much larger than n. each college c i C has a capacity q i - the maximum number of students it will admit each college c i has a strict order i

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References

Outline Computer Science 331 Introduction to Testing of Programs Mike Jacobson Department of Computer Science University of Calgary Lecture #3-4 1 Denitions 2 3 4 Implementation and Evaluation 5 Debugging

Notes on Factoring. MA 206 Kurt Bryan

The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

Regular Languages and Finite Automata

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

Stochastic Inventory Control

Chapter 3 Stochastic Inventory Control 1 In this chapter, we consider in much greater details certain dynamic inventory control problems of the type already encountered in section 1.3. In addition to the

Partitioning edge-coloured complete graphs into monochromatic cycles and paths

arxiv:1205.5492v1 [math.co] 24 May 2012 Partitioning edge-coloured complete graphs into monochromatic cycles and paths Alexey Pokrovskiy Departement of Mathematics, London School of Economics and Political

Linear Algebra. A vector space (over R) is an ordered quadruple. such that V is a set; 0 V ; and the following eight axioms hold:

Linear Algebra A vector space (over R) is an ordered quadruple (V, 0, α, µ) such that V is a set; 0 V ; and the following eight axioms hold: α : V V V and µ : R V V ; (i) α(α(u, v), w) = α(u, α(v, w)),

Chapter 7. Sealed-bid Auctions

Chapter 7 Sealed-bid Auctions An auction is a procedure used for selling and buying items by offering them up for bid. Auctions are often used to sell objects that have a variable price (for example oil)

MAT-71506 Program Verication: Exercises

MAT-71506 Program Verication: Exercises Antero Kangas Tampere University of Technology Department of Mathematics September 11, 2014 Accomplishment Exercises are obligatory and probably the grades will

MAT2400 Analysis I. A brief introduction to proofs, sets, and functions

MAT2400 Analysis I A brief introduction to proofs, sets, and functions In Analysis I there is a lot of manipulations with sets and functions. It is probably also the first course where you have to take

Prime Numbers. Chapter Primes and Composites

Chapter 2 Prime Numbers The term factoring or factorization refers to the process of expressing an integer as the product of two or more integers in a nontrivial way, e.g., 42 = 6 7. Prime numbers are

3. Mathematical Induction

3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

Scheduling Real-time Tasks: Algorithms and Complexity

Scheduling Real-time Tasks: Algorithms and Complexity Sanjoy Baruah The University of North Carolina at Chapel Hill Email: baruah@cs.unc.edu Joël Goossens Université Libre de Bruxelles Email: joel.goossens@ulb.ac.be

Ecient approximation algorithm for minimizing makespan. on uniformly related machines. Chandra Chekuri. November 25, 1997.

Ecient approximation algorithm for minimizing makespan on uniformly related machines Chandra Chekuri November 25, 1997 Abstract We obtain a new ecient approximation algorithm for scheduling precedence

THE FUNDAMENTAL THEOREM OF ARBITRAGE PRICING

THE FUNDAMENTAL THEOREM OF ARBITRAGE PRICING 1. Introduction The Black-Scholes theory, which is the main subject of this course and its sequel, is based on the Efficient Market Hypothesis, that arbitrages

Clustering and scheduling maintenance tasks over time

Clustering and scheduling maintenance tasks over time Per Kreuger 2008-04-29 SICS Technical Report T2008:09 Abstract We report results on a maintenance scheduling problem. The problem consists of allocating

Solving nonlinear equations in one variable

Chapter Solving nonlinear equations in one variable Contents.1 Bisection method............................. 7. Fixed point iteration........................... 8.3 Newton-Raphson method........................

Myla Archer and Constance Heitmeyer. farcher, heitmeyerg@itd.nrl.navy.mil. mechanical verication techniques is promising. Recently, we extended

Verifying Hybrid Systems Modeled as Timed Automata: A Case Study? Presented at HART '97, Grenoble, France, March 26-28, 1997 Myla Archer and Constance Heitmeyer Code 5546, Naval Research Laboratory, Washington,

Factoring & Primality

Factoring & Primality Lecturer: Dimitris Papadopoulos In this lecture we will discuss the problem of integer factorization and primality testing, two problems that have been the focus of a great amount

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 8 Functional Dependencies and Normal Forms Two different kinds

Handbook for the Computer Security Certification of Trusted Systems

Handbook for the Computer Security Certification of Trusted Systems Chapter 1: Overview Chapter 2: Development Plan Chapter 3: Formal Model of the Security Policy Chapter 4: Descriptive Top-Level Specification

arxiv:1112.0829v1 [math.pr] 5 Dec 2011

How Not to Win a Million Dollars: A Counterexample to a Conjecture of L. Breiman Thomas P. Hayes arxiv:1112.0829v1 [math.pr] 5 Dec 2011 Abstract Consider a gambling game in which we are allowed to repeatedly

Quiggin, J. (1991), Too many proposals pass the benefit cost test: comment, TOO MANY PROPOSALS PASS THE BENEFIT COST TEST - COMMENT.

Quiggin, J. (1991), Too many proposals pass the benefit cost test: comment, American Economic Review 81(5), 1446 9. TOO MANY PROPOSALS PASS THE BENEFIT COST TEST - COMMENT by John Quiggin University of

A Systematic Approach. to Parallel Program Verication. Tadao TAKAOKA. Department of Computer Science. Ibaraki University. Hitachi, Ibaraki 316, JAPAN

A Systematic Approach to Parallel Program Verication Tadao TAKAOKA Department of Computer Science Ibaraki University Hitachi, Ibaraki 316, JAPAN E-mail: takaoka@cis.ibaraki.ac.jp Phone: +81 94 38 5130

Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H. Yarmand and Douglas G.

Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H Yarmand and Douglas G Down Appendix A Lemma 1 - the remaining cases In this appendix,

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

MATH10212 Linear Algebra Textbook: D. Poole, Linear Algebra: A Modern Introduction. Thompson, 2006. ISBN 0-534-40596-7. Systems of Linear Equations Definition. An n-dimensional vector is a row or a column

INCIDENCE-BETWEENNESS GEOMETRY

INCIDENCE-BETWEENNESS GEOMETRY MATH 410, CSUSM. SPRING 2008. PROFESSOR AITKEN This document covers the geometry that can be developed with just the axioms related to incidence and betweenness. The full

The Trip Scheduling Problem

The Trip Scheduling Problem Claudia Archetti Department of Quantitative Methods, University of Brescia Contrada Santa Chiara 50, 25122 Brescia, Italy Martin Savelsbergh School of Industrial and Systems

11 Ideals. 11.1 Revisiting Z

11 Ideals The presentation here is somewhat different than the text. In particular, the sections do not match up. We have seen issues with the failure of unique factorization already, e.g., Z[ 5] = O Q(

Invertible elements in associates and semigroups. 1

Quasigroups and Related Systems 5 (1998), 53 68 Invertible elements in associates and semigroups. 1 Fedir Sokhatsky Abstract Some invertibility criteria of an element in associates, in particular in n-ary

SYSTEMS AND SOFTWARE REQUIREMENTS SPECIFICATION (SSRS) TEMPLATE. Version A.4, January 2014 FOREWORD DOCUMENT CONVENTIONS

SYSTEMS AND SOFTWARE REQUIREMENTS SPECIFICATION (SSRS) TEMPLATE Version A.4, January 2014 FOREWORD This document was written to provide software development projects with a template for generating a System

max cx s.t. Ax c where the matrix A, cost vector c and right hand side b are given and x is a vector of variables. For this example we have x

Linear Programming Linear programming refers to problems stated as maximization or minimization of a linear function subject to constraints that are linear equalities and inequalities. Although the study

It all depends on independence

Working Papers Institute of Mathematical Economics 412 January 2009 It all depends on independence Daniel Eckert and Frederik Herzberg IMW Bielefeld University Postfach 100131 33501 Bielefeld Germany email:

Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

1. R In this and the next section we are going to study the properties of sequences of real numbers.

+a 1. R In this and the next section we are going to study the properties of sequences of real numbers. Definition 1.1. (Sequence) A sequence is a function with domain N. Example 1.2. A sequence of real

Introduction to mathematical arguments

Introduction to mathematical arguments (background handout for courses requiring proofs) by Michael Hutchings A mathematical proof is an argument which convinces other people that something is true. Math

Determination of the normalization level of database schemas through equivalence classes of attributes

Computer Science Journal of Moldova, vol.17, no.2(50), 2009 Determination of the normalization level of database schemas through equivalence classes of attributes Cotelea Vitalie Abstract In this paper,

Simulation-Based Security with Inexhaustible Interactive Turing Machines

Simulation-Based Security with Inexhaustible Interactive Turing Machines Ralf Küsters Institut für Informatik Christian-Albrechts-Universität zu Kiel 24098 Kiel, Germany kuesters@ti.informatik.uni-kiel.de

TOPOLOGY: THE JOURNEY INTO SEPARATION AXIOMS

TOPOLOGY: THE JOURNEY INTO SEPARATION AXIOMS VIPUL NAIK Abstract. In this journey, we are going to explore the so called separation axioms in greater detail. We shall try to understand how these axioms

The Goldberg Rao Algorithm for the Maximum Flow Problem

The Goldberg Rao Algorithm for the Maximum Flow Problem COS 528 class notes October 18, 2006 Scribe: Dávid Papp Main idea: use of the blocking flow paradigm to achieve essentially O(min{m 2/3, n 1/2 }

The Halting Problem is Undecidable

185 Corollary G = { M, w w L(M) } is not Turing-recognizable. Proof. = ERR, where ERR is the easy to decide language: ERR = { x { 0, 1 }* x does not have a prefix that is a valid code for a Turing machine

SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

SUBGROUPS OF CYCLIC GROUPS KEITH CONRAD 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by g = {g k : k Z}. If G = g, then G itself is cyclic, with g as a generator. Examples

Automata and Languages

Automata and Languages Computational Models: An idealized mathematical model of a computer. A computational model may be accurate in some ways but not in others. We shall be defining increasingly powerful

School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213

,, 1{8 () c A Note on Learning from Multiple-Instance Examples AVRIM BLUM avrim+@cs.cmu.edu ADAM KALAI akalai+@cs.cmu.edu School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 1513 Abstract.

2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

[Refer Slide Time: 05:10]

Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION REDUCIBILITY ( LECTURE 16) SLIDES FOR 15-453 SPRING 2011 1 / 20 THE LANDSCAPE OF THE CHOMSKY HIERARCHY ( LECTURE 16) SLIDES FOR 15-453 SPRING 2011 2 / 20 REDUCIBILITY

REAL ANALYSIS I HOMEWORK 2

REAL ANALYSIS I HOMEWORK 2 CİHAN BAHRAN The questions are from Stein and Shakarchi s text, Chapter 1. 1. Prove that the Cantor set C constructed in the text is totally disconnected and perfect. In other

Rigorous Software Development CSCI-GA 3033-009

Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 11 Semantics of Programming Languages Denotational Semantics Meaning of a program is defined as the mathematical

Induction and the Division Theorem 2.1 The Method of Induction

2 Induction and the Division Theorem 2.1 The Method of Induction In the Introduction we discussed a mathematical problem whose solution required the verification of an infinite family of statements. We

This chapter is all about cardinality of sets. At first this looks like a

CHAPTER Cardinality of Sets This chapter is all about cardinality of sets At first this looks like a very simple concept To find the cardinality of a set, just count its elements If A = { a, b, c, d },

Math 317 HW #7 Solutions

Math 17 HW #7 Solutions 1. Exercise..5. Decide which of the following sets are compact. For those that are not compact, show how Definition..1 breaks down. In other words, give an example of a sequence

Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

programming languages, programming language standards and compiler validation

Software Quality Issues when choosing a Programming Language C.J.Burgess Department of Computer Science, University of Bristol, Bristol, BS8 1TR, England Abstract For high quality software, an important

Prime Numbers and Irreducible Polynomials

Prime Numbers and Irreducible Polynomials M. Ram Murty The similarity between prime numbers and irreducible polynomials has been a dominant theme in the development of number theory and algebraic geometry.

CARDINALITY, COUNTABLE AND UNCOUNTABLE SETS PART ONE

CARDINALITY, COUNTABLE AND UNCOUNTABLE SETS PART ONE With the notion of bijection at hand, it is easy to formalize the idea that two finite sets have the same number of elements: we just need to verify

A simple criterion on degree sequences of graphs

Discrete Applied Mathematics 156 (2008) 3513 3517 Contents lists available at ScienceDirect Discrete Applied Mathematics journal homepage: www.elsevier.com/locate/dam Note A simple criterion on degree

OPRE 6201 : 2. Simplex Method

OPRE 6201 : 2. Simplex Method 1 The Graphical Method: An Example Consider the following linear program: Max 4x 1 +3x 2 Subject to: 2x 1 +3x 2 6 (1) 3x 1 +2x 2 3 (2) 2x 2 5 (3) 2x 1 +x 2 4 (4) x 1, x 2

MATH 289 PROBLEM SET 1: INDUCTION. 1. The induction Principle The following property of the natural numbers is intuitively clear:

MATH 89 PROBLEM SET : INDUCTION The induction Principle The following property of the natural numbers is intuitively clear: Axiom Every nonempty subset of the set of nonnegative integers Z 0 = {0,,, 3,

Software Process for QA

Software Process for QA Basic approaches & alternatives CIS 610, W98 / M Young 1/7/98 1 This introduction and overview is intended to provide some basic background on software process (sometimes called

DISCRETE MATHEMATICS W W L CHEN

DISCRETE MATHEMATICS W W L CHEN c W W L Chen, 1982, 2008. This chapter originates from material used by the author at Imperial College, University of London, between 1981 and 1990. It is available free

The Role of Dispute Settlement Procedures in International Trade Agreements: Online Appendix

The Role of Dispute Settlement Procedures in International Trade Agreements: Online Appendix Giovanni Maggi Yale University, NBER and CEPR Robert W. Staiger Stanford University and NBER November 2010 1.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 1a Conceptual Design Hello in today session we would be looking

Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that. a = bq + r and 0 r < b.

Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that a = bq + r and 0 r < b. We re dividing a by b: q is the quotient and r is the remainder,

Sensitivity Analysis 3.1 AN EXAMPLE FOR ANALYSIS

Sensitivity Analysis 3 We have already been introduced to sensitivity analysis in Chapter via the geometry of a simple example. We saw that the values of the decision variables and those of the slack and

Large induced subgraphs with all degrees odd

Large induced subgraphs with all degrees odd A.D. Scott Department of Pure Mathematics and Mathematical Statistics, University of Cambridge, England Abstract: We prove that every connected graph of order

Separation Properties for Locally Convex Cones

Journal of Convex Analysis Volume 9 (2002), No. 1, 301 307 Separation Properties for Locally Convex Cones Walter Roth Department of Mathematics, Universiti Brunei Darussalam, Gadong BE1410, Brunei Darussalam

Course 221: Analysis Academic year , First Semester

Course 221: Analysis Academic year 2007-08, First Semester David R. Wilkins Copyright c David R. Wilkins 1989 2007 Contents 1 Basic Theorems of Real Analysis 1 1.1 The Least Upper Bound Principle................

Finite Sets. Theorem 5.1. Two non-empty finite sets have the same cardinality if and only if they are equivalent.

MATH 337 Cardinality Dr. Neal, WKU We now shall prove that the rational numbers are a countable set while R is uncountable. This result shows that there are two different magnitudes of infinity. But we

COMP 250 Fall Mathematical induction Sept. 26, (n 1) + n = n + (n 1)

COMP 50 Fall 016 9 - Mathematical induction Sept 6, 016 You will see many examples in this course and upcoming courses of algorithms for solving various problems It many cases, it will be obvious that

Regular Expressions and Automata using Haskell

Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions

Chapter II. Controlling Cars on a Bridge

Chapter II. Controlling Cars on a Bridge 1 Introduction The intent of this chapter is to introduce a complete example of a small system development. During this development, you will be made aware of the

13 Infinite Sets. 13.1 Injections, Surjections, and Bijections. mcs-ftl 2010/9/8 0:40 page 379 #385

mcs-ftl 2010/9/8 0:40 page 379 #385 13 Infinite Sets So you might be wondering how much is there to say about an infinite set other than, well, it has an infinite number of elements. Of course, an infinite

Chapter 21: The Discounted Utility Model

Chapter 21: The Discounted Utility Model 21.1: Introduction This is an important chapter in that it introduces, and explores the implications of, an empirically relevant utility function representing intertemporal

Betweenness of Points

Math 444/445 Geometry for Teachers Summer 2008 Supplement : Rays, ngles, and etweenness This handout is meant to be read in place of Sections 5.6 5.7 in Venema s text [V]. You should read these pages after

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

Lecture 8 The Subjective Theory of Betting on Theories

Lecture 8 The Subjective Theory of Betting on Theories Patrick Maher Philosophy 517 Spring 2007 Introduction The subjective theory of probability holds that the laws of probability are laws that rational

THE DIMENSION OF A VECTOR SPACE

THE DIMENSION OF A VECTOR SPACE KEITH CONRAD This handout is a supplementary discussion leading up to the definition of dimension and some of its basic properties. Let V be a vector space over a field

Specification and Analysis of Contracts Lecture 1 Introduction

Specification and Analysis of Contracts Lecture 1 Introduction Gerardo Schneider gerardo@ifi.uio.no http://folk.uio.no/gerardo/ Department of Informatics, University of Oslo SEFM School, Oct. 27 - Nov.

2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

Basic building blocks for a triple-double intermediate format

Basic building blocks for a triple-double intermediate format corrected version) Christoph Quirin Lauter February 26, 2009 Abstract The implementation of correctly rounded elementary functions needs high