text:
# In: Eisner, J., L. Karttunen and A. Thériault (eds.), Finite-State Phonology: Proc. of the 5th Workshop of the ACL Special Interest Group in Computational Phonology (SIGPHON), pp. 22-33, Luxembourg, Aug. 2000. [Online proceedings version: small corrections and clarifications to printed version.] Easy and Hard Constraint Ranking in Optimality Theory:Many thanks go to Lane and Edith Hemaspaandra for references to the complexity literature, and to Bruce Tesar for comments on an earlier draft. Algorithms and Complexity

## 1 Introduction

Optimality Theory (OT) is a grammatical paradigm that was introduced by Prince and Smolensky \[Prince and Smolensky, 1993\] and suggests various computational questions, including learnability.

Following Gold \[Gold, 1967\] we might ask: Is the language class $`\{L(𝒢):𝒢`$ is an OT grammar$`\}`$ learnable in the limit? That is, is there a learning algorithm that will converge on any OT-describable language $`L(𝒢)`$ if presented with an enumeration of its grammatical forms?

In this paper we consider an orthogonal question that has been extensively investigated by Tesar and Smolensky \[Tesar and Smolensky, 1996\], henceforth T&S. Rather than asking whether a learner can eventually find an OT grammar compatible with an unbounded set of positive data, we ask: How efficiently can it find a grammar (if one exists) compatible with a finite set of positive data?

Sections 3–5 present successively more realistic versions of the problem (sketched in the abstract). The easiest version turns out to be easier than previously known. The harder versions turn out to be harder than previously known.

## 2 Formalism

An OT grammar $`𝒢`$ consists of three elements, any or all of which may need to be learned:

* a set $``$ of underlying forms produced by a lexicon or morphology,
* a function Gen that maps any underlying form to a set of candidates, and
* a vector $`\stackrel{}{C}=C_1,C_2,\mathrm{}C_n`$ of constraints, each of which is a function from candidates to the natural numbers $``$.

$`C_i`$ is said to rank higher than (or outrank) $`C_j`$ in $`\stackrel{}{C}`$ iff $`i<j`$. We say $`x`$ satisfies $`C_i`$ if $`C_i(x)=0`$, else $`x`$ violates $`C_i`$.

The grammar $`𝒢`$ defines a relation that maps each $`u`$ to the candidate(s) $`x\text{Gen}(u)`$ for which the vector $`\stackrel{}{C}(x)\stackrel{\mathrm{def}}{=}C_1(x),C_2(x),\mathrm{}C_n(x)`$ is lexicographically minimal. Such candidates are called optimal.

One might then say that the grammatical forms are the pairs $`(u,x)`$ of this relation. But for simplicity of notation and without loss of generality, we will suppose that the candidates $`x`$ are rich enough that $`u`$ can always be recovered from $`x`$.111This is necessary in any case if $`C_j(x)`$ is to depend on (all of) the underlying form $`u`$. In general, we expect that each candidate $`x\text{Gen}(u)`$ encodes an alignment of the underlying form $`u`$ with some possible surface form $`s`$, and $`C_j(x)`$ evaluates this pair on some criterion. Then $`u`$ is redundant and we may simply take the candidate $`x`$ to be the grammatical form. Now the language $`L(𝒢)`$ is simply the image of $``$ under $`𝒢`$. We will write $`u_x`$ for the underlying form, if any, such that $`x\text{Gen}(u_x)`$.

An attested form of the language is a candidate $`x`$ that the learner knows to be grammatical (i.e., $`xL(𝒢)`$). $`y`$ is a competitor of $`x`$ if they are both in the same candidate set: $`u_x=u_y`$. If $`x,y`$ are competitors with $`\stackrel{}{C}(y)<\stackrel{}{C}(x)`$, we say that $`y`$ beats $`x`$ (and then $`x`$ is not optimal).

An ordinary learner does not have access to attested forms, since observing that $`xL(𝒢)`$ would mean observing an utterance’s entire prosodic structure and underlying form, which ordinarily are not vocalized. An attested set of the language is a set $`X`$ such that the learner knows that some $`xX`$ is grammatical (but not necessarily which $`x`$). The idea is that a set is attested if it contains all possible candidates that are consistent with something a learner heard.222This is of course a simplification. Attested sets corresponding to laugh and laughed can represent the learner’s uncertainty about the respective underlying forms, but not the knowledge that the underlying forms are related. In this case, we can solve the problem by packaging the entire morphological paradigm of laugh as a single candidate, whose attested set is constrained by the two surface observations and by the requirement of a shared underlying stem. (A $`k`$-member paradigm may be encoded in a form suitable to a finite-state system by interleaving symbols from $`2k`$ aligned tapes that describe the $`k`$ underlying and $`k`$ surface forms.) Alas, this scheme only works within disjoint finite paradigms: while it captures the shared underlying stem of laugh and laughed, it ignores the shared underlying suffix of laughed and frowned. An attested surface set—the case considered in this paper—is an attested set all of whose elements are competitors; i.e., the learner is sure of the underlying form but not the surface form.

Some computational treatments of OT place restrictions on the grammars that will be considered. The finite-state assumptions \[Ellison, 1994, Eisner, 1997a, Frank and Satta, 1998, Karttunen, 1998, Wareham, 1998\] are that

* candidates and underlying forms are represented as strings over some alphabet;
* Gen is a regular relation;333Ellison \[Ellison, 1994\] makes only the weaker assumption that $`\text{Gen}(u)`$ is a regular set for each $`u`$.
* each $`C_j`$ can be implemented as a weighted deterministic finite-state automaton (WDFA) (i.e., $`C_j(x)`$ is the total weight of the path accepting $`x`$ in the WDFA);
* $``$ and any attested sets are regular.

The bounded-violations assumption \[Frank and Satta, 1998, Karttunen, 1998\] is that the value of $`C_j(x)`$ cannot increase with $`|x|`$, but is bounded above by some $`k`$.

In this paper, we do not always impose these additional restrictions. However, when demonstrating that problems are hard, we usually adopt both restrictions to show that the problems are hard even for the restricted case.

Throughout this paper, we follow T&S in supposing that the learner already knows the correct set of constraints $`𝒞=\{C_1,C_2,\mathrm{}C_n\}`$, but must learn their order $`\stackrel{}{C}=C_1,C_2,\mathrm{}C_n`$, known as a ranking of $`𝒞`$. The assumption follows from the OT philosophy that $`𝒞`$ is universal across languages, and only the order of constraints differs. The algorithms for learning a ranking, however, are designed to be general for any $`𝒞`$, so they take $`𝒞`$ as an input.444That is, these methods are not tailored (as others might be) to exploit the structure of some specific, putatively universal $`𝒞`$. Hence they require time at least linear on $`n=|𝒞|`$, if only to read all the constraints. Given the variety of cross-linguistic constraints in the literature, one must worry: is $`n`$ huge? Most authors following Ellison \[Ellison, 1994\] allow as constraints all the regular languages over some alphabet $`\mathrm{\Sigma }`$; then $`n>s^{s(|\mathrm{\Sigma }|1)}`$ distinct constraints can be described by DFAs of size $`s`$, where $`\mathrm{\Sigma }`$ (or $`s`$) must be large to accommodate all features and prosodic constituents. One solution: let each constraint constrain only a few symbols in $`\mathrm{\Sigma }`$ (e.g., bound the number of non-default transitions per DFA). Indeed, Eisner \[Eisner, 1997a, Eisner, 1997b\] proposes that $`𝒞`$ is the union of two “primitive” constraint families. If each primitive constraint may mention at most $`t`$ of $`T`$ autosegmental tiers, then $`n=O(T^t)`$, which is manageable for small $`t`$.

## 3 RCD as Topological Sort

T&S investigate the problem of ranking a constraint set $`𝒞`$ given a set of attested forms $`x_1,\mathrm{}x_m`$ and corresponding competitors $`y_1,\mathrm{}y_m`$. The problem is to determine a ranking $`\stackrel{}{C}`$ such that for each $`i`$, $`\stackrel{}{C}(x_i)\stackrel{}{C}(y_i)`$ lexicographically. Otherwise $`x_i`$ would be ungrammatical, as witnessed by $`y_i`$.

