Abstract 1 Introduction 2 A proof by rewriting of regular expressions 3 Active learning of quasi-ordered automata 4 A proof by active learning of automata 5 The Valk-Jantzen lemma for quotients of WQOs 6 Conclusion and further work References

Active Learning of Upward-Closed Sets of Words

Quentin Aristote ORCID Université Paris Cité, CNRS, Inria, IRIF, F-75013, Paris, France
Abstract

We give a new proof of a result from well quasi-order theory on the computability of bases for upwards-closed sets of words. This new proof is based on Angluin’s L algorithm, that learns an automaton from a minimally adequate teacher. This relates in particular two results from the 1980s: Angluin’s L algorithm, and a result from Valk and Jantzen on the computability of bases for upwards-closed sets of tuples of integers.

Along the way, we describe an algorithm for learning quasi-ordered automata from a minimally adequate teacher, and extend a generalization of Valk and Jantzen’s result, encompassing both words and integers, to finitely generated monoids.

Keywords and phrases:
active learning, well quasi-orders, Valk-Jantzen lemma, piecewise-testable languages, monoids
Category:
(Co)algebraic pearl
Copyright and License:
[Uncaptioned image] © Quentin Aristote; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Formal languages and automata theory
Acknowledgements:
The author thanks Daniela Petrişan and anonymous reviewers for their precious comments.
Funding:
This work has received financial support from the European Research Council (ERC) under the European Union’s Horizon research and innovation program (grant agreement 101167526).
Editors:
Corina Cîrstea and Alexander Knapp

1 Introduction

Active learning of automata

In 1987, Angluin published a seminal work in computational learning theory [1]. She proved that the minimal complete deterministic finite-state automaton (DFA) recognizing a regular language LΣ can be learned with the help of a minimally adequate teacher (MAT), i.e. an oracle able to answer two kinds of queries:

  • membership queries – given a word wΣ, the oracle decides whether wL

  • and equivalence queries – given an automaton A which can be assumed to be minimal for the language it recognizes, the oracle decides whether this language is L, and, in the negative case, also outputs a counterexample word wΣ such that w is in L but is not recognized by A, or conversely.

Angluin’s algorithm, called L, computes the minimal DFA recognizing L. Its complexity is polynomial in the size of this minimal automaton and the maximum length of the counterexamples.

The L algorithm has proven very versatile over time: it has been extended to a number of other families of automata, see e.g. [18, §1.2] for a survey. The similarities between these extensions and the need to unify them has motivated several categorical approaches to MAT learning [6, 18, 15, 12, 3], some of which have in turn been used to develop new extensions of Angluin’s algorithm [2, 17]. In this work we will use yet another extension of the L algorithm, for automata with ordered sets of states, to recover a proof of decidability in well quasi-order theory.

The generalized Valk-Jantzen lemma

Two years before Angluin’s 1987 result, Valk and Jantzen proved a seemingly unrelated theorem. Order k component-wise, and, for z({})k (where denotes the set of positive integers), write Iz={(x1,,xn)ki,xi<zi}.

Theorem 1 (Valk-Jantzen lemma [16, Theorem 2.14]).

Fix an upwards-closed subset Uk. Then, given an oracle that decides for any subset Iz with z({})k whether U intersects Iz, there is an algorithm that computes a minimal basis B of U – a minimal Bk such that U={uk|bB,ub}.

This result is used, by Valk and Jantzen themselves but also later by other authors, to show the decidability of a number of problems regarding Petri nets and similar state machines: see [9] for a list of these. In ibid., Goubault-Larrecq extends Theorem 1 to a whole grammar of well quasi-orders: this last result is called the generalized Valk-Jantzen lemma.

Recall that a quasi-order (QO), also called a preorder, is a set equipped with a reflexive and transitive relation. Given a QO (X,), let A={xX|yA,xy} denote the downward-closure of AX, A={xX|yA,xy} its upward-closure, and for xX let x={x} and x={x}. An xX is minimal in (X,) when it is smaller than every other yx. A subset A of a QO (X,) is called downwards-closed when A=A, and upwards-closed when A=A.
A QO (X,) is well (WQO) when all its upwards-closed subsets U have a finite basis, i.e. can be written U=A for some finite AX. Such a basis is said to be minimal when it does not contain any strictly smaller basis of U. Finite QOs and well-founded linear orders such as are basic examples of WQOs; more involved examples include finite products of WQOs, equipped with the component-wise ordering [10, Lemma 4.7], or free monoids thereon [ibid., §4.4]: if (Σ,) is a WQO, then so is the set Σ of finite words on Σ equipped with the subword ordering, given inductively by εw for all wΣ, xy when xy in Σ and uvuv when uu and vv – informally, ww if w can be obtained from w by inserting new letters and upgrading existing ones. This last example of a WQO is the primary one this work is concerned with. When (Σ,=) is a finite alphabet the upwards-closed sets of (Σ,) are called piecewise-testable languages in formal language theory: they are the ones specified by unions of regular expressions of the shape Σσ1ΣΣσnΣ with σiΣ. It is easy to see that if Σ is still finite but now equipped with a non-trivial QO structure, the upwards-closed sets of (Σ,) are still regular languages.

