MemoryEfficient Reachability Graph Representations Using SweepLine Method TACAS
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Obtaining Memory-Efficient Reachability Graph Representations Using the Sweep-Line Method Thomas Mailund and Michael Westergaard Department of Computer Science University of Aarhus Denmark March 30, 2004 1/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Setting (1) • We want to explicitely store the entire reachability graph, but conserve space by storing each state/node using as few bits as possible • The most naїve representation of a state would store a pair (n, m) as two independent numbers, potentially wasting space (if n, m {0, . . . , 4}, we would use 2 · ceil(log(5)) = 3 + 3 = 6 bits per state, or even 32 + 32 = 64 bits or more, if we store them as integers) • A better approach is to enumerate the syntactically possible states, and use only enough bits to distinguish between them (ceil(log(5 · 5)) = 5 bits per state) March 30, 2004 2/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Setting (2) • The optimal solution is to enumerate the reachable states only, and store each state using the number of bits required to distinguish them (in the example, if only 13 of the states were actually reachable, we could store each state using ceil(log(13)) = 4 bits only) • Unfortunately we do not know the number of reachable states until after we have constructed the entire reachability graph. We try to address this problem here March 30, 2004 3/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Outline • Condensed Representation • The Sweep-Line Method • On-the-fly Construction of the Condensed Representation • Experimental Results March 30, 2004 4/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Example (1) • • 2 runners in a race with 2 laps Either t 1) runner 1 finishes a lap before runner 2, t 2) runner 2 finishes a lap before runner 1, or t 3) both runners finish a lap at the same time • • • A runner can be at most 1 lap ahead of the other runner In the beginning neither of the runners have finished any laps The state of the system is a pair (n, m), where n is the number of laps completed by runner 1 and m is the number of laps completed by runner 2 March 30, 2004 5/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Example (2) • • March 30, 2004 Only some (7) of the syntactically possible states (9) are reachable At least ceil(log(9))=4 bits are used to store each state, although ceil(log(7))=3 bits would suffice In realistic examples, the number of syntactically possible states is much larger than the number of reachable states, so distinguishing only between reachable states yields a good reduction Alas, we first know the number of reachable states, when we have constructed the reachability graph 6/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Condensed Representation • We assume that we can Transition enumerate the transitions • Assign to each reachable Destination Numberstate of transitions a number, 0…R-1 state • 4 2 3 6 5 State number 0 March 30, 2004 1 7/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Traversal of Condensed Representation 2 0 4 6 3 5 1 • We assume the existence of a (partial) mapping next that for a state and a transition gives the next state (e. g. next((1, 0), t 3)=(2, 1)) • We have not lost any information with this reduction, so analysis is still possible; for example a depth-first traversal would look like: DFS(0, s. I) proc DFS(i, m) if (visited(i)) return analyse(m) for each (t, i’) in E[i] DFS(i’, next(m, t)) end for end proc March 30, 2004 8/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 The Sweep-Line Method Not yet discovered state • We assume a progress measure, ψ, that assigns to each state a progress Discovered value, such thatbuts->s’ => unprocessed state ψ(s)≤ψ(s’) • Here, we take ψ(n, m)=n • All states to be processed are in front of the sweepline • All new states are added in front of Processed the sweep-line state • We do not need the states behind the sweep-line; they can safely be removed from memory sweep-line 0 1 2 progress March 30, 2004 9/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 New header: On-the-fly Construction Number of bits used to of the Condensod Representation represent the successor states sweep-line 4 State number 6 Number of transitions 2 3 0 1 Transition Destination state 5 Now 3 bits are required progress March 30, 2004 10/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Experimental Results • A prototypical implementation of the described method has been made in Design/CPN, a tool for editing, simulating and analysing Coloured Petri Nets • The implementation does not take into account the different sizes of the numbers, and encodes everything in a machine word March 30, 2004 11/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Experimental Results (Runner Example) March 30, 2004 12/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Experimental Results (Stop and Wait Protocol) March 30, 2004 13/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Experimental Results (Dining Philosophers) March 30, 2004 14/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Conclusion • We have seen an efficient representation of reachability graphs, and how this representation can be traversed for analysis • We have seen how the efficient representation can be calculated efficiently using the sweep-line method • We have seen how the method performs on some examples – basically, the method performs well when the sweep-line method performs well, i. e. for systems with a clear notion of progress March 30, 2004 15/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Future Work • Implementation of LTL/CTL checker • Use on more realistic examples • Use the described method with methods reducing the reachability graph itself, e. g. symmetry reduction March 30, 2004 16/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Non-monotone Progress Measures • If s->s’ => ψ(s)≤ψ(s’), we say that ψ is monotone • If the progress measure we use is not monotone, the algorithm still works, but the generated reachability graph may be an unfolding of the real reachability graph • The unfolded reachability graph and the real reachability graph are bisimilar (so CTL* is preserved) • This actually happens in the Dining Philosophers example March 30, 2004 17/16
Memory-Efficient Reachability Graph Representations Using Sweep-Line Method TACAS 2004 Non-monotone Progress Measures (2) • To the runner example, add a transition: t 4) When both runners have completed the race, start over March 30, 2004 18/16
- Slides: 18