In this section we give a concise presentation and analysis of T&S’s Recursive Constraint Demotion (RCD) algorithm for this problem. Our presentation exposes RCD’s connection to topological sort, from which we borrow a simple bookkeeping trick that speeds it up.

### 3.1 Compiling into Boolean Formulas

The first half of the RCD algorithm extracts the relevant information from the $`\{x_i\}`$ and $`\{y_i\}`$, producing what T&S call mark-data pairs. We use a variant notation. For each constraint $`C𝒞`$, we construct a negation-free, conjunctive-normal form (CNF) Boolean formula $`\varphi (C)`$ whose literals are other constraints:

$$\varphi (C)=\underset{i:C(x_i)>C(y_i)}{}\underset{C^{}:C^{}(x_i)<C^{}(y_i)}{}C^{}$$

The interpretation of the literal $`C^{}`$ in $`\varphi (C)`$ is that $`C^{}`$ outranks $`C`$. It is not hard to see that a constraint ranking is a valid solution iff it satisfies $`\varphi (C)`$ for every $`C`$. For example, if $`\varphi (d)=(abc)(bef)`$, this means that $`d`$ must be outranked by either $`a,b`$ or $`c`$ (else $`x_1`$ is ungrammatical) and also by either $`b,e`$ or $`f`$ (else $`x_2`$ is ungrammatical).

How expensive is this compilation step? Observe that the inner term $`_{C^{}:C^{}(x_i)<C^{}(y_i)}C^{}`$ is independent of $`C`$, so it only needs to be computed and stored once. Call this term $`D_i`$. We first construct all $`m`$ of the disjunctive clauses $`D_i`$, requiring time and storage $`O(mn)`$. Then we construct each of the $`n`$ formulas $`\varphi (C)=_{i:C(x_i)>C(y_i)}D_i`$ as a list of pointers to up to $`m`$ clauses, again taking time and storage $`O(mn)`$.

The computation time is $`O(mn)`$ for the steps we have already considered, but we must add $`O(mnE)`$, where $`E`$ is the cost of precomputing each $`C(x_i)`$ or $`C(y_i)`$ and may depend on properties of the constraints and input forms.

We write $`M(=O(mn))`$ for the exact storage cost of the formulas, i.e., $`M=_i|D_i|+_C|\varphi (C)|`$ where $`|\varphi (C)|`$ counts only the number of conjuncts.

### 3.2 Finding a Constraint Ranking

The problem is now to find a constraint ranking that satisfies $`\varphi (C)`$ for every $`C𝒞`$. Consider the special case where each $`\varphi (C)`$ is a simple conjunction of literals—that is, $`(i)|D_i|=1`$. This is precisely the problem of topologically sorting a directed graph with $`n`$ vertices and $`_C|\varphi (C)|=M/2`$ edges. The vertex set is $`𝒞`$, and $`\varphi (C)`$ lists the parents of vertex $`C`$, which must all be enumerated before $`C`$.

Topological sort has two well-known $`O(M+n)`$ algorithms \[Cormen et al., 1990\]. One is based on depth-first search. Here we will focus on the other, which is: Repeatedly find a vertex with no parents, enumerate it, and remove it and its outgoing edges from the graph.

The second half of T&S’s RCD algorithm is simply the obvious generalization of this topological sort method (to directed hypergraphs, in fact, formally speaking). We describe it as a function $`\text{Rcd}(𝒞,\varphi )`$ that returns a ranking $`\stackrel{}{C}`$:

1. If $`𝒞=\mathrm{}`$, return $``$. Otherwise:
2. Identify a $`C_1𝒞`$ such that $`\varphi (C_1)`$ is empty. ($`C_1`$ is surface-true, or “undominated.”)
3. If there is no such constraint, then fail: no ranking can be consistent with the data.
4. Else, for each $`C𝒞`$, destructively remove from $`\varphi (C)`$ any disjunctive clause $`D_i`$ that mentions $`C_1`$.
5. Now recursively compute and return $`\stackrel{}{C}=C_1,\text{Rcd}(𝒞\{C_1\},\varphi )`$.

Correctness of $`\text{Rcd}(𝒞,\varphi )`$ is straightforward, by induction on $`n=|𝒞|`$. The base case $`n=0`$ is trivial. For $`n>0`$: $`\varphi (C_1)`$ is empty and therefore satisfied. $`\varphi (C)`$ is also satisfied for all other $`C`$: any clauses containing $`C_1`$ are satisfied because $`C_1`$ outranks $`C`$, and any other clauses are preserved in the recursive call and therefore satisfied by the inductive hypothesis.

We must also show completeness of $`\text{Rcd}(𝒞,\varphi )`$: if there exists at least one correct answer $`\stackrel{}{B}`$, then the function must not fail. Again we use induction on $`n`$. The base case $`n=0`$ is trivial. For $`n>0`$: Observe that $`\varphi (B_1)`$ is satisfied in $`\stackrel{}{B}`$, by correctness of $`\stackrel{}{B}`$. Since $`B_1`$ is not outranked by anything, this implies that $`\varphi (B_1)`$ is empty, so Rcd has at least one choice for $`C_1`$ and does not fail. It is easy to see that $`\stackrel{}{B}`$ with $`C_1`$ removed would be a correct answer for the recursive call, so the inductive hypothesis guarantees that that call does not fail either.

### 3.3 More Efficient Bookkeeping

T&S (p. 61) analyze the Rcd function as taking time $`O(mn^2)`$; in fact their analysis shows more precisely $`O(Mn)`$. We now point out that careful bookkeeping can make it operate in time $`O(M+n)`$, which is at worst $`O(mn)`$ provided $`n>0`$. This means that the whole RCD algorithm can be implemented in time $`O(mnE)`$, i.e., it is bounded by the cost of applying all the constraints to all the forms.

First consider the special case discussed above, topological sort. In linear-time topological sort, each vertex maintains a list of its children and a count of its parents, and the program maintains a list of vertices whose parent count has become 0. The algorithm then requires only $`O(1)`$ time to find and remove each vertex, and $`O(1)`$ time to remove each edge, for a total time of $`O(M+n)`$ plus $`O(M+n)`$ for initialization.

We can organize RCD similarly. We change our representations (not affecting the compilation time in §3.1). Constraint $`C`$ need not store $`\varphi (C)`$. Rather, $`C`$ should maintain a list of pointers to clauses $`D_i`$ in which it appears as a disjunct (cf. “a list of its children”) as well as the integer $`|\varphi (C)|`$ (cf. “a count of its parents”). The program should maintain a list of “undominated” constraints for which $`|\varphi (C)|`$ has become 0. Finally, each clause $`D_i`$ should maintain a list of constraints $`C`$ such that $`D_i`$ appears in $`\varphi (C)`$.

Step 2 of the algorithm is now trivial: remove the head $`C_1`$ of the list of undominated constraints. For step 4, iterate over the stored list of clauses $`D_i`$ that mention $`C_1`$. Eliminate each such $`D_i`$ as follows: iterate over the stored list of constraints $`C`$ whose $`\varphi (C)`$ includes $`D_i`$ (and then reset that list to empty), and for each such $`C`$, decrement $`|\varphi (C)|`$, adding $`C`$ to the undominated list if $`|\varphi (C)|`$ becomes 0.

The storage cost is still $`O(M+n)`$. In particular, $`\varphi (C)`$ is now implicitly stored as $`|\varphi (C)|`$ backpointers from its clauses $`D_i`$, and $`D_i`$ is now implicitly stored as $`|D_i|`$ backpointers from its disjuncts (e.g., $`C_1`$). Since Rcd removes each constraint and considers each backpointer exactly once, in $`O(1)`$ time, its runtime is $`O(M+n)`$.

In short, this simple bookkeeping trick eliminates RCD’s quadratic dependence on $`n`$, the number of constraints to rank. As already mentioned, the total runtime is now dominated by $`O(mnE)`$, the preprocessing cost of applying all the constraints to all the input forms. Under the finite-state assumption, this can be be more tightly bounded as $`O(n\text{total size of input forms})=O(n_i|x_i|+|y_i|)`$, since the cost of running a form through a WDFA is proportional to the former’s length.