The last missing ingredient to understand Goubault-Larrecq’s generalization of Valk and Jantzen’s result is the notion of ideal: an ideal I is a non-empty, downwards-closed and directed subset, the latter meaning that for every x,yI, there is a z greater than both x and y in I. Denote by Idl(X,) the set of ideals of (X,) ordered by inclusion. Notice that for every xD, x is an ideal, called a principal one.

Theorem 2 (generalized Valk-Jantzen lemma, [9, Theorem 1]).

Let (X,) be a WQO, and U an upwards-closed subset thereof. Given an oracle that decides for any IIdl(X,) whether U intersects I, a minimal finite basis of U is computable111Of course this theorem also assumes that (X,) and Idl(X,) are effective, in a way we do not describe here as all the instances we consider will indeed be so. The precise requirements are given in [9, Definitions 3 and 5]..

For D=k, Theorem 2 is Valk and Jantzen’s original result: the ideals of k are exactly the Iz’s for z ranging in ({})k [10, §3.1.2 and 4.3]. Consider now the case (Σ,) where (Σ,) is a finite quasi-ordered alphabet. Then the ideals of (Σ,) are the regular languages specified by the following class of regular expressions, called -products [10, Theorem 4.11]. A -product is any finite concatenation P𝔄1𝔄n of atomic expressions, where an atomic expression 𝔄σ?(Σ) is either some σ?={ε}{σΣ|σσ} for σΣ, or some (Σ)={σ1σn|nandi,σiΣ} for ΣΣ non-empty and downwards-closed. By abuse of language, we will often speak of a -product to mean the ideal it specifies. The instance of Theorem 2 for subword orderings now reads:

Corollary 3 ([9, Theorem 2]).

Fix a finite quasi-ordered alphabet (Σ,) and an upwards-closed subset U of (Σ,). Given an oracle that decides for any -product P whether U intersects P, a minimal finite basis of U is computable.

This instance of Theorem 2 is especially interesting in that subword orderings are one of the simplest example of WQOs for which computing intersections of ideals is not polynomial-time [10, §6.3].

Structure and contributions

In this work we describe a new algorithm that proves Corollary 3, using active learning of automata. We then show that the 1985 result of Valk and Jantzen reduces to this Corollary 3, and thus to the 1987 result of Angluin.

In Section 2, we recall and discuss Goubault-Larrecq’s original proof of Corollary 3. On the way to a new proof, we describe in Section 3, as our first contribution, a new L-like algorithm (Theorem 9) for learning quasi-ordered automata, a family of automata corresponding to regular languages that are upwards-closed. In Section 4, we show as a second contribution how this algorithm for actively learning quasi-ordered automata can be used to prove Corollary 3 (Theorem 10). The automata-based approach and the active learning procedure help alleviate the technical details of Goubault-Larrecq’s original proof. In Section 5, we finally show how Valk-Jantzen-style learnability of a WQO is stable under quotients: in particular, because Corollary 3 holds for finitely generated free monoids, it also holds for finitely generated monoids. As a third contribution, we thus extend the class of WQOs for which Goubault-Larrecq’s general Theorem 2 holds, and we retrieve in particular Valk and Jantzen’s original result as k is the free commutative monoid on k letters (Example 13).

2 A proof by rewriting of regular expressions

In this section we first recall and discuss the proof of the generalized Valk-Jantzen lemma in the case we focus on in this paper, subword orderings. This proof is obtained by instantiating [9, Theorem 1]’s generic proof in this case.

Corollary 3 ([9, Theorem 2]). [Restated, see original statement.]

Fix a finite quasi-ordered alphabet (Σ,) and an upwards-closed subset U of (Σ,). Given an oracle that decides for any -product P whether U intersects P, a minimal finite basis of U is computable.

Proof.

A minimal finite basis of U can always be derived from a non-minimal one by removing redundant elements: if U=B and b1,b2B with b1b2, then still U=(B{b2}). Hence, without loss of generality, we now describe a procedure that computes a non-necessarily minimal basis.

Start with B=. Enumerate all the words in Σ. For each such w=σ1σn, check if wU: because U is upwards-closed, wU if and only if U intersects the -product w=σ1?σn?, and this can be checked by querying the oracle. If wU, add w to B, and just move on to the next word otherwise.

