• No results found

Model definition

Nested words. Data with both linear and hierarchical structure can be encoded using nested words [AM09]. Given a setΣ of symbols, thetagged alphabetΣˆ consists of the symbols a, ha, and ai, for eacha ∈ Σ. Anested wordover Σis a finite sequence over

ˆ

Σ. For a nested word a1· · ·ak, a positionj, for 1 ≤ j≤ k, is said to be acallposition if the symbolaj is of the formha, areturnposition if the symbolaj is of the formai, and

aninternalposition otherwise. The tags induce a matching relation between call and

return positions. Nested words can naturally encode strings and ordered trees.

Symbolic visibly pushdown automata. Symbolic Visibly Pushdown Automata (S- VPA) are an executable model for nested words over infinite alphabets. In S-VPAs transitions are labeled with predicates over the input alphabet, analogous to symbolic automata for strings over infinite alphabets. A key novelty of S-VPAs is the use of binary predicates to model relations between open and close tags in a nested word. We usePx(Ψ)andPx,y(Ψ)to denote the set of unary and binary predicates in Ψ re- spectively. We assume that every unary predicate inPx(Ψ)contains xas the only free variable (similarlyPx,y(Ψ)withxandy).

Definition 4.1 (S-VPA). A (nondeterministic) symbolic visibly pushdown automaton over an alphabetΣis a tupleA= (Q,Q0,P,δi,δc,δr,δb,F), where

• Qis a finite set of states; • Q0 ⊆Qis a set of initial states;

• Pis a finite set of stack symbols;

δi ⊆ Q×Px×Qis a finite set of internal transitions; • δc ⊆Q×Px×Q×Pis a finite set of call transitions; • δr ⊆Q×Px,y×P×Qis a finite set of return transitions;

• F⊆Qis a set of final states.

A transition(q,ϕ,q0)∈ δi, where ϕPx, when reading a symbolasuch thata ∈ [[ϕ]], starting in stateq, updates the state to q0. A transition(q,ϕ,q0,p) δc, whereϕ Px, and p ∈ P, when reading a symbol ha such that a ∈ [[ϕ]], starting in stateq, pushes

the symbol p on the stack along with the symbol a, and updates the state to q0. A transition (q,ϕ,p,q0) δr, where ϕPx,y, is triggered when reading an input bi, starting in stateq, and with(p,a) ∈ P×Σon top of the stack such that(a,b) ∈ [[ϕ]];

the transition pops the element on the top of the stack and updates the state to q0. A transition(q,ϕ,q0) ∈ δb, where ϕPx, is triggered when reading a tagged inputai such that a ∈ [[ϕ]], starting in state q, and with the current stack being empty; the transition updates the state toq0.

A stack is a finite sequence over P×Σ. We denote by Γ the set of all stacks. Given a nested word w = a1. . .ak in Σ∗, a run of M on wstarting in state qis a sequence ρq(w) = (q1,θ1), . . . ,(qk+1,θk+1), where q = q1, each qi ∈ Q, eachθi ∈ Γ, the initial stackθ1is the empty sequenceε, and for every 1≤i≤kthe following holds:

Internal: ifai is internal, there exists(q,ϕ,q0)∈ δi, such thatq= qi,q0 = qi+1,ai ∈[[ϕ]], andθi+1= θi;

Call: if ai = ha, for some a, there exists (q,ϕ,q0,p) ∈ δc, such that q = qi, q0 = qi+1,

a ∈[[ϕ]], andθi+1=θi(p,a);

Return: ifai = ai, for somea, there exists(q,ϕ,p,q0) ∈δr,b∈ Σ, andθ0 ∈ Γ, such that

q=qi,q0 = qi+1,θi =θ0(p,b),θi+1 =θ0, and(b,a)∈[[ϕ]];

Bottom: if ai = ai, for some a, there exists (q,ϕ,q0) ∈ δb, such thatq = qi, q0 = qi+1,

θi =θi+1= ε, anda ∈[[ϕ]].

A run isaccepting ifq1 is an initial state inQ0 and qk+1 is a final state in F. A nested

wordwis accepted by Aif there exists an accepting run ofAonw. The language[[A]]

accepted byAis the set of nested words accepted by A.

Definition 4.2 (Deterministic S-VPA). A symbolic visibly pushdown automaton Ais deterministic iff|Q0|=1 and

• for each two transitions t1 = (q1,ϕ1,q01),t2 = (q2,ϕ2,q02) ∈ δi, if q1 = q2 and

IsSat(ϕ1∧ϕ2), thenq10 =q02;

• for each two transitions t1 = (q1,ϕ1,q01,p1),t2 = (q2,ϕ2,q02,p2) ∈ δc, ifq1 = q2

q0 I:true C:true/p1 R:true,p1 q3 C:true/p2 q1 q2 I:true C:true/p1 R:true,p1 I:x>5 I:true C:true/p1 R:true,p1 I:true C:true/p1 R:true,p1 R:x<y/p2

FIGURE4.1: Example of S-VPA over the theory of integers.

• for each two transitionst1 = (q1,ϕ1,p1,q01),t2 = (q2,ϕ2,p2,q02) ∈ δr, ifq1 = q2,

p1 = p2, andIsSat(ϕ1∧ϕ2), thenq01=q02;

• for each two transitions t1 = (q1,ϕ1,q01),t2 = (q2,ϕ2,q02) ∈ δb, if q1 = q2, and

IsSat(ϕ1∧ϕ2), thenq10 =q02.

Example 4.3. Consider the following property of a program trace over the integers: there exists

a well-matched sub-trace w=hx w1y w2zisuch that z<x and y<5and both w1and w2are

well-matched nested words. This property can easily be expressed using the nondeterministic S-VPA shown in Fig. 4.1. In the figure the transitions are labeled with I, C, and R for Internal, Call and Return respectively. In the return transition the values x and y respectively refer to the symbols at the return and call respectively.

For a deterministic S-VPAAwe useq0to denote the only initial state ofA.

We now define complete S-VPAs, which we will use to prove that S-VPAs are closed under complement.

Definition 4.4(Complete S-VPA). A deterministic symbolic visibly pushdown automa- tonAis complete iff for eachq∈ Q,a,b∈ Σ, andp∈ P, there exist

• a transition(q,ϕ,q0)∈δi, such thata ∈[[ϕ]]; • a transition(q,ϕ,q0,p0)∈δc, such thata∈[[ϕ]]; • a transition(q,ϕ,p,q0)δr, such that(a,b)∈[[ϕ]]; • a transition(q,ϕ,q0)δb, such thata∈[[ϕ]].