### 3.4 Alternative Algorithms

T&S also propose an alternative to RCD called Constraint Demotion (CD), which is perhaps better-known. (They focus primarily on it, and Kager’s textbook \[Kager, 1999\] devotes a chapter to it.) A disjunctive clause $`D_i`$ (compiled as in §3.1) is processed roughly as follows: for each $`C`$ such that $`D_i`$ is an unsatisfied clause of $`\varphi (C)`$, greedily satisfy it by demoting $`C`$ as little as possible. CD repeatedly processes $`D_1,\mathrm{}D_m`$ until all clauses in all formulas are satisfied.

CD can be efficiently implemented so that each pass through all clauses takes time proportional to $`M`$. But it is easy to construct datasets that require $`n+1`$ passes. So the ranking step can take time $`\mathrm{\Omega }(Mn)`$, which contrasts unfavorably with the $`O(M+n)`$ time for Rcd.

CD does have the nice property (unlike RCD) that it maintains a constraint ranking at all times. An “online” (memoryless) version of CD is simply to generate, process, and discard each clause $`D_i`$ upon arrival of the new data pair $`x_i,y_i`$; this converges, given sufficient data. But suppose one wishes to maintain a ranking that is consistent with all data seen so far. In this case, CD is slower than RCD. Modifying a previously correct ranking to remain correct given the new clause $`D_i`$ requires at least one pass through all clauses $`D_1,\mathrm{}D_i`$ (as slow as RCD) and up to $`n+1`$ passes (as slow as running CD on all clauses from scratch, ignoring the previous ranking).

## 4 Considering All Competitors

The algorithms of the previous section only ensure that each attested form $`x_i`$ is at least as harmonic as a given competitor $`y_i`$: $`\stackrel{}{C}(x_i)\stackrel{}{C}(y_i)`$. But for $`x_i`$ to be grammatical, it must be at least as harmonic as all competitors. We would like a method that ensures this. Such a method will rank a constraint set $`𝒞`$ given only a set of attested forms $`\{x_1,\mathrm{}x_m\}`$.

Like T&S, whose algorithm for this case is discussed in §4.2, here we (dangerously) assume we have an efficient computation of OT’s production function $`\text{Opt}(\stackrel{}{C},u)`$ (such as Ellison \[Ellison, 1994\], Tesar \[Tesar, 1996\], or Eisner \[Eisner, 1997a\]). This returns the subset of $`\text{Gen}(u)`$ on which $`\stackrel{}{C}()`$ is lexicographically minimal, i.e., the set of grammatical outputs for $`u`$. For the analysis, let $`P`$ be a bound on the runtime of our Opt algorithm. We will discuss this runtime further in §6!

### 4.1 Generalizing RCD

We propose to solve this problem by running something like our earlier RCD algorithm, but considering all competitors at once.

First, as a false start, let us try to construct the requirements $`\varphi (C)`$ in this case. Consider the contribution of a single $`x_i`$ to a particular $`\varphi (C)`$. $`x_i`$ demands that for any competitor $`y`$ such that $`C(x_i)>C(y)`$, $`C`$ must be outranked by some $`C^{}`$ such that $`C^{}(x_i)<C^{}(y)`$. One set of competitors $`y`$ might all add the same clause $`(abc)`$ to $`\varphi (C)`$; another set might add a different clause $`(bde)`$.

The trouble here is that $`\varphi (C)`$ may become intractably large. This will happen if the constraints are roughly orthogonal to one another. For example, suppose the candidates are bit strings of length $`n`$, and for each $`k`$, there exists a constraint $`\text{Off}_k`$ preferring the $`k`$th bit to be zero.555$`\text{Off}_k(x)`$ simply extracts the $`k`$th bit of $`x`$. We will later denote it as $`C_{\neg v_k}`$. If $`x_i=1000\mathrm{}0`$, then $`\varphi (\text{Off}_1)`$ contains all $`2^{n1}`$ possible clauses: for example, it contains $`(\text{Off}_2\text{Off}_4\text{Off}_5)`$ by virtue of the competitor $`y=0101100000\mathrm{}`$. Of course, the conjunction of all these clauses can be drastically simplified in this case, but not in general.

Therefore, we will skip the step of constructing formulas $`\varphi (C)`$. Rather, we will run something like Rcd directly: greedily select a constraint $`C_1`$ that does not eliminate any of the attested forms $`x_i`$ (but that may eliminate some of its competitors), similarly select $`C_2`$, etc.

In our new function $`\text{RcdAll}(𝒞,\stackrel{}{B},\{x_i\})`$, the input includes a partial hierarchy $`\stackrel{}{B}`$ listing the constraints chosen at previous steps in the recursion. (On a non-recursive call, $`\stackrel{}{B}=`$.)

1. If $`𝒞=\mathrm{}`$, return $``$. Otherwise:
2. By trying all constraints, find a constraint $`C_1`$ such that $`(i)x_i\text{Opt}(\stackrel{}{B},C_1,u_{x_i})`$
3. If there is no such constraint, then fail: no ranking can be consistent with the data.
4. Else recursively compute and return $`\stackrel{}{C}=C_1,\text{RcdAll}(𝒞\{C_1\},\stackrel{}{B},C_1,\{x_i\})`$

It is easy to see by induction on $`|𝒞|`$ that RcdAll is correct: if it does not fail, it always returns a ranking $`\stackrel{}{C}`$ such that each $`x_i`$ is grammatical under the ranking $`\stackrel{}{B},\stackrel{}{C}`$. It is also complete, by the same argument we used for Rcd: if there exists a correct ranking, then there is a choice of $`C_1`$ for this call and there exists a correct ranking on the recursive call.

The time complexity of RcdAll is $`O(mn^2P)`$. Preprocessing and compilation are no longer necessary (that work is handled by Opt). We note that if Opt is implemented by successive winnowing of an appropriately represented candidate set, as is common in finite-state approaches, then it is desirable to cache the sets returned by Opt at each call, for use on the recursive call. Then $`\text{Opt}(\stackrel{}{B},C_1,u_{x_i})`$ need not be computed from scratch: it is simply the subset of $`\text{Opt}(\stackrel{}{B},u_{x_i})`$ on which $`C_1()`$ is minimal.

### 4.2 Alternative Algorithms

T&S provide a different, rather attractive solution to this problem, which they call Error-Driven Constraint Demotion (EDCD). This is identical to the “online” CD algorithm of §3.4, except that for each attested form $`x`$ that is presented to the learner, EDCD automatically chooses a competitor $`y\text{Opt}(\stackrel{}{C},u_x)`$, where $`\stackrel{}{C}`$ is the ranking at the time.

If the supply of attested forms $`x_1,\mathrm{}x_m`$ is limited, as assumed in this paper, one may iterate over them repeatedly, modifying $`\stackrel{}{C}`$, until they are all optimal. When an attested form $`x`$ is suboptimal, the algorithm takes time $`O(nE)`$ to compile $`x,y`$ into a disjunctive clause and time $`O(n)`$ to process that clause using CD.666Instead of using CD on the new clause only, one may use RCD to find a ranking consistent with all clauses generated so far. This step takes worst-case time $`O(n^2)`$ rather than $`O(n)`$ even with our improved algorithm, but may allow faster convergence. Tesar \[Tesar, 1997\] calls this version Multi-Recursive Constraint Demotion (MRCD).

T&S show that the learner converges after seeing at most $`O(n^2)`$ suboptimal attested forms, and hence after at most $`O(n^2)`$ passes through $`x_1,\mathrm{}x_m`$. Hence the total time is $`O(n^3E+mn^2P)`$, where $`P`$ is the time required by Opt. This is superficially worse than our RcdAll, which takes time $`O(mn^2P)`$, but really about as good since $`P`$ dominates (see §6).

Mainly, RcdAll is simpler. §7 (note 17) also shows that RcdAll needs less information from each call to Opt; this improves the complexity class of the call, though not of the full algorithm.