By construction, it is always true that BU. Because U is upwards-closed, it is hence also always true that BU=U. On the other hand, every time a word is added to B and B changes, it is possible to check with the help of the oracle whether, conversely, UB. To check this, notice that it holds if and only if U(B)c=. But (B)c is downwards-closed, and it is a general fact of WQOs that any downwards-closed set is a finite union of ideals [10, Lemma 2.6 and Proposition 2.10], so that (B)c=P1Pn for some n and some -products (Pi)1in. Hence if such Pi’s are computable from B, one can check whether UB by asking the oracle whether U intersects any of the Pi’s.

Let us now see how to compute these Pi’s. Note that the fact that this can be done means that (Σ,) has the effective complement property [9, Definition 5], which is one of the effectivity conditions we omitted in the generic Theorem 2. We do not give the full construction here as it is a bit technical, and only recall the two main steps instead.

  • For every bB, (b)c can be written as a union of -products, each informally obtained by disallowing one letter from b to appear, see also [10, Lemma 4.14] for more details.

  • Then (B)c=bB(b)c can be rewritten as the union of all intersections of any two -products appearing in the decompositions of two different b,bB. The intersection of two -products can always be rewritten as a union of -products [10, Lemma 4.16], and hence (B)c can be rewritten into a union of -products.

All in all, we always have that BU, and every time B changes we can check whether UB and thus whether U=B. This must be the case after having considered a finite number of words: U has a finite basis B as (Σ,) is a WQO, and it must be that BB once all of B’s words have been considered.

The main appeal of the above proof is its genericity and modularity: it works in fact for any WQO that can be shown to be sufficiently effective, in particular having the aforementionned effective complement property – an effective way to transform the complement of an upwards-closed set into a union of ideals.

What hinders the algorithm from being polynomial-time is the rewriting of regular expressions into unions of -products (which we did not describe in detail), and the brute-force enumeration of words. While we do not claim to give another algorithm with better asymptotic complexity, this brute-force enumeration seems particularly inefficient and it is natural to try to improve it, with heuristics for instance.

Another concern that could be raised is the use of bases to represent languages. These are usually represented by automata instead, and this can be exponentially more compact: consider for instance U to be the set of all words of length at least n, whose minimal basis contains |Σ|n words but for which an (n+1)-state automaton is given in Figure 1(a). Note that this is not always the case: the upwards-closed language {σ1,σ22,,σnn} has a much more compact representation in its minimal basis than in its minimal automaton. For instance in the case n=3, the minimal automaton for that language is depicted in Figure 1(b). In general, converting between bases and automata may thus be costly, and it is all the more interesting to also have an algorithm for Corollary 3 that works with automata instead of bases.

In the rest of this work we address these two concerns by shedding the light of active learning of automata on the above proof of Corollary 3. It is quite reasonable to believe that MAT-based learning should be related to this result. Indeed, looking closely at the proof, we see that the oracle is really used in two distinct ways: for checking whether a word belongs to U – which is reminescent of the membership queries to an MAT – and for checking whether a set B is a basis of U – which is reminescent of the equivalence queries to an MAT. While Angluin’s L algorithm is only concerned with DFAs and does not involve any QOs, the recent advances providing categorical frameworks for active learning of automata are a strong hint that this kind of learning is versatile enough to also be done in a quasi-ordered setting.

(a) An automaton recognizing the language (Σn).
(b) An automaton recognizing the language {a,bb,ccc}.
Figure 1: Examples of quasi-ordered automata (Definition 4). All the automata we consider are assumed to be complete: if a transition q𝜎 is not depicted, then it is assumed to be looping, i.e. δσ(q)=q. Initial states are depicted with an incoming arrow, accepting states with a double circle. The quasi-order on states is not explicitly depicted, but it always goes from left to right.

3 Active learning of quasi-ordered automata

We now describe how active learning of automata can indeed be done in a quasi-ordered setting. Because we are only trying to learn those languages that are upwards-closed, DFAs are too general for our purpose. We will focus on a more restricted family of automata:

Definition 4 (quasi-ordered automaton).

Let (Σ,) be a finite quasi-ordered alphabet. A quasi-ordered automaton on (Σ,) is a tuple ((Q,),q0,δ,F) where:

  • (Q,) is a finite QO of states;

  • q0Q is the initial state;

  • δ:(Σ,)×(Q,)(Q,) is a monotone transition function such that qδ(σ,q) for every (σ,q)Σ×Q;

  • FQ is an upwards-closed subset of accepting states.

The language recognized by a quasi-ordered automaton ((Q,),q0,δ,F) is the language recognized by its underlying DFA (Q,q0,δ,F).

Note that the quasi-order on (Σ,)×(Q,) is given by (σ,q)(σ,q) if and only if σσ and qq, so that δ being monotone means: if σσ and qq, then δ(σ,q)δ(σ,q). δ extends to a monotone function δ:(Σ,)×(Q,)(Q,), and we also write δw:(Q,)(Q,) for the monotone function qδ(w,q).

 Remark 5.

