Complete Abstractions for Checking Language Inclusion
aa r X i v : . [ c s . F L ] A p r Complete Abstractions for Checking Language Inclusion
Pierre Ganty ∗ , Francesco Ranzato † and Pedro Valero §∗∗ IMDEA Software Institute, Madrid, Spain. Email: [email protected] † University of Padova, Italy. Email: [email protected] § Universidad Polit´ecnica de Madrid, Spain. Email: [email protected]
Abstract —We study the language inclusion problem L ⊆ L where L is regular or context-free. Our approach relies on ab-stract interpretation and checks whether an overapproximatingabstraction of L , obtained by successively overapproximatingthe Kleene iterates of its least fixpoint characterization, isincluded in L . We show that a language inclusion prob-lem is decidable whenever this overapproximating abstractionsatisfies a completeness condition (i.e. its loss of precisioncauses no false alarm) and prevents infinite ascending chains(i.e. it guarantees termination of least fixpoint computations).Such overapproximating abstraction function on languages canbe defined using quasiorder relations on words where theabstraction gives the language of all words “greater than orequal to” a given input word for that quasiorder. We putforward a range of quasiorders that allow us to systematicallydesign decision procedures for different language inclusionproblems such as context-free languages into regular languagesand regular languages into trace sets of one-counter nets.We also provide quasiorders for which the induced inclusionchecking procedure corresponds to well-known state-of-the-art algorithms like the so-called antichain algorithms. Finally,we provide an equivalent greatest fixpoint language inclusioncheck which relies on quotients of languages and, to the bestof our knowledge, was not previously known.
1. Introduction
Language inclusion is a fundamental and classical prob-lem which consists in deciding, given two languages L and L , whether L ⊆ L holds. We consider languages of finitewords over a finite alphabet Σ .The basic idea of our approach for solving a languageinclusion problem L ⊆ L is to leverage Cousot andCousot’s abstract interpretation [9], [10] for checking theinclusion of an overapproximation (i.e. a superset) of L into L . Assuming that L is specified as least fixpointof an equation system on ℘ (Σ ∗ ) , an approximation of L is obtained by applying an overapproximating languageabstraction function ρ : ℘ (Σ ∗ ) → ℘ (Σ ∗ ) at each step ofthe Kleene iterates converging to the least fixpoint. This ρ is an upper closure operator which is used in standardabstract interpretation for approximating an input languageby adding several words (possibly none) to it. This abstractinterpretation-based approach provides an abstract inclusion check ρ ( L ) ⊆ L which is always sound by construction.We then give conditions on ρ which ensure a complete abstract inclusion check, namely the answer to ρ ( L ) ⊆ L is always exact (no false alarms in abstract interpretationterminology): (i) ρ ( L ) = L ; (ii) ρ is a complete ab-straction for symbol concatenation aX , for all a ∈ Σ ,according to the standard notion of completeness in abstractinterpretation [9], [18]. This approach leads us to designin Section 4 a generic algorithmic framework for languageinclusion problems which is parameterized by an underlyinglanguage abstraction (cf. Theorem 4.5).We then focus on overapproximating abstractions ρ which are induced by a quasiorder relation on words in Σ ∗ . Here, a language L is overapproximated by adding allthe words which are “greater than or equal to” some word of L for . This allows us to instantiate the above conditions(i) and (ii) for having a complete abstract inclusion check interms of the quasiorder . Termination, which correspondsto having finitely many Kleene iterates in the fixpoint com-putations, is guaranteed by requiring that the relation isa well-quasiorder.We define quasiorders satisfying the above conditionswhich are directly derived from the standard Myhill andNerode equivalence relations on words. These quasiordershave been first investigated by Ehrenfeucht et al. [15] andhave been later generalized and extended by de Luca andVarricchio [11], [12]. In particular, drawing from a result byde Luca and Varricchio [11], we show that the language ab-stractions induced by these Myhill and Nerode quasiordersare the most general ones which fit in our algorithmicframework for checking language inclusion. While Myhilland Nerode quasiorder abstractions do not depend on somelanguage representation (e.g., some class of automata orgrammars), we provide quasiorders which instead exploit anunderlying language representation given by a finite automa-ton. In particular, by selecting suitable well-quasiorders forthe class of language inclusion problems at hand we are ableto systematically derive decision procedures for a number ofdifferent inclusion problems L ⊆ L : (i) both L and L and regular; (ii) L is context-free and L is regular; (iii) L is regular and L is the trace language of a one-counter net.These decision procedures that we systematically derivehere by instantiating our framework are then related to ex-isting language inclusion checking algorithms. We study indetail the case where both languages L and L are regular1nd represented by finite state automata. When our decisionprocedure for L ⊆ L is derived from a well-quasiorder on Σ ∗ exploiting the automaton-based representation of L itturns out that we obtain the well-known antichain algorithmby De Wulf et al. [13]. Also, it turns out that by includinga simulation relation in the definition of the well-quasiorderwe derive a decision procedure that partially matches theinclusion algorithm by Abdulla et al. [2], hence also that byBonchi and Pous [5]. Moreover, we systematically derivean antichain algorithm for the case where L is representedby a context-free grammar and L is represented by a finitestate automaton. In this case, the resulting decision proce-dure closely resembles the antichain algorithm by Hol´ıkand Meyer [22]. A similar phenomenon happens for theinclusion problem of a regular language into the set of tracesof a one-counter net: in this case the decision procedure thatwe systematically derive matches the algorithm by Hofmanand Chen [20].Finally, we leverage a standard duality result in abstractfixpoint checking [8] and put forward a greatest fixpointapproach (instead of the above least fixpoint approach) forthe case where L is represented by a linear context-freegrammar and L is regular. In this case, we exploit the prop-erties of the overapproximating abstraction induced by thequasiorder in order to show that the Kleene iterates of thisgreatest fixpoint computation are finitely many. Interestingly,the Kleene iterates of the greatest fixpoint are finitely manywhether you apply the overapproximating abstraction ornot, a known phenomenon happening for so-called forwardcomplete abstract interpretations [17].
2. Background
Order Theory Basics. h D, i is a quasiordered set (qoset)when is a quasiorder relation on D , that is, reflexiveand transitive. A qoset h D, i satisfies the ascending (resp. descending ) chain condition (ACC, resp. DCC) if there isno countably infinite sequence of distinct elements { x i } i ∈ N such that, for all i ∈ N , x i x i +1 (resp. x i +1 x i ).A qoset is called ACC (DCC) when it satisfies the ACC(DCC).A qoset h D, i is a partially ordered set (poset) when is antisymmetric. A subset of a poset is directed if it isnonempty and every pair of elements has an upper boundin it. A poset h D, i is a directed-complete partial order (CPO) if it has the least upper bound (lub) of all its directedsubsets. A poset if a join-semilattice if it has the lub of allits nonempty finite subsets (so that binary lubs are enough).A poset is a complete lattice if it has the lub of all itsarbitrary (possibly empty) subsets (so that it also has thegreatest lower bound (glb) of all its arbitrary subsets).A qoset h D, i is a well-quasiordered set (wqoset) whenfor every countably infinite sequence of elements { x i } i ∈ N there exist i, j ∈ N such that i < j and x i x j . Forevery qoset h D, i we define the following relation betweensubsets X, Y ⊆ D : X ⊑ Y △ ⇐⇒ ∀ x ∈ X, ∃ y ∈ Y, y x. A minor of a set X ⊆ D , denoted by ⌊ X ⌋ , is a subset of X satisfying: (i) X ⊑ ⌊ X ⌋ and (ii) ⌊ X ⌋ is an antichain , that is, x x for no x , x ∈ ⌊ X ⌋ . Let us recall that every subsetof a wqoset h D, i has at least one minor set, all minor setsare finite and if h D, i is additionally a poset then thereexists exactly one minor set. We denote the set of antichainsof h D, i by AC h D, i , { X ⊆ D | X is an antichain } .It turns out that h AC h D, i , ⊑i is a qoset, it is ACC if h D, i is a wqoset and it is a poset if h D, i is a poset. Kleene Iterates.
Let h X, i be a qoset, f : X → X be afunction and b ∈ X . Then, the trace of values of the variable x ∈ X computed by the following iterative procedure: Kleene ( f, b ) , x := b ; while f ( x ) x do x := f ( x ); return x ; provides the possibly infinite sequence of so-called Kleeneiterates of the function f starting from the basis b . When h X, i is a ACC CPO, b f ( b ) and f is monotonic then Kleene ( f, b ) terminates and returns the least fixpoint of thefunction f which is greater than or equal to b .Let us also recall that given a monotonic function f : C → C on a complete lattice C , its least and greatestfixpoints always exist, and we denote them, resp., by lfp( f ) and gfp( f ) .For the sake of clarity, we overload the notation and usethe same symbol for an operator/relation and its component-wise (i.e. pointwise) extension on product domains. A vector Y in some product domain D | S | might be also denoted by h Y i i i ∈ S . In such case, Y q denotes its component Y q . Language Theory Basics.
Let Σ be an alphabet (that is,a finite nonempty set of symbols). Concatenation in Σ ∗ is simply denoted by juxtaposition, both for concatenatingwords uv , languages L L and words with languages, e.g. uL and uLv . We sometimes use the symbol · to referexplicitly to the concatenation operation.A finite automaton (FA) is a tuple A = h Q, δ, I, F, Σ i where Σ is the alphabet , Q is the finite set of states , I ⊆ Q are the initial states , F ⊆ Q are the final states , and δ : Q × Σ → ℘ ( Q ) is the transition relation , where q a → q ′ denotes that q ′ ∈ δ ( q, a ) . If u ∈ Σ ∗ and q, q ′ ∈ Q then q u q ′ means that the state q ′ is reachable from q byfollowing the string u . Therefore, q ǫ q ′ holds iff q = q ′ .The language generated by an FA A , denoted L ( A ) , is givenby L ( A ) , { u ∈ Σ ∗ | ∃ q i ∈ I, ∃ q f ∈ F, q i u q f } .
3. Inclusion Check by Complete Abstractions
The language inclusion problem consists in checkingwhether L ⊆ L holds where L and L are two languagesover an alphabet Σ . In this section, we show how backwardcomplete abstractions ρ can be used to compute ρ ( L ) , anoverapproximation of L such that ρ ( L ) ⊆ L ⇔ L ⊆ L .Let uco( C ) denote the set of upper closure operators(or simply closure operators) on a poset h C, ≤ C i , that is,2he set of monotonic, idempotent (i.e., ρ ( x ) = ρ ( ρ ( x )) ) andincreasing (i.e., x ≤ C ρ ( x ) ) functions in C → C . We oftenwrite c ∈ ρ ( C ) (or simply c ∈ ρ when C is clear from thecontext) to denote that there exists c ′ ∈ C with c = ρ ( c ′ ) .Recall that this happens iff ρ ( c ) = c . More details aboutclosure operators can be found on Appendix A.Closure-based abstract interpretation [10] can be appliedto solve a generic inclusion checking problem stated throughleast fixpoints as follows. Let ρ ∈ uco( C ) and c ∈ C suchthat c ∈ ρ . Then, for all c ∈ C , it turns out that c ≤ C c ⇔ ρ ( c ) ≤ C ρ ( c ) ⇔ ρ ( c ) ≤ C c (1)We apply here the standard notion of backward complete-ness in abstract interpretation [9], [10], [18]. In abstractinterpretation a closure operator ρ ∈ uco( C ) on a concretedomain C plays the role of abstraction function for objectsof C . A closure ρ ∈ uco( C ) is called backward complete fora concrete monotonic function f : C → C when ρf = ρf ρ holds. The intuition is that backward completeness modelsan ideal situation where no loss of precision is accumulatedin the computations of ρf when its concrete input objects areapproximated by ρ . It is well known that in this case back-ward completeness implies completeness of least fixpoints,namely, ρ (lfp( f )) = lfp( ρf ) = lfp( ρf ρ ) holds by assumingthat the these least fixpoints exist (this is the case, e.g., when C is a CPO). Theorem 3.1 shows that in order to check aninclusion c ≤ C c for some c = lfp( f ) and c ∈ ρ , itis enough to perform an inclusion check lfp( ρf ) ≤ C ρ ( c ) which works on the abstraction ρ ( C ) . Theorem 3.1. If C is a CPO, f : C → C is monotonic, ρ is backward complete for f and c ∈ ρ , then lfp( f ) ≤ C c ⇔ lfp( ρf ) ≤ C c . In particular, if h ρ, ≤ C i is ACC thenthe Kleene iterates of lfp( ρf ) are finitely many. In the following sections we apply this general abstrac-tion technique for a number of different language inclusionproblems, by designing decision algorithms which rely onspecific backward complete abstractions of ℘ (Σ ∗ ) .
4. An Algorithmic Framework for LanguageInclusion
Let A = h Q, δ, I, F, Σ i be a FA. Given S, T ⊆ Q , define W A S,T , { u ∈ Σ ∗ | ∃ q ∈ S, ∃ q ′ ∈ T : q u q ′ } . When S = { q } or T = { q ′ } we abuse the notation andwrite W A q,T , W A S,q ′ , or W A q,q ′ . Also, we omit the automaton A in superscripts when this is clear from the context. Thelanguage accepted by A is L ( A ) , W A I,F . Observe that L ( A ) = S q ∈ I W A q,F = S q ∈ F W A I,q . (2)Let us recall how to define the language accepted by anautomaton as a solution of a set of equations (see, e.g., [27,
1. Note that, as usual, S ∅ = ∅ . ba ba Figure 1. Finite automaton A over alphabet Σ = { a, b } with states { , } such that L ( A ) = ( a + ( b + a )) ∗ . Section I.2.4.3]). Given a Boolean predicate p ( x ) (typicallya membership predicate) and two sets T and F , let us define δ TF ( p ( x )) , ( T if p ( x ) holds F otherwise . The FA A induces the following set of equations: Eqn( A ) , { X q = δ { ǫ } ∅ ( q ∈ F ) ∪ S a ∈ Σ ,q a → q ′ aX q ′ | q ∈ Q } where X q ∈ ℘ (Σ ∗ ) , so that the functions in the right-hand sides of Eqn( A ) have type ℘ (Σ ∗ ) | Q | → ℘ (Σ ∗ ) . Since h ℘ (Σ ∗ ) | Q | , ⊆i is a (product) complete lattice (as h ℘ (Σ ∗ ) , ⊆i is a complete lattice) and all the functions in Eqn( A ) aremonotonic, the least solution h Y q i q ∈ Q of Eqn( A ) does exist.It is easy to check that Y q = W A q,F for every q ∈ Q .Note that, by concatenating on the right, one can definean equivalent set of equations whose least solution coincideswith W A I,q instead of W A q,F (see Appendix B). Example 4.1.
Let us consider the automaton A in Figure 1.The set of equations induced by A are as follows: Eqn( A ) = ( X = { ǫ } ∪ aX ∪ bX X = ∅ ∪ aX ∪ bX ♦ We define the vector ǫ F ∈ ℘ (Σ ∗ ) | Q | and the function Pre A : ℘ (Σ ∗ ) | Q | → ℘ (Σ ∗ ) | Q | , which are used to formalizethe equations in Eqn( A ) : ǫ F , h δ { ǫ } ∅ ( q ∈ F ) i q ∈ Q Pre A ( h X q i q ∈ Q ) , h S a ∈ Σ ,q a → q ′ aX q ′ i q ∈ Q . Since ǫ ∈ W A q,F for all q ∈ F , we initialize the fixpointcomputation with ǫ F . Thus, it turns out that h W A q,F i q ∈ Q = lfp( λ X . ǫ F ∪ Pre A ( X )) . (3)Together with Equation (2), it follows that L ( A ) equalsthe union of the component languages of the vector lfp( λ X . ǫ F ∪ Pre A ( X )) indexed by initial states. Example 4.2 (Continuation of Example 4.1) . The fixpointcharacterization of h W A q,F i q ∈ Q is: (cid:18) W A q ,q W A q ,q (cid:19) = lfp (cid:18) λ (cid:18) X X (cid:19) . (cid:18) { ǫ } ∪ aX ∪ bX ∅ ∪ aX ∪ bX (cid:19)(cid:19) . The fixpoint is (cid:18) W A q ,q W A q ,q (cid:19) = (cid:18) ( a + ( b + a )) ∗ ( a + b ) ∗ a (cid:19) . ♦ ixpoint-based Inclusion Check. Consider the languageinclusion problem L ⊆ L where L = L ( A ) for some FA A = h Q, δ, I, F, Σ i . The language L can be formalized asa vector in ℘ (Σ ∗ ) | Q | as follows: L I , h δ L Σ ∗ ( q ∈ I ) i q ∈ Q . (4)Using (2), (3) and (4), it is routine to prove that L ( A ) ⊆ L ⇔ lfp( λ X . ǫ F ∪ Pre A ( X )) ⊆ L I . (5) In what follows we use Theorem 3.1 for solving thelanguage inclusion problem. In this context, we have that C = h ℘ (Σ ∗ ) | Q | , ⊆i , f = λ X . ǫ F ∪ Pre A ( X ) and ρ : ℘ (Σ ∗ ) | Q | → ℘ (Σ ∗ ) | Q | is an upper closure operator. Theorem 4.3. If ρ ∈ uco( ℘ (Σ ∗ )) is backward complete for λX. aX for all a ∈ Σ , then, for all FAs A = h Q, δ, I, F, Σ i , ρ is backward complete for Pre A and λ X . ǫ F ∪ Pre A ( X ) . Corollary 4.4. If ρ ∈ uco( ℘ (Σ ∗ )) is backward complete for λX. aX for all a ∈ Σ then ρ (lfp( λ X . ǫ F ∪ Pre A ( X ))) = lfp( λ X . ρ ( ǫ F ∪ Pre A ( X ))) . Note that if ρ is backward complete for λX.aX for all a ∈ Σ and L ∈ ρ then, as a straightforward consequenceof Theorem 3.1 and Corollary 4.3, Equation 5 becomes L ( A ) ⊆ L ⇔ lfp( λ X . ρ ( ǫ F ∪ Pre A ( X ))) ⊆ L I . (6) To solve a language inclusion problem L ( A ) ⊆ L using Equation (6) we must compute the corresponding leastfixpoint and then decide its inclusion in L I . Since closureoperators are fully isomorphic to Galois connections [10,Section 6], they allow us to conveniently define and reasonon abstract domains independently of their representation.Recall that a Galois Connection (GC) between two posets h C, ≤ C i (called concrete domain) and h A, ≤ A i (called ab-stract domain) consists of two functions α : C → A and γ : A → C such that α ( c ) ≤ A a ⇔ c ≤ C γ ( a ) alwaysholds. A GC is denoted by h C, ≤ C i −−−→←−−− αγ h A, ≤ A i .The next result shows that there exists an algorithmthat solves the language inclusion problem L ( A ) ⊆ L on an abstraction D of the concrete domain of languages ℘ (Σ ∗ ) whenever D satisfies a list of requirements related tobackward completeness and computability. Theorem 4.5.
Let A = h Q, δ, I, F, Σ i be a FA and let L be a language over Σ . Let h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i bea GC where h D, ⊑i is a poset. Assume that the followingproperties hold: ( i ) L ∈ γ ( D ) and for every a ∈ Σ , X ∈ ℘ (Σ ∗ ) we have α ( aX ) = α ( aγα ( X )) . ( ii ) ( D, ⊑ , ⊔ ) is an effective domain, meaning that: ( D, ⊑ ) is ACC, every element of D has a finite representation, ⊑ is decidable and ⊔ is a computable binary lub. ( iii ) There is an algorithm, say
Pre ♯ ( X ) , which computes α (Pre A ( γ ( X ))) , for all X ∈ ℘ (Σ ∗ ) | Q | . ( iv ) There is an algorithm, say ǫ ♯ , computing α ( ǫ F ) . ( v ) There is an algorithm, say
Incl ♯ ( X ) , deciding theabstract inclusion X ⊑ α ( L I ) , for every vector X ∈ α ( ℘ (Σ ∗ ) | Q | ) .Then, the following algorithm decides whether L ( A ) ⊆ L : h Y q i q ∈ Q := Kleene ( λ X . ǫ ♯ ⊔ Pre ♯ ( X ) , ∅∅∅ ) ; return Incl ♯ ( h Y q i q ∈ Q ) ; Quasiorder Galois Connections.
It turns out that Theo-rem 4.5 still holds for abstract domains which are mereqosets rather than posets.
Definition 4.6 ( Quasiorder GC ) . A quasiorder GC (QGC) h C, ≤i −−−→←−−− αγ h D, ⊑i consists of: (a) two qosets h C, ≤i and h D, ⊑i such that one of them is a poset; (b) two functions α : C → D and γ : D → C such that α ( c ) ⊑ d ⇔ c ≤ γ ( d ) holds for all c ∈ C and d ∈ D .Analogously to GCs, it is easily seen that in QGCsboth α and γ are monotonic as well as c ≤ γ ( α ( c )) and α ( γ ( d )) ⊑ d always hold. Observe that if C is a poset and d ⊑ d ′ ⊑ d with d = d ′ then γ ( d ) = γ ( d ′ ) , because γ ismonotonic, and conversely, if D is a poset and c ≤ c ′ ≤ c with c = c ′ then α ( c ) = α ( c ′ ) holds. Also, similarly to GCs,if C is a poset then γ ◦ α ∈ uco( h C, ≤i ) holds for QGCsas well.In the following, we apply all the standard order-theoretic notions used for posets also to the qosets h C, ≤i and h D, ⊑i by implicitly referring to the quotient posets h C / ∼ = C , ≤ / ∼ = C i and h D / ∼ = D , ⊑ / ∼ = D i where ∼ = C , ≤ ∩ ≤ − and ∼ = D , ⊑ ∩ ⊑ − . For example: • h D, ⊑i is ACC (CPO) means that the poset h D / ∼ = D , ⊑ / ∼ = D i is ACC (CPO). • h D, ⊑i is a join-semilattice means that h D / ∼ = D , ⊑ / ∼ = D i is a join-semilattice; a binary lub for D (one could haveseveral binary lubs) is a function λ h d, d ′ i .d ⊔ d ′ suchthat λ h [ d ] ∼ = D , [ d ′ ] ∼ = D i . [ d ⊔ d ′ ] ∼ = D is the lub in the poset h D / ∼ = D , ⊑ / ∼ = D i . Corollary 4.7.
Theorem 4.5 still holds for a QGC h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i where h D, ⊑i is a qoset.
5. Instantiating the Framework
In this section we focus on a particular class of closures:those induced by quasiorders. Then, we provide a list ofconditions on quasiorders such that the induced closures fitour framework. In addition, we study some instances of suchquasiorders and compare them.
Let be a quasiorder on words in Σ ∗ . A correspondingclosure operator ρ ∈ uco( ℘ (Σ ∗ )) is defined as follows: ρ ( X ) , { v ∈ Σ ∗ | ∃ u ∈ X, u v } . (7)4hus, ρ ( X ) is the -upward closure of X and it is easyto check that ρ is indeed a closure on h ℘ (Σ ∗ ) , ⊆i .A quasiorder on Σ ∗ is left-monotonic ( right-monotonic ) if ∀ y, x , x ∈ Σ ∗ , x x ⇒ yx yx ( x y x y ). Also, is called monotonic if it is both left-and right-monotonic. Definition 5.1 ( L -Consistent Quasiorder ) . Let L ∈ ℘ (Σ ∗ ) ,a quasiorder L on Σ ∗ is called left (resp. right ) L -consistent when (a) L ∩ ( L × ¬ L ) = ∅ and (b) L is left-(resp. right-) monotonic. Also, L is called L -consistent when it is both left and right L -consistent.It turns out that a L -consistent quasiorder induces aclosure which includes L and is backward complete. Lemma 5.2.
Let L be a language over Σ and L be a left(resp. right) L -consistent quasiorder on Σ ∗ . Then, ( a ) ρ L ( L ) = L . ( b ) ρ L is backward complete for λX. aX (resp. λX. Xa )for all a ∈ Σ . Moreover, we show that the -upward closure ρ de-fined in (7) can be equivalently defined through the qoset ofantichains. In fact, the qoset of antichains h AC h Σ ∗ , i , ⊑i canbe viewed as a language abstraction through the minor ab-straction map. More precisely, let α : ℘ (Σ ∗ ) → AC h Σ ∗ , i and γ : AC h Σ ∗ , i → ℘ (Σ ∗ ) be defined as follows: α ( X ) , ⌊ X ⌋ γ ( Y ) , ρ ( Y ) . (8) Theorem 5.3.
Let h Σ ∗ , i be a qoset. (a) h ℘ (Σ ∗ ) , ⊆i −−−−→←−−−− α γ h AC h Σ ∗ , i , ⊑i is a QGC. (b) γ ◦ α = ρ . The QGC h ℘ (Σ ∗ ) , ⊆i −−−−→←−−−− α γ h AC h Σ ∗ , i , ⊑i allows usto represent and manipulate -upward closed sets in ℘ (Σ ∗ ) using finite subsets, as already shown by Abdulla et al. [1].We are now in position to show that, given alanguage L with decidable membership problem, forevery decidable L -consistent wqo L , the QGC h ℘ (Σ ∗ ) , ⊆i −−−−−→←−−−−− α L γ L h AC h Σ ∗ , L i , ⊑i of Theorem 5.3 (a)yields an algorithm for deciding the inclusion L ( A ) ⊆ L where A is a FA. In particular, for a left L -consistent wqo lL , the algorithm FAIncW solves the inclusion problem.
FAIncW is called “word-based” because h Y q i q ∈ Q consistsof finite sets of words. Theorem 5.4.
Let A be a FA and let L be a language suchthat ( i ) membership in L is decidable; and ( ii ) there existsa decidable left L -consistent wqo on Σ ∗ . Then, FAIncW decides the inclusion L ( A ) ⊆ L .Proof: Let lL be a decidable left L -consistentwqo on Σ ∗ . Let us check that hypotheses (i)-(v) of The-orem 4.5 are satisfied for h D, ⊑i = h AC h Σ ∗ , lL i , ⊑i , α = ⌊·⌋ , γ = ρ lL . Indeed we apply Corollary 4.7 because h AC h Σ ∗ , lL i , ⊑i is a qoset so that we deal with a QGC. FAIncW : Word-based algorithm for L ( A ) ⊆ L Data: FA A = h Q, δ, I, F, Σ i Data:
Decision procedure for membership in L Data:
Decidable left L -consistent wqo lL Result:
Whether L ( A ) ⊆ L holds h Y q i q ∈ Q := Kleene ( λ X . ⌊ ǫ F ⌋ ⊔ ⌊ Pre A ( X ) ⌋ , ∅∅∅ ) ; forall q ∈ I do forall u ∈ Y q do if u / ∈ L then return false ; return true ;( i ) It follows from Theorem 5.3 (b) and Lemma 5.2 (a)that L ∈ γ ( D ) . Moreover: α ( aX ) = [ α = αγα ] α ( γ ( α ( aX ))) = [L. 5.2 (b) with ρ lL = γα ] α ( γ ( α ( aγ ( α ( X ))))) = [ α = αγα ] α ( aγα ( X )) . ( ii ) It turns out that h AC h Σ ∗ , lL i , ⊑i is ACC because lL is a wqo. Moreover, the decidability of the binaryrelation lL entails that W ⊔ W , ⌊ W ∪ W ⌋ isa computable binary lub in h AC h Σ ∗ , lL i , ⊑i . Hence, h AC h Σ ∗ , lL i , ⊑ , ⊔i is an effective domain.( iii ) Let us first observe that by Lemma 5.2 (b) and Theo-rem 4.3, ρ lL is backward complete for Pre A . Then,it turns out that α (Pre A ( γ ( X ))) = ⌊ Pre A ( X ) ⌋ since α (Pre A ( γ ( X ))) = [ α = αγα ] αγα (Pre A ( γ ( X ))) = [def. α and γ ] ⌊ ρ lL (Pre A ( ρ lL ( X ))) ⌋ = [bw. completeness] ⌊ ρ lL (Pre A ( X )) ⌋ = [ α = αγα ] ⌊ Pre A ( X ) ⌋ . This entails that α (Pre A ( γ ( X ))) is computable.( iv ) α ( { ǫ } ) = { ǫ } and α ( ∅ ) = ∅ , hence α ( ǫ F ) = ⌊ ǫ F ⌋ is trivial to compute.( v ) Since α ( L I ) = α ( h δ L Σ ∗ ( q ∈ I ) i q ∈ Q , the relation h Y q i q ∈ Q ⊑ α ( L I ) trivially holds for Y q with q / ∈ I .Therefore it suffices to check that ∀ q ∈ I , Y q ⊑ α ( L ) is decidable. We have that: Y q ⊑ α ( L ) ⇔ [def. ⊑ and α ] ∀ y ∈ Y q , ∃ x ∈ ⌊ L ⌋ , x lL y ⇔ [ ⌊ X ⌋ is a minor set] ∀ y ∈ Y q , ∃ x ∈ L , x lL y ⇔ [def. ρ lL ( L ) ] ∀ y ∈ Y q , y ∈ ρ lL ( L ) ⇔ [ ρ lL ( L ) = L ] ∀ y ∈ Y q , y ∈ L . This latter condition coincides with the check per-formed by lines 2-5 of algorithm
FAIncW and is there-fore decidable.5umming up, by Corollary 4.7, algorithm
FAIncW solves L ( A ) ⊆ L .A symmetric version of algorithm FAIncW (and of The-orem 5.4) for right L -consistent wqos, which relies onequations concatenating to the right (instead of to the leftas in Eqn( A ) ), is given in Appendix B.In what follows, we consider different quasiorders andshow that they fulfill the requirements of Theorem 5.4(or its symmetric for right quasiorders), hence, they yieldalgorithms for solving the language inclusion problem. Given w ∈ Σ ∗ and X ∈ ℘ (Σ ∗ ) , left and right quotientsare defined as usual: w − X , { u ∈ Σ ∗ | wu ∈ X } and Xw − , { u ∈ Σ ∗ | uw ∈ X } . Given a language L ⊆ Σ ∗ ,let us define the following quasiorders on Σ ∗ : u ≦ lL v △ ⇐⇒ Lu − ⊆ Lv − u ≦ rL v △ ⇐⇒ u − L ⊆ v − L .
De Luca and Varricchio [11] call them, resp., the left ( ≦ lL )and right ( ≦ rL ) Nerode quasiorders relative to L . The fol-lowing result shows that Nerode quasiorders are the mostgeneral (greatest for set inclusion) L -consistent quasiordersfor which the above algorithm FAIncW can be used to decidetha language inclusion L ( A ) ⊆ L . Lemma 5.5.
Let L ⊆ Σ ∗ be a language. (a) ≦ lL and ≦ rL are, resp., left and right L -consistentqos. If L is regular then ≦ lL and ≦ rL are, additionally,decidable wqos. (b) Let be a quasiorder on Σ ∗ . If is left (resp. right) L -consistent then ρ ≦ lL ⊆ ρ (resp. ρ ≦ rL ⊆ ρ ).Proof: De Luca and Varricchio [11, Theorem 2.4]show that ≦ lL and ≦ rL are left and right monotonic, respec-tively. Moreover, if L is regular then they are wqos. Observethat given u ∈ L and v / ∈ L we have that ǫ ∈ Lu − and ǫ ∈ u − L while ǫ / ∈ Lv − and ǫ / ∈ v − L . Hence, ≦ lL ( ≦ rL ) is a left (right) L -consistent quasiorder. Finally, if L is regular then both relations are clearly decidable.Let us now show point (b). We consider the left case(the right case is symmetric). De Luca and Varricchio [11,Section 2, point 4] observe that ≦ lL is maximum in theset of all left L -consistent quasiorders, i.e. every left L -consistent quasiorder is such that x y ⇒ x ≦ lL y . Asa consequence, ρ ( U ) ⊆ ρ ≦ lL ( U ) holds for all U ∈ ℘ (Σ ∗ ) : ρ ( U ) = [def. ρ ] { x ∈ Σ ∗ | ∃ u ∈ U, u x } ⊆ [ x y ⇒ x ≦ lL y ] { x ∈ Σ ∗ | ∃ u ∈ U, u ≦ lL x } = [def. ρ ≦ lL ] ρ ≦ lL ( U ) . Therefore, ρ ≦ lL ⊆ ρ .Let us now consider a first application of Theorem 5.4for deciding L ( A ) ⊆ L Because membership is decidable for regular languages, Lemma 5.5 (a) for ≦ lL shows that thehypotheses (i) and (ii) of Theorem 5.4 hold, hence algorithm FAIncW decides the inclusion L ( A ) ⊆ L . Under thesehypotheses, as a consequence of Lemma 5.5 (b) we havethat ≦ lL is the most general (i.e., greatest for set inclusion)left L -consistent quasiorder for which algorithm FAIncW can be used to decide L ( A ) ⊆ L .We conclude with some useful remarks on the complex-ity of Nerode quasiorder relations. For the inclusion problembetween languages generated by automata, deciding the (leftor right) Nerode quasiorder can be easily shown to be ashard as the language inclusion problem (which is PSPACE-hard). For the inclusion problem of a language generatedby an automaton within the trace set of a one-counter net(cf. Section 5.3.2) the right Nerode quasiorder is a rightlanguage-consistent well-quasiorder but it turns out to beundecidable (cf. Lemma 5.11). Consider the inclusion problem L ( A ) ⊆ L ( A ) where A and A are FAs. In the following, we study a classof well-quasiorders based on A . This is a strict subclassof Nerode quasiorders defined in Section 5.2 and sidestepsthe untractability or undecidability of Nerode quasiordersyet allowing to define an algorithm solving the languageinclusion problem. We define thequasiorders ≤ l A and ≤ r A on Σ ∗ induced by a FA A = h Q, δ, I, F, Σ i as follows: u ≤ l A v △ ⇐⇒ pre A u ( F ) ⊆ pre A v ( F ) u ≤ r A v △ ⇐⇒ post A u ( I ) ⊆ post A v ( I ) (9)where, for any X ⊆ Q and u ∈ Σ ∗ , pre A u ( X ) , { q ∈ Q | u ∈ W A q,X } and post A u ( X ) , { q ′ ∈ Q | u ∈ W A X,q ′ } . Lemma 5.6.
Let A be an FA. Then ≤ l A and ≤ r A are, resp.,decidable left and right L ( A ) -consistent wqos. It follows from Lemma 5.6 that Theorem 5.4 applies to ≤ l A (and ≤ r A ), so that one can instantiate the algorithm FAIncW with the wqo ≤ l A for deciding L ( A ) ⊆ L ( A ) .Turning back to the left Nerode wqo ≦ l L ( A ) we find that: u ≦ l L ( A ) v ⇔ L ( A ) u − ⊆ L ( A ) v − ⇔ W I, pre A u ( F ) ⊆ W I, pre A u ( F ) . Since pre A u ( F ) ⊆ pre A v ( F ) ⇒ W I, pre A u ( F ) ⊆ W I, pre A u ( F ) ,it follows that u ≤ l A v ⇒ u ≦ l L ( A ) v . Moreover, byLemmas 5.5 (b) and 5.6, we also have that ρ ≤ l L ( A ⊆ ρ ≤ l A . Simulation-based Quasiorders.
Let us recall that, givena FA A = h Q, δ, I, F, Σ i , a simulation on A is a relation
2. Hint: given A and A , group them into A and add transitions q a → q ′ and q b → q ′′ for all q ∈ I , q ′ ∈ I , q ′′ ∈ I to δ . Then a ≦ r L ( A ) b ⇔ a − L ( A ) ⊆ b − L ( A ) ⇔ L ( A ) ⊆ L ( A ) . ⊆ Q × Q such that if p (cid:22) q then: ( i ) p ∈ F implies q ∈ F and ( ii ) for every transition p a −→ p ′ , there exists a transition q a −→ q ′ such that p ′ (cid:22) q ′ . It is well known that simulationimplies language inclusion, i.e., if (cid:22) is a simulation on A then q (cid:22) q ′ ⇒ W A q,F ⊆ W A q ′ ,F . We lift a qo (cid:22) on Q to a qo (cid:22) ∀∃ on ℘ ( Q ) as follows: X (cid:22) ∀∃ Y △ ⇐⇒ ∀ x ∈ X, ∃ y ∈ Y, x (cid:22) y so that X (cid:22) ∀∃ Y ⇒ W A X,F ⊆ W A Y,F holds. Therefore, wedefine the right simulation-based quasiorder (cid:22) r A on Σ ∗ as: u (cid:22) r A v △ ⇐⇒ post A u ( I ) (cid:22) ∀∃ post A v ( I ) (10) Lemma 5.7.
Given a simulation relation (cid:22) on A , theright simulation-based qo (cid:22) r A is a decidable right L ( A ) -consistent wqo. Thus, once again, Theorem 5.4 applies to (cid:22) r A and thisallows us to instantiate the algorithm FAIncW to (cid:22) r A fordeciding L ( A ) ⊆ L ( A ) .Observe that u (cid:22) r A v implies W post A u ( I ) ,F ⊆ W post A v ( I ) ,F which is equivalent to the right Nerode qua-siorder u ≦ r L ( A ) v , so that u (cid:22) r A v ⇒ u ≦ r L ( A ) v .Moreover, u ≤ r A v ⇒ u (cid:22) r A v trivially holds. Summingup, the following containments relate (the right versions of)state-based, simulation-based and Nerode quasiorders: ≤ r A ⊆ (cid:22) r A ⊆ ≦ r L ( A ) All these quasiorders are decidable L ( A ) -consistent wqosso that the algorithm FAIncW can be instantiated to each ofthem for deciding L ( A ) ⊆ L ( A ) . In thissection show that our framework can be used to sys-tematically derive an algorithm for deciding the inclusion L ( A ) ⊆ L when L is the trace set of a one-counter net.We proceed by showing that there exists a decidable L -consistent quasiorder so that we can apply Theorem 5.4.Intuitively, a one-counter net is a FA equipped with anonnegative integer counter. Formally, a One-Counter Net(OCN) [23] is a tuple O = h Q, Σ , δ i where Q is the finite setof states , Σ is the alphabet and δ ⊆ Q × Σ × {− , , } × Q is the set of transitions . A configuration of O is a pair qn consisting of a state q ∈ Q and a value n ∈ N for thecounter. Given two configurations qn and q ′ n ′ we write qn a −→ q ′ n ′ and call it a a - step (or simply step ) if thereexists a transition ( q, a, d, q ′ ) ∈ δ such that n ′ = n + d .Given qn ∈ Q × N , the trace set of an OCN , T ( qn ) ⊆ Σ ∗ ,is defined as follows: T ( qn ) , { u ∈ Σ ∗ | Z qnu = ∅ } with Z qnu , { q k n k | qn a −→ q n · · · a k −→ q k n k ∧ a · · · a k = u } Observe that Z qnǫ = { qn } and Z qnu is finite for all words u ∈ Σ ∗ . For a set S ⊆ Q × N , T ( S ) , S qn ∈ S T ( qn ) . Let N ⊥ , N ∪ {⊥} where ⊥ ≤ N ⊥ n holds for all values n ∈ N ⊥ . For a finite set of states S ⊆ Q × N define theso-called macro state M S : Q → N ⊥ as M S ( q ) , max { n ∈ N | qn ∈ S } where max ∅ , ⊥ . Define the following quasiorder on Σ ∗ : u ≤ rqn v △ ⇐⇒ ∀ q ′ ∈ Q, M Z qnu ( q ′ ) ≤ N ⊥ M Z qnv ( q ′ ) Lemma 5.8.
Given a OCN O together with a configuration qn , ≤ rqn is a right T ( qn ) -consistent decidable wqo. Thus, as a consequence of Theorem 5.4, Lemma 5.8and the decidability of membership in T ( qn ) , we derive thefollowing known decidability result ([24, Theorem 3.2]) byresorting to our framework. Theorem 5.9.
Given a FA A and a OCN O together with aconfiguration qn , the problem L ( A ) ⊆ T ( qn ) is decidable. Moreover, the following result closes a conjecture madeby De Luca and Varricchio [11, Section 6].
Lemma 5.10.
The right Nerode quasiorder ≦ rT ( qn ) relativeto T ( qn ) is a well-quasiorder.Proof: De Luca and Varricchio [11] show that ≦ rT ( qn ) is maximum in the set of all right T ( qn ) -consistentquasiorders, that is, u ≤ rqn v implies u ≦ rT ( qn ) v for all u, v ∈ Σ ∗ . Since ≤ rqn is a wqo then ≦ rT ( qn ) is a wqo.It is worth remarking that, by Lemma 5.5 (a), the leftand right Nerode quasiorders relative to T ( qn ) are T ( qn ) -consistent. However, the left Nerode quasiorder does notneed to be a wqo for otherwise T ( qn ) would be regular. Lemma 5.11.
The right Nerode quasiorder for the trace setof OCN is undecidable.Proof:
Let ≦ rT ( qn ) denote the right Nerode qua-siorder for a T ( qn ) . Undecidability for ≦ rT ( qn ) followsfrom the undecidability of the trace inclusion problem fornondeterministic OCNs [20, Theorem 20] by an argumentsimilar to the automata case.We conjecture that, using our framework, Theorem 5.9can be extended to traces of Petri Nets, which is alreadyknown to be true [24].
6. A Novel Perspective on the Antichain Algo-rithm
Consider two FAs A = h Q , δ , I , F , Σ i and A = h Q , δ , I , F , Σ i . and consider the left L ( A ) -consistentwqo ≤ l A defined in (9). Theorem 5.4 shows that the algo-rithm FAIncW solves the inclusion problem L ( A ) ⊆ L ( A ) by working on the qoset abstraction h AC h Σ ∗ , ≤ l A i , ⊑i ofantichains of h Σ ∗ , ≤ l A i .Note that since u ≤ l A v ⇔ pre A u ( F ) ⊆ pre A v ( F ) , itsuffices to keep the sets of states pre A u ( F ) for each word u instead of the words themselves. Thus, we could design7n algorithm analogous to FAIncW but working on the posetabstraction h AC h ℘ ( Q ) , ⊆i , ⊑i of antichains of sets of statesof h ℘ ( Q ) , ⊆i . In order to do this, h AC h ℘ ( Q ) , ⊆i , ⊑i canbe viewed as a further abstraction of the antichain qoset h AC h Σ ∗ , ≤ l A i , ⊑ ′ i (where ⊑ ′ is used for distinguishing thetwo ordering relations on antichains) through the abstractionand concretization maps α A : AC h Σ ∗ , ≤ l A i → AC h ℘ ( Q ) , ⊆i and γ A : AC h ℘ ( Q ) , ⊆i → AC h Σ ∗ , ≤ l A i defined as follows: α A ( X ) , { pre A u ( F ) | u ∈ X } γ A ( Y ) , ⌊{ u ∈ Σ ∗ | pre A u ( F ) ∈ Y }⌋ Lemma 6.1. h AC h Σ ∗ , ≤ l A i , ⊑ ′ i −−−−→←−−−− α A γ A h AC h ℘ ( Q ) , ⊆i , ⊑i is a QGC. Combining the word-based algorithm
FAIncW with thesefunctions α A and γ A we are able to systematically derivea novel algorithm solving the inclusion L ( A ) ⊆ L ( A ) using the abstract domain h AC h ℘ ( Q ) , ⊆i , ⊑i by composingthe two QGCs: h ℘ (Σ ∗ ) , ⊆i −−−−−−→←−−−−−− α ≤ l A γ ≤ l A h AC h Σ ∗ , ≤ l A i , ⊑ ′ i [Theorem 5.3 (a)] h AC h Σ ∗ , ≤ l A i , ⊑ ′ i −−−−→←−−−− α A γ A h AC h ℘ ( Q ) , ⊆i , ⊑i [Lemma 6.1]Let α : ℘ (Σ ∗ ) → AC h ℘ ( Q ) , ⊆i , γ : AC h ℘ ( Q ) , ⊆i → ℘ (Σ ∗ ) and Pre A A ( h X q i q ∈ Q ) : ℘ ( Q ) | Q | → ℘ ( Q ) | Q | be definedas follows: α ( X ) , ⌊{ pre A u ( F ) | u ∈ X }⌋ γ ( Y ) , { u ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ pre A u ( F ) } Pre A A ( h X q i q ∈ Q ) , h⌊ (cid:8) pre A a ( s ) | ∃ a ∈ Σ , q ′ ∈ Q , q a → A q ′ ∧ s ∈ X q ′ (cid:9) ⌋i q ∈ Q Lemma 6.2.
The following hold: (a) α = α A ◦ α ≤ l A (b) γ = γ ≤ l A ◦ γ A (c) h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h AC h ℘ ( Q ) , ⊆i , ⊑i is a GC. (d) γ ◦ α = ρ ≤ l A (e) Pre A A ( X ) = α A ◦ α ≤ l A ◦ Pre A ◦ γ ≤ l A ◦ γ A ( X ) for all X ∈ α ( ℘ (Σ ∗ ) | Q | ) It follows from Lemma 6.2 that the Galois Connection h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h AC h ℘ ( Q ) , ⊆i , ⊑i together with the ab-stract function Pre A A satisfy the requirements (i)-(iv) ofTheorem 4.5. In order to obtain an algorithm solving theinclusion L ( A ) ⊆ L ( A ) it remains to show that require-ment (v) of Theorem 4.5 holds, i.e., there is an algorithm todecide whether Y ⊑ α ( L I ) for every Y ∈ α ( ℘ (Σ ∗ )) | Q | .Let us notice that the Kleene’s iterates of the abstractfunction λ X . α ( ǫ F ) ⊔ Pre A A ( X ) of Theorem 4.5 are vec-tors in h AC h ℘ ( Q ) , ⊆i , ⊑i where each component q ∈ Q rep-resents (through its minor set) a set of sets of states that arepredecessors of F in A by a word generated by A from state q (i.e. pre A u ( F ) with u ∈ W A q,F ). Since ǫ ∈ W A q,F for all q ∈ F and pre A ǫ ( F ) = F the iterations of the pro-cedure Kleene start with α ( ǫ F ) = h δ F ∅ ( q ∈ F ) i q ∈ Q . Bytaking the minor of each vector component, we are consider-ing smaller sets which still preserve the relation ⊑ (because A ⊑ B ⇔ ⌊ A ⌋ ⊑ B ⇔ A ⊑ ⌊ B ⌋ ⇔ ⌊ A ⌋ ⊑ ⌊ B ⌋ ) . Let Y be the fixpoint computed by the Kleene procedure. We havethat, for each q ∈ Q , Y q = ⌊{ pre A u ( F ) | u ∈ W A q,F }⌋ .Whenever L ( A ) ⊆ L ( A ) holds, all the sets of states in Y q for q ∈ I are predecessors of F in A by words in L ( A ) , so that they all contain at least one initial state in I .As a result, we obtain the “state-based” algorithm FAIncS . FAIncS : State-based algorithm for L ( A ) ⊆L ( A ) Data: FA A = h Q , δ , I , F , Σ i Data: FA A = h Q , δ , I , F , Σ i Result:
Whether L ( A ) ⊆ L ( A ) holds h Y q i q ∈ Q := Kleene ( λ X . α ( ǫ F ) ⊔ Pre A A ( X ) , ∅∅∅ ) ; forall q ∈ I do forall s ∈ Y q do if s ∩ I = ∅ then return false ; return true ; Theorem 6.3.
Let A , A be two FAs. The algorithm FAIncS decides L ( A ) ⊆ L ( A ) . In what follows we show that
FAIncS precisely coin-cides with the well-known antichain algorithm put forwardby Wulf et al. [13]. To this end, let us consider the followingposet of antichains h AC h ℘ ( Q ) , ⊆i , b ⊑i where X b ⊑ Y △ ⇐⇒ ∀ x ∈ X, ∃ y ∈ Y, x ⊆ y Thus, we have that h AC h ℘ ( Q ) , ⊆i , b ⊑i = h AC h ℘ ( Q ) , ⊇i , ⊑i and, as observed in [14], h AC h ℘ ( Q ) , ⊆i , b ⊑i is a finite lattice,where b ⊓ and b ⊔ denote, resp., glb and lub of antichains.Let S c denote the complement of a generic subset S .The antichain algorithm described by Wulf et. al [13] forchecking L ( A ) ⊆ L ( A ) can be stated as follows. Theorem 6.4 ( [13, Theorem 6] ) . Let
F P , b d (CPre A A ( S ) b ⊔ h δ { F c } ∅ ( q ∈ F ) i q ∈ Q ) where CPre A A : ℘ ( Q ) | Q | → ℘ ( Q ) | Q | is defined by: CPre A A ( h X q i q ∈ Q ) , h⌈{ Y | ∃ a ∈ Σ , q ′ ∈ Q , X ⊆ Q ,q a → A q ′ ∧ X ∈ X q ′ ∧ post A a ( Y ) ⊆ X }⌉i q ∈ Q Then, L ( A ) * L ( A ) iff ∃ q ∈ I , { I } b ⊑ F P q . The intuition behind the antichain algorithm is to com-pute for each state q ∈ Q the set of states that arenot predecessors of F in A by any word generated by A from q (i.e. (pre A u ( F )) c with u ∈ W A q,F ). Since ǫ ∈ W A q,F for all q ∈ F and pre A ǫ ( F ) = F ,the iteration begins with h δ { F c } ∅ ( q ∈ F ) i q ∈ Q , which is8he complement of α ( ǫ F ) . By using the major operator ⌈·⌉ (dual of the minor operator) the antichain algorithmprocesses smaller sets while preserving the relation ⊑ ′ (as A ⊑ ′ B ⇔ ⌈ A ⌉ ⊑ ′ B ⇔ A ⊑ ′ ⌈ B ⌉ ⇔ ⌈ A ⌉ ⊑ ′ ⌈ B ⌉ ).As a consequence, F P q = ⌈{ (pre u ( F )) c | u ∈ W A q,F }⌉ and if L ( A ) * L ( A ) then there exists a word u ∈ L ( A ) such that u / ∈ L ( A ) , so that I ∩ pre A u ( F ) = ∅ , namely, I ⊆ (pre A u ( F )) c .To summarize, while our algorithm FAIncS considersupper closed sets in ℘ ( Q ) represented by their minimalelements, the antichain algorithm considers dual down-ward closed sets in ℘ ( Q ) represented by their maximalelements. Equivalently, FAIncS works on the abstraction h AC h ℘ ( Q ) , ⊆i , ⊑i while the antichain algorithm works onits dual lattice h AC h ℘ ( Q ) , ⊇i , ⊑i . Theorem 6.5 preciselyformalizes this duality between these two algorithms. Theorem 6.5.
At each step of the least fixpoint computationsfor
F P of Theorem 6.4 and Y of FAIncS , the followinginvariant holds: ∀ S ⊆ Q , q ∈ Q , { S } b ⊑ F P q ⇔ { S c } ⊑ Y q The forward antichain algorithm (previously we consid-ered the backward version) can be shown to be equivalent tothe algorithm systematically derived within our frameworkwhen considering the quasiorder u r A v as defined in (9).Abdulla et al. [2] and subsequently Bonchi and Pous [5]improved the original antichain algorithm by exploiting aprecomputed simulation quasiorder relation on the states ofthe input automata. Note that (cid:22) r A , by definition, does notconsider pairs of states in the simulation relation outside Q × Q , while the works mentioned above do so.
7. Inclusion for Context Free Languages A context-free grammar (CFG) is a tuple G = hV , Σ , P i where V = { X , . . . , X n } is the finite set of variables including the start symbol X , Σ is the finite alphabet of terminals , and P is the set of productions X i → β where β ∈ ( V ∪ Σ) ∗ . We assume, for simplicity and withoutloss of generality, that CFGs are in Chomsky Normal Form(CNF), that is, every production X i → β ∈ P is such that β ∈ ( V × V ) ∪ Σ ∪ { ǫ } and if β = ǫ then i = 0 [6]. Wealso assume that for all X i ∈ V there exists a production X i → β ∈ P , otherwise X i can be safely removed from V . Similarly to the case of automata discussed in Sections 4and 5, a context-free grammar G = ( V , Σ , P ) in CNFinduces the following set of equations: Eqn( G ) , { X i = S X i → β j ∈ P β j | i ∈ [0 , n ] } . We define the vector b ∈ ℘ (Σ ∗ ) |V| and the function Fn G : ℘ (Σ ∗ ) |V| → ℘ (Σ ∗ ) |V| which are used to formalizethe fixpoint equations in Eqn( G ) as follows: • b , h b i i i ∈ [0 ,n ] ∈ ℘ (Σ ∗ ) |V| where is component is ofthe form b i , { β | X i → β ∈ P, β ∈ Σ ∪ { ǫ }} . • Fn G ( h X i i i ∈ [0 ,n ] ) , h β ( i )1 ∪ . . . ∪ β ( i ) k i i i ∈ [0 ,n ] whereeach β ( i ) j is such that β ( i ) j ∈ V and X i → β ( i ) j ∈ P .Notice that λ X . b ∪ Fn G ( X ) is a well-defined mono-tonic function in ℘ (Σ ∗ ) |V| → ℘ (Σ ∗ ) |V| . Given the fixpoint h Y i i i ∈ [0 ,n ] = lfp( λ X . b ∪ Fn G ( X )) , it is known fromGinsburg and Rice [19] that the language L ( G ) acceptedby G is such that L ( G ) = Y . Example 7.1.
Consider a CFG G in CNF with Σ = { a, b } and productions { X → X X | X X | b, X → a } .The corresponding equation system is Eqn( G ) = { X = X X ∪ X X ∪ { b } , X = { a }} . Also, we have that b = h{ b } , { a }i ∈ ℘ (Σ ∗ ) and Fn G : ℘ (Σ ∗ ) → ℘ (Σ ∗ ) is given by Fn G ( h X , X i ) = h X X ∪ X X , ∅ i . Theinfinite sequence of Kleene iterates of the least fixpointcomputation of λ X . b ∪ Fn G ( X ) goes as follows: h ∅ , ∅ i ⇒ h{ b } , { a }i ⇒ h{ ab, ba, b } , { a }i ⇒h{ ab, ba, b, aab, aba, baa } , { a }i ⇒ · · · ♦ Hence, by Ginsburg and Rice [19] we have that L ( G ) ⊆ L ⇔ lfp( λ X . b ∪ Fn G ( X )) ⊆ L X where L X , h δ L Σ ∗ ( i = 0) i i ∈ [0 ,n ] . Theorem 7.2.
Let G = ( V , Σ , P ) be a CFG in CNF. If ρ ∈ uco( ℘ (Σ ∗ )) is backward complete for both λX.Xa and λX.aX , for all a ∈ Σ , then ρ is backward completefor Fn G and λ X . b ∪ Fn G ( X ) . As a consequence, by backward completeness of ρ , ρ (lfp( λ X . b ∪ Fn G ( X ))) = lfp( λ X . ρ ( b ∪ Fn G ( X ))) . Note that if ρ is backward complete for left and rightconcatenation and ρ ( L ) = L then, as a straightforwardconsequence of Theorems 3.1 and 7.2, we have that: L ( G ) ⊆ L ⇔ lfp( λ X . ρ ( b ∪ Fn G ( X ))) ⊆ L X . (11)The following results are the equivalent of Theorem 4.5and Corollary 4.7 for context-free languages. Theorem 7.3.
Let G = hV , Σ , P i be a CFG in CNF and let L be a language over Σ . Let h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i bea GC where h D, ⊑i is a poset. Assume that the followingproperties hold: ( i ) L ∈ γ ( D ) and for every a ∈ Σ , X ∈ ℘ (Σ ∗ ) we have α ( aX ) = α ( aγα ( X )) and α ( Xa ) = α ( γα ( X ) a ) . ( ii ) ( D, ⊑ , ⊔ ) is an effective domain, meaning that: ( D, ⊑ ) is ACC, every element of D has a finite representation, ⊑ is decidable and ⊔ is a computable binary lub. ( iii ) There is an algorithm, say Fn ♯ ( X ) , computing α (Fn G ( γ ( X ))) , for all X ∈ ℘ (Σ ∗ ) |V| . ( iv ) There is an algorithm, say b ♯ , computing α ( b ) . ( v ) There is an algorithm, say
Incl ♯ ( X ) , deciding theabstract inclusion X ⊑ α ( L X ) , for every vector X ∈ α ( ℘ (Σ ∗ ) |V| ) . hen, the following algorithm decides whether L ( G ) ⊆ L : h Y i i i ∈ [0 ,n ] := Kleene ( λ X . b ♯ ⊔ Fn ♯ ( X ) , ∅∅∅ ) ; return Incl ♯ ( h Y i i i ∈ [0 ,n ] ) ; Corollary 7.4.
Theorem 7.3 still holds for a QGC h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i where h D, ⊑i is a qoset. As we did in Section 5 for the language inclusionproblem L ( A ) ⊆ L , we next show how to systematicallyderive an algorithm solving L ( G ) ⊆ L and we discuss andcompare some quasiorders for which our framework applies. Word-based Abstractions
By Lemma 5.2, it turns out thata (left and right) L -consistent quasiorder L on Σ ∗ inducesthe L -upward closure ρ L ∈ uco( ℘ (Σ ∗ )) defined in (7)such that: (a) ρ L ( L ) = L , and (b) ρ L is backwardcomplete for λX. aX and λX. Xa , for all a ∈ Σ . More-over, the closure ρ L can be defined through the qoset ofantichains. As shown by Theorem 5.3, the maps α L and γ L define a QGC h ℘ (Σ ∗ ) , ⊆i −−−−−→←−−−−− α L γ L h AC h Σ ∗ , L i , ⊑i with ρ L = γ L ◦ α L .Theorem 5.4 shows that every decidable left L -consistent wqo L yields an algorithm for deciding L ( A ) ⊆ L . Next, we show a similar result for L ( G ) ⊆ L . CFGIncW : Word-based algorithm for L ( G ) ⊆ L Data:
CFG G = hV , Σ , P i Data:
Decision procedure for membership in L Data:
Decidable L -consistent wqo L Result:
Whether L ( G ) ⊆ L holds h Y i i i ∈ [0 ,n ] := Kleene ( λ X . ⌊ b ⌋ ⊔ ⌊ Fn G ( X ) ⌋ , ∅∅∅ ) ; forall u ∈ Y do if u / ∈ L then return false ; return true ; Theorem 7.5.
Let G be a CFG and let L be a languagesuch that there exists a decidable L -consistent wqo on Σ ∗ .Then, CFGIncW decides the inclusion L ( G ) ⊆ L . Let us compare Theorem 5.4 with Theorem 7.5. Theformer had the additional hypothesis (i) that the membershipproblem in L is decidable. Such condition is de facto truefor Theorem 7.5 since a quasiorder is a L -consistent wqoiff L is regular (as proved by De Luca and Varricchio [11,Theorem 2.1]). Myhill Quasiorder
Given a language L over Σ , define thefollowing quasiorder on Σ ∗ : u ≦ L v △ ⇐⇒ r L ( u ) ⊆ r L ( v ) where r L ( u ) , { ( x, y ) ∈ Σ ∗ × Σ ∗ | xuy ∈ L } . De Luca and Varricchio [11] call ≦ L the Myhill quasiorderrelative to L . Lemma 7.6.
Let L ⊆ Σ ∗ be a language. ( a ) ≦ L is a (left and right) L -consistent quasiorder. More-over, ≦ L is well-quasiorder iff L is regular. Also, if L is regular then ≦ L is decidable. ( b ) Let ≤ be a quasiorder. If ≤ is (left and right) L -consistent then ρ ≦ L ⊆ ρ ≤ . As a consequence, ≦ L is the most general (greatestfor set inclusion) L -consistent quasiorder for which theabove algorithm CFGIncW can be used to decide the lan-guage inclusion L ( G ) ⊆ L . However, deciding the My-hill quasiorder ≦ L can be easily shown to be as hardas the language inclusion problem (which is PSPACE-hard). In the following, we restrict ourselves to the problem L ( G ) ⊆ L ( A ) and consider a wqo based on A which yieldsan effective algorithm for deciding the inclusion. State-based Quasiorder
We define the quasiorder ≤ A on Σ ∗ induced by a FA A = h Q, δ, I, F, Σ i as follows: u ≤ A v △ ⇐⇒ ctx A ( u ) ⊆ ctx A ( v ) . (12)where ctx A ( u ) , { ( q, q ′ ) ∈ Q | u ∈ W q,q ′ } . Lemma 7.7.
Let A be an FA. Then ≤ A is a decidable L ( A ) -consistent well-quasiorder. Observe that for the Myhill quasiorder ≤ L ( A ) we have u ≤ L ( A ) v ⇔ [ { W I,q × W q ′ ,F | u ∈ W q,q ′ } ⊆ [ { W I,q × W q ′ ,F | v ∈ W q,q ′ } Note that W I,π ( A ) × W π ( A ) ,F ⊆ W I,π ( B ) × W π ( B ) ,F holds for all A ⊆ B ⊆ Q × Q . Thus, u ≤ A v ⇒ u ≤ L ( A ) v ,hence ρ ≤ L ( A ) ⊆ ρ ≤ A , as stated by Lemma 7.6. Consider a CFG G = hV , Σ , P i and a FA A = h Q, δ, I, F, Σ i and let ≤ A be the L ( A ) -consistent wqodefined in (12). Theorem 7.3 shows that the algorithm CFGIncW solves the inclusion problem L ( G ) ⊆ L ( A ) byworking on the antichain abstraction h AC h Σ ∗ , ≤ A i , ⊑i .Similarly to the case of the quasiorder ≤ l A (Sec-tion 6) it suffices to keep the sets ctx A ( u ) of pairs ofstates of Q for each word u instead of the words them-selves. Therefore, we can systematically derive an al-gorithm analogous to CFGIncW but working on the an-tichain poset h AC h ℘ ( Q × Q ) , ⊆i , ⊑i viewed as an abstrac-tion of h AC h Σ ∗ , ≤ A i , ⊑ ′ i (where ⊑ ′ is used for distin-guishing the two orderings). Here, the abstraction map α A : AC h Σ ∗ , ≤ A i → AC h ℘ ( Q × Q ) , ⊆i and concretization map γ A : AC h ℘ ( Q × Q ) , ⊆i → AC h Σ ∗ , ≤ A i are defined as follows: α A ( X ) , { ctx A ( u ) | u ∈ X } γ A ( Y ) , ⌊{ u ∈ Σ ∗ | ctx A ( u ) ∈ Y }⌋ π is the projection on the first component, π on the second. emma 7.8. h AC h Σ ∗ , ≤ A i , ⊑ ′ i −−−−→←−−−− α A γ A h AC h ℘ ( Q × Q ) , ⊆i , ⊑i is a QGC. As done in Section 6 we combine the word-based al-gorithm
CFGIncW with the functions α A and γ A in orderto obtain a “state-based” algorithm deciding L ( G ) ⊆ L ( A ) .Let us define the functions α : ℘ (Σ ∗ ) → AC h ℘ ( Q × Q ) , ⊆i , γ : AC h ℘ ( Q × Q ) , ⊆i → ℘ (Σ ∗ ) and Fn AG ( h X i i i ∈ [0 ,n ] ) : ℘ ( Q × Q ) |V| → ℘ ( Q × Q ) |V| as follows: α ( X ) , ⌊{ ctx A ( u ) | u ∈ X }⌋ γ ( Y ) , { u ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ ctx A ( u ) } Fn AG ( h X i i i ∈ [0 ,n ] ) , h⌊{ X j ◦ X k | X i → X j X k ∈ P }⌋i i ∈ [0 ,n ] where X ◦ Y , { ( q, q ′ ) | ( q, q ′′ ) ∈ X ∧ ( q ′′ , q ′ ) ∈ Y } isstandard composition of two relations X, Y ⊆ Q × Q . Lemma 7.9.
The following hold: (a) α = α A ◦ α ≤ A (b) γ = γ ≤ A ◦ γ A (c) h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h AC h ℘ ( Q × Q ) , ⊆i , ⊑i is a GC. (d) γ ◦ α = ρ ≤ A (e) Fn AA ( X ) = α A ◦ α ≤ A ◦ Fn A ◦ γ ≤ A ◦ γ A ( X ) for all X ∈ α ( ℘ (Σ ∗ ) |V| ) CFGIncS : State-based algorithm for L ( G ) ⊆ L ( A ) Data:
CFG G = hV , Σ , P i Data: FA A = h Q, δ, I, F, Σ i Result:
Whether L ⊆ L holds h Y i i i ∈ [0 ,n ] := Kleene ( λ X . ⌊ b ⌋ ⊔ Fn AG ( X ) , ∅∅∅ ) ; forall y ∈ Y do if y ∩ ( I × F ) = ∅ then return false ; return true ; Theorem 7.10.
Let G be a CFG and A be a FA. Thealgorithm CFGIncS decides L ( G ) ⊆ L ( A ) . The resulting algorithm
CFGIncS shares some featureswith two previous works. On the one hand, it is related to thework of Hofmann and Chen [21] which defines an abstractinterpretation-based language inclusion decision proceduresimilar to ours. Even though Hofmann and Chen’s algorithmand ours both manipulate sets of pairs of states of an au-tomaton, their abstraction is based on equivalence relationsand not quasiorders. Since quasiorders are strictly moregeneral than equivalences our framework can be instantiatedto a larger class of abstractions, most importantly coarserones. Finally, it is worth pointing out that Hofmann andChen’s [21] approach aims at including languages of finiteand also infinite words.A second related work is that of Hol´ık and Meyer [22]who define an antichain like algorithm manipulating sets ofpairs of states. Hol´ık and Meyer [22] start from the standardantichain algorithm for the automata case and rely on theirexpert knowledge about it to design an ad-hoc antichainalgorithm for checking the inclusion of grammar languages into automata languages. By contrast, our approach is notad-hoc but systematic, since we derive
CFGIncS startingfrom the known Myhill quasiorder. The study of a pre-cise relationship between Hol´ık and Meyer’s algorithm and
CFGIncS is left as future work.
8. Equivalent Greatest Fixpoint Check
Let us recall [8, Theorem 4] that if g : C → C isa monotonic function on a complete lattice h C, ≤ , ∨ , ∧i and e g : C → C is the right-adjoint function of g then thefollowing equivalence holds: for any c, c ′ ∈ C , lfp( λx. c ∨ g ( x )) ≤ c ′ ⇔ c ≤ gfp( λy. c ′ ∧ e g ( y )) (13)This property has been exploited to derive equivalent in-variance proof methods for programs [8]. In the following,we use it to derive an equivalent algorithm for deciding theinclusion L ( G ) ⊆ L ( A ) for a linear CFG G and a FA A which relies on the computation of a greatest fixpoint ratherthan a least fixpoint.Given two languages X, Y ∈ ℘ (Σ ∗ ) , we define XY , { xy ∈ Σ ∗ | ∀ x ∈ X, y ∈ Y } ,X − Y , { u ∈ Σ ∗ | ∀ x ∈ X, xu ∈ Y } ,XY − , { u ∈ Σ ∗ | ∀ y ∈ Y, uy ∈ X } . Thus, X − Y and XY − are a universal generalizationto languages of, resp., left and right quotients of words(recalled in Section 5.2). It turns out that concatenation andquotients give rise to the following equivalences. Lemma 8.1.
For all
X, Y, Z ⊆ Σ ∗ and w ∈ Σ ∗ : (a) X ⊆ ZY − ⇔ XY ⊆ Z ⇔ Y ⊆ X − Z . (b) wY ⊆ Z ⇔ Y ⊆ w − Z and Xw ⊆ Z ⇔ X ⊆ Zw − . For this greatest fixpoint based language inclusion check,we restrict ourselves to linear context-free languages. With-out loss of generality [19], we assume that these languagesare represented by linear context-free grammars where eachproduction X i → β is such that β ∈ Σ V ∪ V Σ ∪ Σ ∪ { ǫ } .For instance the grammar G on Σ = { a, b, c } with rules { X → c, X → X b, X → aX } is a linear CFGspecifying the language { a n cb n | n ≥ } . Let us alsorecall that the set of linear context-free languages properlycontains all regular languages.Given a linear CFG G = hV , Σ , P i , we define thefunction f Fn G : ℘ (Σ ∗ ) |V| → ℘ (Σ ∗ ) |V| as follows: f Fn G ( h X i i i ∈ [0 ,n ] ) , * T X j → aX i ∈ P a − X j ∩ T X k → X i b ∈ P X k b − + i ∈ [0 ,n ] where, as usual, T ∅ = Σ ∗ . It turns out that f Fn G is theadjoint of Fn G . Lemma 8.2. If G is a linear CFG then for all X , Y ∈ ℘ (Σ ∗ ) |V| , Fn G ( X ) ⊆ Y ⇔ Y ⊆ f Fn G ( X ) . L ( G ) ⊆ L ⇔ lfp( λ X . b ∪ Fn G ( X )) ⊆ L X ⇔ (14) b ⊆ gfp( X . L X ∩ f Fn G ( X )) Assuming for now that the Kleene iterates of the greatestfixpoint computation gfp( X . L X ∩ f Fn G ( X )) are finitelymany, we define the following algorithm for the inclusion L ( G ) ⊆ L :(1) compute the Kleene iterates of gfp( X . L X ∩ f Fn G ( X )) ;(2) check whether the output vector h Y i i i ∈ [0 ,n ] ∈ ℘ (Σ ∗ ) |V| is such that for all i , b i ⊆ Y i , where h b i i i ∈ [0 ,n ] = b .The regularity of L together with the basic property of reg-ular languages of being closed under intersections and quo-tients shows that each Kleene iterate is a regular languageand computable. Also, since, by definition, each b i is a finiteset of words, the final check can be simply implemented byresorting to membership queries in Y i where h Y i i i ∈ [0 ,n ] isthe greatest fixpoint. To the best of our knowledge, the abovealgorithm has never been described in the literature before.Next, we discharge the fundamental assumption onwhich the previous algorithm depends on: the Kleene it-erates of gfp( X . L X ∩ f Fn G ( X )) are finitely many. Toshow this, we proceed as follows. First, we consider anabstract version of the greatest fixpoint computation for aclosure operator such that the Kleene iterates thereof arefinitely many. This closure operator will be ρ ≤ A where L = L ( A ) and we will show that ρ ≤ A is forward complete for λ X . L X ∩ f Fn G ( X ) . Forward completeness of abstractinterpretations [17] is different from backward complete-ness already used in the previous sections. In particular,as a consequence of having a forward complete abstrac-tion, it turns out that the Kleene iterates of the concreteand abstract greatest fixpoint computations coincide. Theintuition here is that this forward complete closure ρ ≤ A allows us to disclose the property that every Kleene iterateof gfp( X . L X ∩ f Fn G ( X )) belongs to the image of theclosure ρ ≤ A , i.e., every Kleene iterate is a language whichis ≤ A -upward closed. A similar phenomenon occurs in well-structured transition systems [1], [16].Let us now describe in detail this abstraction. A closure ρ ∈ uco( C ) on a concrete domain C is forward completefor a monotonic function f : C → C if ρf ρ = f ρ . Theintuition here is that forward completeness means that noloss of precision is accumulated when the output of thecomputations of f ρ is approximated by ρ . Dually to the caseof backward completeness, forward completeness impliesthat gfp( f ) = gfp( f ρ ) = gfp( ρf ρ ) holds, when thesegreatest fixpoints exist (this is the case, e.g., when C isa complete lattice). It turns out that forward and backwardcompleteness are linked by a duality on the function f . Lemma 8.3 ( [17, Corollary 1] ) . Let h C, ≤ C i be a completelattice and assume that f : C → C admits a right-adjoint e f : C → C , i.e., f ( c ) ≤ C c ′ ⇔ c ≤ C e f ( c ′ ) always holds. Then, ρ is backward complete for f iff ρ is forward completefor e f . Thus, by Lemma 8.3, in the following result insteadof assuming the hypotheses implying that a closure ρ isforward complete for f Fn G we assume the hypotheses whichguarantee that ρ is backward complete for its adjoint Fn G . Theorem 8.4.
Let G = hV , Σ , P i be a linear CFG and let A be an FA with L = L ( A ) . If ρ ∈ uco( ℘ (Σ ∗ )) satisfies: (1) ρ ( L ) = L ; (2) ρ is backward complete for λX. aX and λX. Xa forall a ∈ Σ then L ( G ) ⊆ L iff b ⊆ gfp( λ X . ρ ( L X ∩ f Fn G ( X ))) .Moreover, the Kleene iterates coincide in lockstep with thoseof gfp( λ X . L X ∩ f Fn G ( X )) . As announced, we can now establish that the Kleeneiterates of gfp( λ Y . L X ∩ f Fn G ( Y )) are finitely many. Let L = L ( A ) , for some FA A , and consider the correspond-ing state-based quasiorder ≤ A on Σ ∗ as defined in (12).Lemma 7.7 tells us that ≤ A is a L -consistent wqo. Further-more, since Q is finite we have that both ≤ A and ( ≤ A ) − are wqos, so that, in turn, h ρ ≤ A , ⊆i is both ACC and DCC.The definition of ≤ A shows that every chain in h ρ ≤ A , ⊆i has at most | Q | elements. This means that if we compute | Q | Kleene iterates then we have necessarily computedthe greatest fixpoint. It follows from the DCC property thatthe iterates of gfp( λ X . ρ ≤ A ( L X ∩ f Fn G ( X ))) are finitelymany, hence so are the iterates of gfp( λ Y . L X ∩ f Fn G ( Y )) because they go in lockstep as proved in Theorem 8.4.
9. Conclusion
We believe we have only scratched the surface of theuse of well-quasiorders on words for solving language in-clusion problems. Future directions include leveraging well-quasiorders for infinite words [3], [26] to shed new lighton the inclusion problem between ω -regular languages. Ourresults could also be extended to inclusion of tree languagesby relying on the extensions of Myhill-Nerode theorems fortree languages [25].Another interesting topic for future work is the enhance-ment of quasiorders using simulation relations. Even thoughwe already showed in this paper that simulations can be usedto refine our language inclusion algorithms, we are not onpar with the thoughtful use of simulation relations made byAbdulla et al. [2] and Bonchi and Pous [5].Finally, let us mention that the correspondence betweenleast and greatest fixpoint based inclusion checks assumingcomplete abstractions was studied by Bonchi et al. [4]with the aim of formally connecting sound up-to techniquesand complete abstract interpretations. Possible developmentsinclude the study of our abstract interpretation-based algo-rithms for language inclusion from the point of view ofsound up-to techniques.12 eferences [1] P. A. Abdulla, K. Cerans, B. Jonsson, and Y.-K. Tsay, “Generaldecidability theorems for infinite-state systems,” in LICS ’96: Proc.11th Annual IEEE Symp. on Logic in Computer Science . IEEEComputer Society, 1996, pp. 313–321.[2] P. A. Abdulla, Y.-F. Chen, L. Hol´ık, R. Mayr, and T. Vojnar,“When simulation meets antichains,” in
Proceedings of the16th International Conference on Tools and Algorithms for theConstruction and Analysis of Systems (TACAS’10) . SpringerBerlin Heidelberg, 2010, pp. 158–174. [Online]. Available:https://doi.org/10.1007/978-3-642-12002-2 14[3] A. Arnold, “A syntactic congruence for ra-tional ω -languages,” Theoretical Computer Science
Proceedingsof the 33rd Annual ACM/IEEE Symposium on Logic in ComputerScience - LICS ’18 . ACM Press, 2018. [Online]. Available:https://doi.org/10.1145/3209108.3209169[5] F. Bonchi and D. Pous, “Checking nfa equivalence withbisimulations up to congruence,” in
Proceedings of the40th Annual ACM SIGPLAN-SIGACT Symposium on Principlesof Programming Languages , ser. POPL’13. New York,NY, USA: ACM, 2013, pp. 457–468. [Online]. Available:http://doi.acm.org/10.1145/2429069.2429124[6] N. Chomsky, “On certain formal properties of grammars,”
Informa-tion and Control , vol. 2, no. 2, pp. 137–167, 1959.[7] P. Cousot, “M´ethodes it´eratives de construction et d’approximationde points fixes d’op´erateurs monotones sur un treillis, analyse s´e-mantique de programmes (in French),” Th`ese d’ ´Etat `es sciences ma-th´ematiques, Universit´e Joseph Fourier, Grenoble, France, 21 March1978.[8] ——, “Partial completeness of abstract fixpoint checking,” in
Proceedings of the 4th International Symposium on Abstraction,Reformulation, and Approximation , ser. SARA’02. London,UK, UK: Springer-Verlag, 2000, pp. 1–25. [Online]. Available:https://doi.org/10.1007/3-540-44914-0 1[9] P. Cousot and R. Cousot, “Abstract interpretation: a unifiedlattice model for static analysis of programs by construction orapproximation of fixpoints,” in
Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages(POPL’77) . New York, NY, USA: ACM, 1977, pp. 238–252.[Online]. Available: http://doi.acm.org/10.1145/512950.512973[10] ——, “Systematic design of program analysis frameworks,”in
Proceedings of the 6th ACM SIGACT-SIGPLAN Symposiumon Principles of Programming Languages (POPL’79) . NewYork, NY, USA: ACM, 1979, pp. 269–282. [Online]. Available:http://doi.acm.org/10.1145/567752.567778[11] A. de Luca and S. Varricchio, “Well quasi-orders and regularlanguages,”
Acta Informatica , vol. 31, no. 6, pp. 539–557, Jun 1994.[Online]. Available: https://doi.org/10.1007/BF01213206[12] ——,
Finiteness and Regularity in Semigroups and Formal Lan-guages , 1st ed. Springer Publishing Company, Incorporated, 2011.[13] M. De Wulf, L. Doyen, T. A. Henzinger, and J. F. Raskin, “Antichains:A new algorithm for checking universality of finite automata,” in
Proceedings of the 18th International Conference on Computer AidedVerification , ser. CAV’06. Berlin, Heidelberg: Springer-Verlag, 2006,pp. 17–30. [Online]. Available: http://dx.doi.org/10.1007/11817963 5[14] M. De Wulf, “From timed models to timed implementations,”Ph.D. dissertation, Universit´e libre de Bruxelles, Facult´e desSciences – Informatique, Bruxelles, Dec. 2006. [Online]. Available:http://hdl.handle.net/2013/ULB-DIPOT:oai:dipot.ulb.ac.be:2013/210797 [15] A. Ehrenfeucht, D. Haussler, and G. Rozenberg, “On regularity ofcontext-free languages,”
Theoretical Computer Science , vol. 27, no. 3,pp. 311–332, Jan. 1983.[16] A. Finkel and P. Schnoebelen, “Well-structured transitionsystems everywhere!”
Theoretical Computer Science , vol.256, no. 1-2, pp. 63–92, apr 2001. [Online]. Available:https://doi.org/10.1016/s0304-3975(00)00102-x[17] R. Giacobazzi and E. Quintarelli, “Incompleteness, counterexamples,and refinements in abstract model-checking,” in
Proceedings of the8th Static Analysis Symposium (SAS’01), LNCS vol. 2126 , P. Cousot,Ed. Berlin, Heidelberg: Springer Berlin Heidelberg, 2001, pp. 356–373. [Online]. Available: https://doi.org/10.1007/3-540-47764-0 20[18] R. Giacobazzi, F. Ranzato, and F. Scozzari, “Making abstractinterpretations complete,”
J. ACM , vol. 47, no. 2, pp. 361–416, Mar.2000. [Online]. Available: http://doi.acm.org/10.1145/333979.333989[19] S. Ginsburg and H. G. Rice, “Two families of languages relatedto algol,”
J. ACM , vol. 9, no. 3, pp. 350–371, Jul. 1962. [Online].Available: http://doi.acm.org/10.1145/321127.321132[20] P. Hofman, R. Mayr, and P. Totzke, “Decidability of weak simulationon one-counter nets,” in
Proceedings of the 2013 28th AnnualACM/IEEE Symposium on Logic in Computer Science , ser. LICS ’13.Washington, DC, USA: IEEE Computer Society, 2013, pp. 203–212.[Online]. Available: http://dx.doi.org/10.1109/LICS.2013.26[21] M. Hofmann and W. Chen, “Abstract interpretation from b¨uchiautomata,” in
Proceedings of the Joint Meeting of the Twenty-ThirdEACSL Annual Conference on Computer Science Logic (CSL’14)and the Twenty-Ninth Annual ACM/IEEE Symposium on Logicin Computer Science (LICS’14) . ACM Press, 2014. [Online].Available: https://doi.org/10.1145/2603088.2603127[22] L. Hol´ık and R. Meyer, “Antichains for the verificationof recursive programs,” in
Networked Systems . SpringerInternational Publishing, 2015, pp. 322–336. [Online]. Available:https://doi.org/10.1007/978-3-319-26850-7 22[23] J. E. Hopcroft and J. D. Ullman,
Formal Languages and TheirRelation to Automata . Boston, MA, USA: Addison-Wesley LongmanPublishing Co., Inc., 1969.[24] P. Janar, J. Esparza, and F. Moller, “Petri nets and regularprocesses,”
Journal of Computer and System Sciences
Bulletin of theEATCS , vol. 47, pp. 170–173, 1992.[26] M. Ogawa, “Well-quasi-orders and regular ω -languages,” Theoretical Computer Science
Elements of Automata Theory . Cambridge UniversityPress, 2009. ppendix A.Closures and Galois Connections Let us recall some basic notions on closure operators and Galois connections commonly used in abstract interpretation(see, e.g., [7], [10], [18]). Let h C, ≤ C , ∨ , ∧i be a complete lattice. An upper closure operator , or simply closure , on h C, ≤ C i is a function ρ : C → C which is: • Monotone : x ≤ C y ⇒ ρ ( x ) ≤ C ρ ( y ) for all x, y ∈ C ; • Idempotent : ρ ( ρ ( x )) = ρ ( x ) for all x ∈ C ; • Extensive : x ≤ C ρ ( x ) for all x ∈ C The set of all upper closed operators on C is denoted by uco( C ) . One useful property of closures states that for all X ⊆ C , ρ ( ∨ X ) = ρ ( ∨ ρ ( X )) and ∧ ρ ( X ) = ρ ( ∧ ρ ( X )) . Given two closures ρ, ρ ′ ∈ uco( C ) , ρ is a coarser abstraction than ρ ′ iff the image of ρ is a subset of the image of ρ ′ , i.e. ρ ⊆ ρ ′ , and this happens iff for any x ∈ C , ρ ′ ( x ) ≤ C ρ ( x ) . Lemma A.1.
Let h C, ≤ C i −−−→←−−− αγ h A, ≤ A i be a GC between a poset and a qoset (or viceversa). Then the following propertieshold: (a) x ≤ C γ ◦ α ( x ) and α ◦ γ ( y ) ≤ A y . (b) α and γ are monotonic functions. (c) If A is a poset then α = α ◦ γ ◦ α . If C is a poset then γ = γ ◦ α ◦ γ .Proof: Assume that h A, ≤ A i is a poset (the case where h C, ≤ C i is a poset is dual).(a): α ( x ) ≤ A α ( x ) ⇔ x ≤ C γ ( α ( x )) and α ( γ ( y )) ≤ A y ⇔ γ ( y ) ≤ C γ ( y ) .(b): Assume that c ≤ C c ′ . Thus, c ≤ C c ′ ≤ C γ ( α ( c ′ )) , hence c ≤ C γ ( α ( c ′ )) ⇒ α ( c ) ≤ A α ( c ′ ) .(c): c ≤ C γ ( α ( c )) ⇒ α ( c ) ≤ A α ( γ ( α ( c ))) . Also, α ( γ ( α ( c ))) ≤ A α ( c ) ⇔ γ ( α ( c )) ≤ C γ ( α ( c )) . Thus, since h A, ≤ A i is aposet, α ( γ ( α ( c ))) = α ( c ) . Lemma A.2.
Let h C, ≤ C i −−−→←−−− αγ h A, ≤ A i be a GC between complete lattices. If f : C → C is a monotonic function then γ (lfp( α ◦ f ◦ γ )) = lfp( γ ◦ α ◦ f ) .Proof: First we show that γ (lfp( αf γ )) ≥ C lfp( γαf ) . lfp( γαf ) ≤ C γ (lfp( αf γ )) ⇐ γαf ( γ (lfp( αf γ ))) ≤ C γ (lfp( αf γ )) ⇔ γ (lfp( αf γ )) ≤ C γ (lfp( αf γ )) . Then, we prove that γ (lfp( αf γ )) ≤ C lfp( γαf ) . γ (lfp( αf γ )) ≤ C lfp( γαf ) ⇔ γ (lfp( αf γ )) ≤ C γα (lfp( γαf )) ⇐ lfp( αf γ ) ≤ A α (lfp( γαf )) ⇔ αf γ ( α lfp( γαf )) ≤ A α (lfp( γαf )) ⇔ αf (lfp( γαf )) ≤ A α (lfp( γαf )) ⇔ γαf (lfp( γαf )) ≤ C γα (lfp( γαf )) ⇔ lfp( γαf ) ≤ C γα (lfp( γαf )) . Appendix B.Right Monotonicity
In this section we show results equivalent to the ones from Section 4 but requiring right (instead of left) monotonicity.Let A = h Q, δ, I, F, Σ i be an FA with L = L ( A ) and recall W A I,q , { w ∈ Σ ∗ | ∃ q i ∈ I, q i w q } . It is easy to observe that W I,q = δ { ǫ } ∅ ( q ∈ I ) ∪ S a ∈ Σ ,a ∈ W q ′ ,q W I,q ′ a which induces the following sets of fixpoint equations on ℘ (Σ ∗ )Eqn( A ) , { X q = δ { ǫ } ∅ ( q ∈ I ) ∪ S a ∈ Σ ,q ′ a → q X q ′ a | q ∈ Q } . We have that h ℘ (Σ ∗ ) | Q | , ⊆ , ∪ , ∩i is a (product) complete lattice and all functions in Eqn( A ) (of type ℘ (Σ ∗ ) | Q | → ℘ (Σ ∗ ) )are monotonic so that the least fixpoint solution Y = h Y q i q ∈ Q of Eqn( A ) do exist. It is easy to show that Y q = W A I,q forevery q ∈ Q , hence L ( A ) = S q i ∈ I Y q i following (2). 14 xample B.1. Let us consider the automaton A of Figure 1. The set of equations induced by A are as follows: Eqn( A ) = ( X = { ǫ } ∪ X a ∪ X aX = ∅ ∪ X b ∪ X b . ♦ Let us introduce the vector ǫ I ∈ ℘ (Σ ∗ ) | Q | and the function Post A : ℘ (Σ ∗ ) | Q | → ℘ (Σ ∗ ) | Q | , used to formalize the fixpointequations in Eqn( A ) : ǫ I , h δ { ǫ } ∅ ( q ∈ I ) i q ∈ Q Post A ( h X q i q ∈ Q ) , h S a ∈ Σ ,q ′ a → q X q ′ a i q ∈ Q . Thus, we have h W A I,q i q ∈ Q = lfp( λ X . ǫ I ∪ Post A ( X )) (15)By equality (2), L ( A ) is the union of the languages of lfp( λ X . ǫ I ∪ Post A ( X )) for the components associated to F . Example B.2.
Consider again the automaton A from Figure 1. The fixpoint equations induced by A are as follows: (cid:18) W A q ,q W A q ,q (cid:19) = lfp (cid:18) λ (cid:18) X X (cid:19) . (cid:18) { ǫ } ∪ X a ∪ X a ∅ ∪ X b ∪ X b (cid:19)(cid:19) The fixpoint is (cid:18) W A q ,q W A q ,q (cid:19) = (cid:18) ( a + ( b + a )) ∗ a ∗ b ( b + a + b ) ∗ (cid:19) , hence L ( A ) = ( a + ( b + a )) ∗ . ♦ Let us go back to the language inclusion problem L ( A ) ⊆ L where A is an FA A = h Q, δ, I, F, Σ i . We formalize thelanguage L as the following vector in ℘ (Σ ∗ ) | Q | : L F , h δ L Σ ∗ ( q ∈ F ) i q ∈ Q . Thus L ( A ) ⊆ L ⇔ [by (2)] ∀ q ∈ F, W A I,q ⊆ L ⇔ [definition of L F ] h W A I,q i q ∈ Q ⊆ L F ⇔ [by (15)] lfp( λ X . ǫ I ∪ Post A ( X )) ⊆ L F The following result is the equivalent of Theorem 4.3 for right concatenation and it can be proved in a similar manner.
Theorem B.3. If ρ ∈ uco( ℘ (Σ ∗ )) and ρ is backward complete for λX. Xa for all a ∈ Σ , then ρ is backward complete for Post A , and also for λ X . ǫ I ∪ Post A ( X ) for all FA A = h Q, δ, I, F, Σ i . Similarly, Theorem 4.5 can be adapted to the new equation system.
Theorem B.4.
Let A = h Q, δ, I, F, Σ i be an FA and let L be a language over Σ . Let h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i be a GCwhere h D, ⊑i is a poset. If all of the following properties hold: ( i ) L ∈ γ ( D ) and for every a ∈ Σ , X ∈ ℘ (Σ ∗ ) we have α ( Xa ) = α ( γα ( X ) a ) . ( ii ) ( D, ⊑ , ⊔ ) is an effective domain, meaning that: ( D, ⊑ ) is ACC, every element of D has a finite representation, ⊑ isdecidable and ⊔ is a computable binary lub. ( iii ) There is an algorithm, say
Post ♯ ( X ) , computing α (Post A ( γ ( X ))) . ( iv ) There is an algorithm, say ǫ ♯ , computing α ( ǫ I ) . ( v ) There is an algorithm, say
Incl ♯♯ ( X ) , deciding the abstract inclusion X ⊑ α ( L F ) for every vector X ∈ α ( ℘ (Σ ∗ ) | Q | ) .Then, the following algorithm decides whether L ( A ) ⊆ L : h Y q i q ∈ Q := Kleene ( λ X . ǫ ♯ ⊔ Post ♯ ( X ) , ∅∅∅ ) ; return Incl ♯ ( h Y q i q ∈ Q ) ; Corollary B.5.
Theorem B.4 remains true when we have a QGC.
We have shown in Lemma 5.2 that for every right L -consistent quasiorder there exists a backward complete L -closedclosure operator ρ ≤ rL . Theorem 5.4 gives an algorithm for solving the language inclusion problem L ( A ) ⊆ L whenevermembership in L is decidable and there exists a decidable left L -consistent wqo L . Next we show that Theorem 5.4also holds when provided a decidable right L -consistent quasiorder.15 AIncWr : Word-based algorithm for L ( A ) ⊆ L Data: FA A , h Q, δ, I, F, Σ i s.t. L = L ( A ) Data:
Decision procedure for membership in L Data:
Right L -consistent decidable wqo rL Result:
Whether L ( A ) ⊆ L holds h Y q i q ∈ Q := Kleene ( λ X . ⌊ ǫ I ⌋ ⊔ ⌊ Post A ( X ) ⌋ , ∅∅∅ ) ; forall q ∈ F do forall u ∈ Y q do if u / ∈ L then return false ; return true ; Theorem B.6.
Let A = h Q, δ, I, F, Σ i be a FA and let L be a language such that ( i ) membership u ∈ L is decidable;and ( ii ) there exists a decidable right L -consistent wqo on Σ ∗ . Then, FAIncW decides the inclusion L ( A ) ⊆ L .Proof: We proceed by showing that all the premises of Theorem B.4 are satisfied for h D, ⊑i = h AC h Σ ∗ , rL i , ⊑i , α = ⌊·⌋ and γ = ρ rL . Indeed we apply Corollary B.5 because h AC h Σ ∗ , rL i , ⊑i is a qoset so that we deal with a QGCrather than a GC.( i ) γ ( L ) = L by Lemma 5.2 since γ = ρ rL . Further-more α ( Xa ) = [QGC] α ( γ ( α ( Xa ))) = [L. 5.2 with ρ rL = γα ] α ( γ ( α ( γ ( α ( X )) a ))) = [QGC] α ( γα ( X ) a ) . ( ii ) It turns out that h AC h Σ ∗ , rL i , ⊑i is ACC because rL is a wqo. Moreover, the decidability of rL entails that W ⊔ W , ⌊ W ∪ W ⌋ is a computable binary lub,therefore h AC h Σ ∗ , rL i , ⊑ , ⊔i is an effective domain.( iii ) Let us first observe that by Lemma 5.2 (b) and The-orem 4.3, ρ rL is backward complete for Post A .Moreover, α (Post A ( γ ( X ))) = ⌊ Post A ( X ) ⌋ since α (Post A ( γ ( X ))) = [GC] αγα (Post A ( γ ( X ))) = [def. α and γ ] ⌊ ρ rL (Post A ( ρ rL ( X ))) ⌋ = [bw. completeness] ⌊ ρ rL (Post A ( X )) ⌋ = [GC] ⌊ Post A ( X ) ⌋ . This entails that α (Post A ( γ ( X ))) is computable. ( iv ) α ( { ǫ } ) = { ǫ } and α ( ∅ ) = ∅ , hence α ( ǫ I ) = ⌊ ǫ I ⌋ istrivial to compute.( v ) Since α ( L F ) = α ( h δ L Σ ∗ ( q ∈ F ) i q ∈ Q , the relation h Y q i q ∈ Q ⊑ α ( L F ) trivially holds for all componentswith q / ∈ F . Therefore it suffices to check that ∀ q ∈ F , Y q ⊑ α ( L ) is decidable. We have that: Y q ⊑ α ( L ) ⇔ [defs. ⊑ and α ] ∀ y ∈ Y q , ∃ x ∈ ⌊ L ⌋ , x rL y ⇔ [ ⌊ X ⌋ is a minor set] ∀ y ∈ Y q , ∃ x ∈ L , x rL y ⇔ [Def. ρ rL ( L ) ] ∀ y ∈ Y q , y ∈ ρ rL ( L ) ⇔ [ ρ rL ( L ) = L ] ∀ y ∈ Y q , y ∈ L . This latter condition coincides with the check per-formed by lines 2-5 of algorithm
FAIncWr and istherefore decidable.By Corollary B.5, algorithm
FAIncWr solves L ⊆ L . Appendix C.Deferred Proofs
Theorem 4.3. If ρ ∈ uco( ℘ (Σ ∗ )) is backward complete for λX. aX for all a ∈ Σ , then, for all FAs A = h Q, δ, I, F, Σ i , ρ is backward complete for Pre A and λ X . ǫ F ∪ Pre A ( X ) . roof: By definition we have that
Pre A ( h X q i q ∈ Q ) = h S a ∈ Σ ,q a → q ′ aX q ′ i q ∈ Q . Hence ρ ( S a ∈ Σ ,q a → q ′ aX q ′ ) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( S a ∈ Σ ,q a → q ′ ρ ( aX q ′ )) = [backward completeness of λX. aX ] ρ ( S a ∈ Σ ,q a → q ′ ρ ( aρ ( X q ′ ))) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( S a ∈ Σ ,q a → q ′ aρ ( X q ′ )) . Thus, by a straightforward componentwise application on vectors in ℘ (Σ ∗ ) | Q | , we obtain that ρ is backward complete for Pre A . Next, we turn to backward completeness of ρ for λ X . ǫ F ∪ Pre A ( X ) : ρ ( ǫ F ∪ Pre A ( ρ ( X ))) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( ρ ( ǫ F ) ∪ ρ (Pre A ( ρ ( X )))) = [backward completeness of Pre A ] ρ ( ρ ( ǫ F ) ∪ ρ (Pre A ( X ))) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( ǫ F ∪ Pre A ( X )) . Theorem 4.5.
Let A = h Q, δ, I, F, Σ i be a FA and let L be a language over Σ . Let h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i be a GCwhere h D, ⊑i is a poset. Assume that the following properties hold: ( i ) L ∈ γ ( D ) and for every a ∈ Σ , X ∈ ℘ (Σ ∗ ) we have α ( aX ) = α ( aγα ( X )) . ( ii ) ( D, ⊑ , ⊔ ) is an effective domain, meaning that: ( D, ⊑ ) is ACC, every element of D has a finite representation, ⊑ isdecidable and ⊔ is a computable binary lub. ( iii ) There is an algorithm, say
Pre ♯ ( X ) , which computes α (Pre A ( γ ( X ))) , for all X ∈ ℘ (Σ ∗ ) | Q | . ( iv ) There is an algorithm, say ǫ ♯ , computing α ( ǫ F ) . ( v ) There is an algorithm, say
Incl ♯ ( X ) , deciding the abstract inclusion X ⊑ α ( L I ) , for every vector X ∈ α ( ℘ (Σ ∗ ) | Q | ) .Then, the following algorithm decides whether L ( A ) ⊆ L : h Y q i q ∈ Q := Kleene ( λ X . ǫ ♯ ⊔ Pre ♯ ( X ) , ∅∅∅ ) ; return Incl ♯ ( h Y q i q ∈ Q ) ; Proof:
Let ρ = γ ◦ α ∈ uco( ℘ (Σ ∗ )) . Then, it follows from property (i) that L ∈ ρ and ρ ( aX ) = ρ ( aρ ( X )) .Therefore L ( A ) ⊆ L ⇔ [by (6)] lfp( λ X . ρ ( ǫ F ∪ Pre A ( X ))) ⊆ L I ⇔ [L. A.2] γ (lfp( λ X . α ( ǫ F ) ⊔ α (Pre A ( γ ( X ))))) ⊆ L I ⇔ [GC] lfp( λ X . α ( ǫ F ) ⊔ α (Pre A ( γ ( X )))) ⊑ α ( L I ) . Since ( D, ⊑ ) is ACC, Kleene is an algorithm computing the least fixpoint. Properties (ii), (iii) and (iv) ensure that the
Kleene iterates of λ X . α ( ǫ F ) ⊔ α (Pre A ( γ ( X ))) are computable and it is possible to check whether the iterates have reacha fixpoint. Property (v) ensures decidability of the required ⊑ -check since all Kleene iterates are in α ( ℘ (Σ ∗ )) | Q | . Lemma 5.2.
Let L be a language over Σ and L be a left (resp. right) L -consistent quasiorder on Σ ∗ . Then, ( a ) ρ L ( L ) = L . ( b ) ρ L is backward complete for λX. aX (resp. λX. Xa ) for all a ∈ Σ .Proof: We consider the left case, the right case is symmetric.( a ) The inclusion L ⊆ ρ L ( L ) holds because ρ L is an upper closure. Property (a) of Definition 5.1 entails ρ L ( L ) ⊆ L .( b ) We prove that ρ L ( aX ) = ρ L ( aρ L ( X )) for every a ∈ Σ . Monotonicity of concatenation together with monotonicityand extensivity of ρ L imply that ρ L ( aX ) ⊆ ρ L ( aρ L ( X )) holds. For the reverse inclusion ρ L ( aρ L ( X )) = [definition of ρ L ] ρ L ( { ay | ∃ x ∈ X, x L y } ) = [definition of ρ L ] { z | ∃ y, ay L z ∧ ∃ x ∈ X, x L y } ⊆ [left monotonicity] { z | ∃ y, ay L z ∧ ∃ x ∈ X, ax L ay } = [transitivity of L ] { z | ∃ x ∈ X, ax L z } = [definition of ρ L ] ρ L ( aX ) . heorem 5.3. Let h Σ ∗ , i be a qoset. (a) h ℘ (Σ ∗ ) , ⊆i −−−−→←−−−− α γ h AC h Σ ∗ , i , ⊑i is a QGC. (b) γ ◦ α = ρ .Proof: Since h ℘ (Σ ∗ ) , ⊆i is a poset and h AC h ℘ (Σ ∗ ) , i , ⊑i is a qoset, property (a) holds iff the relation α ( X ) ⊑ Y ⇔ X ⊆ γ ( Y ) holds. α ( X ) ⊑ Y ⇔ [definition of ⊑ ] ∀ z ∈ α ( X ) , ∃ y ∈ Y, y z ⇔ [definitions of α and ⌊·⌋ ] ∀ x ∈ X, ∃ y ∈ Y y x ⇔ [definition of γ ] ∀ x ∈ X, x ∈ γ ( Y ) ⇔ [definition of ⊆ ] X ⊆ γ ( Y ) . Property (b) trivially holds by definition of α and γ . Lemma 5.6.
Let A be an FA. Then ≤ l A and ≤ r A are, resp., decidable left and right L ( A ) -consistent wqos.Proof: Since, for every u ∈ Σ ∗ , pre A u ( F ) is a finite and computable set, it turns out that ≤ l A is a decidable well-quasiorder. Let us check that ≤ l A is left L ( A ) -consistent according to Definition 5.1 (a)-(b).(a) By picking x ∈ L ( A ) and y / ∈ L ( A ) we have that pre A x ( F ) contains some initial state while pre A y ( F ) does not,hence x (cid:2) l A y .(b) Let us check that ≤ l A is left monotonic. Observe that pre A x is a monotonic function and that pre A uv = pre A u ◦ pre A v . (16)Therefore: x ≤ l A x ⇒ [definition of ≤ l A ] pre A x ( F ) ⊆ pre A x ( F ) ⇒ [ pre A a is monotonic] pre A a (pre A x ( F )) ⊆ pre A a (pre A x ( F )) ⇔ [by (16)] pre A ax ( F ) ⊆ pre A ax ( F ) ⇔ [definition of ≤ l A ] ax ≤ l A ax . It can be similarly proved that ≤ r A is a decidable right L ( A ) -consistent quasiorder by relying on the fact that function post A x is monotonic and post A uv = post A v ◦ post A u . Lemma 5.7.
Given a simulation relation (cid:22) on A , the right simulation-based qo (cid:22) r A is a decidable right L ( A ) -consistentwqo. Recall the following definitions: q (cid:22) q ′ ⇔ (cid:16) ( q ∈ F ⇒ q ′ ∈ F ) ∧ (cid:16) q a → q ⇒ (cid:16) q ′ a → q ∧ q (cid:22) q (cid:17)(cid:17)(cid:17) X (cid:22) ∀∃ Y ⇔ ∀ x ∈ X, ∃ y ∈ Y : x (cid:22) y, u (cid:22) r A v ⇔ post u ( I ) (cid:22) ∀∃ post v ( I ) Proof:
Let u ∈ L ( A ) and v / ∈ L ( A ) . Then ( F ∩ post u ( I )) = ∅ while ( F ∩ post v ( I )) = ∅ hence there exists q ∈ (post u ( F ) ∩ F ) such that q (cid:22) r A q ′ for no q ′ ∈ post v ( F ) since, by definition of simulation it would imply q ′ ∈ (post v ( F ) ∩ F ) , whichcontradicts the fact that ( F ∩ post v ( I )) = ∅ . Therefore u (cid:14) r A v .Next we show that (cid:22) r A is right monotonic, i.e. u (cid:22) r A v ⇒ ua (cid:22) r A va . u (cid:22) r A v ⇔ [definition of (cid:22) r A ] post u ( I ) (cid:22) ∀∃ post v ( I ) ⇔ [definition of (cid:22) ∀∃ ] ∀ x ∈ post u ( I ) , ∃ y ∈ post v ( I ) , x (cid:22) y ⇒ [definition of (cid:22) ] ∀ x a → x ′ with x ∈ post u ( I ) , ∃ y a → y ′ with y ∈ post v ( u ) , x ′ (cid:22) y ′ ⇔ [ x a → x ′ ∧ x ∈ post u ( I ) ⇔ x ′ ∈ post ua ( I ) ] ∀ x ′ ∈ post ua ( I ) , ∃ y ′ ∈ post va ( I ) , x ′ (cid:22) y ′ ⇔ [definition of (cid:22) ∀∃ ] post ua ( I ) (cid:22) ∀∃ post va ( I ) ⇔ [definition of (cid:22) r A ] ua (cid:22) r A va . Therefore (cid:22) r A is a right L ( A ) -consistent quasiorder. 18inally, since ℘ ( Q ) is finite, it follows that (cid:22) r A is a well-quasiorder and, since post u ( I ) is finite and computable forevery u , it follows that (cid:22) r A is decidable. Lemma 5.8.
Given a OCN O together with a configuration qn , ≤ rqn is a right T ( qn ) -consistent decidable wqo.Proof: Well quasiordering follows from Dickson’s Lemma [27, Section II.7.1.2].Since the configuraton qn if fixed, in what follows we omit the superscript qn from sets Z qnu for clarity. We concludefrom the finiteness of Z u and Z v that M Z u and M Z v are computable, hence the ordering ≤ r O is decidable. Let u ∈ T ( qn ) and v / ∈ T ( qn ) then u ≤ r O v does not hold since M Z u ( q ) = ⊥ for some q ∈ Q but M Z v ( q ) = ⊥ for all q ∈ Q because Z v = ∅ . It remains to show that u ≤ r O v implies ua ≤ r O va for all a ∈ Σ . We proceed by contradiction. Assume u ≤ r O v and ∃ q ∈ Q, M Z ua ( q ) > M Z ua ( q ) . Then m , max { n | qn ∈ Z ua } > m , max { n | qn ∈ Z va } and,therefore, ∀ ( q ′ , a, d, q ) ∈ δ we have q ′ ( m − d ) ∈ Z u and q ′ ( m − d ) ∈ Z v . Since m − d > m − d we have that max { n | q ′ n ∈ Z u } > max { n | q ′ n ∈ Z v } , which contradicts u r O . Lemma 6.1. h AC h Σ ∗ , ≤ l A i , ⊑ ′ i −−−−→←−−−− α A γ A h AC h ℘ ( Q ) , ⊆i , ⊑i is a QGC.Proof: α A ( X ) ⊑ Y ⇔ [definition of ⊑ ] ∀ z ∈ α A ( X ) , ∃ y ∈ Y, y ⊆ z ⇔ [definition of α A ] ∀ v ∈ X, ∃ y ∈ Y, y ⊆ pre A v ( F ) ⇔ [definitions of γ A and ⌊·⌋ ] ∀ v ∈ X, ∃ u ∈ γ A ( Y ) , pre A u ( F ) ⊆ pre A v ( F ) ⇔ [definition of ≤ l A ] ∀ v ∈ X, ∃ u ∈ γ A ( Y ) , u ≤ l A v ⇔ [definition of ⊑ ′ ] X ⊑ ′ γ A ( Y ) . Lemma 6.2.
The following hold: (a) α = α A ◦ α ≤ l A (b) γ = γ ≤ l A ◦ γ A (c) h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h AC h ℘ ( Q ) , ⊆i , ⊑i is a GC. (d) γ ◦ α = ρ ≤ l A (e) Pre A A ( X ) = α A ◦ α ≤ l A ◦ Pre A ◦ γ ≤ l A ◦ γ A ( X ) for all X ∈ α ( ℘ (Σ ∗ ) | Q | ) Recall the following definitions α ≤ l A ( X ) , ⌊ X ⌋ γ ≤ l A ( Y ) , ρ ≤ l A ( Y ) α A ( X ) , { pre A u ( F ) | u ∈ X } γ A ( Y ) , ⌊{ u ∈ Σ ∗ | pre A u ( F ) ∈ Y }⌋ α ( X ) , ⌊{ pre A u ( F ) | u ∈ X }⌋ γ ( Y ) , { u ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ pre A u ( F ) } Proof: ( a ) α A ( α ≤ l A ( X )) = [definitions of α ≤ l A and α A ] { pre A u ( F ) | u ∈ ⌊ X ⌋} = [definition of ⌊·⌋ ] { pre A u ( F ) | u ∈ X ∧ ∀ x ∈ X, x (cid:2) l A u } = [definition of ≤ l A ] { pre A u ( F ) | u ∈ X ∧ ∀ x ∈ X, pre A x ( F ) * pre A u ( F ) } = [definition of ⌊·⌋ ] ⌊{ pre A u ( F ) | u ∈ X }⌋ = [definition of α ] α ( X ) . b ) γ ≤ l A ( γ A ( Y )) = [definition of γ A and γ ≤ l A ] ρ ≤ l A ( ⌊{ u ∈ Σ ∗ | pre A u ( F ) ∈ Y }⌋ ) = [definition of ρ ≤ l A ] { x ∈ Σ ∗ | ∃ y ∈ ⌊{ u ∈ Σ ∗ | pre A u ( F ) ∈ Y }⌋ , y ≤ l A x } = [definition of ⌊·⌋ ] { x ∈ Σ ∗ | ∃ y ∈ { u ∈ Σ ∗ | pre A u ( F ) ∈ Y } , y ≤ l A x } = [definition of ≤ l A ] { x ∈ Σ ∗ | ∃ y ∈ { u ∈ Σ ∗ | pre A u ( F ) ∈ Y } , pre A y ( F ) ⊆ pre A x ( F ) } = { x ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ pre A x ( F ) } = [definition of γ ] γ ( Y ) . ( c ) This follows by composition of QGCs and by the fact that concrete and abstract domains are posets.( d ) γ ( α ( X )) = [definition of γ ] { u ∈ Σ ∗ | ∃ y ∈ α ( X ) , y ⊆ pre A u ( F ) } = [definitions of α and ⌊·⌋ ] { u ∈ Σ ∗ | ∃ x ∈ X, pre A x ( F ) ⊆ pre A u ( F ) } = [definition of ≤ l A ] { u ∈ Σ ∗ | ∃ x ∈ X, x ≤ l A u } = [definition of ρ ≤ l A ] ρ ≤ l A ( X ) . ( e ) Due to properties (a) and (b) it suffices to show that α (Pre A ( γ ( X ))) = Pre A A ( X ) for all X in the image of α : α (Pre A ( γ ( X ))) = [definition of Pre A ] h α ( S a ∈ Σ ,q a → A q ′ aγ ( X q ′ )) i q ∈ Q = [definition of α ] h⌊{ pre A u ( F ) | u ∈ S a ∈ Σ ,q a → A q ′ aγ ( X q ′ ) ⌋i q ∈ Q = [ pre A av = pre A a ◦ pre A v ] h⌊{ pre A a ( { pre A u ( F ) | u ∈ S q a → A q ′ γ ( X q ′ ) } ) | a ∈ Σ ⌋i q ∈ Q = h⌊{ pre A a ( s ) | a ∈ Σ , q a → A q ′ , s ∈ { pre A u ( F ) | u ∈ γ ( X q ′ ) }}⌋i q ∈ Q = [ ⌊ pre A a ( X ) ⌋ = ⌊ pre A a ( ⌊ X ⌋ ) ⌋ ] h⌊{ pre A a ( s ) | a ∈ Σ , q a → A q ′ , s ∈ ⌊{ pre A u ( F ) | u ∈ γ ( X q ′ ) }⌋}⌋i q ∈ Q = [definition of α ] h⌊{ pre A a ( s ) | a ∈ Σ , q a → A q ′ , s ∈ α ( γ ( X q ′ )) ⌋i q ∈ Q = [since X ∈ α , α ( γ ( X q ′ )) = X q ′ ] h⌊{ pre A a ( s ) | s ∈ X q ′ , a ∈ Σ , q a → A q ′ }⌋i q ∈ Q =Pre A A ( X ) . Theorem 6.3.
Let A , A be two FAs. The algorithm FAIncS decides L ( A ) ⊆ L ( A ) . For clarity, we first recall some of the notation used in this paper: α ( X ) , ⌊{ pre A x ( F ) | x ∈ X }⌋ γ ( Y ) , { u ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ pre A u ( F ) } Pre A A ( h X q i q ∈ Q ) , h⌊ (cid:8) pre A a ( s ) | s ∈ X q ′ , ∃ a ∈ Σ , q a → A q ′ (cid:9) ⌋i q ∈ Q Proof:
We show that the all the premises of Theorem 4.5 are satisfied for h D, ⊑i = h AC h ℘ ( Q ) , ⊆i , ⊑i and the maps α and γ defined before.( i ) Since ρ ≤ l A ( X ) = γ ( α ( X )) , it follows from Lemmas 5.6 and 5.2 that γ ( α ( L )) = L . Furthermore, for all a ∈ Σ , X ∈ ℘ (Σ ∗ ) we next show that α ( aX = α ( aγα ( X )) α ( aX ) = [Galois Connection] α ( γ ( α ( aX ))) = [Lemma 6.2 (d)] α ( ρ ≤ l A ( aX )) = [Lemma 5.2 (b)] α ( aρ ≤ l A ( X )) = [Lemma 6.2 (d)] α ( aγα ( X )) . ( ii ) (AC h ℘ ( Q ) , ⊆i , ⊑ ) is effective. 20 iii ) α ( { ǫ } ) = { F } and α ( ∅ ) = ∅ , hence ⌊ α ( ǫ F ) ⌋ is trivial to compute.( iv ) By Lemma 6.2 (e) we have α (Pre A ( γ ( X ))) = Pre A A ( X ) for all X in the image of α .( v ) Since α ( L I ) = h α ( δ L Σ ∗ ( q ∈ I )) i q ∈ Q , the relation Y ⊑ α ( L I )) trivially holds for all components q / ∈ I . For theremaining components, it suffices to show that for all Y in the image of α we have Y ⊑ α ( L ) ⇔ ∀ y ∈ Y, I ∩ y = ∅ ,which coincides with the check performed by lines 2-5 of algorithm FAIncS . Y ⊑ α ( L ) ⇔ [ Y = α ( U ) for some U ∈ ℘ (Σ ∗ ) ] α ( U ) ⊑ α ( L ) ⇔ [Galois Connection] U ⊆ γ ( α ( L )) ⇔ [Lemmas 5.2, 5.6 and 6.2] U ⊆ L ⇔ [definition of pre A u ] ∀ u ∈ U, pre u ( F ) ∩ I = ∅ ⇔ [definition of α ] ∀ y ∈ Y, y ∩ I = ∅ . It follows from these properties and Theorem 4.5 that algorithm
FAIncS solves the inclusion problem L ( A ) ⊆ L ( A ) . Theorem 6.4 ( [13, Theorem 6] ) . Let
F P , b d (CPre A A ( S ) b ⊔ h δ { F c } ∅ ( q ∈ F ) i q ∈ Q ) where CPre A A : ℘ ( Q ) | Q | → ℘ ( Q ) | Q | is defined by: CPre A A ( h X q i q ∈ Q ) , h⌈{ Y | ∃ a ∈ Σ , q ′ ∈ Q , X ⊆ Q ,q a → A q ′ ∧ X ∈ X q ′ ∧ post A a ( Y ) ⊆ X }⌉i q ∈ Q Then, L ( A ) * L ( A ) iff ∃ q ∈ I , { I } b ⊑ F P q .Proof: Let us introduce some notation necessary to understand the antichain algorithm of Wulf et. al [13] for deciding L ( A ) ⊆ L ( A ) . Let (AC h ℘ ( Q × ℘ ( Q )) , ⊆ × i , b ⊑ × ) be the complete lattice of antichains over ℘ ( Q × ℘ ( Q )) with X b ⊔ × Y , ⌈{ ( q, z ) | ( q, z ) ∈ X ∪ Y }⌉ X b ⊓ × Y , ⌈{ ( q, x ∩ y ) | ( q, x ) ∈ X ∧ ( q, y ) ∈ Y }⌊ X ⌋ × , { ( q, x ) ∈ X | ∀ ( q ′ , x ′ ) ∈ X, q = q ′ ⇒ x ′ * x } ⌈ X ⌉ × , { ( q, x ) ∈ X | ∀ ( q ′ , x ′ ) ∈ X, q = q ′ ⇒ x * x ′ } X b ⊑ × Y ⇔ ∀ ( q, S ) ∈ X, ∃ ( q, S ′ ) ∈ Y, S ⊆ S ′ and let CPre q ( S ) , ⌈ (cid:8) ( q, X ) | ∃ a ∈ Σ , ∃ ( q ′ , X ′ ) ∈ S, q a → A q ′ ∧ post A a ( X ) ⊆ X ′ }⌉ .The result of Wulf et al. [13, Theorem 6] states that L ( A ) * L ( A ) iff there is q ∈ I such that { ( q, I ) } b ⊑ FP q where FP q = b d × { s | s ∈ CPre q ( s ) b ⊔ × ( F × { F c } ) } It is easy to observe that the notation ( q, X ) ∈ ( Q , ℘ ( Q )) used by Wulf to denote elements in AC h ℘ ( Q × ℘ ( Q )) , ⊆ × i simply associates states of A with sets of states of A . Therefore, we can modify the notation to work with vectors X = h{ X | ( q, X ) ∈ S }i q ∈ Q of | Q | components in (AC h ℘ ( Q ) , ⊆i , b ⊑ ) , where X b ⊑ Y ⇔ ∀ x ∈ X, ∃ y ∈ Y, x ⊆ y X b ⊓ Y , ⌈{ x ∩ y | x ∈ X, y ∈ Y }⌉ X b ⊔ Y , ⌈{ z | z ∈ X ∪ Y }⌉ Then, we can replace
CPre q ( S ) by its vector-equivalent CPre A A ( X ) : CPre A A ( X ) , h⌈{ Y | ∃ a ∈ Σ , X ∈ X ′ q , q a → A q ′ ∧ post A a ( Y ) ⊆ X }⌉i q ∈ Q . and replace the list of FP q by vector F P where
F P , b d (CPre A A ( S ) b ⊔ h δ { F c } ∅ ( q ∈ F ) i q ∈ Q ) Finally, the condition ∃ q ∈ I , { ( q, I ) } b ⊑ × FP q translates into ∃ q ∈ I , { I } b ⊑ F P q . Theorem 6.5.
At each step of the least fixpoint computations for
F P of Theorem 6.4 and Y of FAIncS , the followinginvariant holds: ∀ S ⊆ Q , q ∈ Q , { S } b ⊑ F P q ⇔ { S c } ⊑ Y q Pre A A ( h X q i q ∈ Q ) , h⌊ (cid:8) pre A a ( s ) | s ∈ X q , q a → A q ′ (cid:9) ⌋i q ∈ Q CPre A A ( h X q i q ∈ Q ) , h⌈{ Y | ∃ a ∈ Σ , X ∈ X q ′ , q a → A q ′ ∧ post A a ( Y ) ⊆ X }⌉i q ∈ Q post A u ( X ) , { q ∈ Q | u ∈ W A X,q } pre A u ( X ) , { q ∈ Q | u ∈ W A q,X } X ⊑ Y ⇔ ∀ x ∈ X, ∃ y ∈ Y, y ⊆ x X b ⊑ Y ⇔ ∀ x ∈ X, ∃ y ∈ Y, x ⊆ y Proof:
Define the complement of a set R ⊆ ℘ ( Q ) as ∁ ( R ) = { S c | S ∈ R } . As with other operators, we use thesame symbol to denote the componentwise extension of the complement to vectors. Next we prove that ∀ S ∈ ℘ ( Q ) , ∀ X ∈ ℘ ( Q ) | Q | , ∀ q ∈ Q , { S } b ⊑ CPre A A ( X ) q ⇔ { S c } ⊑ Pre A A ( ∁ ( X )) q We proceed by proving the two sides of the implication { S } b ⊑ CPre A A ( X ) q ⇔ [definition of b ⊑ ] ∃ Y ∈ CPre A A ( X ) q , S ⊆ Y ⇔ [definition of CPre A A ] ∃ Y ∈ ℘ ( Q ) , a ∈ Σ , X ∈ X q ′ , q a → q ′ , post A a ( Y ) ⊆ X ∧ S ⊆ Y ⇒ [ S ⊆ Y ⇒ post A a ( S ) ⊆ post A a ( Y ) ] ∃ a ∈ Σ , X ∈ X q ′ , q a → q ′ , post A a ( S ) ⊆ X ⇔ [P. Cousot [8]: post A a ( S ) ⊆ X ⇔ S ⊆ (pre A a ( X c )) c ] ∃ a ∈ Σ , X ∈ X q ′ , q a → q ′ , S ⊆ (pre A a ( X c )) c ⇔ [ A ⊆ B ⇔ B c ⊆ A c ] ∃ a ∈ Σ , X ∈ X q ′ , q a → q ′ , pre A a ( X c ) ⊆ S c ⇔ [definition of Pre A A ] ∃ Y ∈ Pre A A ( ∁ ( X )) q , Y ⊆ S c ⇔ [definition of ⊑ ] { S c } ⊑ Pre A A ( ∁ ( X )) q . (17)On the other hand { S c } ⊑ Pre A A ( ∁ ( X )) q ⇔ [definition of ⊑ ] ∃ Y ∈ Pre A A ( ∁ ( X )) q , Y ⊆ S c ⇔ [definition of Pre A A ] ∃ Y ∈ ℘ ( Q ) , a ∈ Σ , X ∈ ∁ ( X ) q ′ , q a → q ′ , pre A a ( X ) ⊆ Y ∧ Y ⊆ S c ⇒ [transitivity of ⊆ ] ∃ a ∈ Σ , X ∈ ∁ ( X ) q ′ , q a → q ′ , pre A a ( X ) ⊆ S c ⇔ [ A ⊆ B ⇔ B c ⊆ A c ] ∃ a ∈ Σ , X ∈ ∁ ( X ) q ′ , q a → q ′ , S ⊆ (pre A a ( X )) c ⇔ [P. Cousot [8]: post A a ( S ) ⊆ X ⇔ S ⊆ (pre A a ( X c )) c ] ∃ a ∈ Σ , X ∈ ∁ ( X ) q ′ , q a → q ′ , post A a ( S ) ⊆ X c ⇔ [definition of CPre A A ] ∃ Y ∈ CPre A A ( X ) , S ⊆ Y ⇔ [definition of b ⊑ ] { S } b ⊑ CPre A A ( X ) . (18)It follows from (17) and (18) that: { S } b ⊑ CPre A A ( X ) q ⇔ { S c } ⊑ Pre A A ( ∁ ( X )) q . (19)On the other hand, observe that ∁ ( ⌈ X ⌉ ) = { s c | s ∈ ⌈ X ⌉} = { s c | s ∈ ⌈ X ⌉ ∧ ∀ x ∈ ⌈ X ⌉ , s * x } = { s | s c ∈ ⌈ X ⌉ ∧ ∀ x ∈ ⌈ X ⌉ , s c * x } = { s | s ∈ ∁ ( ⌈ X ⌉ ) ∧ ∀ x ∈ ⌈ X ⌉ , x c * s } = { s | s ∈ ∁ ( ⌈ X ⌉ ) ∧ ∀ x ∈ ∁ ( ⌈ X ⌉ ) , x * s } = ⌊ ∁ ( ⌈ X ⌉ ) ⌋ . (20)Therefore ∀ q ∈ Q , ∀ S ∈ ℘ ( Q ) , ∀ X ∈ ℘ ( Q ) | Q | we have { S } b ⊑ CPre A A ( ⌈ X ⌉ ) q ⇔ [Equation 19] { S c } ⊑ Pre A A ( ∁ ( ⌈ X ⌉ )) q ⇔ [Equation 20] { S c } ⊑ Pre A A ( ⌊ ∁ ( ⌈ X ⌉ ) ⌋ ) q . (21)Now, we show by induction in the steps of the fixpoint computations that ∀ S ∈ ℘ ( Q ) , ∀ q ∈ Q , { S } b ⊑ F P q ⇔ { S c } ⊑ Y q . (22)where Y = Kleene ( λ X . ⌊ α ( ǫ F ) ⌋ ⊔ ⌊ Pre A A ( X ) ⌋ , ∅∅∅ ) . 22 Base case.
The vectors
F P and Y are initialized as: F P = h δ { F c } ∅ ( q ∈ F ) i q ∈ Q and Y = h δ { F } ∅ ( q ∈ F ) i q ∈ Q .Clearly, ∀ S ∈ ℘ ( Q ) , ∀ q ∈ Q the relation { S } b ⊑ F P q ⇔ { S c } ⊑ Y q holds since S ⊆ F c ⇔ F ⊆ S c . • Inductive step.
Assume that (22) holds up to the n -th step of the fixpoint computation, i.e. ∀ S ∈ ℘ ( Q ) , ∀ q ∈ Q wehave { S } b ⊑ F P nq ⇔ { S c } ⊑ Y nq (23)Then ∀ S ∈ ℘ ( Q ) , ∀ q ∈ Q we prove that { S } b ⊑ F P nq ⇔ { S c } ⊑ ∁ ( F P nq ) { S } b ⊑ F P nq ⇔ [definition of b ⊑ ] ∃ Y ∈ F P nq , S ⊆ Y ⇔ [ A ⊆ B ⇔ B c ⊆ A c ] ∃ Y ∈ F P nq , Y c ⊆ S c ⇔ [definition of ∁ ] ∃ Y ′ ∈ ∁ ( F P nq ) , Y ′ ⊆ S c ⇔ [definition of ⊑ ] { S c } ⊑ ∁ ( F P nq ) . (24)It follows from (23) and (24) that ∀ S ∈ ℘ ( Q ) , ∀ q ∈ Q , { S } ⊑ Y nq ⇔ { S } ⊑ ∁ ( F P nq ) hence (note quantifier ∀ S ) ⌊ Y nq ⌋ = ⌊ ∁ ( F P nq ) ⌋ . (25)On the other hand F P n +1 = h δ { F c } ∅ ( q ∈ F ) i q ∈ Q b ⊔ CPre A A ( F P n ) and Y n +1 = h δ { F } ∅ ( q ∈ F ) i q ∈ Q ⊔ Pre A A ( Y n ) . Therefore, ∀ S ∈ ℘ ( Q ) , q ∈ Q whenever S ⊆ F c , we know ( base case ) that (22) holds. When S * F c then { S } b ⊑ F P n +1 q ⇔ [definition of F P n +1 , S * F c ] { S } b ⊑ CPre A A ( F P n ) q ⇔ [Equation (21)] { S c } ⊑ Pre A A ( ⌊ ∁ ( F P n ) ⌋ ) q ⇔ [Equation (25)] { S c } ⊑ Pre A A ( ⌊ Y n ⌋ ) q ⇔ [definition of Y n +1 q , S * F c ] { S c } ⊑ Y n +1 q . which concludes the inductive step. Theorem 7.2.
Let G = ( V , Σ , P ) be a CFG in CNF. If ρ ∈ uco( ℘ (Σ ∗ )) is backward complete for both λX.Xa and λX.aX ,for all a ∈ Σ , then ρ is backward complete for Fn G and λ X . b ∪ Fn G ( X ) .Proof: First we show that backward completeness for left and right concatenation can be extended from letter towords. We give the proof for the concatenation to the left, the case of the concatenation to the right has a similar proof.The formal statement to prove is ρ ( wX ) = ρ ( wρ ( X )) for every w ∈ Σ ∗ . We proceed by induction on | w | . The base caseis trivial to prove using the fact that ρ is idempotent. For the inductive case ( | w | > ) let u ∈ Σ ∗ and a ∈ Σ be such that w = au . ρ ( auX ) = [backward completeness for λX. aX ] ρ ( aρ ( uX )) = [Induction hypothesis] ρ ( aρ ( uρ ( X ))) = [backward completeness for λX. aX ] ρ ( auρ ( X )) . ρ ( Y Z ) = ρ ( ρ ( Y ) ρ ( Z )) for all Y, Z ∈ ℘ (Σ ∗ ) ρ ( ρ ( Y ) ρ ( Z )) = [definition of concatenation] ρ ( S u ∈ ρ ( Y ) uρ ( Z )) = [ ρ ( ∪ Z ) = ρ ( ∪ ρ ( Z )) ] ρ ( S u ∈ ρ ( Y ) ρ ( uρ ( Z ))) = [backward completeness of λX. wX ] ρ ( S u ∈ ρ ( Y ) ρ ( uZ )) = [ ρ ( ∪ Z ) = ρ ( ∪ ρ ( Z )) ] ρ ( S u ∈ ρ ( Y ) uZ ) = [definition of concatenation] ρ ( ρ ( Y ) Z ) = [definition of concatenation] ρ ( S v ∈ Z ρ ( Y ) v ) = [ ρ ( ∪ Z ) = ρ ( ∪ ρ ( Z )) ] ρ ( S v ∈ Z ρ ( ρ ( Y ) v )) = [backward completeness of λX. Xw ] ρ ( S v ∈ Z ρ ( Y v )) = [ ρ ( ∪ Z ) = ρ ( ∪ ρ ( Z )) ] ρ ( S v ∈ Z Y v ) = [definition of concatenation] ρ ( Y Z ) . Finally, the proof follows the same lines of the proof of Theorem 4.3. Indeed, it follows from the definition of Fn G ( h X i i i ∈ [0 ,n ] ) ρ ( S k i j =1 β ( i ) j ) = [definition of β ( i ) j ] ρ ( S k i j =1 X ( i ) j Y ( i ) j ) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( S k i j =1 ρ ( X ( i ) j Y ( i ) j )) = [backward completeness of binary concatenation] ρ ( S k i j =1 ρ ( ρ ( X ( i ) j ) ρ ( Y ( i ) j ))) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( S k i j =1 ρ ( X ( i ) j ) ρ ( Y ( i ) j )) . Hence, by a straightforward componentwise application on vectors in ℘ (Σ ∗ ) |V| , we obtain that ρ is backward completefor Fn G . In turn, ρ is backward complete for λ X . ( b ∪ Fn G ( X )) , because: ρ ( b ∪ Fn G ( ρ ( X ))) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( ρ ( b ) ∪ ρ (Fn G ( ρ ( X )))) = [backward completeness of Fn G ] ρ ( ρ ( b ) ∪ ρ (Fn G ( X ))) = [ ρ ( ∪ Y ) = ρ ( ∪ ρ ( Y )) ] ρ ( b ∪ Fn G ( X )) . Theorem 7.3.
Let G = hV , Σ , P i be a CFG in CNF and let L be a language over Σ . Let h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h D, ⊑i be aGC where h D, ⊑i is a poset. Assume that the following properties hold: ( i ) L ∈ γ ( D ) and for every a ∈ Σ , X ∈ ℘ (Σ ∗ ) we have α ( aX ) = α ( aγα ( X )) and α ( Xa ) = α ( γα ( X ) a ) . ( ii ) ( D, ⊑ , ⊔ ) is an effective domain, meaning that: ( D, ⊑ ) is ACC, every element of D has a finite representation, ⊑ isdecidable and ⊔ is a computable binary lub. ( iii ) There is an algorithm, say Fn ♯ ( X ) , computing α (Fn G ( γ ( X ))) , for all X ∈ ℘ (Σ ∗ ) |V| . ( iv ) There is an algorithm, say b ♯ , computing α ( b ) . ( v ) There is an algorithm, say
Incl ♯ ( X ) , deciding the abstract inclusion X ⊑ α ( L X ) , for every vector X ∈ α ( ℘ (Σ ∗ ) |V| ) .Then, the following algorithm decides whether L ( G ) ⊆ L : h Y i i i ∈ [0 ,n ] := Kleene ( λ X . b ♯ ⊔ Fn ♯ ( X ) , ∅∅∅ ) ; return Incl ♯ ( h Y i i i ∈ [0 ,n ] ) ; Proof:
Let ρ = γ ◦ α ∈ uco( ℘ (Σ ∗ )) . Then, it follows from property (i) that L ∈ ρ , ρ ( aX ) = ρ ( aρ ( X )) and ρ ( Xa ) = ρ ( ρ ( X ) a ) . Therefore L ( A ) ⊆ L ⇔ [by (11)] lfp( λ X . ρ ( b ∪ Fn G ( X ))) ⊆ L X ⇔ [Lemma A.2] γ (lfp( λ X . α ( b ) ⊔ α (Fn G ( γ ( X ))))) ⊆ L X ⇔ [Galois Connection] lfp( λ X . α ( b ) ⊔ α (Fn G ( γ ( X )))) ⊑ α ( L X ) . ( D, ⊑ ) is ACC, Kleene is an algorithm computing the least fixpoint. Properties (ii), (iii) and (iv) ensure that the
Kleene iterates of lfp( λ X . α ( b ) ⊔ α (Fn G ( γ ( X )))) are computable. Property (v) ensures decidability of the required ⊑ -check since all Kleene iterates are in α ( ℘ (Σ ∗ )) |V| . Theorem 7.5.
Let G be a CFG and let L be a language such that there exists a decidable L -consistent wqo on Σ ∗ . Then, CFGIncW decides the inclusion L ( G ) ⊆ L . Before proving Theorem 7.5 we show a result equivalent to Lemma 5.2 for left and right monotonic L -quasiorders. Lemma C.1.
Let L be a language over Σ ∗ and let L be a L -consistent quasiorder Then,(a) ρ L ( L ) = L .(b) ρ is backward complete for λX. aX and for λX. Xa , with a ∈ Σ Proof:
We consider the left case, the right case is symmetric.( a ) The inclusion L ⊆ ρ L ( L ) holds because ρ L is an upper closure. Property (a) of Definition 5.1 entails ρ L ( L ) ⊆ L .( b ) We prove that ρ L ( aX ) = ρ L ( aρ L ( X )) for every a ∈ Σ . Monotonicity of concatenation together with monotonicityand extensivity of ρ L imply that ρ L ( aX ) ⊆ ρ L ( aρ L ( X )) holds. For the reverse inclusion ρ L ( aρ L ( X )) = [definition of ρ L ] ρ L ( { ay | ∃ x ∈ X, x L y } ) = [definition of ρ L ] { z | ∃ y, ay L z ∧ ∃ x ∈ X, x L y } ⊆ [left monotonicity of L ] { z | ∃ y, ay L z ∧ ∃ x ∈ X, ax L ay } = [transitivity of L ] { z | ∃ x ∈ X, ax L z } = [definition of ρ L ] ρ L ( aX ) . Backward completeness for right concatenation is proven similarly by relying on the right monotonicity of . Proof of Theorem 7.5:
Let L a decidable L -consistent wqo on Σ ∗ . Next we show that all the premises ofTheorem 7.3 are satisfied for h D, ⊑i = h AC h Σ ∗ , L i , ⊑i , α = ⌊·⌋ and γ = ρ . Indeed, we apply Corollary 7.4 because h AC h Σ ∗ , L i , ⊑i is a qoset so that we deal with a QGC rather than a GC.( i ) Since L = ρ L ( L ) = γ ( α ( L )) , it follows by byLemma C.1 (a) that L ∈ γ ( D ) . Moreover α ( aX ) = [Galois Connection] α ( γ ( α ( aX ))) = [L. C.1 with ρ L = γ ◦ α ] α ( γ ( α ( aγ ( α ( X ))))) = [Galois Connection] α ( aγα ( X )) . Similarly, α ( Xa ) = α ( γα ( X ) a ) .( ii ) It turns out that h AC h Σ ∗ , L i , ⊑i is ACC because L is a wqo. Moreover, the decidability of L entails that W ⊔ W , ⌊ W ∪ W ⌋ is a computable binary lub in h AC h Σ ∗ , L i , ⊑i , therefore h AC h Σ ∗ , L i , ⊑ , ⊔i is aneffective domain.( iii ) We have α (Fn G ( γ ( X ))) = ⌊ Fn G ( X ) ⌋ since α (Fn G ( γ ( X ))) = [Galois Connection] αγα (Fn G ( γ ( X ))) = [definition of α and γ ] ⌊ ρ L Fn G ( ρ L ( X ))) ⌋ = [Lemma C.1 (b)] ⌊ ρ L (Fn G ( X )) ⌋ = [Galois Connection] ⌊ Fn G ( X ) ⌋ . ( iv ) α ( b ) is computable since b i is finite and L isdecidable.( v ) Since α ( L X ) = α ( h δ L Σ ∗ ( i = 0) i i =[0 ,n ] , the relation Y ⊑ α ( L X ) trivially holds for all components i > .Therefore it suffices to check that Y ⊑ α ( L ) Y ⊑ α ( L ) ⇔ [defs. ⊑ , α ] ∀ y ∈ Y , ∃ x ∈ ⌊ L ⌋ , x L y ⇔ [ ⌊ X ⌋ ⊆ X ] ∀ y ∈ Y , ∃ x ∈ L , x L y ⇔ [def. ρ L ( L ) ] ∀ y ∈ Y , y ∈ ρ L ( L ) ⇔ [ ρ L ( L ) = L ] ∀ y ∈ Y , y ∈ L . This latter condition coincides with the check performed bylines 2-5 of algorithm
CFGIncW and is therefore decidable.
Lemma 7.6.
Let L ⊆ Σ ∗ be a language. ( a ) ≦ L is a (left and right) L -consistent quasiorder. Moreover, ≦ L is well-quasiorder iff L is regular. Also, if L is regularthen ≦ L is decidable. ( b ) Let ≤ be a quasiorder. If ≤ is (left and right) L -consistent then ρ ≦ L ⊆ ρ ≤ . roof: We first show that ≦ L is left and right monotonic, i.e. ∀ a, b ∈ (Σ ∪ { ǫ } ) , u ≦ L v ⇒ aub ≦ L avbu ≦ L v ⇔ [definition of ≦ L ] r L ( u ) ⊆ r L ( v ) ⇔ [definitions of r L , ⊆ ] ∀ xuy ∈ L, xvy ∈ L ⇒ [ x = x ′ b , y = ay ′ ] ∀ x ′ auby ′ ∈ L, x ′ avby ′ ∈ L ⇔ [definitions of r L , ⊆ ] r L ( aub ) ⊆ r L ( avb ) ⇔ [definition of ≦ L ] aub ≦ L avb . Let u ∈ L and v / ∈ L . By definition, ( ǫ, ǫ ) ∈ r L ( u ) but ( ǫ, ǫ ) / ∈ r L ( v ) , hence u (cid:20) L v . Therefore, ≦ L is a L -consistentquasiorder. It follows from De Luca and Varricchio [11, Theorem 2.1] that ≦ L is a wqo iff L is regular.It remains to show that ≦ L is decidable, which we do by using transducers. Define a sequential transducer as the 5-tuple T = ( S, Σ , ∆ , H, s ) where S is the finite set of states including the initial state s , Σ is the input alphabet, ∆ is the outputalphabet and H ⊆ S × Σ × ∆ × S is the finite set of transitions.For every u ∈ Σ ∗ , let T u = ( { q, q ′ } , Σ , Σ ∪ { ♯ } , H, q ) , with H = { q, u, ♯, q ′ } ∪ { ( q, a, a, q ) , ( q ′ , a, a, q ′ ) | a ∈ Σ } .Observe that T u ( L ) = { x♯y | ( x, y ) ∈ r L ( u ) } for every language L , hence r L ( u ) ⊆ r L ( v ) ⇔ T u ( L ) ⊆ T v ( L ) . When L isregular, we know T u ( L ) is regular. It is straightforward to see that T u ( L ) is also computable, hence ≦ L is decidable.Let us know show point (b). De Luca and Varricchio [11, Section 2, point 4] observe that ≦ L is maximum in the set ofall L -consistent quasiorders, i.e. every L -consistent quasiorder ≤ on Σ ∗ is such that x ≤ y ⇒ x ≦ L y . As a consequence, ρ ≤ ( U ) ⊆ ρ ≦ L ( U ) holds for all U ∈ ℘ (Σ ∗ ) : ρ ≤ ( U ) = [definition of ρ ≤ ] { x ∈ Σ ∗ | ∃ u ∈ U, u ≤ x } ⊆ [ x ≤ y ⇒ x ≦ L y ] { x ∈ Σ ∗ | ∃ u ∈ U, u ≦ L x } = [definition of ρ ≦ L ] ρ ≦ L ( U ) . In particular, ρ ≦ L ( ℘ (Σ ∗ )) ⊆ ρ ≤ ( ℘ (Σ ∗ )) holds. Lemma 7.7.
Let A be an FA. Then ≤ A is a decidable L ( A ) -consistent well-quasiorder.Proof: Let u ∈ L ( A ) and v / ∈ L ( A ) . Then the set ctx A ( u ) must contain a pair in I × F while ctx A ( v ) does not,hence u (cid:2) A v . Next we show ≤ A is left monotonic, i.e. ∀ a ∈ Σ , u ≤ A v ⇒ au ≤ A av . Right monotonicity is provensimilarly. Observe that for all a ∈ Σ : au ∈ W q ,q ⇔ ∃ q ′ ∈ Q, a ∈ W q ,q ′ ∧ u ∈ W q ′ ,q . (26)Therefore u ≤ A v ⇔ [definitions of ≤ A , ⊆ ] ∀ q , q , u ∈ W q ,q ⇒ v ∈ W q ,q ⇒ [by (26)] ∀ q ′ , q ′′ au ∈ W q ′ ,q ′′ ⇒ av ∈ W q ′ ,q ′′ ⇔ [definition of ≤ A , ⊆ ] au ≤ A av . Since ℘ ( Q × Q ) is finite, it follows that ≤ is a wqo. Finally, decidability follows from the fact that Q × Q is finite and thesets W q,q ′ are regular and computable. Lemma 7.8. h AC h Σ ∗ , ≤ A i , ⊑ ′ i −−−−→←−−−− α A γ A h AC h ℘ ( Q × Q ) , ⊆i , ⊑i is a QGC.Proof: α A ( X ) ⊑ Y ⇔ [definition of ⊑ ] ∀ z ∈ α A ( X ) , ∃ y ∈ Y, y ⊆ z ⇔ [definition of α A ] ∀ v ∈ X, ∃ y ∈ Y, y ⊆ ctx A ( v ) ⇔ [definition of γ A ] ∀ v ∈ X, ∃ u ∈ γ A ( Y ) , ctx A ( u ) ⊆ ctx A ( v ) ⇔ [definition of ≤ l A ] ∀ v ∈ X, ∃ u ∈ γ A ( Y ) , u ≤ A v ⇔ [definition of ⊑ ′ ] X ⊑ ′ γ A ( Y ) . emma 7.9. The following hold: (a) α = α A ◦ α ≤ A (b) γ = γ ≤ A ◦ γ A (c) h ℘ (Σ ∗ ) , ⊆i −−−→←−−− αγ h AC h ℘ ( Q × Q ) , ⊆i , ⊑i is a GC. (d) γ ◦ α = ρ ≤ A (e) Fn AA ( X ) = α A ◦ α ≤ A ◦ Fn A ◦ γ ≤ A ◦ γ A ( X ) for all X ∈ α ( ℘ (Σ ∗ ) |V| ) Recall the following definitions α ≤ A ( X ) , ⌊ X ⌋ γ ≤ A ( Y ) , ρ ≤ A ( Y ) α A ( X ) , { ctx A ( u ) | u ∈ X } γ A ( Y ) , ⌊{ u ∈ Σ ∗ | ctx A ( u ) ∈ Y }⌋ α ( X ) , ⌊{ ctx A ( u ) | u ∈ X }⌋ γ ( Y ) , { u ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ ctx A ( u ) } Proof: ( a ) α A ( α ≤ A ( X )) = [definitions of α ≤ A and α A ] { ctx A ( u ) | u ∈ ⌊ X ⌋} = [definition of ⌊·⌋ ] { ctx A ( u ) | u ∈ X ∧ ∀ x ∈ X, x (cid:2) A u } = [definition of ≤ A ] { ctx A ( u ) | u ∈ X ∧ ∀ x ∈ X, ctx A ( x ) * ctx A ( u ) } = [definition of ⌊·⌋ ] ⌊{ ctx A ( u ) | u ∈ X }⌋ = [definition of α ] α ( X ) . ( b ) γ ≤ A ( γ A ( Y )) = [definitions of γ A and γ ≤ A ] ρ ≤ A ( ⌊{ u ∈ Σ ∗ | ctx A ( u ) ∈ Y }⌋ ) = [definition of ρ ≤ A ] { x ∈ Σ ∗ | ∃ y ∈ ⌊{ u ∈ Σ ∗ | ctx A ( u ) ∈ Y }⌋ , y ≤ A x } = [definition of ⌊⌋ ] { x ∈ Σ ∗ | ∃ y ∈ { u ∈ Σ ∗ | ctx A ( u ) ∈ Y } , y ≤ A x } = [definition of ≤ A ] { x ∈ Σ ∗ | ∃ y ∈ { u ∈ Σ ∗ | ctx A ( u ) ∈ Y } , ctx A ( y ) ⊆ ctx A ( x ) } = { x ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ ctx A ( x ) } = [definition of γ ] γ ( Y ) . ( c ) This follows by composition of QGCs and by the fact that concrete and abstract domains are posets.( d ) γ ( α ( X )) = [definition of γ ] { u ∈ Σ ∗ | ∃ y ∈ α ( X ) , y ⊆ ctx A ( u ) } = [definition of α ] { u ∈ Σ ∗ | ∃ x ∈ X, ctx A ( x ) ⊆ ctx A ( u ) } = [definition of ρ ≤ A ] ρ ≤ A ( X ) . ( e ) Due to properties a and b, it suffices to show that α (Fn G ( γ ( X ))) = Fn AG ( X ) for all X in the image of α . First,observe that ctx A ( uv ) = [definitions of ctx A and W q,q ′ ] { ( q, q ′ ) ∈ Q | q uv q ′ } = [ q uv q ′ ⇔ ∃ q ′′ ∈ Q, q u q ′′ ∧ q ′′ v q ′ ] { ( q, q ′ ) ∈ Q | ∃ q ′′ ∈ Q, q u q ′′ ∧ q ′′ v q ′ } = [definition of ◦ for binary relations] { ( q, q ′′ ) ∈ Q | q u q ′′ } ◦ { ( q ′′ , q ′ ) ∈ Q | q ′′ v q ′ } = [definitions of W q,q ′ and ctx A ] ctx A ( u ) ◦ ctx A ( v ) . (27)27ext we show that for all X in the image of α we have α (Fn G ( γ ( X ))) = Fn AG ( X ) : α (Fn G ( γ ( X ))) = [definition of Fn G ] h α ( S X i → X j X k ∈ P γ ( X j ) γ ( X k )) i i ∈ [0 ,n ] = [definition of α ] h⌊{ ctx A ( w ) | w ∈ S X i → X j X k ∈ P γ ( X j ) γ ( X k ) }⌋i i ∈ [0 ,n ] = h⌊{ ctx A ( w ) | ∃ X i → X j X k ∈ P, w ∈ γ ( X j ) γ ( X k ) }⌋i i ∈ [0 ,n ] = [definition of concatenation] h⌊{ ctx A ( uv ) | ∃ X i → X j X k ∈ P, u ∈ γ ( X j ) ∧ v ∈ γ ( X k ) }⌋i i ∈ [0 ,n ] = [by 27] h⌊{ ctx A ( u ) ◦ ctx A ( v ) | ∃ X i → X j X k ∈ P, u ∈ γ ( X j ) ∧ v ∈ γ ( X k ) }⌋i i ∈ [0 ,n ] = [definition of X ◦ Y ] h⌊{ ctx A ( u ) | u ∈ γ ( X j ) , X i → X j X k } ◦ { ctx A ( v ) | v ∈ γ ( X k ) , X i → X j X k }⌋i i ∈ [0 ,n ] = [ ⌊ X ◦ Y ⌋ = ⌊⌊ X ⌋ ◦ ⌊ Y ⌋⌋ ] h⌊⌊{ ctx A ( u ) | u ∈ γ ( X j ) , X i → X j X k }⌋ ◦ ⌊{ ctx A ( v ) | v ∈ γ ( X k ) , X i → X j X k }⌋⌋i i ∈ [0 ,n ] = [ α ( γ ( X )) = ⌊ X ⌋ ] h⌊⌊{ X j | X i → X j X k }⌋ ◦ ⌊{ X k | X i → X j X k }⌋⌋i i ∈ [0 ,n ] = [ ⌊ X ◦ Y ⌋ = ⌊⌊ X ⌋ ◦ ⌊ Y ⌋⌋ ] h⌊{ X j | X i → X j X k } ◦ { X k | X i → X j X k }⌋i i ∈ [0 ,n ] = [definition of ◦ ] h⌊{ X j ◦ X k | X i → X j X k }⌋i i ∈ [0 ,n ] = [definition of Fn AG ] Fn AG ( X ) . Theorem 7.10.
Let G be a CFG and A be a FA. The algorithm CFGIncS decides L ( G ) ⊆ L ( A ) . For clarity, we first recall some of the notation used in this paper: ctx( u ) , { ( q, q ′ ) | u ∈ W q,q ′ } α ( X ) , ⌊{ ctx A ( x ) | x ∈ X }⌋ γ ( Y ) , { u ∈ Σ ∗ | ∃ y ∈ Y, y ⊆ ctx A ( u ) } Fn AG ( h X i i i ∈ [0 ,n ] ) , h⌊{ X j ◦ X k | X i → X j X k ⌋}i i ∈ [0 , |V| ] Proof:
We show that all the premises of Theorem 7.3 are satisfied for h D, ⊑i = h AC h ℘ ( Q × Q ) , ⊆i , ⊑i and the maps α and γ define before.( i ) Since ρ ≤ A ( X ) = γ ( α ( X )) , it follows from Lemmas 7.7 and C.1 that γ ( α ( L )) = L . Furthermore, for all a ∈ Σ , X ∈ ℘ (Σ ∗ ) we next show that α ( aX = α ( aγα ( X )) and α ( X = α ( γα ( X ) a ) . α ( aX ) = [Galois Connection] α ( γ ( α ( aX ))) = [Lemma 7.9] α ( ρ ≤ A ( aX )) = [Lemma C.1] α ( aρ ≤ A ( X )) = [Lemma 7.9] α ( aγα ( X )) α ( Xa ) = [Galois Connection] α ( γ ( α ( Xa ))) = [Lemma 7.9] α ( ρ ≤ A ( Xa )) = [Lemma C.1] α ( ρ ≤ A ( X ) a ) = [Lemma 7.9] α ( γα ( X ) a ) ( ii ) It turns out that h AC h ℘ ( Q × Q ) , ⊆i , ⊑i is ACC because A is a wqo. Moreover, the decidability of A entails that W ⊔ W , ⌊ W ∪ W ⌋ is a computable binary lub in h AC h ℘ ( Q × Q ) , ⊆i , ⊑i , therefore h AC h ℘ ( Q × Q ) , ⊆i , ⊑i is an effectivedomain.( iii ) α ( { b } ) = { ( q, q ′ ) | q b → q ′ } and α ( ∅ ) = ∅ , hence ⌊ α ( b ) ⌋ is trivial to compute.( iv ) It follows from Lemma 7.9 (e).( v ) Next, we prove that for all Y in the image of α we have Y ⊑ α ( L ) ⇔ ∀ y ∈ Y, ( I × F ) ∩ y = ∅ , which coincideswith the check performed by lines 2-4 of algorithm CFGIncS . Y ⊑ α ( L ) ⇔ [ Y = α ( U ) for some U ∈ ℘ (Σ ∗ ) ] α ( U ) ⊑ α ( L ) ⇔ [Galois Connection] U ⊆ γ ( α ( L )) ⇔ [Lemmas C.1, 7.7 and 7.9] U ⊆ L ⇔ [definition of ctx A ( u ) ] ∀ u ∈ U, ctx A ( u ) ∩ ( I × F ) = ∅ ⇔ [definition of α ] ∀ y ∈ Y, y ∩ ( I × F ) = ∅ It follows from these properties and Theorem 7.3 that algorithm
CFGIncS solves the inclusion problem L ⊆ L .28 emma 8.1. For all
X, Y, Z ⊆ Σ ∗ and w ∈ Σ ∗ : (a) X ⊆ ZY − ⇔ XY ⊆ Z ⇔ Y ⊆ X − Z . (b) wY ⊆ Z ⇔ Y ⊆ w − Z and Xw ⊆ Z ⇔ X ⊆ Zw − .Proof: (a) By definition, for any u ∈ Σ ∗ , u ∈ ZY − iff uY ⊆ Z . Hence, X ⊆ ZY − ⇔ ∀ u ∈ X, uY ⊆ Z ⇔ XY ⊆ Z .Symmetrically, XY ⊆ Z ⇔ Y ⊆ X − Z holds.(b) It is a particular case of (a). Lemma 8.2. If G is a linear CFG then for all X , Y ∈ ℘ (Σ ∗ ) |V| , Fn G ( X ) ⊆ Y ⇔ Y ⊆ f Fn G ( X ) .Proof: For clarity, we only consider rules in P of the form X i → aX j . It is routine to include the other case( X i → X j b ) in the proof using the equivalence X j b ⊆ X i iff X j ⊆ X i b − . Fn G ( h X i i i ∈ [0 ,n ] ) ⊆ h Y i i i ∈ [0 ,n ] ⇔∀ i ∈ [0 , n ] , S X i → aX j ∈ P aX j ⊆ Y i ⇔∀ i, j ∈ [0 , n ] , X i → aX j ∈ P ⇒ aX j ⊆ Y i ⇔ [Lemma 8.1] ∀ i, j ∈ [0 , n ] , X i → aX j ∈ P ⇒ X j ⊆ a − Y i ⇔∀ j ∈ [0 , n ] , X j ⊆ T X i → aX j ∈ P a − Y i ⇔h X i i i ∈ [0 ,n ] ⊆ f Fn G ( h Y i i i ∈ [0 ,n ] ) Theorem 8.4.
Let G = hV , Σ , P i be a linear CFG and let A be an FA with L = L ( A ) . If ρ ∈ uco( ℘ (Σ ∗ )) satisfies: (1) ρ ( L ) = L ; (2) ρ is backward complete for λX. aX and λX. Xa for all a ∈ Σ then L ( G ) ⊆ L iff b ⊆ gfp( λ X . ρ ( L X ∩ f Fn G ( X ))) . Moreover, the Kleene iterates coincide in lockstep with those of gfp( λ X . L X ∩ f Fn G ( X )) .Proof: Theorem 7.2 shows that if ρ is backward complete for λX. aX and λX. Xa for all a ∈ Σ then it isbackward complete for Fn G . Thus, by Lemma 8.3, ρ is forward complete for f Fn G . Hence ρ is forward complete for λ Y . L X ∩ f Fn G ( Y ) , because: ρ ( L X ∩ f Fn G ( ρ ( Y ))) = [by forward completeness, ρ ( L ) = L ] ρ ( ρ ( L X ) ∩ ρ ( f Fn G ( ρ ( Y )))) = [ ρ ( ∩ ρ ( Y )) = ∩ ρ ( Y ) ] ρ ( L X ) ∩ ρ ( f Fn G ( ρ ( Y ))) = [by forward completeness, ρ ( L ) = L ] L X ∩ f Fn G ( ρ ( Y )) Due to Equation (14), it follows that L ( G ) ⊆ L iff b ⊆ gfp( λ Y . L X ∩ f Fn G ( Y )) . Finally, observe that the Kleeneiterates computing gfp( λ Y . L X ∩ f Fn G ( Y )) and those computing gfp( λ Y . L X ∩ f Fn G ( ρ ( Y ))) coincide in lockstep since ρf ρ = f ρ and ρ ( L ) = L2