Algorithms that adjust constraint rankings or weights along a continuous scale include the Gradual Learning Algorithm \[Boersma, 1997\], which resembles simulated annealing, and maximum likelihood estimation \[Johnson, 2000\]. These methods have the considerable advantage that they can deal with noise and free variation in the attested data. Both algorithms repeat until convergence, which makes it difficult to judge their efficiency except by experiment.

## 5 Incompletely Observed Forms

We now add a further wrinkle. Suppose the input to the learner specifies only $`𝒞`$ together with attested surface sets $`\{X_i\}`$, as defined in §2, rather than attested forms. This version of the problem captures the learner’s uncertainty about the full description of the surface material. As before, the goal is to rank $`𝒞`$ in a manner consistent with the input.

With this wrinkle, even determining whether such a ranking exists turns out to be surprisingly harder. In §7 we will see that it is actually $`\mathrm{\Sigma }_2^p`$-complete. Here we only show it NP-hard, using a construction that suggests that the NP-hardness stems from the need to consider exponentially many rankings or surface forms.

### 5.1 NP-Hardness Construction

Given $`r`$, we will be considering finite-state OT grammars of the following form:

* $`=\{ϵ\}`$.
* $`\text{Gen}(ϵ)=\mathrm{\Sigma }^r`$, the set of all length-$`r`$ strings over the alphabet $`\mathrm{\Sigma }=\{1,2,\mathrm{}r\}`$. (This set can be represented with a straight-line DFA of $`r+1`$ states and $`r^2`$ arcs.)
* $`𝒞=\{\text{Early}_j:1jr\}`$, where for any $`x\mathrm{\Sigma }^{}`$, the constraint $`\text{Early}_j(x)`$ counts the number of digits in $`x`$ before the first occurrence of digit $`j`$, if any. For example, $`\text{Early}_3(2188353)=\text{Early}_3(2188)=4`$. (Each such constraint can be implemented by a WDFA of 2 states and $`2r`$ arcs.)

$`\text{Early}_j`$ favors candidates in which $`j`$ appears early. The ranking $`\text{Early}_5,\text{Early}_8,`$ $`\text{Early}_1,\mathrm{}`$ favors candidates of the form $`581\mathrm{}`$; no other candidate can be grammatical.

Given a directed graph $`G`$ with $`r`$ vertices identified by the digits $`1,2,\mathrm{}r`$. A path in $`G`$ is a string of digits $`j_1j_2j_3\mathrm{}j_k`$ such that $`G`$ has edges from $`j_1`$ to $`j_2`$, $`j_2`$ to $`j_3`$, … and $`j_{k1}`$ to $`j_k`$. Such a string is called a Hamilton path if it contains each digit exactly once. It is an NP-complete problem to determine whether an arbitrary graph $`G`$ has a Hamilton path.

Suppose we let the attested surface set $`X_1`$ be the set of length-$`r`$ paths of $`G`$. This is a regular set that can be represented in space proportional to $`r|G|`$, by intersecting the DFA for $`\text{Gen}(ϵ)`$ with a DFA that accepts all paths of $`G`$.777The latter DFA is isomorphic to $`G`$ plus a start state. The states are $`0,1,\mathrm{}r`$; there is an arc from $`j`$ to $`j^{}`$ (labeled with $`j^{}`$) iff $`j=0`$ or $`G`$ has an edge from $`j`$ to $`j^{}`$.

Now $`(𝒞,\{X_1\})`$ is an instance of the ranking problem whose size is $`O(r|G|)`$. We observe that any correct ranking algorithm determines if $`G`$ has a Hamilton path. Why? A ranking is a vector $`\stackrel{}{C}=\text{Early}_{j_1},\mathrm{}\text{Early}_{j_r}`$, where $`j_1,\mathrm{}j_r`$ is a permutation of $`1,\mathrm{}r`$. The optimal form under this ranking is in fact the string $`j_1\mathrm{}j_r`$. A string is consistent with $`X_1`$ if it is a path of $`G`$, so the ranking $`\stackrel{}{C}`$ is consistent with $`X_1`$ iff $`j_1\mathrm{}j_r`$ is a Hamilton path of $`G`$. If such a ranking exists, the algorithm is bound to find it, and otherwise to return a failure code. Hence the ranking problem of this section is NP-hard.

Further, if the Satisfiability Hypothesis (SH) holds \[Stearns and Hunt III, 1990\], Hamilton Path must take time $`2^{\mathrm{\Omega }(|G|)}`$, a fortiori $`2^{\mathrm{\Omega }(r)}`$. Then any ranking algorithm takes $`2^{\mathrm{\Omega }(n)}`$ ($`n=|𝒞|`$).

### 5.2 Discussion

Since each ranking of the constraints $`\text{Early}_j`$ is trivial to test against $`X_1`$ (by DFA intersection), the NP-hardness of ranking them arises not from the difficulty of each test (though other constraint sets do have such hard tests! see §6) but from the $`2^n`$ possible rankings. A brute-force check of exponentially many rankings takes time $`2^{\mathrm{\Theta }(n)}`$. Thus, given SH, no ranking algorithm can consistently beat such a brute-force check.

Note that our construction shows NP-hardness for even a restricted version of the ranking problem: finite-state grammars and finite attested surface sets. The result holds up even if we also make the bounded-violations assumption (see §2): the violation count can stop at $`r`$, since $`\text{Early}_j`$ need only work correctly on strings of length $`r`$. We revise the construction, modifying the automaton for each $`\text{Early}_j`$ by intersection (more or less) with the straight-line automaton for $`\mathrm{\Sigma }^r`$. This preserves $`|𝒞|`$ and $`X_1`$ and blows up the ranker’s input $`𝒞`$ by only $`O(r)`$.

By way of mitigating this stronger result, we note that the construction in the previous paragraph bounds $`|X_i|`$ by $`r!`$ and the number of violations by $`r`$. These bounds (as well as $`|𝒞|=r`$) increase with the order $`r`$ of the input graph. If the bounds were imposed by universal grammar, the construction would not be possible and NP-hardness might not hold. Unfortunately, any universal bounds on $`|X_i|`$ or $`|𝒞|`$ would hardly be small enough to protect the ranking algorithm from having to solve huge instances of Hamilton path.888We expect attested sets $`X_i`$ to be very large—especially in the more general case where they reflect uncertainty about the underlying form. That is why we describe them compactly by DFAs. A universal constraint set $`𝒞`$ would also have to be very large (footnote 4). As for bounded violations, the only real reason for imposing this restriction is to ensure that the OT grammar defines a regular relation \[Frank and Satta, 1998, Karttunen, 1998\]. In recent work, Eisner \[Eisner, 2000\] argues that the restriction is too severe for linguistic description, and proposes a more general class of “directional constraints” under which OT grammars remain regular.999Allowing directional constraints would not change any of the classifications in this paper. If this relaxed restriction is substituted for a universal bound on violations, the ranking problem remains NP-hard, since each $`\text{Early}_j`$ is a directional constraint.

A more promising “way out” would be to universally restrict the size or structure of the automaton that describes the attested set. The set used in our construction was quite artificial.

However, in $`\mathrm{\S }\text{7}`$ we will answer all these objections: we will show the problem to be $`\mathrm{\Sigma }_2^p`$-complete, using finite-state constraints with at most 1 violation (which, however, will not interact as simply) and a natural attested set.

### 5.3 Available Algorithms

The NP-hardness result above suggests that existing algorithms designed for this ranking problem are either incorrect or intractable on certain cases. Again, this does not rule out efficient algorithms for variants of the problem—e.g., for a specific universal $`𝒞`$—nor does it rule out algorithms that tend to perform well in the average case, or on small inputs, or on real data.

T&S proposed an algorithm for this problem, RIP/CD, but left its efficiency and correctness for future research (p. 39); Tesar and Smolensky \[Tesar and Smolensky, 2000\] show that it is not guaranteed to succeed. Tesar \[Tesar, 1997\] gives a related algorithm based on MRCD (see §4.2), but which sometimes requires iterating over all the candidates in an attested surface set; this might easily be intractable even when the set is finite.

## 6 Complexity of OT Generation

The ranking algorithms in §§4.14.2 relied on the existence of an algorithm to compute the independently interesting “language production” function $`\text{Opt}(\stackrel{}{C},u)`$, which maps underlying $`u`$ to the set of optimal candidates in $`\text{Gen}(u)`$.