The category-enclined reader may notice that quasi-ordered automata are equivalently certain 𝐐𝐎-enriched functors, where 𝐐𝐎 is the the category of quasi-orders and monotone functions between them. Let indeed 𝐈(Σ,) be the 𝐐𝐎-enriched category freely generated by the 𝐐𝐎-enriched quiver below (the QO of edges 𝚜𝚝𝚜𝚝 is (Σ,)), with the additional requirement that ε:𝚜𝚝𝚜𝚝 be smaller than every w:𝚜𝚝𝚜𝚝

Then quasi-ordered automata are exactly enriched functors 𝐈(Σ,)𝐐𝐎 that send 𝚒𝚗 on the singleton QO and 𝚘𝚞𝚝 on 2={<}. The active learning algorithm of Theorem 9 below could thus be obtained by extending the functorial framework of [5, 6] to enriched functors, but for the sake of conciseness we do not delve in this as we would only end up using the 𝐐𝐎-enriched case here.

It seems the full expressiveness of enriched functors is needed to model quasi-ordered automata. Classical functors 𝐈(Σ,)𝐐𝐎 indeed only encompass that each δσ:(Q,)(Q,) be monotone, but not that δ:(Σ,)×(Q,)(Q,) be monotone. The latter condition can be encompassed by considering instead pointed 𝐐𝐎-coalgebras for the functor 2×𝐐𝐎((Σ,),), but these in turn need not satisfy that qδ(σ,q) for every (σ,q)Σ×Q, which is crucial in proving that δ:(Σ,)×(Q,)(Q,) is monotone, itself key in proving that quasi-ordered automata recognize upwards-closed languages (Lemma 6 below).

Quasi-ordered automata are indeed a sensible family of automata to consider when working with upwards-closed languages:

Lemma 6.

The language recognized by a quasi-ordered automaton on (Σ,) is upwards-closed in (Σ,).

Proof.

Let L be a language recognized by a quasi-ordered automaton ((Q,),q0,δ,F) on (Σ,), and consider some wwΣ. Because δ:(Σ,)×(Q,)(Q,) is monotone, δ(w,q0)δ(w,q0). In particular if δ(w,q0)F and wL, then because F is upwards-closed δ(w,q0)F and wL as well: L is upwards-closed.

Proposition 7.

Let (Σ,) be a finite quasi-ordered alphabet. Given a reachable DFA A on Σ, it can be decided whether A recognizes a language that is upwards-closed in (Σ,). If this is the case, A is in fact a quasi-ordered automaton and the corresponding QO is computable; otherwise two words ww in (Σ,) such that A accepts w but not w are computable. All of this can moreover be done in polynomial time in the size of A.

Proof.

Let A=(Q,q0,δ,F). Define an order on Q as follows:

qqwΣ,δw(q)Fδw(q)F

Deciding whether qq amounts to checking whether the language Lq recognized when making q initial is included in the language Lq recognized when making q initial. It is standard that this can be done in polynomial time, see e.g. [14, Theorem 2.4]: compute an automaton recognizing LqLqc, and decide whether it recognizes an empty language. If this is not the case, an additional wLqLqc, i.e. such that δw(q)F but δw(q)F, is computable in polynomial time.

If this order makes A into a quasi-ordered automaton, then by Lemma 6 A recognizes an upwards-closed language. Otherwise, we show next that the language recognized by A cannot be upwards-closed, and construct two words ww such that A accepts w but not w.

Here we use that A is reachable so that for every qQ, there is a uΣ such that q=δu(q0). If fails to make into A into a quasi-ordered automaton, then either

  • F is not upwards-closed: this is in fact not possible, as qF means δε(q)F and thus, if qq, q=δε(q)F as well;

  • there are some qqQ, σΣ such that δ(σ,q)δ(σ,q): this is not possible neither, since qq implies that for every vΣ, δv(δσ(q))Fδv(δσ(q))F, and thus that δσ(q)δσ(q);

  • there are some qQ, σσΣ such that δ(σ,q)δ(σ,q): taking u,vΣ respectively such that δu(q0)=q and δv(δσ(q))F but δv(δσ(q))F, then A accepts uσv but not uσv, yet uσvuσv;

  • there are some qQ, σΣ such that qδσ(q): taking u,vΣ respectively such that δu(q0)=q and δv(q)F but δv(δσ(q))F, then A accepts uv but not uσv, yet uvuσv.

Given an upwards-closed language U, we call minimal quasi-ordered automaton the minimal DFA recognizing U, equipped with the quasi-order described in the proof of Proposition 7. The minimal quasi-ordered automaton is state-minimal among all quasi-ordered automata recognizing U, and it has a very specific structure, simple examples of which are given by the automata in Figure 1:

Lemma 8 (structure of the minimal quasi-ordered automata).

