• Keine Ergebnisse gefunden

Transfinite Control Flow Graphs

To go on, we take a slightly different view to transfinite trace semantics. Firstly, we must describe the transition in terms ofψrather thanψin terms of the transi-tion like in Sect. 4.1. This enables one to formulate all our properties of semantics in terms of properties ofψ. Secondly, we must augment our configurations with additional information about the atomic computation step executed just before reaching this configuration. In particular, this holds for the configurations reached via jumping out from an endless computation. Explicit encoding of such “trans-finite steps” into the semantics simplifies formalization of some useful properties later.

We will define the augmented configurations formally in the next section; this section introduces the appropriate context for doing it. Our graphs are all directed;

many well-known notions of graph theory are used, the necessary definitions and properties were given in Chapter 2.

LetPP be a set of formal objects called program points where one pointf ∈PP is called final. This in principle coincides with that of Sect. 4.1. Additionally, let AS be a set of formal objects encoding all conceivable atomic computation steps, e.g. assignments, predicate tests etc., including the transfinite steps seceding from loops. The transfinite steps form a subsetASofAS.

We require eache ∈AS incorporating also information about the program point

to which control reaches after making this step; call this program point target of eand denote it byt(e). Hence the elements ofAS cannot be just code fragments, they must enable one to locate the code in terms of our program points.

Assume that eache ∈AS determines also the source point ofewhich we denote bys(e). For ordinary stepse, it is the program point from which stepestarts. For transfinite stepse, the source ofe is meant to be the program point at which the values of variables are recorded for finding limit state when doing the transfinite stepe. Relying on Example 4.1.2, the source point of the transfinite step escaping from a while-loop should be the head point of this loop.

This way, the system TCFG = (PP,AS,(s,t))forms a (possibly infinite) di-rected graph (Definition 2.1.1). We call it global transfinite control flow graph and the elements ofAStransfinite arcs. This graph is a formal object like code.

The explanations in the preceding paragraphs take into account also the purpose the vertices and arcs can obtain via associating with a semantics.

Assume further thatf is reachable from every program point inTCFG while no arc starts fromf. The former means that transfinite arcs must in principle allow to escape from any place the computation has driven and enable finishing the run.

So(TCFG,f)forms a flow graph in the sense of Definition 2.2.1.

Denote byCFG the directed graph obtained fromTCFG by removing transfinite arcs; call it global control flow graph. The word ‘global’ is used in both cases with the aim of reflecting the property of the graph to incorporate all programs. To handle control flow graphs of specific programs, we introduce the parallel notions of local flow graphs.

Call local transfinite control flow graph any system (G,i) whereG is any sub-graph of TCFG being closed w.r.t. finding reachable vertices and arcs, and i is any vertex ofG. The vertexi is called initial. A graph is called local control flow graph if can be obtained from a local transfinite control flow graph by removing all transfinite arcs.

Note that any local transfinite control flow graph contains f and forms a flow graph of Definition 2.2.1 together withf. Any local control flow graph also must containf but not necessarily forms a flow graph in the sense of Definition 2.2.1.

The initial vertex can be different for different local flow graphs while the final vertexf is common for all.

For every programS ∈Prog, lettcfgS be a local transfinite control flow graph called transfinite control flow graph ofS. LetcfgS, the control flow graph ofS, be the local control flow graph obtained fromtcfgSby removing transfinite arcs.

The initial point oftcfgSis denoted byiS; call it the initial point of S. The set of all program points of a programS can therefore be denoted byV(tcfgS)(or, equivalently, byV(cfgS)).

The treatment may seem mysterious at first glance since we have fixed control flow graphs for programs before fixing a semantics. The common mind tells that finding control flow graph of a program cannot be done without knowing the se-mantics of this program.

The idea is that we take a big graph (the global transfinite) which enfolds all pos-sible transition systems ever needed, define semantics in terms of this graph and then programs can get their semantics via an appropriate mappingS 7→tcfgS. In our theoretical study, we just say that some mapping is fixed, omitting the details of its definition, and are therefore able to introduce it independently of semantics.

Another reason for this approach is that control flow graphs, like they are tradi-tionally computed according to the code, are not semantically precise, they are conservative approximations. Finding a semantically precise control flow graph is not decidable because a program doing it would decide whether a test statement really involves branching or whether a while-loop can terminate normally. To ob-tain results about slicing algorithms, the theory must capture decidable control flow graphs. In particular, this holds for transfinite arcs which also must be decid-able because the analyses being preformed in order to find slices must be decid-able to follow them.

Definition 4.2.1. LetSbe any program.

(i) CallSfinite ifftcfgScontains only a finite number of vertices and arcs.

(ii) CallSregular iffSis finite and, for every transfinite arceintcfgS,t(e)is the immediate postdominator ofs(e)intcfgS.

The notion of finiteness of programs places the traditional finiteness of programs into the context of control flow graphs. The definition of regularity refers to the postdominance order which is well-known but also explained by us in Sect. 2.2 for abstract flow graphs. Informally, a program pointq postdominates a program point p if control definitely reaches q whenever it has reached p (provided the computation finishes at f). The immediate postdominator ofp is the least w.r.t.

postdominance order point postdominating p. The notion of regularity is not in-tended to be a counterpart of any standard notion. It states the transfinite arcs respecting some order in the global graph. This condition has been formed keep-ing the treatment of while-loops from Sect. 4.1 in mind. There, the limit program point of a while-loop was defined in such a way that it coincided with the imme-diate postdominator of the head point of the while-loop.