In this section, we consider the computational complexity of some functions related to Opt:101010All these functions take an additional argument Gen, which we suppress for readability.

* $`\text{OptVal}(\stackrel{}{C},u)`$: returns $`\mathrm{min}_{x\text{Gen}(u)}\stackrel{}{C}(x)`$. This is the violation vector shared by all the optimal candidates $`x\text{Opt}(\stackrel{}{C},u)`$.
* $`\text{OptValZ}(\stackrel{}{C},u)`$: returns “yes” iff the last component of the vector $`\text{OptVal}(\stackrel{}{C},u)`$ is zero. This decision problem is interesting only because if it cannot be computed efficiently then neither can OptVal (or Opt).
* $`\text{Beatable}(\stackrel{}{C},u,k_1,\mathrm{}k_n)`$: returns “yes” iff $`\text{OptVal}(\stackrel{}{C},u)<k_1,\mathrm{}k_n`$.
* $`\text{Best}(\stackrel{}{C},u,k_1,\mathrm{}k_n)`$: returns “yes” iff $`\text{OptVal}(\stackrel{}{C},u)=k_1,\mathrm{}k_n`$.
* $`\text{Check}(\stackrel{}{C},x)`$: returns “yes” iff $`x\text{Opt}(\stackrel{}{C},u_x)`$. This checks whether an attested form is consistent with $`\stackrel{}{C}`$.
* $`\text{CheckSSet}(\stackrel{}{C},X)`$: returns “yes” iff $`\text{Check}(\stackrel{}{C},x)`$ for some $`xX`$. This checks whether an attested surface set (namely $`X`$) is consistent with $`\stackrel{}{C}`$.

These problems place a lower bound on the difficulty of OT generation, since an algorithm that found a reasonable representation of $`\text{Opt}(\stackrel{}{C},u)`$ (e.g., a DFA) could solve them immediately, and an algorithm that found an exemplar $`x\text{Opt}(\stackrel{}{C},u)`$ could solve all but CheckSSet immediately. §7 will relate them to OT learning.

### 6.1 Past Results

Under finite-state assumptions, Ellison \[Ellison, 1994\] showed that for any fixed $`\stackrel{}{C}`$, a representation of $`\text{Opt}(\stackrel{}{C},u)`$ could be generated in time $`O(|u|\mathrm{log}|u|)`$, making all the above problems tractable. However, Eisner \[Eisner, 1997a\] showed generation to be intractable when $`\stackrel{}{C}`$ was not fixed, but rather considered to be part of the input—as when generation is called by an algorithm like RcdAll that learns rankings. Specifically, Eisner showed that OptValZ is NP-hard. Similarly, Wareham \[Wareham, 1998, theorem 4.6.4\] showed that a version of Beatable is NP-hard.111111Wareham also gave hardness results for versions of Beatable where some parameters are bounded or fixed. (We will obtain more precise classifications below.)

To put this another way, the worst-case complexity of generation problems is something like $`O(|u|\mathrm{log}|u|)`$ times a term exponential in $`|\stackrel{}{C}|`$.

Thus there are some grammars for which generation is very difficult by any algorithm. So when testing exponentially many rankings (§5), a learner may need to spend exponential time testing an individual ranking.

We offer an intuition as to why generation can be so hard. In successive-winnowing algorithms like that of \[Eisner, 1997a\], the candidate set begins as a large simple set such as $`\mathrm{\Sigma }^{}`$, and is filtered through successive constraints to end up (typically) as a small simple set such as the singleton $`\{x_1\}`$. Both these sets can be represented and manipulated as small DFAs. The trouble is that intermediate candidate sets may be complex and require exponentially large DFAs to represent. (Recall that the intersection of DFAs can grow as the product of their sizes.)

For example, Eisner’s \[Eisner, 1997a\] NP-hardness construction led to such an intermediate candidate set, consisting of all permutations of $`r`$ digits. Such a set arises simply from a hierarchy such as $`\text{Project}_1,\mathrm{}\text{Project}_r,\text{Short}`$, where $`\text{Project}_j(x)=0`$ provided that $`j`$ appears (at least once) in $`x`$, and $`\text{Short}(x)=|x|`$. (Adding a bottom-ranked constraint that prefers $`x`$ to encode a path in a graph $`G`$ forces Opt to search for a Hamilton path in $`G`$, which demonstrates NP-hardness of OptValZ.)

### 6.2 Relevant Complexity Classes

Perhaps the reader recalls that $`\text{P}\text{NP}\text{coNP}\text{NP}\text{coNP}D^p\mathrm{\Delta }_2^p=\text{P}^{\mathrm{𝖭𝖯}}\mathrm{\Sigma }_2^p=\text{NP}^{\mathrm{𝖭𝖯}}`$. If not, we will review these classes as they arise.121212Problems in all but P are widely suspected to require exponential time—which suffices by brute-force search. (Smaller classes allow “more cleanly parallel” search.)

These are classes of decision problems, i.e., functions taking values in {yes,no}. Hardness and completness for such classes are defined via many-one (Karp) reductions: $`g`$ is at least as hard as $`f`$ iff $`(x)f(x)=g(T(x))`$ for some function $`T(x)`$ computable in polynomial time.131313$`g`$ is $`X`$-hard if it is at least as hard as all $`fX`$, and $`X`$-complete if also $`gX`$.

In contrast, OptP is a class of integer-valued functions, introduced by Krentel \[Krentel, 1988\]. Recall that NP is the class of decision problems solvable in polytime by a nondeterministic Turing machine: each control branch of the machine checks a different possibility and gives a yes/no answer, and the machine returns the disjunction of the answers. For coNP, the machine returns the conjunction. For OptP, each branch writes a binary integer $`0`$, and the machine returns the minimum (or maximum) of these answers.

A canonical example (analogous to OptVal) is the Traveling Salesperson problem—finding the minimum cost $`\text{TspVal}(G)`$ of all tours of an integer-weighted graph $`G`$. It is OptP-complete in the sense that all functions $`f`$ in OptP can be metrically reduced to it \[Krentel, 1988, p. 493\]. A metric reduction solves an instance of $`f`$ by transforming it to an instance of $`g`$ and then transforming the integer result of $`g`$: $`(x)f(x)=T_2(x,g(T_1(x)))`$ for some polytime-computable functions $`T_1:\mathrm{\Sigma }^{}\mathrm{\Sigma }^{}`$ and $`T_2:\mathrm{\Sigma }^{}\times `$.

Krentel showed that OptP-complete problems yield complete problems for decision classes under broad conditions. The question $`\text{TspVal}(G)k`$ is of course the classical TSP decision problem, which is NP-complete. (It is analogous to Beatable.) The reverse question $`\text{TspVal}(G)k`$ (which is related to Check) is coNP-complete. The question $`\text{TspVal}(G)=k`$ (analogous to Best) is therefore in the class $`D^p=\{L_1L_2:L_1\text{NP}`$ and $`L_2\text{coNP}\}`$ \[Papadimitriou and Yannakakis, 1982\], and it is complete for that class. Finally, suppose we wish to ask whether the optimal tour is unique. (Like OptValZ and CheckSSet, this asks about a complex property of the optimum.) Papadimitriou \[Papadimitriou, 1984\] first showed this question to be complete for $`\mathrm{\Delta }_2^p=\text{P}^{\mathrm{𝖭𝖯}}`$, the class of languages decidable in polytime by deterministic Turing machines that have unlimited access to an oracle that can answer NP questions in unit time. (Such a machine can certainly decide uniqueness: It can compute the integer $`\text{TspVal}(G)`$ by binary search, asking the oracle for various $`k`$ whether or not $`\text{TspVal}(G)k`$, and then ask it a final NP question: do there exist two distinct tours with cost $`\text{TspVal}(G)`$?)

### 6.3 New Complexity Results