Let A=((Q,),q0,δ,F) be the minimal quasi-ordered automaton for an upwards-closed language U. Then

  1. 1.

    (Q,) is not just a quasi-order, but an order, so that, except for transitions q𝜎q that loop on a state, the underlying graph of the automaton is acyclic;

  2. 2.

    the initial state is the minimum of (Q,);

  3. 3.

    unless U is empty, an accepting state is reachable from any state;

  4. 4.

    there is at most one accepting state, and it is the maximum of (Q,).

Proof.

We implicitly use the Myhill-Nerode theorem, and the quasi-order constructed in the proof of Proposition 7.

  1. 1.

    If two states q and q are such that qq and qq, then for every wΣ, δw(q)Fδw(q)F. In a minimal DFA, this can never be true of two distinct states (otherwise the two states could be merged).

  2. 2.

    For every q=δu(q0)Q and vΣ such that δv(q0)F, vU. U is upwards-closed, hence uvv is in U as well and δv(q)=δuv(q0)F: q0q.

  3. 3.

    Pick some qQ and vU. The argument for item 2 above applies.

  4. 4.

    Because the language recognized by the automaton is upwards-closed, any accepting state q is such that δw(q)F for every wΣ. Hence the uniqueness of such an accepting state, and its maximality.

We now consider the problem of learning such a minimal quasi-ordered automaton from an MAT. For a fixed upwards-closed subset U of (Σ,), suppose given an oracle able to answer two kinds of queries:

  • membership queries – given a word wΣ, the oracle decides whether wU

  • and equivalence queries – given a quasi-ordered automaton A that is minimal for the upwards-closed language it recognizes, the oracle decides whether this language is U, and, in the negative case, also outputs a counterexample word wΣ such that w is in U but is not recognized by A, or conversely.

Can U be learned by querying this oracle a finite number of times? We answer this in the positive:

Theorem 9 (active learning of quasi-ordered automata).

Suppose given an MAT as above. There is an algorithm that computes the minimal quasi-ordered automaton recognizing U, and its complexity is polynomial in the size of this minimal automaton and the maximum length of a counterexample outputted by the oracle.

Proof.

We prove this by giving a polynomial-time reduction to the active learning problem for DFAs, where U is only seen as a regular language, the complexity result being that of the classical active learning algorithm of Angluin [1]. We therefore explain how to implement an oracle in the classical setting, call it OracleU, from the oracle in the quasi-ordered setting, call it Oracle(U,): one can then learn the minimal DFA recognizing the regular language U in polynomial-time using the classical active learning algorithm, and then equip this minimal DFA with a quasi-order in polynomial-time as explained in Proposition 7.

First, any membership query to OracleU can simply be forwarded to Oracle(U,): when it comes to membership queries, the two oracles have the same computing power. Consider now a DFA A minimal for the language it recognizes, given to OracleU for an equivalence query. By Proposition 7, one can then check in polynomial-time whether A is in fact a quasi-ordered automaton:

  • if it is the case we also get the QO structure on A, and can then forward A to Oracle(U,) for an equivalence query;

  • otherwise, we get some ww such that A recognizes w but not w, and one of these two words must then be a counterexample to A recognizing U.

4 A proof by active learning of automata

We now give a new proof of Corollary 3, by reducing it to the problem of actively learning quasi-ordered automata.

Theorem 10.

Fix a finite quasi-ordered alphabet (Σ,) and an upwards-closed subset U of (Σ,). Given an oracle that decides for any -product P whether U intersects P, a minimal quasi-ordered automaton recognizing U is computable.

Proof.

We reduce this problem to that of actively learning quasi-ordered automata, for which we gave a polynomial time algorithm in Theorem 9. In other words, we describe how to implement an MAT in the quasi-ordered setting by checking whether U intersects some well-chosen -products.

Answering a membership query for a w=σ1σnΣ can be done by checking whether U intersects σ1?σn?: because U is upwards-closed, this is the case if and only if wU. Consider now some minimal quasi-ordered automaton A=((Q,),q0,δ,F) submitted to the MAT for an equivalence query. We decide whether A recognizes U in two steps, implicitly using the properties of A described in Lemma 8 and assuming A does not recognize the empty language.

  • First, we check whether U contains the language recognized by A. For this, enumerate all the paths q0σ1σnqn in A that go from the initial state q0 to the accepting state qnF, that are strictly increasingq0q1qn1qn – and that are minimal – for every qiσiqi+1, σi is minimal among the letters σ such that δσ(qi)=qi+1 (see Figure 2(a) for an example within the automaton of Figure 1(b)). Check whether σ1σnU with a membership query. If this is not the case, σ1σn is a counterexample. Otherwise, if no path yields such a counterexample, then all the words accepted by A are in U as well: if A accepts w, then, for one of the paths q0σ1σnqn enumerated above, wσ1σn and wU as U is upwards-closed.

  • Second, we check whether U is contained in the language recognized by A, i.e. whether every word not accepted by A is not in U neither. For this, enumerate all the strictly increasing paths q0σ1σnqn in A that go from the initial state q0 to a non-accepting state qnF one transition away from the accepting state (see Figure 2(b) for an example within the automaton of Figure 1(b)). Let ΣiΣ be the subset of these letters σ for which δσ(qi)=qi. Then any word w that is not accepted by A must be in one of the -products Σ0σ1?Σ1Σn1σn?Σn corresponding to one of these paths: the run for w in A must stop in a non-accepting state, and, since ww is accepted by A for any w accepted by A, the run for w can be completed into a run that ends in the accepting state. It is thus enough to check whether U intersects any of these -products. If this is the case for one of these -products P, then enumerating the words in P will end up producing a counterexample wΣ such that wU but w is not accepted by A.

