ebook img

Minimization of Visibly Pushdown Automata Using Partial Max-SAT PDF

0.66 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Minimization of Visibly Pushdown Automata Using Partial Max-SAT

Minimization of Visibly Pushdown Automata Using Partial Max-SAT Matthias Heizmann, Christian Schilling, and Daniel Tischner UniversityofFreiburg,Germany 7 1 0 2 Abstract. Weconsidertheproblemofstate-spacereductionfornonde- n terministic weakly-hierarchical visibly pushdown automata (Vpa). Vpa a recognizearobustandalgorithmicallytractablefragmentofcontext-free J languagesthatisnaturalformodelingprograms. 8 Wedefineanequivalencerelationthatissufficientforlanguage-preserving 1 quotientingof Vpa.Ourdefinitionallowstomergestatesthathavedif- ferent behavior, as long as they show the same behavior for reachable ] equivalentstacks.WeencodetheexistenceofsucharelationasaBoolean L partial maximum satisfiability (PMax-Sat) problem and present an al- F gorithmthatquicklyfindssatisfyingassignments.Theseassignmentsare . s sub-optimal solutions to the PMax-Sat problem but can still lead to a c significantreductionofstates. [ Weintegratedourmethodintheautomata-basedsoftwareverifierUlti- 1 mateAutomizerandshowperformanceimprovementsonbenchmarks v fromthesoftwareverificationcompetitionSV-COMP. 0 6 1 1 Introduction 5 0 . Theclassofvisiblypushdownlanguages(Vpl)[7]liesproperlybetweentheregu- 1 larandthecontext-freelanguages.Vplenjoymostdesirablepropertiesofregular 0 languages (closure under Boolean operations and decision procedures for, e.g., 7 1 the equivalence problem). They are well-suited for representing data that have : both a linear and a hierarchical ordering, e.g., procedural programs [39,25,23,5] v and XML documents [36,33,40,35]. i X The corresponding automaton model is called visibly pushdown automaton r (Vpa).Itextendsthefiniteautomatonmodelwithastackofrestrictedaccessby a requiring that the input symbol specifies the stack action – a call (resp. return) symbolimpliesapush(resp.pop)operation,andaninternalsymbolignoresthe stack.Inthispaper,weconsideranotionof Vpawhereacallalwayspushesthe current state on the stack. These Vpa are called weakly-hierarchical Vpa [8]. Size reduction of automata is an active research topic [15,34,9,16,10,2,4] that is theoretically appealing and has practical relevance: smaller automata require less memory and speed up automata-based tools [28,30,22,24]. In this Thispaperisanextendedversionofthepaperwiththesametitlethatwillappear atTACAS2017[27]. q1 a c1 r/q 0 a q0 a q2 a qf a c q a 2 q3 r/q0 q a 1 1 c1 r/q0 (a) AVpa. c1 r/q0 a q0 a q2 aa qf q0 c2 q2 a qf a c 2 q3 r/q0 q3 r/q0 (b) Onepossiblequotienting. (c) Anotherpossiblequotienting. Fig.1: A Vpa and two possible quotientings due to unreachable stacks. paper, we present a size reduction technique for a general class of (nondeter- ministic) Vpa that is different from classes that were considered in previous approaches [6,32,14]. It is well-known that for deterministic finite automata the unique minimal automatoncanbeobtainedbyquotienting(i.e.,mergingequivalentstates),and there exists an efficient algorithm for this purpose [29]. Vpa do not have a canonicalminimum[6].Forotherautomatonclassesthatlackthisproperty,the usual approach is to find equivalence relations that are sufficient for quotient- ing [19,1,4]. The main difficulty of a quotienting approach for Vpa is that two states may behave similarly given one stack but differently given another stack, and as the number of stacks is usually infinite, one cannot simply compare the behaviors for each of them. 1.1 Motivating examples We now present three observations. The first observation is our key insight and showsthatVpahaveinterestingpropertiesthatwecanexploit.Theotherobser- vations show that Vpa have intricate properties that make quotienting nontriv- ial. For convenience, we use a for internal, c for call, and r for return symbols, and we omit transitions to the sink state. Exploiting unreachable stacks allows merging states Consider the Vpa in Figure 1(a). The states q and q have the same behavior for the internal 1 2 symbol a but different behaviors for the return symbol r with stack symbol q : 0 Namely, state q leads to the accepting state while q has no respective return 1 2 transition. However, in q it is generally impossible to take a return transition 2 with stack symbol q since q can only be reached with an empty stack. Thus 0 2 thebehaviorforthestacksymbolq is“undefined”andwecanmergeq andq 0 1 2 without changing the language. The resulting Vpa is depicted in Figure 1(b). a q q0 aa12 qq12 cc q3 rr12//qq12 qf a q0 aa12 q12 c q3 rr12//{{qq11,,qq22}} qf (a) AVpa. (b) Alanguage-changingquotienting. Fig.2: AVpawherequotientingofstatesleadstoquotientingofstacksymbols. Merging states requires a transitive relation Usingthesameargumentas above,wecanalsomergethestatesq andq ;theresultisdepictedinFigure1(c). 2 3 Forfiniteautomata,mergeabilityofstatesistransitive.However,herewecannot merge all three states q , q , and q without changing the language because q 1 2 3 1 and q have different behaviors for stack symbol q . For Vpa, we have to check 3 0 compatibility for each pair of states. Merging states means merging stack symbols Consider the Vpa in Fig- ure 2(a). Since for (weakly-hierarchical) Vpa, stack symbols are states, merging thestatesq andq implicitlymergesthestacksymbolsq andq aswell.After 1 2 1 2 mergingwereceivetheVpainFigure2(b)whichrecognizesadifferentlanguage (e.g., it accepts the word a cr ). 1 2 1.2 Our approach WedefineanequivalencerelationoverVpastatesforquotientingthatislanguage- preserving. This equivalence relation exploits our key observation, namely that we can merge states if they have the same behavior on equivalent reachable stacks, even if they have different behavior in general (Section 3). We show an encodingofsucharelationasaBooleanpartialmaximumsatisfiability(PMax- Sat)instance(Section4).Inordertosolvetheseinstancesefficiently,wepropose a greedy algorithm that finds suboptimal solutions (Section 5.1). As a proof of concept, we implemented the algorithm and evaluated it in the context of the automata-based software verifier Ultimate Automizer [24,26] (Section 5.2). 2 Visibly pushdown automata In this section, we recall the basic definitions for visibly pushdown automata [7] and quotienting. After that, we characterize when an automaton is live. 2.1 Preliminaries Alphabet A (visibly pushdown) alphabet Σ = Σ Σ Σ is a partition i c r ] ] consistingofthreefinitesetsofinternal (Σ),call (Σ ),andreturn (Σ )symbols. i c r Aword isasequenceofsymbols.Wedenotethesetoffinitewordsoveralphabet Σ by Σ and the empty word by ε. As a convention we use a for internal, c for ∗ call, and r for return symbols, x for any type of symbol, and v,w for words. Thesetofwell-matched wordsoverΣ,WM(Σ),isthesmallestsetsatisfying: 1)ε WM(Σ);2)ifw WM(Σ),soiswafora Σ;and3)ifv,w WM(Σ), i ∈ ∈ ∈ ∈ soisvcwr forcr Σ Σ ,andwecallsymbolscandr matching.Givenaword c r ∈ · overΣ,foranyreturnsymbolwecanuniquelydeterminewhetherthesymbolis matching.Thesetofmatched-return words,MR(Σ),consistsofallwordswhere each return symbol is matching. Clearly, WM(Σ) is a subset of MR(Σ). Visibly pushdown automaton A visibly pushdown automaton (Vpa) is a tuple = (Q,Σ, ,∆,Q ,F) with a finite set of states Q, a visibly push- 0 A ⊥ down alphabet Σ, a bottom-of-stack symbol / Q, a transition relation ∆ = ⊥ ∈ (∆,∆ ,∆ ) consisting of internal transitions ∆ Q Σ Q, call transitions i c r i i ⊆ × × ∆ Q Σ Q,andreturntransitions∆ Q Σ Q Q,anonemptyset c c r r ⊆ × × ⊆ × × × of initial states Q Q, and a set of accepting states F Q. 0 ⊆ ⊆ def A stack σ is a word over St = Q . We write σ[i] for the i-th symbol of ∗ {⊥}· σ. A configuration is a pair (q,σ) Q St. A run ρ (w) of Vpa on word ∈ × A A w = x x Σ is a sequence of configurations (q ,σ )(q ,σ ) according 1 2 ∗ 0 0 1 1 ··· ∈ ··· to the following rules (for i 0): ≥ 1. If x Σ then (q ,x ,q ) ∆ and σ =σ . i+1 i i i+1 i+1 i i+1 i ∈ ∈ 2. If x Σ then (q ,x ,q ) ∆ and σ =σ q . i+1 c i i+1 i+1 c i+1 i i ∈ ∈ · 3. If x Σ then (q ,x ,qˆ,q ) ∆ and σ =σ qˆ. i+1 r i i+1 i+1 r i i+1 ∈ ∈ · A run is initial if (q ,σ ) Q . A configuration (q,σ) is reachable if 0 0 0 ∈ ×{⊥} there exists some initial run ρ = (q ,σ )(q ,σ ) such that (q ,σ ) = (q,σ) 0 0 1 1 i i ··· for some i 0, and unreachable otherwise. Similarly, we say that a stack σ is ≥ reachable(resp.unreachable)forstateqif(q,σ)isreachable(resp.unreachable). A run of length n is accepting if q F. A word w Σ is accepted if some n ∗ ∈ ∈ initial run ρ (w) is accepting. The language recognized by a Vpa is defined def A A as L( )= w w is accepted by . A Vpa is deterministic if it has one initial A { | A} state and the transition relation is functional. A finite automaton (Fa) is a Vpa where Σ =Σ = . c r ∅ Remark 1. We use a variant of Vpa that deviates from the Vpa model by Alur andMadhusudan[7]intwoways:1)Weforbidreturntransitionswhenthestack is empty, i.e., the automata accept only matched-return words; this assumption is also used in other works [37,32]. 2) We consider weakly-hierarchical Vpa where a call transition implicitly pushes the current state on the stack; this assumption is also a common assumption [32,14]; every Vpa can be converted to weakly-hierarchical form with 2Q Σ states [8]. | || | Both assumptions are natural in the context of computer programs: The call stack can never be empty, and return transitions always lead back to the respective program location after the corresponding call. Quotienting ForanequivalencerelationoversomesetS,wedenotetheequiv- def alenceclassofelementeby[e];analogously,liftedtosets,let[T]= [e] e T . { | ∈ } Given a Vpa =(Q,Σ, ,(∆,∆ ,∆ ),Q ,F) and an equivalence relation i c r 0 A ⊥ def Q Qonstates,thequotient VpaistheVpa / =([Q],Σ, ,∆,[Q ],[F]) 0 0 ≡⊆ × A ≡ ⊥ with ∆ =(∆,∆ ,∆ ) and 0 0i 0c 0r ∆ = ([q],a,[q ]) (p,a,p) ∆.p [q],p [q ] , • 0i { 0 |∃ 0 ∈ i ∈ 0 ∈ 0 } ∆ = ([q],c,[q ]) (p,c,p) ∆ .p [q],p [q ] , and • 0c { 0 |∃ 0 ∈ c ∈ 0 ∈ 0 } ∆ = ([q],r,[qˆ],[q ]) (p,r,pˆ,p) ∆ .p [q],p [q ], pˆ [qˆ] . • 0r { 0 |∃ 0 ∈ r ∈ 0 ∈ 0 ∈ } Quotienting is theprocess of mergingstates from the sameequivalenceclass to obtain the quotient Vpa; this implicitly means merging stack symbols, too. 2.2 Live visibly pushdown automata def Let Q =Q be the stack alphabet. The function top : St Q returns ⊥ ∪{⊥} → ⊥ the topmost symbol of a stack: σ = def top(σ)= ⊥ ⊥  q σ =σ q for some σ St  0· 0 ∈ Given a state q, the function tops : Q 2Q returns the topmost symbols  → ⊥ of all reachable stacks σ for q (i.e., reachable configurations (q,σ)): def tops(q)= top(σ) σ St.(q,σ) is reachable { |∃ ∈ } For seeing that tops is computable, consider a Vpa =(Q,Σ, ,∆,Q ,F). 0 A ⊥ The function tops is the smallest function f :Q 2Q satisfying: → ⊥ 1. q Q = f(q) 0 ∈ ⇒ ⊥∈ 2. qˆ f(q),(q,a,q ) ∆ = qˆ f(q ) 0 i 0 ∈ ∈ ⇒ ∈ 3. (q,σ) reachable for some σ, (q,c,q ) ∆ = q f(q ) 0 c 0 ∈ ⇒ ∈ 4. qˆ f(q),(q,r,qˆ,q ) ∆ = f(qˆ) f(q ) 0 r 0 ∈ ∈ ⇒ ⊆ WecallaVpalive ifthefollowingholds.Foreachstateqandforeachinternal andcallsymbolxthereisatleastoneoutgoingtransition(q,x,q )tosomestate 0 q ;additionally,foreachreturnsymbolrandstateqˆthereisatleastoneoutgoing 0 return transition (q,qˆ,r,q ) to some state q if and only if qˆ tops(q). 0 0 ∈ Note that a live Vpa has a total transition relation in a weaker sense: There areoutgoingreturntransitionsfromstateqifandonlyiftherespectivetransition can be taken in at least one run. That is, we forbid return transitions when no corresponding configuration is reachable. Every Vpa can be converted to live form by adding one sink state. Remark 2. For live Vpa , a run ρ (w) on word w can only “get stuck” in an A A empty-stack configuration, i.e., if w = v rv with r Σ such that ρ (v ) = 1 2 r 1 ∈ A (q ,σ ) (q , ) for some q Q. If w MR(Σ), no run gets stuck. 0 0 k k ··· ⊥ ∈ ∈ For the remainder of the paper, we fix a live Vpa = (Q,Σ, ,∆,Q ,F). 0 A ⊥ We sometimes refer to this Vpa as the input automaton. 3 A quotienting relation for VPA In this section, we define an equivalence relation on the states of a Vpa that is usefulforquotienting,i.e.,whoserespectivequotientVpaislanguage-preserving. Wefirstneedthenotionofclosure under successors foreachkindofsymbol. LetR Q Qbeabinaryrelationoverstatesandletp,q,pˆ,qˆ Qbestates. ⊆ × ∈ We say that R is closed under internal successors for (p,q) if for each internal symbol a Σ i • ∈ (p,a,p) ∆ (q,a,q ) ∆.(p,q ) R and 0 i 0 i 0 0 • ∀ ∈ ∃ ∈ ∈ (q,a,q ) ∆ (p,a,p) ∆.(p,q ) R, 0 i 0 i 0 0 • ∀ ∈ ∃ ∈ ∈ closed under call successors for (p,q) if for each call symbol c Σ c • ∈ (p,c,p) ∆ (q,c,q ) ∆ .(p,q ) R and 0 c 0 c 0 0 • ∀ ∈ ∃ ∈ ∈ (q,c,q ) ∆ (p,c,p) ∆ .(p,q ) R, 0 c 0 c 0 0 • ∀ ∈ ∃ ∈ ∈ closedunderreturnsuccessorsfor(p,q,pˆ,qˆ)ifforeachreturnsymbolr Σ r • ∈ (p,r,pˆ,p) ∆ (q,r,qˆ,q ) ∆ .(p,q ) R and 0 r 0 r 0 0 • ∀ ∈ ∃ ∈ ∈ (q,r,qˆ,q ) ∆ (p,r,pˆ,p) ∆ .(p,q ) R. 0 r 0 r 0 0 • ∀ ∈ ∃ ∈ ∈ Wearereadytopresentanequivalencerelationthatisusefulforquotienting using a fixpoint characterization. Definition 1 (Reachability-aware quotienting relation). Let be a Vpa A and R Q Q be an equivalence relation over states. We say that R is a Raq ⊆ × relation if for each pair of states (p,q) R the following constraints hold. ∈ (i) State p is accepting if and only if state q is accepting (p F q F). ∈ ⇐⇒ ∈ (ii) R is closed under internal successors for (p,q). (iii) R is closed under call successors for (p,q). (iv) For each pair of states (resp. topmost stack symbols) (pˆ,qˆ) R, ∈ R is closed under return successors for (p,q,pˆ,qˆ), or • no configuration (q,σ ) with qˆ=top(σ ) is reachable, or q q • no configuration (p,σ ) with pˆ=top(σ ) is reachable. p p • Remark 3. “Noconfiguration(q,σ )withqˆ=top(σ )isreachable”isequivalent q q to“qˆ/ tops(q)”.The equalityrelation (q,q) q Q isa Raqrelationforany ∈ { | ∈ } Vpa; the respective quotient Vpa is isomorphic to the input automaton. Example 1. Consider again the Vpa from Figure 1(a). We claim that the re- def lation R= (q,q) q Q (q ,q ),(q ,q ) is a Raq relation. Note that it 1 2 2 1 { | ∈ }∪{ } corresponds to the quotient Vpa from Figure 1(b). First we observe that R is an equivalence relation. We check the remaining constraints only for the two pairs (q ,q ) and (q ,q ). Both states are not accepting. Relation R is closed 1 2 2 1 under internal (here: a) and call (here: none, i.e., implicitly leading to a sink) successors. The return transition constraint is satisfied because in state q no 2 stack with topmost symbol q is reachable (q / tops(q )). 0 0 2 ∈ We want to use a Raq relation for language-preserving quotienting. For this purpose we need to make sure that unreachable configurations in Definition 1 do not enable accepting runs that are not possible in the original Vpa. In the remainder of this section, we show that this is indeed the case. Given an equivalence relation R Q Q on states, we call a stack σ the ⊆ × R-quotienting of some stack σ of the same height if either σ =σ = or for all 0 0 ⊥ i=2,..., σ each symbol σ[i] is the equivalence class of σ [i], i.e., σ [i] [σ[i]]. 0 0 | | ∈ We write σ [σ] in this case. (We compare stacks only for i 2 because the 0 ∈ ≥ first stack symbol is always .) ⊥ Lemma 1 (Corresponding run). Let be a Vpa and be some Raq rela- A ≡ tion for . Then for any matched-return word w and respective run A ρ (w)=([q ], ) ([q ],[σ ]) A/≡ 0 ⊥ ··· n n ··· in / there is some corresponding run A ≡ ρA(w)=(q00,⊥)···(qn0,σn0)··· in such that q [q ] and σ [σ ] for all i 0. A i0 ∈ i i0 ∈ i ≥ Proof. The proof is by induction on the length of w. The case for w = ε is trivial. Now assume w = w x for x Σ and fix some run ρ (w) = ([q ], ) ([q ],[σ ]) 0([q ],·[σ ]). T∈he hypothesis ensures thaAt/t≡here0 ex- 0 n n n+1 n+1 ⊥ ··· · ists a corresponding run for the prefix ρ (w)=(q , ) (q ,σ ) s.t. q [q ] A 00 ⊥ ··· n0 n0 n0 ∈ n and σ [σ ]. We will extend this run in each of the three cases for symbol x. n0 ∈ n 1) If x Σ, then, since there is a transition ([q ],x,[q ]) ∆ , there exist some∈staties q [q ] and q [q ] s.t. (qn,x,q n+1) ∈∆ i(/f≡rom the n00 ∈ n n00+1 ∈ n+1 n00 n00+1 ∈ i definitionofquotienting).Usingthat isclosedunderinternalsuccessors,there ≡ also exists a target state q [q ] s.t. (q ,x,q ) ∆. Additionally, n0+1 ∈ n+1 n0 n0+1 ∈ i because x Σ, we have that σ =σ [σ ]=[σ ] by the hypothesis. ∈ i n0+1 n0 ∈ n n+1 2) If x Σ , a similar argument holds, only this time the stack changes. We c ∈ have that σ =σ q [σ q ]=[σ ] by the hypothesis. n0+1 n0 · n0 ∈ n· n n+1 3) If x Σ , then the configuration (q ,σ ) is reachable (witnessed by the ∈ r n0 n0 runρ (w)).Since isclosedunderreturnsuccessorsforallstatesin[q ](mod- n A ≡ ulo unreachable configurations), for each top-of-stack symbol qˆ [top(σ )] s.t. ∈ n0 (q ,σ qˆ) is reachable for some stack σ there exists a corresponding return n0 00 · 00 transition (q ,x,qˆ,q ) ∆ with q [q ]; in particular, this holds for n0 n0+1 ∈ r n0+1 ∈ n+1 qˆ=top(σ ).Recallthat isassumedtobelive,whichensuresthateveryreturn n0 A transitionthatexistsinthequotientVpahassuchawitness.Thestackproperty σ [σ ] follows from the hypothesis. n0+1 ∈ n+1 tu FromtheabovelemmawecanconcludethatquotientingwithaRaqrelation preserves the language. Theorem 1 (Language preservation of quotienting). Let be a Vpa and A let be a Raq relation on the states of . Then L( )=L( / ). ≡ A A A ≡ Proof. Clearly, L( ) L( / ) for any equivalence relation . We show the A ⊆ A ≡ ≡ other inclusion by means of a contradiction. Assumethereexistsawordws.t.w L( / ) L( ).Byassumption,in / ∈ A ≡ \ A A ≡ thereisan acceptingrunρ (w).Then,byLemma1,there isacorresponding / run ρ (w). A ≡ A The run ρ (w) is also accepting by the property that [q] [F] if and only if A ∈ q F for all q [q] (cf. Property (i) of a Raq relation). 0 0 ∈ ∈ tu 4 Computing quotienting relations InSection3,weintroducedthenotionofaRaqrelationandshowedhowwecan use it to minimize Vpa while preserving the language. In this section, we show how we can compute a Raq relation. For this purpose, we provide an encoding as a partial maximum satisfiability problem (PMax-Sat). From a (in fact, any) solution, i.e., satisfying assignment, we can synthesize a Raq relation. While this does not result in the coarsest Raq relation possible, the relation obtained is locally optimal, i.e., there is no coarser Raq relation that is a strict superset. 4.1 Computing RAQ relations Note that in general there are many possible instantiations of a Raq relation, e.g., the trivial equality relation which is not helpful for minimization. Since we are interested in reducing the number of states, we prefer coarser relations over finer relations. To obtain a coarse relation, we describe an encoding of the Raq relation constraints as an instance of the PMax-Sat problem [13,20]. Such a problem consists of a propositional logic formula in conjunctive normal form with each clausebeingmarkedaseitherhard orsoft.Thetaskistofindatruthassignment suchthatallhardclausesaresatisfiedandthenumberofthesatisfiedsoftclauses is maximal. SAT encoding For the moment, we ignore soft clauses and provide a stan- dard Sat encoding of the constraints. The encoding has the property that any satisfying assignment induces a valid Raq relation . ≡ Let true and false be the Boolean constants. We need (n2) variables of the O form X where p and q are states of the input automaton. The idea is that p,q p q h{old}s if we assign the value true to X . (We ignore the order of p and q ≡as must be symmetric.) We express th{pe,qc}onstraints from Definition 1 as ≡ follows. Consider the constraint (i). For each pair of states (p,q) not satisfying the constraint we introduce the clause X . (1) ¬ {p,q} Consider the constraints (ii), (iii), (iv). For each transition (p,a,p) ∆, 0 i ∈ (p,c,p) ∆ , and (p,r,pˆ,p) ∆ and all states q and qˆwe respectively con- 0 c 0 r ∈ ∈ struct one of the following clauses. X (X X ) (2) ¬ {p,q}∨ {p0,q1a}∨···∨ {p0,qkaa} X (X X ) (3) ¬ {p,q}∨ {p0,q1c}∨···∨ {p0,qkcc} X X (X X ) (4) ¬ {p,q}∨¬ {pˆ,qˆ}∨ {p0,q1r}∨···∨ {p0,qkrr} Here the qa/qc are the respective a/c-successors of q and the qr are the r- i i i successorsofqwithstacksymbolqˆ.Toaccountfortheunreachableconfiguration relaxation, we may omit return transition clauses (4) where pˆ / tops(p) or ∈ qˆ/ tops(q). ∈ Wealsoneedtoexpressthat isanequivalencerelation,i.e.,weneedaddi- ≡ tional reflexivity clauses X (5) {q1,q1} and transitivity clauses X X X (6) ¬ {q1,q2}∨¬ {q2,q3}∨ {q1,q3} for any distinct states q , q , q (assuming there are least three states). Recall 1 2 3 that our variables already ensure symmetry. Let Φ be the conjunction of all clauses of the form (1), (2), (3), (4), (5), and (6). All assignments satisfying Φ represent valid Raq relations. However, we know that the assignment true p=q X {p,q} 7→false otherwise  corresponding to the equality relation is always trivially satisfying. Such an as- signment is not suited for our needs. We consider an assignment optimal if it represents a Raq relation with a coarsest partition. PMax-SAT encoding WenowdescribeanextensionoftheSatencodingtoa PMax-Satencoding.Inthissetting,wecanenforcethatthenumberofvariables that are assigned the value true is maximal. As an addition to Φ, we add for every two states p, q with p=q the clause 6 X (7) p,q { } and finally we consider all old clauses, i.e., clauses of the form (1)–(6), as hard clauses and all clauses of the form (7) as soft clauses. 4.2 Locally optimaximal RAQ relation NotethatanassignmentobtainedfromthePMax-Satencodingdoesnotneces- sarilygiveusacoarsestRaqrelation.ConsideraVpawithsevenstatesq ,...,q 0 6 andthepartition q ,q ,q ,q , q , q , q .Herewesetsixvariablesto 0 1 2 3 4 5 6 { } { } { } { } true (all pairs of states from the first set). However, the partition q ,q ,q , (cid:8) (cid:9) { 0 1 2} q ,q , q ,q is coarser, and yet we only set five variables to true. { 3 4} { 5 6} (cid:8) Despite not (cid:9)finding the globally maximal solution, we can establish local maximality. Theorem 2 (Local maximum). A satisfying assignment of the PMax-Sat instancecorrespondstoa Raqrelationsuchthatnostrictsupersetoftherelation is also a Raq relation. Proof. Itis clearfromthe constructionthatin theobtainedassignment,nofur- thervariableX canbeassignedthevaluetrue.Eachsuchvariabledetermines p,q membership of{the}symmetric pairs (p,q) and (q,p) in the Raq relation. tu 5 Experimental evaluation In this section, we report on our implementation and its potential in practice. 5.1 Implementation Initially, we apply the following preprocessing steps for reducing the complex- ity. First, we remove unreachable and dead states and make the Vpa live for return transitions (we do not require that the Vpa is total for internal or call transitions).Second,weimmediatelyreplacevariablesX bytrue(reflexivity). p Third,weconstructaninitialpartitionofthestatesand{re}placevariablesX p,q by false if p and q are not in the same block. This partition is the coarsest{fix}- point of a simple partition refinement such that states in the same block have thesameacceptancestatus,thesameoutgoinginternalandcallsymbols,and,if allstatesinablockhaveauniquesuccessorunderaninternal/callsymbol,those successorsareinthesameblock(cf.Definition1andHopcroft’salgorithm[29]). OptimallysolvingaPMax-SatinstanceisanNp-completeproblem.Expect- edly, a straightforward implementation of the algorithm presented in Section 4 using an off-the-shelf PMax-Sat solver does not scale to interesting problems (see also Appendix A). Therefore, we implemented a domain-specific greedy PMax-Sat solver that only maximizes the satisfied soft clauses locally. Our solver is interactive, i.e., clauses are added one after another, and prop- agation is applied immediately. After adding the last clause, the solver chooses some unset variable and first sets it to true optimistically. Theorem 2 still holds with this strategy. Apart from that, the solver follows the standard DPLL algo- rithm and uses no further enhancements found in modern Sat solvers. Remark 4. If the Vpa is deterministic, we obtain a Horn clause system. Then the above algorithm never needs to backtrack for more than one level, as the remaining clauses can always be satisfied by assigning false to the variables.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.