It is quite easy to show analogous results for OT generation. Our main tool will be one of Krentel’s \[Krentel, 1988\] OptP-complete problems: Minimum Satisfying Assignment. If $`\varphi `$ is a CNF boolean formula on $`n`$ variables, then $`\text{Msa}(\varphi )`$ returns the lexicographically minimal bitstring $`b_1b_2\mathrm{}b_n`$ that represents a satisfying assignment for $`\varphi `$, or $`1^n`$ if no such bitstring exists.141414Krentel’s presentation is actually in terms of Maximum Satisfying Assignment, which merely reverses the roles of 0 and 1. Also, Krentel does not mention that $`\varphi `$ can be restricted to CNF, but importantly for us, his proof of OptP-hardness makes this fact clear.

We consider only problems where we can compute $`C_j(x)`$, or determine whether $`x\text{Gen}(u)`$, in polytime. We further assume that Gen produces only candidates of length polynomial in the size of the problem input—or more weakly, that our functions need not produce correct answers unless at least one optimal candidate is so bounded.

Our hardness results (except as noted) apply even to OT grammars with the finite-state and bounded-violations assumptions (§2). In fact, we will assume without further loss of generality \[Ellison, 1994, Frank and Satta, 1998, Karttunen, 1998\] that constraints are $`\{0,1\}`$-valued, hence representable by unweighted DFAs.

Notation: We may assume that all formulas $`\varphi `$ use variables from a set $`\{v_1,v_2,\mathrm{}v_{O(|\varphi |)}\}`$. Let $`\mathrm{}(\varphi )`$ be the maximum $`i`$ such that $`v_i`$ appears in $`\varphi `$. We define the constraint $`C_\varphi `$ to map strings of at least $`\mathrm{}(\varphi )`$ bits to $`\{0,1\}`$, defining $`C_\varphi (b_1b_2\mathrm{})=0`$ iff $`\varphi `$ is true when the variables $`v_i`$ in $`\varphi `$ are instantiated respectively to values $`b_i`$.

If we do not make the finite-state assumptions, then any $`C_\varphi `$ can be represented trivially in size $`|\varphi |`$. But under these assumptions, we must represent $`C_\varphi `$ as a DFA that accepts just those bitstrings that satisfy $`\varphi `$. While this is always possible (operators $`,,\neg `$ in $`\varphi `$ correspond to DFA operations), we necessarily take care in this case to use only $`C_\varphi `$ whose DFAs are polynomial in $`|\varphi |`$. In particular, if $`\varphi `$ is a disjunction of (possibly negated) literals, such as $`b_2b_3\neg b_7`$, then a DFA of $`\mathrm{}(\varphi )+2`$ states suffices.

We begin by showing that $`\text{OptVal}(\stackrel{}{C},u)`$ is OptP-complete. It is obvious under our restrictions that it is in the class OptP—indeed it is a perfect example. Each nondeterministic branch of the machine considers some string $`x`$ of length $`p(|u|)`$, simply writing the bitstring $`\stackrel{}{C}(x)`$ if $`x\text{Gen}(u)`$ and $`1^n`$ otherwise.

To show OptP-hardness, we metrically reduce $`\text{Msa}(\varphi )`$ to OptVal, where $`\varphi =_{i=1}^mD_i`$ is in CNF. Let $`r=\mathrm{}(\varphi )`$, and put $`=\{ϵ\}`$ and $`\text{Gen}(ϵ)=\{0,1\}^r`$. Also put $`D_i^{}=D_i(v_1\mathrm{}v_r)`$, so that $`1^r`$ satisfies each $`C_{D_i^{}}`$. Now let $`\stackrel{}{C}=C_{D_1^{}},\mathrm{}`$ $`C_{D_m^{}},`$ $`C_{\neg v_1},\mathrm{}`$ $`C_{\neg v_r}`$. Then $`\text{Msa}(\varphi )=`$ the last $`r`$ bits of $`\text{OptVal}(\stackrel{}{C},ϵ)`$.151515$`C_{D_i^{}}`$ requires a DFA of $`2r+2`$ states. Remark: Without the finite-state assumptions, we could just write $`\text{Msa}(\varphi )=\text{OptVal}(C_{\varphi \neg v_1},\mathrm{}C_{\varphi \neg v_r},ϵ)`$ for any $`\varphi `$.

Because OptVal is OptP-complete, Krentel’s theorem 3.1 says it is complete for $`\text{FP}^{\mathrm{𝖭𝖯}}`$, the set of functions computable in polynomial time using an oracle for NP. This is the function class corresponding to the decision class $`\text{P}^{\mathrm{𝖭𝖯}}=\mathrm{\Delta }_2^p`$.

Next we show that $`\text{Beatable}(\stackrel{}{C},u,\stackrel{}{k})`$ is NP-complete. It is obviously in NP. To show NP-hardness (and power index 1, so that SH (§5.1) implies runtime $`2^{\mathrm{\Omega }(\mathrm{size}\mathrm{of}\mathrm{input})}`$), again put $`\varphi =_{i=1}^mD_i`$, $`r=\mathrm{}(\varphi )`$, and $`\text{Gen}(ϵ)=\{0,1\}^r`$. Now $`\text{CNF-Sat}(\varphi )=\text{Beatable}(C_{D_1},\mathrm{}C_{D_m},ϵ,0,0,\mathrm{}0,1)`$.

Next consider $`\text{Check}(\stackrel{}{C},x)`$. This is simply $`\neg \text{Beatable}(\stackrel{}{C},u_x,\stackrel{}{C}(x))`$. Even when restricted to calls of this form, Beatable remains just as hard. To show this, we tweak the above construction so we can write $`\stackrel{}{C}(x)`$ (for some $`x`$) in place of $`0,0,\mathrm{}0,1`$. Add the new element $`ϵ`$ to $`\text{Gen}(ϵ)`$, and extend the constraint definitions by putting $`C_{D_i}(ϵ)=0`$ iff $`i<m`$. Then $`\text{CNF-Sat}(\varphi )=\text{Beatable}(\stackrel{}{C},ϵ,\stackrel{}{C}(ϵ))`$. Therefore $`\text{Check}=\neg \text{Beatable}`$ is coNP-complete.

Next we consider $`\text{Best}(\stackrel{}{C},u,\stackrel{}{k})`$. This problem is in $`D^p`$ for the same simple reason that the question $`\text{TspVal}(G)=k`$ is (see above). If we do not make the finite-state assumptions, it is also $`D^p`$-hard by reduction from the $`D^p`$-complete language $`\text{Sat-Unsat}=\{(\varphi ,\psi ):\varphi \text{Sat},\psi \text{Sat}\}`$ \[Papadimitriou and Yannakakis, 1982\], as follows: $`\text{Sat-Unsat}(\varphi ,\psi )=\text{Best}(C_\varphi ,C_\psi ,ϵ,0,1)`$, renaming variables as necessary so that $`\varphi `$ uses only $`v_1,\mathrm{}v_r`$ and $`\psi `$ uses only $`v_{r+1},\mathrm{}v_s`$, and $`\text{Gen}(ϵ)=\{0,1\}^{r+s}`$.

It is not clear whether Best remains $`D^p`$-hard under the finite-state assumptions. But consider a more flexible variant $`\text{Range}(\stackrel{}{C},u,\stackrel{}{k_1},\stackrel{}{k_2})`$ that asks whether $`\text{OptVal}(\stackrel{}{C},u)`$ is between $`\stackrel{}{k_1}`$ and $`\stackrel{}{k_2}`$ inclusive. This is also in $`D^p`$, and is $`D^p`$-hard because $`\text{Sat-Unsat}(\varphi \mathrm{\#}\psi )=`$ $`\text{Range}(C_{D_1},\mathrm{}C_{D_m},C_{D_1^{}},\mathrm{}C_{D_m^{}^{}}`$, $`ϵ`$, $`0,\mathrm{}`$ $`0,0,\mathrm{}1,0,\mathrm{}0,1,\mathrm{}1`$, where $`\varphi `$, $`\psi `$, Gen are as before and $`\varphi =_{i=1}^mD_i`$, $`\psi =_{i=1}^m^{}D_i^{}`$.