(a) Two strictly increasing paths to the accepting state. They are minimal as soon as abba in (Σ,).
(b) Two strictly increasing paths to non-accepting states one transition away from the accepting state.
Figure 2: Strictly increasing paths in the automaton of Figure 1(b).

Note that a finite basis of U can then be obtained from its minimal quasi-ordered automaton by enumerating words labelling minimal strictly increasing paths.

This new proof partially addresses the two concerns highlighted in Section 2: upwards-closed languages are now represented using automata, and not finite bases, and the MAT learning procedure (that we leave as a black box) takes care of efficiently enumerating words and constructing guesses to submit for an equivalence query. The reduction we provide is where the non-polynomial-time part happens: what now makes the algorithm exponential-time is the enumeration of paths to the accepting state in a minimal quasi-ordered automaton, and the brute-force enumeration of words in a -product to produce a counterexample.

5 The Valk-Jantzen lemma for quotients of WQOs

We now move on from quasi-orders on the finitely generated free monoid Σ of words, to quasi-orders on finitely generated monoids. We thus consider a monoid M equipped with a quasi-order M, and generated by a finite quasi-ordered alphabet (Σ,): we assume there is a surjective homomorphism of monoids eM:ΣM that is also a monotone function (Σ,)(M,M). The surjectivity and monotonicity of eM automatically makes (M,M) into a WQO, and eM can be used to describe the ideals of (M,M):

Lemma 11 (ideals of a quasi-ordered monoid).

The ideals of a quasi-ordered monoid (M,M) generated by (Σ,) are exactly the downward-closures of images of languages specified by -products:

Idl(M,M)={eM[I]|IIdl(Σ,)}

Proof.

This result is an instance of [10, Proposition 5.1], but the phrasing differs slightly so we repeat the proof here for completeness.

On the one hand, if I is an ideal of (Σ,) (a language described by a -product) then eM[I] is an ideal of (M,M). Indeed, eM[I] is non-empty and directed because I is: for every x,yeM[I], write x=eM(x) and y=eM(y) with x,yI; then there is a zI such that zx and zy, so that eM(z)eM[I], eM(z)MeM(x) and eM(z)MeM(y). eM[I] is thus also non-empty and directed, and it is of course downwards-closed: it is an ideal.

On the other hand, we show that every ideal of (M,M) is of the shape eM[I] for some IIdl(Σ,). To see this, we use the following characterization of ideals in a WQO: a downwards-closed subset D can always be written as a finite union D=i=1nIi of ideals [10, Lemma 2.6(2)], and D is an ideal if and only if it is join-irreducible, i.e. for every finite family of downwards-closed subsets D1,,Dn, if D=i=1nDi then D=Di for some 1in [10, Lemma 2.5]. Consider thus a downwards-closed subset D of (M,M). Then eM1[D] is downwards-closed in (Σ,), hence eM1[D]=i=1nIi for some I1,,InIdl(Σ,). But then

D=eM[eM1[D]]=eM[i=1nIi]=i=1neM[Ii]=i=1neM[Ii]

hence when D is an ideal it must be equal to eM[Ii] for some 1in.

If P is a -product that specifies an ideal I of (Σ,), write by abuse of notation eM[P] for the downard-closed set eM[I] of (M,M). Finitely generated quasi-ordered monoids also enjoy a Valk-Jantzen-like result:

Theorem 12.

Fix a finite quasi-ordered alphabet (Σ,) and an upwards-closed subset U of a quasi-ordered monoid (M,M) generated by (Σ,). Given an oracle that decides for any -product P whether U intersects eM[P], a finite basis of U is computable as soon as eM is.

Proof.

We reduce this problem to that of computing a finite basis of the upwards-closed subset eM1[U] of (Σ,). For this it is enough, by Corollary 3, to decide, given a -product P, whether eM1[U] intersects P. But eM1[U] intersects P if and only if U intersects eM[P]: if xeM1[U]P, then eM(x)UeM[P]; conversely, if xUeM[P], then there is a yP such that xeM(y), and of course eM(y)UeM[P] as U is upwards-closed, so that yeM1[U]P.