Finally, we show that the decision problems CheckSSet and OptValZ are $`\mathrm{\Delta }_2^p`$-complete. They are in $`\mathrm{\Delta }_2^p`$ by an algorithm similar to the one used for TSP uniqueness above: since Beatable can be determined by an NP oracle, we can find $`\text{OptVal}(\stackrel{}{C},u)`$ by binary search.161616This takes polynomially many steps provided that $`\mathrm{log}C_i(x)`$ is polynomial in $`|x|`$ (as it is under the finite-state assumptions). We’ve already assumed that $`|x|`$ itself is polynomial on the input size, at least for optimal $`x`$. An additional call to an NP oracle decides $`\text{CheckSSet}(\stackrel{}{C},X)`$ by asking whether $`xX`$ such that $`\stackrel{}{C}(x)=\text{OptVal}(\stackrel{}{C},u)`$. Such a call also trivially decides OptValZ.

The reduction to show $`\mathrm{\Delta }_2^p`$-hardness is from a $`\mathrm{\Delta }_2^p`$-complete problem exhibited by Krentel \[Krentel, 1988, theorem 3.4\]: Msalsb accepts $`\varphi `$ iff the final (least significant) bit of $`\text{Msa}(\varphi )`$ is 0. Given $`\varphi `$, we use the same grammar as when we reduced Msa to OptVal: since Msa and OptVal then share the same last bit, $`\text{Msa}\text{lsb}(\varphi )=\text{OptValZ}(\stackrel{}{C},ϵ)=\text{CheckSSet}(\stackrel{}{C},\{0,1\}^{m+r1}0)`$.

Note that we did not have to use an unnatural attested surface set as in §5.1. The set $`\{0,1\}^{m+r1}0`$ means that the learner has observed only certain bits of the utterance—exactly the kind of partial observation that we expect. So even some restriction to “reasonable” attested sets is unlikely to help.

## 7 Complexity of OT Ranking

We now consider two ranking problems. These ask whether $`𝒞`$ can be ranked in a manner consistent with attested forms or attested sets:

* $`\text{Rankable}(𝒞,\{x_1,\mathrm{}x_m\})`$: returns “yes” iff there is a ranking $`\stackrel{}{C}`$ of $`𝒞`$ such that $`\text{Check}(\stackrel{}{C},x_i)`$ for all $`i`$.
* $`\text{RankableSSet}(𝒞,\{X_i,\mathrm{}X_m\})`$: returns “yes” iff there is a ranking $`\stackrel{}{C}`$ of $`𝒞`$ such that $`\text{CheckSSet}(\stackrel{}{C},X_i)`$ for all $`i`$.

We do not have an exact classification of Rankable at this time. But interestingly, the special case where $`m=1`$ and the constraints take values in $`\{0,1\}`$ (which has sufficed to show most of our hardness results) is only coNP-complete—the same as Check, which merely verifies a solution. Why? Here Rankable need only ask whether there exists any $`y\text{Gen}(u_{x_1})`$ that satisfies a proper superset of the constraints that $`x_1`$ satisfies. For if so, $`x_1`$ cannot be optimal under any ranking, and if not, then we can simply rank the constraints that $`x_1`$ satisfies above the others. This immediately implies that the special case is in coNP. It also implies it is coNP-hard: using the grammar from our proof that Check is coNP-hard (§6.3), we write $`\text{CNF-Sat}(\varphi )=\neg \text{Rankable}(𝒞,\{ϵ\})`$.

The RcdAll algorithm of §4 provides an upper bound on the complexity of Rankable. We saw in §4.1 that RcdAll can decide Rankable with $`O(n^2m)`$ calls to Opt (where $`n=|𝒞|`$). In fact, it suffices to call Check rather than Opt (since RcdAll only tests whether $`x_i\text{Opt}(\mathrm{})`$). Since $`\text{Check}\text{coNP}`$, it follows that Rankable is in $`\text{P}^{\mathrm{𝖼𝗈𝖭𝖯}}=\text{P}^{\mathrm{𝖭𝖯}}=\mathrm{\Delta }_2^p`$.171717Tesar’s EDCD and MRCD algorithms (§4.2) also run in polytime given an NP oracle. They too decide Rankable with polynomially many calls to Opt. While they cannot substitute Check for Opt, they can substitute OptVal (since they need optimal $`y`$ only to compute $`\stackrel{}{C}(y)`$). Each call to $`\text{OptVal}\text{FP}^{\mathrm{𝖭𝖯}}`$ can then be replaced by polynomially many calls to $`\text{Check}\text{coNP}`$. It is not relevant to RcdAll vs. EDCD that calling Check once (coNP-complete) is in an easier complexity class than calling OptVal once ($`\text{FP}^{\mathrm{𝖭𝖯}}`$-complete). Nor is it relevant for any practical purpose, since these two classes collapse under Turing (Cook) reductions.

RankableSSet is certainly in $`\mathrm{\Sigma }_2^p`$, since it may be phrased in $``$ form as $`(\stackrel{}{C},\{x_iX_i\})`$ $`(i,y_i\text{Gen}(u_{x_i}))`$ $`\stackrel{}{C}(x_i)\stackrel{}{C}(y_i)`$. We saw in §5 that it is NP-hard even when the constraints interact simply. One suspects it is $`\mathrm{\Delta }_2^p`$-hard, since merely verifying a solution (i.e., CheckSSet) is $`\mathrm{\Delta }_2^p`$-complete (§6.3). We now show that is actually $`\mathrm{\Sigma }_2^p`$-hard and therefore $`\mathrm{\Sigma }_2^p`$-complete.

The proof is by reduction from the canonical $`\mathrm{\Sigma }_2^p`$-complete problem $`\text{QSat}\text{2}(\varphi ,r)`$, where $`\varphi =_{i=1}^mD_i`$ is a CNF formula with $`\mathrm{}(\varphi )r0`$. This returns “yes” iff

$$b_1,\mathrm{}b_r\neg b_{r+1},\mathrm{}b_s\varphi (b_1,\mathrm{}b_s),$$

where $`s\stackrel{\mathrm{def}}{=}\mathrm{}(\varphi )`$ and $`\varphi (b_1,\mathrm{}b_s)`$ denotes the truth value of $`\varphi `$ when the variables $`v_1,\mathrm{}v_s`$ are bound to the respective binary values $`b_1\mathrm{}b_s`$.

Given an instance of QSat2 as above, put $`=\{ϵ\}`$ and $`\text{Gen}(ϵ)=\{0,1\}^{r+s}X`$ where $`X=`$ the set $`\{0,1\}^r2`$. Let $`𝒞=\{C_{D_1},\mathrm{}C_{D_m}`$, $`C_{v_1},\mathrm{}C_{v_r}`$, $`C_{\neg v_1},\mathrm{}C_{\neg v_r},\overline{X}\}`$, where all constraints have range $`\{0,1\}`$, we extend $`C_{D_i}`$ over $`X`$ by defining it to be satisfied (i.e., take value 0) on all candidates in $`X`$, and we define $`\overline{X}`$ to be satisfied on exactly those candidates not in $`X`$. As before, $`C_{v_i}`$ and $`C_{\neg v_i}`$ are satisfied on a candidate iff its $`i^{\mathrm{th}}`$ bit is 1 or 0 respectively, regardless of whether the candidate is in $`X`$.

We now claim that $`\text{QSat}\text{2}(\varphi ,r)=\text{RankableSSet}(𝒞,\{X\})`$. The following terminology will be useful in proving this: Given a bit sequence $`\stackrel{}{b}=b_1,\mathrm{}b_r`$, define a $`\stackrel{}{b}`$-satisfier to be a bit string $`b_1\mathrm{}b_rb_{r+1}\mathrm{}b_s`$ such that $`\varphi (b_1,\mathrm{}b_s)`$. For $`1ir`$, let $`B_i,\overline{B}_i`$ denote the constraints $`C_{v_i},C_{\neg v_i}`$ respectively if $`b_i=1`$, or vice-versa if $`b_i=0`$. We then say that a ranking $`\stackrel{}{C}`$ of $`𝒞`$ is $`\stackrel{}{b}`$-compatible if $`B_i`$ precedes $`\overline{B}_i`$ in $`\stackrel{}{C}`$ for every $`1ir`$.

First observe that a candidate $`y\text{Gen}(ϵ)`$ is a $`\stackrel{}{b}`$-satisfier iff it satisfies the constraints $`B_1,\mathrm{}B_r`$ and $`C_{D_1},\mathrm{}C_{D_m}`$ and $`\overline{X}`$. From this it is not difficult to see that if $`\stackrel{}{C}`$ is a $`\stackrel{}{b}`$-compatible ranking, then $`y`$ beats $`x`$ (i.e., $`\stackrel{}{C}(y)<\stackrel{}{C}(x)`$) for any $`\stackrel{}{b}`$-satisfier $`y`$ and any $`xX`$.181818$`y`$ satisfies $`\overline{X}`$ while $`x`$ doesn’t, so $`\stackrel{}{C}(y)\stackrel{}{C}(x)`$. And $`\stackrel{}{C}(y)>\stackrel{}{C}(x)`$ is impossible, for if $`x`$ satisfies any constraint that $`y`$ violates, namely some $`\overline{B}_i`$, then it violates a higher-ranked constraint that $`y`$ satisfies, namely $`B_i`$. Now for the proof:

Suppose $`\text{RankableSSet}(𝒞,`$ $`\{X\})`$. Then choose $`xX`$ and $`\stackrel{}{C}`$ a ranking of $`𝒞`$ such that $`x`$ is optimal (i.e., $`\text{Check}(\stackrel{}{C},x)`$). For each $`1ir`$, let $`b_i=1`$ if $`C_{v_i}`$ is ranked before $`C_{\neg v_i}`$ in $`\stackrel{}{C}`$, otherwise $`b_i=0`$. Then $`\stackrel{}{C}`$ is a $`\stackrel{}{b}`$-compatible ranking. Since $`xX`$ is optimal, there must be no $`\stackrel{}{b}`$-satisfiers $`y`$, i.e., $`\text{QSat}\text{2}(\varphi ,r)`$.

Conversely, suppose $`\text{QSat}\text{2}(\varphi ,r)`$. This means we can choose $`b_1,\mathrm{}b_r`$ such that there are no $`\stackrel{}{b}`$-satisfiers. Let $`\stackrel{}{C}=C_{D_1},\mathrm{}C_{D_m}`$, $`B_1,\mathrm{}B_r`$, $`\overline{B}_1,\mathrm{}\overline{B}_r,\overline{X}`$. Observe that $`x=b_1\mathrm{}b_r2X`$ satisfies the first $`m+r`$ of the constraints; this is optimal (i.e., $`\text{Check}(\stackrel{}{C},x)`$), since any better candidate would have to be a $`\stackrel{}{b}`$-satisfier.191919Since it would have to satisfy the first $`m+r`$ constraints plus a later constraint, which could only be $`\overline{X}`$. Hence there is a ranking $`\stackrel{}{C}`$ consistent with $`X`$, i.e., $`\text{RankableSSet}(𝒞,\{X\})`$.

## 8 Optimization vs. Derivation

The above results mean that OT generation and ranking are hard. We will now see that they are harder than the corresponding problems in deterministic derivational theories, assuming that the complexity classes discussed are distinct.

A derivational grammar consists of the following elements (cf. §2):

* an alphabet $`\mathrm{\Sigma }`$;
* a set $`\mathrm{\Sigma }^{}`$ of underlying forms;
* a vector $`\stackrel{}{R}=R_1,\mathrm{}R_n`$ of rules, each of which is a function from $`\mathrm{\Sigma }^{}`$ to $`\mathrm{\Sigma }^{}`$.

The grammar maps each $`x`$ to $`\stackrel{}{R}(x)\stackrel{\mathrm{def}}{=}R_n\mathrm{}R_2R_1(x)`$. If all the rules are polytime-computable (i.e., in the function class FP), then so is $`\stackrel{}{R}`$. (By contrast, the OT analogue Opt is complete for the function class $`\text{FP}^{\mathrm{𝖭𝖯}}`$.) It follows that the derivational analogues of the decision problems given at the start of §6 are in P202020However, Wareham \[Wareham, 1998\] analyzes a more powerful derivational approach where the rules are nondeterministic: each $`R_i`$ is a relation rather than a function. Wareham shows that generation in this case is NP-hard (Theorem 4.3.3.1). He does not consider learning. (whereas we have seen that the OT versions range from NP-complete to $`\mathrm{\Delta }_2^p`$-complete).

How about learning? The rule ordering problem OrderableSSet takes as input a set $``$ of possible rules, a unary integer $`n`$, and a set of pairs $`\{(u_1,X_1),\mathrm{}(u_m,X_m)\}`$ where $`u_i\mathrm{\Sigma }^{}`$ and $`X_i\mathrm{\Sigma }^{}`$. It returns “yes” iff there is a a rule sequence $`\stackrel{}{R}^n`$ such that $`(i)\stackrel{}{R}(u_i)X_i`$. It is clear that this problem is in NP. This makes it easier than its OT analogue RankableSSet and possibly easier than Rankable.

For interest, we show that OrderableSSet is NP-complete, as is its restricted version Orderable (where the attested sets $`X_i`$ are replaced by attested forms $`x_i`$). As usual, our result holds even with finite-state restrictions: we can require the rules in $``$ to be regular relations \[Johnson, 1972\]. The hardness proof is by reduction from Hamilton Path (defined in §5.1). Given a directed graph $`G`$ with vertices $`1,2,\mathrm{}n`$, put $`\mathrm{\Sigma }=\{\mathrm{\#},0,1,2,\mathrm{}n\}`$. Each string we consider will be either $`ϵ`$ or a permutation of $`\mathrm{\Sigma }`$. Define $`\text{Move}_j`$ to be a rule that maps $`\alpha j\beta \mathrm{\#}\gamma i`$ to $`\alpha \beta \mathrm{\#}\gamma ij`$ for any $`i,j\mathrm{\Sigma }`$, $`\alpha ,\beta ,\gamma \mathrm{\Sigma }^{}`$ such that $`i=0`$ or else $`G`$ has an edge from $`i`$ to $`j`$, and acts as the identity function on other strings. Also define Accept to be a rule that maps $`\mathrm{\#}\alpha `$ to $`ϵ`$ for any $`\alpha \mathrm{\Sigma }^{}`$, and acts as the identity function on other strings. Now $`\text{Orderable}(\{\text{Move}_1,\mathrm{}\text{Move}_n,\text{Accept}\},n+1,\{(12\mathrm{}n\mathrm{\#}0,ϵ)\})`$ decides whether $`G`$ has a Hamilton path.

## 9 Conclusions

See the abstract for our most important results. Our main conclusion is a warning that OT carries large computational burdens. When formulating the OT learning problem, even small nods in the direction of realism quickly drive the complexity from linear-time up through coNP (for multiple competitors) into the higher complexity classes (for multiple possible surface forms).

Hence all OT generation and learning algorithms should be suspect. Either they oversimplify their problem, or they sometimes fail, or they take worse than polynomial time on some class of inputs. (Or they demonstrate $`\text{P}=\text{NP}`$!)

One constraint ranking problem we consider, RankableSSet, is in fact a rare “natural” example of a problem that is complete for the higher complexity class $`\mathrm{\Sigma }_2^p`$ (“$``$”). Intuitively, an OT learner must both pick a constraint ranking ($``$) and check that an attested form beats or ties all competitors under that ranking ($``$). Some other learning problems were already known to be $`\mathrm{\Sigma }_2^p`$-complete \[Ko and Tzeng, 1991\], but ours differs in that the input has no negative exemplars (not even implicit ones, given ties).

This paper leaves some theoretical questions open. Most important is the exact classification of Rankable. Second, we are interested in any cases where problem variants (e.g., accepting vs. rejecting the finite-state assumptions) differ in complexity. Third, in the same spirit, parameterized complexity analyses \[Wareham, 1998\] may help further identify sources of hardness.

We are also interested in more realistic versions of the phonology learning problem. We are especially interested in the possibility that $`𝒞`$ has internal structure, as discussed in footnote 4, and in the problem of learning from general attested sets, not just attested surface sets.

Finally, in light of our demonstrations that efficient algorithms are highly unlikely for the problems we have considered, we ask: Are there restrictions, reformulations, or randomized or approximate methods that could provably make OT learning practical in some sense?