Once a minimal finite basis B of eM1[U] is computed, eM[B] is a finite basis of U. Note that eM[B] need not be a minimal basis, and need not be effectively reducable to a minimal one, as that would require the quasi-order M on M to be decidable, an assumption we have not made.

Theorem 12 is not just an instance of Goubault-Larrecq’s [9, Theorem 1]. Indeed, the latter result requires an effectivity assumption (namely, the effective complement property we mentioned in the proof in Section 2) which need not be true of any quotient of the free monoid, as discussed in [10, Theorem 5.2].

We restricted ourselves to monoids, but the careful reader may have noticed that nowhere in the proofs of Lemmas 11 and 12 we actually use the fact that (Σ,) is a subword ordering or that M is a monoid. We could in fact have stated Theorem 12 more generally, and it would then informally read as follows. Fix a WQO (X,) for which Theorem 2 holds, a monotone surjection e:(X,)(Y,), and an upwards-closed subset U of (Y,). Then (Y,) is a WQO and, given an oracle that decides for any IIdl(X,) whether U intersects e[I], a finite basis of U is computable. Again, we do not make this any more formal to avoid delving in the topic of effective representations of WQOs and their ideals.

Example 13.

Let (Σ,=) be an alphabet with k letters. Then k, also known as the free commutative monoid with k generators, is a quotient of Σ: the surjection ||:Σk, written |w|=(|w|1,,|w|k) counts the number of appearances of each letter in a word. This surjection is monotone from the subword ordering on Σ to the component-wise ordering on k. Given a -product Σ0σ1?Σ1Σn1σn?Σn, the downward-closure of its image by || is the subset of elements (x1,,xk)k such that, for every 1ik,

  • xi if the i-th letter appears in j=0nΣj;

  • xi|σ1σn|i otherwise.

Hence the corresponding instance of Theorem 12 is Valk and Jantzen’s original 1985 result, except we have now proved it by reducing it to Angluin’s 1987 active learning algorithm.

Representing elements of k as k-letter words is of course not very efficient, and what is interesting in Example 13 is how it reduces the result of Valk and Jantzen to that of Angluin. But for other non-trivial monoids, using word representations may still be a sensible choice: a trace monoid where only a few pairs of letters are allowed to commute, for instance, is very close to a monoid of words.

6 Conclusion and further work

In this work we have provided a new proof, relying on active learning of automata, of the generalized Valk-Jantzen lemma for subword orderings. This reduces in particular the original 1985 result by Valk and Jantzen for k to Angluin’s 1987 L algorithm. Along the way, we have described a new MAT-based learning algorithm, for quasi-ordered automata, and have extended Goubault-Larrecq’s generalized Valk-Jantzen lemma to finitely generated monoids.

We have restricted ourselves to words on finite alphabets, but there are other WQOs for which the generalized Valk-Jantzen lemma could reduce to an MAT-based learning algorithm.

  • Words on infinite (or very large) alphabets: this would require regrouping transitions in quasi-ordered automata by upwards-closed subsets, so that they can still be finitely represented. This use of an additional structure to represent infinite alphabets finitely also comes up with nominal automata [4]. More generally, enriched functors could provide a unifying framework for such state-machines on infinite alphabets: a Myhill-Nerode theorem for topos-enriched automata is notably given in [11].

  • Tree orderings: trees on well quasi-ordered families of terms can naturally be well quasi-ordered themselves [13], their ideals can be characterized as regular tree expressions [8, §10], but “the technicalities are daunting” [10]. Perhaps an approach based on the active learning algorithm for tree automata described in [7] can soothe out these technicalities.

References

  • [1] Dana Angluin. Learning regular sets from queries and counterexamples. Information and Computation, 75(2):87–106, November 1987. doi:10.1016/0890-5401(87)90052-6.
  • [2] Quentin Aristote. Active Learning of Deterministic Transducers with Outputs in Arbitrary Monoids. In 32nd EACSL Annual Conference on Computer Science Logic (CSL 2024), volume 288 of Leibniz International Proceedings in Informatics (LIPIcs), pages 11:1–11:20, Dagstuhl, Germany, 2024. Schloss-Dagstuhl - Leibniz Zentrum für Informatik. doi:10.4230/LIPIcs.CSL.2024.11.
  • [3] Simone Barlocco, Clemens Kupke, and Jurriaan Rot. Coalgebra Learning via Duality. In Mikołaj Bojańczyk and Alex Simpson, editors, Foundations of Software Science and Computation Structures, Lecture Notes in Computer Science, pages 62–79, Cham, 2019. Springer International Publishing. doi:10.1007/978-3-030-17127-8_4.
  • [4] Mikołaj Bojańczyk, Bartek Klin, and Sławomir Lasota. Automata theory in nominal sets. Logical Methods in Computer Science, Volume 10, Issue 3, August 2014. doi:10.2168/LMCS-10(3:4)2014.
  • [5] Thomas Colcombet and Daniela Petrisan. Automata Minimization: A Functorial Approach. Logical Methods in Computer Science, Volume 16, Issue 1, March 2020. doi:10.23638/LMCS-16(1:32)2020.
  • [6] Thomas Colcombet, Daniela Petrişan, and Riccardo Stabile. Learning Automata and Transducers: A Categorical Approach. In Christel Baier and Jean Goubault-Larrecq, editors, 29th EACSL Annual Conference on Computer Science Logic (CSL 2021), volume 183 of Leibniz International Proceedings in Informatics (LIPIcs), pages 15:1–15:17, Dagstuhl, Germany, 2021. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.CSL.2021.15.
  • [7] Frank Drewes and Johanna Högberg. Learning a Regular Tree Language from a Teacher. In Zoltán Ésik and Zoltán Fülöp, editors, Developments in Language Theory, Lecture Notes in Computer Science, pages 279–291, Berlin, Heidelberg, 2003. Springer. doi:10.1007/3-540-45007-6_22.
  • [8] Alain Finkel and Jean Goubault-Larrecq. Forward analysis for WSTS, part I: Completions. Mathematical Structures in Computer Science, 30(7):752–832, August 2020. doi:10.1017/S0960129520000195.
  • [9] Jean Goubault-Larrecq. On a Generalization of a Result by Valk and Jantzen. Research Report LSV-09-09, École Normale Supérieure de Cachan, Cachan, May 2009. URL: https://hal.science/hal-03195658.
  • [10] Jean Goubault-Larrecq, Simon Halfon, Prateek Karandikar, K. Narayan Kumar, and Philippe Schnoebelen. The Ideal Approach to Computing Closed Subsets in Well-Quasi-orderings. In Peter M. Schuster, Monika Seisenberger, Andreas Weiermann, Henrich Wansing, and Henrich Wansing, editors, Well-Quasi Orders in Computation, Logic, Language and Reasoning: A Unifying Concept of Proof Theory, Automata Theory, Formal Languages and Descriptive Set Theory, number 53 in Trends in Logic, pages 55–105. Springer Nature, Switzerland, 1 edition, 2020. doi:10.1007/978-3-030-30229-0_3.
  • [11] Victor Iwaniack. Automata in W-Toposes, and General Myhill-Nerode Theorems. In Barbara König and Henning Urbat, editors, Coalgebraic Methods in Computer Science, volume 14617 of Lecture Notes in Computer Science, pages 93–113, Cham, 2024. Springer Nature Switzerland. doi:10.1007/978-3-031-66438-0_5.
  • [12] Bart Jacobs and Alexandra Silva. Automata Learning: A Categorical Perspective. In Franck van Breugel, Elham Kashefi, Catuscia Palamidessi, and Jan Rutten, editors, Horizons of the Mind. A Tribute to Prakash Panangaden: Essays Dedicated to Prakash Panangaden on the Occasion of His 60th Birthday, pages 384–406. Springer International Publishing, Cham, 2014. doi:10.1007/978-3-319-06880-0_20.
  • [13] J. B. Kruskal. Well-Quasi-Ordering, The Tree Theorem, and Vazsonyi’s Conjecture. Transactions of the American Mathematical Society, 95(2):210–225, 1960. doi:10.2307/1993287.
  • [14] Christof Löding and Wolfgang Thomas. Automata on finite trees. In Jean-Éric Pin, editor, Handbook of Automata Theory, volume 1, pages 235–264. EMS Press, 1 edition, 2021. doi:10.4171/AUTOMATA-1/7.
  • [15] Henning Urbat and Lutz Schröder. Automata Learning: An Algebraic Approach. In Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS ’20, pages 900–914, New York, NY, USA, July 2020. Association for Computing Machinery. doi:10.1145/3373718.3394775.
  • [16] Rüdiger Valk and Matthias Jantzen. The residue of vector sets with applications to decidability problems in Petri nets. Acta Informatica, 21(6):643–674, March 1985. doi:10.1007/BF00289715.
  • [17] Gerco van Heerdt, Clemens Kupke, Jurriaan Rot, and Alexandra Silva. Learning Weighted Automata over Principal Ideal Domains. In Jean Goubault-Larrecq and Barbara König, editors, Foundations of Software Science and Computation Structures, pages 602–621, Cham, 2020. Springer International Publishing. doi:10.1007/978-3-030-45231-5_31.
  • [18] Gerrit K. van Heerdt. CALF - Categorical Automata Learning Framework. PhD thesis, University College London, London, UK, 2020. URL: https://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.819869.