Papers
Project Theory: Formal Academic Version
The same theoretical framework, presented with rigorous formulations, complexity bounds, and full bibliographic details for all sources. This version has undergone seven rounds of external academic review; the errors identified during the process - including our own - have been corrected.
- LEVEL 1. ESSENTIAL PREREQUISITES
- LEVEL 2. FOR THE THEORY CHAPTER
- LEVEL 3. NAME AND CITE, NO PROOF REQUIRED
- WHAT AUTOMATA COURSES LEAVE OUT, BUT THE WORK REQUIRES: METRICS
- BEFORE THE AUTOMATON AND AFTER THE DETECTOR: THREE TOPICS ABSENT FROM EVERY COURSE
- TEAM SELF-CHECK
- HOW TO OBTAIN THE SOURCES
- MINIMUM PATH IF YOU HAVE NOT TAKEN AN AUTOMATA COURSE
This handbook is intended for students and their supervisor. Not every degree program includes a course in automata theory, and where it exists, it is often an elective. Therefore, this syllabus is written to serve both cases: if the team has taken the course, they will see which specific exam topics apply here; if they have not, they will see what to read and in what depth. Each item is framed not as a topic, but as a skill: what the student must be able to carry out by hand.
The syllabus is divided into three levels. Level 1 is mandatory: the work cannot be done without it. Level 2 is required for those writing the theoretical chapter. Level 3 is for naming and citing; proofs are not required.
The textbooks are standard: Hopcroft, Motwani, and Ullman (hereafter HMU), and Sipser. Full bibliographic details are provided for all papers, making it clear what is available through university subscriptions and what is open access. The access guide is at the end.
LEVEL 1. ESSENTIAL PREREQUISITES
1. DFAs, NFAs, and their equivalence; the subset construction. HMU Ch. 2; Sipser Theorem 1.39. Where it applies: our error pattern is a finite automaton over an alphabet of word classes. The statement "the matcher only sees the nearest neighbor" is a claim about states, not code, and can only be debated in terms of the automaton. Skill: construct an automaton by hand for one of our patterns and determine its number of states.
2. Closure properties of regular languages: union, intersection, complementation, difference; the product construction. HMU Ch. 4.2. Where it applies: this is the core of the project, not a mere formality. A "deviation from a construction" is the difference of two languages: all phrases where the construction is detected, minus those where it is well-formed. A negative constraint ("there is no determiner to the left of the noun") is complementation. A gap between anchors is concatenation with Σ* if the gap is arbitrary. Three expressions must be kept distinct: Σᵏ for exactly k symbols, the union of powers from zero to k for a gap of length at most k, and Σ* for a gap of arbitrary length. A common mistake is to write a fixed power where a Kleene star is needed. Restricting the scope is intersection.
Two of our three measured defects map directly to closure operations: the lack of a negative constraint is complementation; seeing only the nearest neighbor is a fixed-width window where an arbitrary gap is needed, that is, concatenation with Σ*. The third defect, the absence of grammatical classes in the alphabet, is not an operation but alphabet impoverishment - it is analyzed in item 3. All three preserve regularity. Skill: for each proposed extension of the formalism, state which operation it corresponds to, whether the language remains regular, and the computational cost you will pay for it. The cost of complementation must be stated precisely. For a complete deterministic finite automaton, complementation costs a swap of the set of accepting states, which is linear in the number of states.
Exponential blowup occurs when the initial description is nondeterministic (an NFA or regular expression): to complement it, one must first determinize it, and the subset construction yields an exponential blowup in the worst case. One must write "under the standard construction via a DFA": the exponential blowup is the cost of this specific pathway, not a theorem stating that no other exists. In other models, complementation works differently (for alternating finite automata, it reduces to swapping quantifiers and is inexpensive), but the cost does not vanish; it merely relocates - there, it appears in the emptiness check. This distinction must be stated explicitly, rather than discovered during the first runtime test.
3. The Myhill-Nerode theorem and DFA minimization. HMU Ch. 4.4 (the Myhill-Nerode theorem and minimization - 4.4.1-4.4.3; equivalence and decidability - 4.3; numbering follows the 3rd edition, 2007); Sipser - Problem 1.52. Two distinct arguments are needed here, and they are frequently conflated.
The first argument concerns the alphabet boundary. Take two phrases with the exact same sequence of word classes but different ground-truth labels. Over the class alphabet, this is one and the same string; that is, the required labeling is not a function of the class sequence at all - no model, whether an automaton, a grammar, or a language model, can produce different outputs for identical inputs. This is an argument about feature loss under the "word-to-class" projection, and it must be referred to as such. The Myhill-Nerode theorem does not apply to it, and the theorem itself must be stated carefully: the equivalence relation is defined for any pair of strings (x and y are equivalent if for every extension z, the strings xz and yz are either both in the language or both outside it); x and y are not required to be distinct in the definition.
Identical strings are trivially equivalent - therefore, by the Myhill-Nerode theorem, nothing whatsoever follows from the collision of class sequences. The theorem becomes substantive on distinct strings that are pairwise inequivalent. The practical conclusion is stronger than the initial premise: such an error family is remedied by enriching the alphabet (with morphological features, lemmas, subclasses), not by adding states, and until the alphabet is enriched, a subset of cases remains indistinguishable in principle. However, be careful with the strength of this conclusion: feature loss implies the impossibility of classifying all cases without error, not a plateau in performance - over the same alphabet, classification can still be improved until you hit the upper bound of that representation.
Moreover, this bound is measurable, which constitutes an independent result for the empirical chapters. Group the annotated corpus into equivalence classes of identical input representations; in each class c, count the number of erroneous instances n+ and correct instances n-; then the maximum achievable accuracy for any classifier that only has access to this representation is the sum over all classes of max(n+, n-), divided by the total sample size N. This bound holds for any decision rule that is a function of this representation; for a randomized rule, the same value bounds the expected accuracy. This is a bound for a given representation on a given corpus - not a universal limit and not an F0.5 score (which is a different metric; see item 20).
There are three conditions without which the figure itself cannot be properly computed. First: the unit of observation must be declared, that is, what counts as a single instance. For us, this is not a sentence, but a check site - a window around a candidate (the word plus its context of whatever width the rule inspects); the bound cannot be computed at the sentence level because a single sentence contains multiple check sites with different ground-truth labels. Second: raw accuracy under our class imbalance is inherently high - erroneous instances are orders of magnitude fewer than correct ones, so the "never trigger" rule already yields an accuracy close to one. Therefore, alongside the bound, one must report the same metric for the trivial majority-class baseline: it is the margin between them that is informative, not the absolute number.
Third: if a bound is needed specifically for F0.5, it is computed over the same classes, but by a different derivation - by choosing which classes to declare positive: each class c yields n+ true positives and n- false positives, and the maximum of F0.5 is found without a brute-force search over all subsets. For a fixed total number of actual errors, the F-measure is a ratio of linear functions of the number of true positives and false positives; therefore, the optimal set consists precisely of those classes where the error rate exceeds some threshold. A single pass over the classes sorted in descending order of the proportion of errors in the class, n+/(n+ + n-), examining the prefixes of this ordering, is sufficient. One cannot sort by the ratio n+/n-: when n- = 0 it is undefined, and it is precisely these classes that must come first in the ordering.
The derivation is brief, and it is worth including in full in the paper because it is a standalone result. Let E denote the total number of gold-standard errors, T the number of true positives, and F the number of false positives. Substituting P = T/(T + F) and R = T/E into the definition of the measure yields F0.5 = 1.25 T / (0.25 E + T + F). Adding a class containing a error instances and b correct instances increases the measure if and only if a/(a + b) > T/(0.25 E + T + F), that is, when the proportion of errors in the class is strictly greater than F0.5/1.25 for the current set. This threshold is identical for all classes - hence the optimality of a prefix: at the optimum, every included class has a proportion above the threshold, and every excluded class has one below it. Cost: grouping takes O(N) time assuming constant-size representations are hashed, sorting takes O(C log C) time for C classes, and scanning the prefixes takes O(C) time.
Three degenerate cases are stated separately: when E = 0, the measure is undefined; the empty set of classes (T = F = 0) is assigned zero by convention, and this convention is explicitly stated; classes with an equal proportion of errors yield the same measure, so the relative order among them is immaterial. This is the same representation bound, calculated for the target metric. It is worth computing before writing the detector: it tells you how much information is lost before the automaton even runs.
The second argument is Nerode's theorem proper: the number of equivalence classes equals the number of states in the minimal automaton. From this follow lower bounds ("this pattern cannot be expressed in fewer states") and non-regularity when the number of classes is infinite. From this also follows the canonicity of the minimal automaton: two specific languages are compared by constructing their minimal automata, not by informal discussion. A caveat, without which the conclusion is overstated: canonicity decides the equality of two languages, but does not by itself prove the equal expressive power of two formalisms - that requires a separate argument. And a second caveat, more important for our project: minimization and equivalence testing apply to a recognizer, whereas our detector is not a recognizer.
A recognizer is a function from strings to yes/no; a detector returns a set of matches, that is, pairs of "span plus rule identifier". Two detectors can define the exact same language of error-containing sentences while pointing to different locations - and with respect to TP, FP, and FN from Sections 17 and 26, they are different detectors. Consequently, the equivalence of two implementations cannot be proved on recognizers: one must first declare an output model - either an annotated alphabet where the error position is part of the string, or a finite-state transducer from Section 9 - and verify equality within that model. Until the model is declared, the phrase "the two versions of the detector are equivalent" has no testable meaning. The model must be chosen before the first claim of implementation equality appears in the paper.
Skill: for one family of errors, carry one of the two arguments through to the end and state which argument it is; minimize an automaton.
Two complexity bounds for minimization should be kept separate, because our alphabet consists of word classes and grows: Moore's algorithm (iterative partition refinement) is O(|Σ| cdot n²): the alphabet size cannot be omitted here; Hopcroft (An n log n algorithm for minimizing states in a finite automaton, Stanford technical report STAN-CS-71-190, 1971) is k cdot n log n, where k in the original paper is the number of input symbols of the automaton, so the bound reads as O(|Σ| cdot n log n). We cite the table-filling method of pairs from the textbook (HMU 4.4.2) and advise citing it the same way: we have not held Moore's 1956 paper in our hands, so in this handbook we will neither attribute this method to it nor deny its contribution - that is a question for the primary source, not for us.
4. The pumping lemma. HMU Sec. 4.1; Sipser Theorem 1.70. Where it applies: when the required memory is unbounded - counting (equal numbers of one thing and another) and unbounded nesting of agreement - the detector cannot be a finite automaton at all, and this is also a valid result. An important boundary where it is easy to stumble: agreement across an arbitrarily long linear insertion (a feature on the left, any number of words in between, the agreeing word on the right) is regular - a finite feature fits into the state. Non-regularity arises not from length, but from the need to store an unbounded amount of information: counting or unbounded nesting. The converse is also false: the mere possibility of unbounded nesting does not yet prove non-regularity - one must prove that recognition requires unbounded memory, using the pumping lemma or via the number of Nerode equivalence classes.
Otherwise, Section 7 would contradict this section: the TSL class, designed precisely for agreement across intervening material, lies entirely within the regular languages. Skill: apply the lemma to one family and understand that it is one-directional. If a contradiction is obtained, the language is not regular. If no contradiction is obtained, this is not a proof of regularity: regularity is proved by constructing an automaton or regular expression, or via closure properties from Section 2. The converse implication is a standard error, and it stands out in a text immediately. The inadequacy of our automaton when the language is regular is proved not by pumping, but by one of the two arguments in Section 3. A separate case is bounded nesting. If the nesting depth is bounded by a constant d, the language is regular again: the state stores a stack of unclosed features of height at most d.
The cost is a number of states exponential in the depth; however, this claim must be made about a formally defined language, not about the phrase "nested agreements", otherwise it is not a theorem. Take the language of balanced parenthesis strings of f types with depth at most d (an opening parenthesis is a feature, a closing one is the word agreeing with it). The complete minimal DFA for it has exactly 1 + (f^(d+1) - 1)/(f - 1) states: one for each reachable stack of height at most d, plus a dead state; for f = 1 the fraction is undefined, and the number of states is d + 2. That this is a lower bound on the number of states, rather than just the size of our construction, is proved via Nerode, and the proof requires three conditions - all three hold here. First: every stack is reachable, built up by reading opening parentheses.
Second, each stack has a valid continuation: closing it in reverse order. Third, this continuation is not accepted from any other stack; the very first type mismatch or non-empty remainder leads to the trap state. The state counts have been machine-verified by minimization for f from 2 to 4 and d from 1 to 5: 8 for f = 2 and d = 2, 41 for f = 3 and d = 3, and 365 for f = 3 and d = 5. Transferring this argument to agreement is a separate step, and it is valid precisely when the agreeing word identifies the type of its feature, meaning that pairs are matched in order of nesting. If one only checks membership in a finite class without matching pairs, the problem is simpler and does not require this many states. Takeaway for the paper: bounding the depth brings the problem inside the regular languages, but the bound d must be stated explicitly, along with the price paid for it.
LEVEL 2. FOR THE THEORY CHAPTER
5. Kleene's theorem, Thompson's construction. HMU Ch. 3. Needed by whoever builds the pattern compiler: this is the bridge between our notation and regular expressions.
6. Decidable properties of regular languages: emptiness (reachability), membership, equivalence, inclusion. HMU Ch. 4.3. Where it applies: "the extension covers more" is a language inclusion claim. It can be verified, but the cost must be stated together with the input representation: for deterministic finite automata, inclusion is decidable in polynomial time (product construction and emptiness check), whereas for nondeterministic automata and regular expressions the problem is PSPACE-complete. On DFAs, verification is cheaper than arguing; on regular expressions, look at the size first.
7. The subregular hierarchy: SL-k (strictly local), LT-k (locally testable), SP (strictly piecewise), and PT (piecewise testable; SP is a proper subclass of PT, with different properties and different complexity), SF (star-free), TSL (tier-based strictly local). A standard automata course does not cover this, making it a place for the paper's own contribution rather than a textbook recap. Scope for this item: the team needs the class definitions and one measured transition between two of them. The algebra and complexity bounds below are given for reference so that the wording in the paper does not turn out to be false; you do not need to prove them. Where it applies. It is easy to go wrong here, and two mistakes are so common that they are singled out below.
First mistake: fixed window width does not imply membership in SL-k. A window gives a local condition of fixed width, whereas the class of the language recognized in this way must be established separately. The counterexample is short. The language "the text contains a determiner followed immediately by a noun" - that is, the language of strings containing the contiguous factor DN - is recognized by a two-symbol window, yet it is not strictly local for any k. Keep two similarly worded languages apart, or this point will read as self-contradictory: the contiguous pair DN and "a D somewhere, and an N later, across an arbitrary gap" are different languages belonging to different classes; the first is LT-2, while the second, as discussed below, is not LT for any k.
The hallmark of SL is closure under suffix substitution: if u₁ v w₁ and u₂ v w₂ are in the language and v has length k-1, then u₁ v w₂ must also be in the language. For k = 2, take v = D, u₁ and w₂ empty, w₁ = N, and u₂ = DN: the string u₁ v w₁ = DN is in the language, u₂ v w₂ = DND is in the language, but u₁ v w₂ = D is not. The condition fails, so the language is not SL-2; the same construction works for any k (take v to be k-1 letters D). The contiguous-pair language is locally testable, LT-2: LT can require the presence of a factor, whereas SL only specifies a list of permitted factors and cannot enforce presence. By contrast, the complement of this language - "nowhere is there a determiner-noun pair" - really is SL-2, because it is defined by a single forbidden factor. Consequence for the entire paper: one must distinguish four different objects - the language of well-formed constructions, the language of ill-formed constructions, the language of sentences containing an error, and the local detection mechanism.
A detector that fires upon seeing a forbidden factor defines the third of these, and the third lies on the LT side, not the SL side. Question 1 of our self-check asks about precisely this. Second mistake: SL and PT are not two rungs of the same ladder, but classes that are incomparable under inclusion. SL and LT are built on contiguous substrings (factors), while SP and PT are built on scattered subwords (subsequences), and neither branch is contained in the other (see Graf 2022 for a survey and a diagram of the hierarchy). This can be verified directly on witness strings. The language "no factor DN" (which is SL-2) is not PT for any k: for k = 2, the strings DAND and DADND have the exact same set of subsequences of length up to two, yet the first is in the language and the second is not; for k = 3, the same pair with an extra DA - DADAND and DADADND - works.
Here too, "and so on" is not a proof, so we give the family: x(k) = (DA)^k N D and y(k) = (DA)^k D N D. The first string does not contain the factor DN, while the second does, yet their sets of subsequences of length up to k coincide - and this too can be proved. The alternation (DA)^k contains as a subsequence every string of length at most k over the letters D and A; the same holds for (DA)^k D. Therefore, for both strings, the set of subsequences of length at most k is the union of three families, with different bounds on the length of u: strings u with |u| at most k, strings u N with |u| at most k-1, and strings u N D with |u| at most k-2, where u is an arbitrary string over D and A; after the sole letter N, both strings have exactly one D remaining.
A single uniform bound of k-1 across all three families is not enough: for k = 2, the subsequence DA occurs in both strings, yet would be missed by such a description. The subsequence sets coincide, while the strings differ in language membership. Machine verification for k from 1 to 7 served as a check on both the equality of the sets and the description itself. Conversely, the language "there is a D somewhere, and an N later" is not LT for any k. The class of this language is PT-2; a common mistake is to call it SP-2. SP (strictly piecewise) languages are defined by a list of permitted subsequences and are therefore closed under symbol deletion: if a string is in the language, every subsequence of it is also in the language. Our language violates this on two letters - DN is in the language, its subsequence D is not - so it is not SP for any k.
As in the first mistake, what turns out to be SP-2 is the complement: "DN is not a subsequence", a single forbidden subsequence. The mistake is the exact same one as in the first case, just on the other branch of the hierarchy: presence lives on the testable side (LT, PT), whereas the strict side (SL, SP) can only forbid. This is not a theorem about the wording of a definition, but a heuristic that comes with a proof obligation: whenever you hear "contains", look for a violation of suffix substitution (for SL) or of downward closure under deletion (for SP), and prove it for your language.
The exact formulation is a theorem with a premise, and that premise must be stated explicitly. Theorem: over an alphabet of at least two letters, the language "contains the factor w" for a non-empty w is not SL-k for any k. The proof takes a single line and holds for any w: pick a letter c such that w is not a power of c - with two letters, such a c always exists - and set v = cᵏ⁻¹, let u₁ and w₂ be empty, w₁ = w, and u₂ = w. Then u₁ v w₁ = cᵏ⁻¹ w and u₂ v w₂ = w cᵏ⁻¹ are in the language, whereas u₁ v w₂ = cᵏ⁻¹ is not: suffix substitution fails. As a special case for w = D over the alphabet {D, N} at k = 2: v = N, the words ND and DN are in the language, while N is not. The two-letter premise in the theorem is not merely decorative: without it, the statement is false. Over a one-letter alphabet, the language "contains D" coincides with the language of all non-empty words, satisfies suffix substitution, and turns out to be SL-2 (machine-verified) - this marks the boundary of the theorem, not an exception to it.
Presence at a fixed position is accessible to the strict side over any alphabet: the language "the word begins with D" is strictly local (all initial segments other than D are forbidden), and the language consisting of the single word DN is likewise SL-2. Therefore, saying "the strict side can only forbid" works as a heuristic for where to look, but in the text of a paper there must be a theorem with its own premise and its own proof for your specific language.
Non-membership in LT is proved via a family of witnesses, one pair for each k: x(k) = N A^k D A^k N A^k and y(k) = N A^k N A^k D A^k. They share the exact same sets of factors of length up to k, and the same prefix and suffix of length k-1, yet x contains D before N, whereas y does not. The equality of the factor sets is proved here, not merely checked. Letters other than A appear in both words at a distance of k from one another, so any window of length at most k sees at most one such letter; consequently, the set of factors of length up to k for each word equals the set of words of the form A^i (with i at most k) and A^i X A^j, where X is D or N, and i + j + 1 is at most k. In both words, both D and N have an occurrence flanked by k letters A on either side, meaning all such factors are present in both; the prefix and suffix of length k-1 coincide by construction.
Machine verification for k from 1 to 8 served as a sanity check on this argument, not a replacement for it. Two specific pairs (NDANA versus NANDA and NADAANAA versus NAANADAA) are valid in themselves, but two examples do not suffice to establish a claim about a class - one needs a family parameterized by k. Consequently, the phrase "we moved from SL to PT" as a description of an added gap is doubly wrong: it classifies an operation by its surface appearance and presupposes a hierarchy that does not exist. Worse still, a detector where local and piecewise conditions operate together can define a language that lies neither in LT nor in PT.
How to write so that the contribution stands. One takes the specific language of a single rule before expansion and the same language after; for each, class membership is proved - either algebraically using the characterizations below, or via the tool plebby, which computes this directly from the automaton - and the cost of the transition is measured separately in terms of false alarms. Then the text contains a verifiable claim of the form "the language of rule X was LT-2 and became PT-2, and the cost of the transition is Y false alarms on sample Z", rather than a narrative about having added a skip. That is precisely the difference that separates tool-building from research, and now it is verifiable as well.
Let us note TSL separately: this class was introduced for phonological tiers, that is, for dependencies across irrelevant intervening material (Heinz, Rawal, Tanner, Tier-based Strictly Local Constraints for Phonology, ACL 2011, pp. 58-64; seven pages, open access in the ACL Anthology). Morphosyntactic agreement across intervening material is structurally the same dependency, but transferring TSL to syntax is an application rather than the original purpose of the class; state this explicitly in your paper, otherwise you end up citing the article for something it does not contain. And state the transfer condition explicitly, because it does not always hold: TSL works when the intervening material is irrelevant to the dependency, meaning it is not projected onto the tier. Where other candidates of the same class stand between the anchors, the tier projects all of them, and the condition breaks down; with unbounded nesting of the form N1 N2 ...
V2 V1, the dependency can escape not only TSL, but regular languages altogether - and it does so under a specific premise: if each V is required to agree with its own N, meaning pairs are matched in order of nesting, and the feature has at least two values. If, however, one only checks that words belong to a finite class without matching pairs, the language remains regular: the nesting schema by itself does not induce non-regularity, and point 4 states the exact same thing. Therefore, a paper must declare which specific insertions are treated as irrelevant, and this declaration must be validated against the data.
Classes are not recognized by eye; there are theorems for this. The formulations below (for reference) have been verified against the primary sources and the open-access survey by Pin, Syntactic semigroups (chapter in Handbook of Formal Languages, vol. I, pp. 679-746, Springer 1997; author's preprint is openly available):
- star-free: a language is star-free if and only if its syntactic
monoid is finite and aperiodic. Schutzenberger, On finite monoids having only
trivial subgroups, Information and Control 8(2), 1965, pp. 190-194. The word "finite"
is mandatory. The connection to first-order logic FO(<) is due to McNaughton and Papert
1971, and the full four-part theorem is called the
Schutzenberger-McNaughton-Papert theorem; it cannot be attributed to Schutzenberger alone. Checking
aperiodicity is PSPACE-complete even when the input is a DFA (Cho, Huynh, Finite-automaton
aperiodicity is PSPACE-complete, Theoretical Computer Science 88(1), 1991, pp.
99-116); the input model must be specified here, otherwise the bound reads as milder than it
actually is. - piecewise testable: a language is piecewise testable if and only if its
syntactic monoid is finite and J-trivial. Simon, Piecewise testable events, in:
Automata Theory and Formal Languages, 2nd GI Conference, LNCS 33, Springer 1975, pp.
214-222 (conference proceedings, not a journal; originally a dissertation, University of
Waterloo, 1972). A terminological trap: in this tradition, subword means
subsequence (scattered subword), whereas a contiguous fragment is called a
factor. Reading subword as "substring" yields a false theorem.
Complexity here involves four distinct questions that must not be conflated: whether a language is piecewise testable at all, and whether it is piecewise testable for a given k, each asked separately for a DFA input and an NFA input. A summary of all four is compiled in one place - Masopust, Piecewise Testable Languages and Nondeterministic Automata, MFCS 2016 (preprint arXiv:1603.00361 is open access), Table 1; we take our bounds from there. First question: for a DFA input, the problem is NL-complete (Cho, Huynh 1991); for an NFA input, it is PSPACE-complete. Second question, for a given k: for a DFA input over an arbitrary alphabet, it is NL-complete for k = 2 and 3, and coNP-complete for k >= 4 (for k = 1 the problem is solvable in LOGSPACE, see below; the summary table collapses these cells into a single row "k <= 3", so for k = 1 this is an upper bound rather than a tight one), whereas over a fixed alphabet it is polynomial for any k; for an NFA input, it is coNP-complete over a unary alphabet, and PSPACE-complete over both fixed and arbitrary alphabets.
For us, the cell that matters is "DFA, fixed alphabet": our alphabet of word classes is fixed, so coNP-completeness does not apply to our classification problem at all. Secondary accounts often misattribute this result: coNP-completeness for k >= 4 was established neither in the Masopust 2016 survey nor in Masopust, Thomazo, DLT 2015, but in Klima, Kunc, Polak, Deciding k-piecewise testability - a paper that circulated for a long time as a manuscript and appears in the International Journal of Algebra and Computation, Vol. 36, No. 8. The proof there requires a growing alphabet, as Masopust states explicitly (arXiv:1907.13115), which is precisely why a fixed alphabet escapes this bound. Masopust, Thomazo, On the complexity of k-piecewise testability and the depth of automata, DLT 2015, LNCS 9168, pp. 364-376 provide something else: a coNP upper bound, LOGSPACE for k = 1, NL-completeness for k = 2 and 3, and PSPACE-completeness for NFAs. And a third pitfall in the same area: the statement about PSPACE for NFAs does not appear in the abstract of arXiv:1603.00361 - the claim is true, but must be cited from Table 1 in the body of the paper.
A general condition applying to all four cells: the bounds are given for a language specified by an automaton, not, say, by a regular expression. - Locally testable languages (class membership is decidable in polynomial time: Kim, McNaughton, McCloskey, A polynomial time algorithm for the local testability problem of deterministic finite automata, IEEE Transactions on Computers 40(10), 1991, pp. 1087-1093 - not available under some subscriptions, see the access list): the concept itself was introduced by McNaughton and Papert (Counter-Free Automata, MIT Research Monograph 65, MIT Press, 1971), who also posed the membership problem there but gave no characterization.
The characterization was obtained independently by several authors: Zalcstein, Locally testable languages, Journal of Computer and System Sciences 6(2), 1972, pp. 151-167; Brzozowski, Simon, Characterizations of locally testable events, Discrete Mathematics 4(3), 1973, pp. 243-271; McNaughton, Algebraic decision procedures for local testability, Mathematical Systems Theory 8(1), 1974, pp. 60-76. Crucially, the condition here is placed on the syntactic semigroup, not on the monoid: LT is a +-variety, and it corresponds to locally idempotent commutative semigroups.
No characterization of LT in terms of the syntactic monoid exists, and this is not a gap in our knowledge but a consequence of the structure of the class: LT is a +-variety, so a condition on the monoid cannot define it (Pin, ibid., Theorem 5.19 and Introduction). The witness is short and machine-verifiable. The language consisting of the single word a over a unary alphabet is strictly local (SL-2). The language b*ab* over a two-letter alphabet is not LT for any k: the witnesses b^k a b^k and b^k a b^k a b^k share the exact same set of factors of length up to k and the same prefix and suffix of length k-1 (verified for k from 1 to 5), yet differ in language membership. At the same time, the syntactic monoids of these two languages are isomorphic - both are {1, a, 0} with a squared equal to zero, and their multiplication tables coincide. Therefore, no condition on the monoid can distinguish them. Writing "LT is equivalent to a condition on the syntactic monoid" is incorrect; this error is widespread.
The decidability of class membership in this hierarchy has been worked out, and recent bounds are compiled in an open-access paper: Lambert, On the Structure of Sets Testable in the Strict Sense, Proceedings of the 18th Meeting on the Mathematics of Language (MoL 2025), pp. 59-73 - linear time for SP and fifth-degree polynomial time for SL. There are two caveats without which these bounds cannot be carried over. First: the input size here is the size of the syntactic join-semigroup of the language, not the number of states in the automaton, and the fifth power comes from five bound variables in the condition being checked. Second: the input there is the algebraic structure of the language rather than an arbitrary DFA, and computing this structure from an automaton takes work of its own.
For a DFA input, the same paper lists different bounds: on a trimmed canonical automaton the procedure is exponential, given an already constructed subset graph it is linear (Rogers, Lambert 2019), and a quadratic bound follows Edlefsen et al. 2008 after Caron 2000. Therefore, always specify your input representation first. There is also a ready-made tool that classifies an automaton into these classes without requiring custom code: the Language Toolkit and its interpreter plebby (Hackage package language-toolkit, source code on GitHub). A word of caution: classification goes through the syntactic semigroup, and on the combined automaton of all 182 rules over a large alphabet it may fail to terminate within time or memory limits - feed the patterns one by one.
The easiest survey from which to write the theory chapter is: Graf, Subregular Linguistics: Bridging Theoretical Linguistics and Formal Grammar, Theoretical Linguistics 48(3-4), 2022, pp. 145-184 - fully open access.
And the main takeaway from our literature survey. In the course of our literature review, we found no work where SL-k, LT-k, SP, PT, SF, or TSL meet learner corpora or the grammatical error detection task: we searched in four independent passes. This must be stated in precisely this way - as a search result, not as an established claim of priority. Claiming "for the first time" requires a documented protocol: a list of databases (ACL Anthology, Scopus or Web of Science, Google Scholar, DBLP), verbatim search queries, search dates, and inclusion criteria. It is worth drawing up the protocol - it is needed for the review chapter anyway - but until then, the weaker formulation should stand in the text. It takes nothing away from the value of the work and shields it from a question that has no answer.
In the publications we reviewed, no direct overlap between these two lines of research was found - and it must be stated strictly like that, rather than "the two literatures do not cite each other": the latter claim requires an exhaustive citation analysis, which we did not conduct. For a Shlav B project, this is precisely the unoccupied niche, but it must be claimed honestly by naming the predecessor in terms of the core technique: Sofkova Hashemi, Detecting Grammar Errors in Children's Writing: A Finite State Approach, NODALIDA 2001 (open access) - there, errors are detected by automaton subtraction, the grammar is written strictly positively, and the difference between machines of varying granularity is computed. This is the exact same idea twenty years prior to the hierarchy, and it should be cited first.
If one wishes to infer the automaton from a corpus rather than write it by hand, the path is likewise rigorous: for a fixed k, SL-k and SP-k are learnable from positive examples alone (Heinz, String Extension Learning, ACL 2010, pp. 897-906, open access), and so is TSL-2 (Jardine, Heinz, Learning Tier-based Strictly 2-Local Languages, TACL 4, 2016, pp. 87-98, open access). This is particularly important in our case: annotated negative examples are virtually nonexistent in error corpora. However, keep the phrasing precise in two places, lest the promise exceed the theorem. First: learning here means identification in the limit - convergence to the correct hypothesis given a sufficiently complete stream of examples, where what is polynomial is the processing time per example; this is neither polynomial-time learnability in the PAC sense nor a bound on sample complexity.
Second: keeping k fixed is essential. The union of SL-k over all k is a superfinite class, and by Gold's theorem (Gold, Language identification in the limit, Information and Control 10(5), 1967, pp. 447-474), no superfinite class is identifiable in the limit from positive examples alone. Thus, k must be declared in advance, and this is a design decision of the paper, not an implementation detail.
8. Lookahead in regular expressions. It does not change the language class; the language remains regular: Morihata, Translation of regular expression with lookahead into finite state automaton, Computer Software 29(1), 2012, pp. 1_147-1_158; Berglund, van der Merwe, van Litsenborgh, Regular Expressions with Lookahead, Journal of Universal Computer Science 27(4), 2021, pp. 324-340 (open access). State the complexity cost according to the sources and alongside the automaton model, otherwise it will sound more alarming than in the papers themselves. Berglund et al. translate an expression with lookahead - both positive and negative - into a Boolean automaton with at most three more states than the length of the expression, which is linear. The double exponential blow-up applies to DFAs and was established in a different paper: Miyazaki, Minamide, Derivatives of Regular Expressions with Lookahead, Journal of Information Processing 27, 2019, pp. 422-430 - an upper bound of 2^(2ⁿ) + 1 and a lower bound of 2^(2^(Ω(√n))); Berglund et al. improve upon this.
An intermediate "single exponential for NFAs" does not appear as a standalone result in either of these papers: the exponential blow-up occurs when converting a Boolean (alternating) automaton into a nondeterministic one, which is the general cost of removing alternation. One must not cite both bounds without specifying the automaton model. State the scope of this citation explicitly: both papers analyze lookahead specifically. These bounds do not carry over to lookbehind - its semantics depends on whether the width is fixed. At the same time, the condition "no determiner to the left" itself requires no new model and is regular even with unbounded width: a deterministic automaton with a single bit tracking "a determiner has already been seen" suffices, which reduces to Item 2 - concatenation and complementation. And herein lies a frequent conflation.
"A noun with no determiner to its left" and "it is not the case that a determiner appears somewhere to the left of a noun" define different languages. The former is positional negation within a single match: the language (Σ setminus D)* N Σ*. The latter is negation of the entire string: the complement of the language Σ* D Σ* N Σ*. They diverge even on short strings: NDN belongs to the first (the first N has no D to its left) but not to the second (a D appears to the left of the second N); an exhaustive machine search over strings of length up to five over a three-letter alphabet yields 113 distinguishing strings. Which of the two languages your rule specifies must be declared before constructing the automaton: they yield different automata and different false positives. What requires a citation is not expressive power, but the complexity and semantics of lookbehind in a specific regular expression engine: there, both the permissible width and the matching order are implementation-defined, and bounds from papers on lookahead do not transfer.
A separate topic arises if backreferences appear in the project: when combined with them, lookahead does increase expressive power (Chida, Terauchi, On Lookaheads in Regular Expressions with Backreferences, FSCD 2022, LIPIcs 228, Article 15, open access). The two statements are opposite, and what distinguishes them is the presence of backreferences.
9. Finite-state transducers, regular relations, closure under composition. Kaplan and Kay 1994; Koskenniemi 1983; Beesley and Karttunen 2003. Where it applies: a lexicon of third-person forms can be specified by a transducer rather than a word list (this is one approach, not the only one). And separately: in finite-state toolkits (XFST, Foma, HFST), complementation and language difference are provided as a single built-in operation, so errors there are detected as the difference of positive grammars. "Provided" means "available in the toolkit", not "computationally free": the cost is the same as in Item 2, and the toolkit pays it. Our matcher lacks this operation. This item is optional: it opens a path that we did not take.
LEVEL 3. NAME AND CITE, NO PROOF REQUIRED
10. Context-free grammars and pushdown automata. They are needed for precisely one claim: "a stack memory is required here". We do not ask for proofs, but caution in phrasing is necessary: non-regularity implies only that a finite automaton is insufficient. That a pushdown automaton suffices is a separate claim, and it must not be written as a corollary of non-regularity.
11. Turing machines, the classes R, RE, co-RE, Rice's theorem. Not used in the project. There is only one request. The word "undecidable" in the sense of "cannot be decided by a finite automaton" must never be used in academic writing: the term has a strict meaning. There are four different terms for four different claims: - a language is non-regular - it is not recognized by any finite automaton; - a property is inexpressible in the formalism - it cannot be written using the primitives of our rule language; - cases are indistinguishable under a given input representation - this is the first argument from Item 3, loss of a feature under projection; - a problem is algorithmically undecidable - no deciding algorithm exists at all (Rice's theorem and its relatives). The paper needs the first three. The fourth does not apply to our subject, and using it in any of the first three senses reads as an error: for anyone grading the paper, that term is already taken.
From Algorithmics (course 61753, mandatory)
12. Aho-Corasick: multi-pattern matching in a single pass. Aho, Corasick, Efficient string matching: an aid to bibliographic search, Communications of the ACM 18(6), 1975, pp. 333-340. The complexity bound must be stated as it appears in the paper: preprocessing is linear in the total length of the patterns, while the number of state transitions required to process a text of length n is strictly less than 2n and does not depend on the number of patterns. The common formulation "linear in the text length plus the number of matches" is a textbook paraphrase: the original paper decomposes the bound differently - into preprocessing and transition count - and explicitly notes that actual execution time depends on the cost of computing a single transition. One should cite the decomposition, not the paraphrase. Where it applies: our run applies 182 rules across 49,826 texts, yielding roughly 47,000 rule-per-text evaluations per second, with a full pass taking about three minutes on commodity hardware.
This figure cannot be used without four accompanying specifications: the total volume in tokens (by text count alone, "three minutes" is meaningless - texts vary from a hundred words to three thousand), whether morphological tagging (Section 25) is included in the timing or only the automaton pass was measured, the testbed configuration including thread count, and the matching engine used. We do not have these specifications alongside the number, so in the paper the benchmark must either be reported together with them or omitted entirely. Furthermore, this measurement reflects our current implementation rather than serving as an argument for Aho-Corasick: dividing by 182 yields about 260 texts per second, which is on the order of a standard sequential rule pass. Aho-Corasick is relevant here specifically because it promises independence from the number of rules, a property that must be verified by a dedicated benchmark varying the rule count.
We must explicitly state two limitations ourselves, lest the promise exceed the scope of the algorithm. First: Aho-Corasick searches for a finite set of fixed strings. It is easy to overstate this limitation: if the tagger assigns exactly one class per word, the classes themselves serve as the alphabet, and a rule consisting of a chain of fixed classes is simply a standard Aho-Corasick keyword - there is nothing to expand. Expansion becomes necessary when a pattern ceases to be a fixed string: when a word is assigned a set of classes (making the input a lattice, Section 25), or when a rule contains a predicate, an alternation, a negative condition, or an arbitrary gap. In such cases, either the pattern reduces to a set of strings - in which case one must specify how many strings it expands into - or the combined automaton must be constructed by other means.
Second: it is the number of state transitions that is independent of the number of patterns, not the total running time; reporting matches depends on their quantity, which grows with the number of rules. Independence from the rule count is therefore stated for the text traversal, not for the entire run. There is a single complete bound worth writing in the paper: O(M + n + z), where M is the total length of the patterns, n is the length of the text, and z is the number of reported matches. This assumes O(1) transitions and match reporting via output lists; an implementation that resolves transitions by scanning edges does not meet this bound. Required competency: state how the running time of your implementation scales with the number of rules, and substantiate this with benchmarks rather than theoretical arguments.
13. KMP and the failure function - a relative of Section 12. They share a core principle: suffix transitions and a failure function in place of backtracking over the text. This connection has a documented source, which is the Aho-Corasick paper itself. Its introduction states: "Our approach combines the ideas in the Knuth-Morris-Pratt algorithm [13] with those of finite state machines"; Algorithm 1 is described as modeled after KMP, and the failure function as a generalization of the next function from that same work. Their reference [13] is Knuth, Morris, Pratt, Fast pattern matching in strings, Technical Report TR CS-74-440, Stanford University, 1974; the journal version appeared later (SIAM Journal on Computing 6(2), 1977, pp. 323-350), but by 1975 the work already existed and was cited. The reverse argument - "Aho-Corasick came out before KMP and therefore could not have been built on it" - is false, and the takeaway is general: priority is not settled by a journal publication date, and the paper itself names its source - one merely had to open it.
14. Thompson's NFA simulation versus backtracking. Thompson's bound is O(n cdot m), where n is the text length and m is the size of the expression (the number of automaton states); "linear in the text" holds for a fixed expression. For an extensible rule system, this caveat must be kept in mind: it is precisely m that grows. The alphabet size does not enter into this bound, which is a consequence of an underlying premise rather than a general rule: in Thompson's construction, each state has at most two outgoing transitions, so a simulation step costs O(1) per state regardless of alphabet size. For an NFA specified by a symbol transition table, this proviso no longer holds - there, the step cost depends on the alphabet, as in Moore's bound from Section 3. This bound rests on two further premises, both directly relevant to our system.
First: the epsilon-closure at a single step is computed without revisiting already visited states - otherwise, the step ceases to be linear in the number of states. Second: testing a symbol costs O(1). The second premise is not free in our case: if the input symbol is not a class identifier but a predicate over morphological features, its cost enters the bound as a separate factor and must be stated explicitly. Catastrophic backtracking on an expression with nested repetition halts the testbed on a single sentence. Anyone writing regular expressions for a detector must know which of the two engines they have under the hood.
15. Determinization blowup (exponential in the number of states) and the lazy DFA with caching. This is the practical side of Section 2, and it must be stated precisely, otherwise it contradicts Section 2 itself: what is expensive is not complementation, but determinization. For a complete DFA, complementation is linear - the set of accepting states is simply inverted. The exponential blowup arises when the initial representation is nondeterministic (an NFA or regular expression) and must be determinized for the complement to be well-defined in the first place. The common saying "complementation is never free" is incorrect.
16. Dynamic programming: Levenshtein distance and the alignment of two sequences. Where it applies: in this research tradition, reference error annotations are extracted by aligning the source text with the corrected text - this is precisely where dynamic programming operates. This is the standard convention, not the only possible one: annotation can also be performed manually against a specification, in which case alignment is not needed at all. Whichever method you use, state it explicitly. Matching the detected spans (text intervals) against the reference spans is no longer alignment, but coordinate comparison (Section 17); these two steps must not be conflated. The ERRANT scorer, which is the standard tool for computing metrics in this field (Bryant, Felice, Briscoe, Automatic Annotation and Evaluation of Error Types for Grammatical Error Correction, ACL 2017, pp. 793-805, open access), is built directly on alignment, except that its operation costs are linguistically weighted rather than uniform: part-of-speech and lemma information are incorporated into the cost function of the Damerau-Levenshtein algorithm, alongside rules for merging edits.
This alignment method itself is the work of Felice et al. (2016), and ERRANT uses it. A caveat to what has been said: precision and recall shift unnoticeably only when the annotation is produced by alignment. With pre-existing manual annotation done according to a specification, no alignment is needed at all; in that case, this point does not apply to the evaluation - Item 17 applies instead.
17. Interval intersection: when a detector span counts as hitting a gold span. This is a design decision, and it must be declared before the first evaluation; changing the rule midway invalidates any "before and after" comparison. ERRANT has three such modes, and they yield different numbers. The default is span-based correction: an edit counts as correct only if BOTH the span boundaries AND the correction string match - exactly, not merely by overlap. The -ds flag gives span-based detection (exact span, correction ignored), and the -dt flag gives token-based detection (matching at the token level, meaning partial span overlap is allowed). Our detector does not propose corrections; it only identifies the span. Our mode is therefore -ds or -dt, and the chosen one must be stated explicitly in the report, not left at the default.
Alongside the mode, one must state the ERRANT version and the spaCy model it runs on: error-type tags and span boundaries have changed from version to version, and figures obtained on different versions are not mutually comparable. The difference between the modes lies not in strictness, but in the unit of counting: -dt counts matched tokens, whereas -ds counts whole spans. Therefore, one cannot simply declare a custom overlap rule to be equivalent to an ERRANT mode by fiat: equivalence is verified by running both on the exact same examples with partial overlap, and any discrepancy must be reported as a number. A technical caveat, lest the first run grind to a halt: ERRANT compares two files in the M2 format, while errant_parallel builds an M2 file from a "source text - corrected text" pair.
A detector that outputs no corrections cannot pass through errant_parallel: its output must be serialized into M2 with span coordinates directly, or else interval intersection must be computed by a custom script implementing the same specification. Moreover, the gold standard and the detector must share the exact same tokenization: a discrepancy on an apostrophe or a hyphen in -ds mode yields zero precision out of nowhere. Alongside the mode, three edge cases must be declared; otherwise the very first run will produce irreproducible numbers. A missing word is a span of zero length (an insertion), and the rule for hitting it must be specified separately: interval intersection does not work on zero length. Identical spans emitted by two distinct rules count either as one trigger or as two. And a single detector span covering two gold spans (or vice versa) yields either one hit or two. These are three distinct decisions, and they adjoin Item 26.
18. Disjoint-set data structures (union-find) and testing the equivalence of two automata: Hopcroft, Karp, A Linear Algorithm for Testing Equivalence of Finite Automata, Cornell technical report TR 71-114, 1971 (openly available in Cornell eCommons). In the paper itself, the bound is stated as linear, on the order of the alphabet size times the number of states, and relies on a linear-time list merge. The famous "nearly linear" bound involving the inverse Ackermann function comes from Tarjan's later 1975 analysis of union-find, and should not be attributed to Hopcroft and Karp. A direct application of Item 3.
19. Tries and hashing - the lexicon of word forms; which also serves as a bridge to Item 9.
WHAT AUTOMATA COURSES LEAVE OUT, BUT THE WORK REQUIRES: METRICS
These are neither automata nor algorithms, which is why they are set apart in their own section: automata theory syllabi do not cover them, yet without them the work does not count.
20. Precision, recall, F-measure; and why this field specifically uses F0.5. The source of the standard formulation is Ng, Wu, Briscoe, Hadiwinoto, Susanto, Bryant, The CoNLL-2014 Shared Task on Grammatical Error Correction, CoNLL-2014 Shared Task, pp. 1-14 (open access), which puts it as follows: F0.5 weights precision twice as much as recall, because proposing an incorrect correction is worse than proposing none at all. Regarding "twice" versus "four times", it is worth knowing that these reflect the exact same property of the metric evaluated at two different points, rather than someone's mistake or a figure of speech. The ratio of the partial derivatives of F with respect to recall and precision equals beta squared times P squared divided by R squared. At equal precision and recall, R = P, this ratio equals beta squared, which is 1 to 4 for beta = 0.5 - hence "four times".
At the point R = beta P, the ratio equals one, and this is the exact point implied when beta is read as an importance ratio: van Rijsbergen, Information Retrieval, 2nd ed., Butterworths 1979, Ch. 7 derives beta as the ratio at which a user is willing to trade recall for precision - hence "twice". Thus both numbers are formally derivable, and the difference between them is a difference in operating point, not a discrepancy between formula and prose. When citing CoNLL-2014, write "twice" in its own words; when speaking of the marginal trade-off at equal P and R, state 1 to 4 and specify the point. One must neither conflate the two nor declare either of them an error. Practical importance and the true cost of errors in our system constitute a third quantity, and we assign it ourselves. Precision percentage on its own is only half a metric.
And one adjustment for our specific task: the CoNLL-2014 argument ("an incorrect correction is worse than none") was stated for systems that propose corrections. Our detector only flags a location, so the cost of a false alarm is different - it consumes the second-stage quota (Item 27) rather than corrupting the text. Consequently, our choice of F0.5 is justified not by citation, but by an argument of our own, which must be stated explicitly. Explicitly, it goes as follows: beta = 0.5 is our engineering decision regarding the cost of a false alarm relative to a miss, not a corollary from the literature. The literature provides only one thing here: it is standard practice in this field to measure F0.5, making our numbers comparable to others'. Incidentally, so as not to mix up sources: the M2 scorer was introduced in Dahlmeier, Ng, Better Evaluation for Grammatical Error Correction, NAACL-HLT 2012, pp. 568-572, where it computes F1; the field switched to F0.5 in CoNLL-2014.
21. Cohen's kappa: inter-annotator agreement between two raters. We do not require a threshold, and this is important. Values measured in the literature for related tasks are given below from primary sources, specifying what exactly was measured. The binary judgment "is the sentence correct or not" on learner material: three pairs of annotators yielded kappas of 0.16, 0.40, and 0.23 with observed agreement of 56-78%, computed over 100 sentences per pair - specifically those that the second annotator reviewed after the first (Rozovskaya, Roth, Annotating ESL Errors: Challenges and Rewards, in: Proceedings of the NAACL HLT 2010 Fifth Workshop on Innovative Use of NLP for Building Educational Applications, Los Angeles, 2010, pp. 28-36, Table 7; open access in the ACL Anthology). In Tetreault and Chodorow (Native Judgments of Non-Native Usage: Experiments in Preposition Error Detection, in: Coling 2008, Proceedings of the Workshop on Human Judgements in Computational Linguistics, Manchester, pp. 24-32; open access), one must distinguish between two separate measurements, and they must not be confused.
Annotating preposition usage in learner text: across two trained annotators, kappa ranges from 0.411 to 0.786, with an overall value of 0.630 on 1,336 doubly annotated contexts. Filling in a missing preposition in native text (a cloze test on Encarta): kappa is 0.70 between the same annotators, with 0.76 raw agreement (Table 2). The first figure reflects a task of our kind; the second reflects an easier task than ours, and in both cases, disagreements are often justified by the context.
A requirement like "kappa no lower than 0.6" would doom the project to failure for reasons beyond the team's control. What is required instead is something else: to measure kappa and, on the same sample, to measure human-against-human performance.
And before measuring, one must declare the unit of count. Cohen's kappa is defined for categorizing a fixed set of items, whereas our annotator places spans at free boundaries - meaning the set of items itself depends on the annotator. Until the unit is specified (sentence, token, or target construction), a kappa value cannot be compared to anyone else's, nor even to our own on a different sample.
The second caveat is especially important in our case: under severe class imbalance, kappa behaves counterintuitively - even with high observed agreement, it can end up close to zero, which is the well-known prevalence paradox (Feinstein, Cicchetti, High agreement but low kappa: I. The problems of two paradoxes, Journal of Clinical Epidemiology 43(6), 1990, pp. 543-549). Our imbalance is inherently severe: erroneous instances are orders of magnitude fewer than correct ones. Therefore, for spans, kappa is not the primary metric - agreement on spans is measured by the pairwise F-measure of one annotator against another (as done in Bryant, Ng 2015) or by Krippendorff's alpha, which can handle unitizing on free boundaries.
One should also be aware of a strong objection to the metric itself: Bryant, Ng, How Far are We from Fully Automatic High Quality Grammatical Error Correction?, ACL-IJCNLP 2015, pp. 697-707 (open access) shows that among ten annotators, no two matched each other exactly, and concludes that an agreement metric requiring an exact match is uninformative for tasks with multiple valid answers. From the same paper comes our benchmark: human-to-human agreement is around 73% F0.5 (72.58 across nine reference annotators), and the top CoNLL-2014 systems operate at 67-73% of that figure. One must be careful in naming it: "human ceiling" is a careless term. It is an empirical agreement benchmark obtained on a single corpus, under a single annotation guideline, and with a single pool of annotators, not a universal upper bound on quality.
A second caveat is more important than the first: that study measured error correction (GEC), whereas our task is error detection (GED), and one cannot carry a number over from one task to the other without a separate argument. Verify the figure 72.58 itself against the table in the original paper before putting it into your text. That paper does not report a kappa of its own, so it cannot be cited as a source for a kappa value.
22. The Wilson score interval for proportions (Wilson, Probable Inference, the Law of Succession, and Statistical Inference, Journal of the American Statistical Association 22(158), 1927, pp. 209-212). Foundational papers in this field report no confidence intervals on their metrics at all: CoNLL-2014, the M2 scorer, and Bryant, Ng 2015 report bare P, R, and F0.5; ERRANT 2017 uses the bootstrap, but for significance testing rather than confidence intervals: it states verbatim that hypotheses were tested "for precision, recall and F0.5 by means of bootstrap significance testing (Efron and Tibshirani, 1993)" (Bryant, Felice, Briscoe, Automatic Annotation and Evaluation of Error Types for Grammatical Error Correction, ACL 2017, pp. 793-805). A notable and welcome exception is Choshen, Abend, Inherent Biases in Reference-based Evaluation for Grammatical Error Correction, ACL 2018, pp. 632-642, which reports 95% bootstrap intervals.
The difference between their approach and ours is substantive, not stylistic: the bootstrap is needed for the F-measure because the Wilson interval cannot be applied to it directly - F is not a binomial proportion. The Wilson interval applies strictly to a proportion. In our setup, precision and recall are proportions - but that alone is not enough to justify using Wilson, and an argument that stops there is incomplete. The Wilson interval relies on a binomial model, that is, on independent trials with a constant probability of success. Our observations are dependent: errors within the same essay, and even more so within the same author, are correlated. A student who systematically omits articles produces twenty instances of the same type, and these do not constitute twenty independent observations - which means an interval computed as binomial will be narrower than the true one. Items 22 and 23 both acknowledge this correlation, and they must not contradict each other.
Hence the procedure that must be declared in the paper. The primary method for precision, recall, F0.5, and the difference between system versions is the cluster bootstrap; the resampling unit is the author if the corpus provides an author identifier, and the essay otherwise. Falling back on "there is no author identifier, so we use the essay" does not eliminate the correlation; it merely renders it invisible: essays by the same person end up in different clusters, dependence across clusters remains, and the interval will again be narrower than the true one. This is a limitation of the study, and it must be documented as a limitation, not as a choice of unit. The Wilson interval remains a supplementary estimate, and its assumptions must be stated alongside it: independence of observations and a binomial model.
The denominators still need to be discussed explicitly, because they differ. For recall, the denominator is fixed in advance - the number of reference errors. For precision, the denominator is the number of times the detector itself triggers, which is a random variable in its own right, so the Wilson interval here is constructed conditionally on the observed number of triggers. The proportion of sentences on which the detector triggered is not a quality metric at all: it is the trigger rate, and it is needed in Item 27.
And a correction to the common phrase "for F0.5, only the bootstrap works": that is false. F0.5 is a smooth function of two estimators, and an interval for it can be obtained, for example, via the delta method. However, the delta method comes with its own price here, which must be stated: it requires the covariance between precision and recall, which are dependent - they share the numerator TP - and the variances plugged into it must be cluster-robust, otherwise the very error we avoided above will return. We choose the bootstrap - because it does not require deriving partial derivatives and naturally accommodates clustering - rather than declaring it the only admissible option.
The cluster bootstrap is not a single word but a protocol, and it must be reported in full, otherwise no one will be able to reproduce the numbers: the number of resamples and the random seed (without the seed, not even the author will reproduce the numbers), where the number of resamples is set not by convention, but according to Monte Carlo error: choose it large enough that the variation in the interval boundary across runs with different seeds on the same data is noticeably smaller than the difference you aim to demonstrate; this is verified directly by running it twice. One thousand resamples is usually too small for tail quantiles, while ten thousand is usually sufficient - but "ten thousand" must be the outcome of such a check, not the rule itself; and when the number of clusters is small, no number of resamples will cure the narrowness of the interval.
Therefore, one must also report the number of clusters and the distribution of their sizes: how many authors, how many essays per author, the median and the maximum - an interval based on twenty clusters and one based on two hundred do not carry the same weight, and the bounds alone do not reveal this. Next comes the method for constructing the interval from the resulting distribution (percentile or BCa; this choice is not stylistic: the percentile interval is biased if the estimator is biased or its distribution is asymmetric, and the F-measure on a small number of reference errors is noticeably asymmetric, whereas BCa corrects for both bias and acceleration), micro-averaging versus macro-averaging (summing detections across all authors and dividing once, or computing the metric for each author and averaging; the resulting numbers differ, and macro-averaging gives disproportionate weight to short essays), how resamples with a zero denominator are handled (if the detector never fires, precision is undefined; such a resample is either discarded or the metric is redefined, and the choice must be stated), and when comparing versions - using the exact same resamples for both versions, otherwise the comparison ceases to be paired.
And a caveat to the argument itself. The binomial interval is narrower than the true one under positive intracluster correlation - which is what we assume here, because a given student tends to repeat the same types of errors. Correlation by itself does not determine the direction; if it were negative, the binomial interval would, on the contrary, be wider than the cluster-robust one. Thus, this is an assumption rather than a theorem, and it is worth verifying on your own corpus - the intracluster correlation coefficient is computed over the very same partition by authors. State it in precisely these terms: we encountered almost no confidence intervals in this literature; we require them because without them a two-point gain is indistinguishable from noise, and we choose the cluster method because of within-author correlation.
23. McNemar's test for paired observations (McNemar, Note on the sampling error of the difference between correlated proportions or percentages, Psychometrika 12(2), 1947, pp. 153-157). Where it applies: "before and after" on a single sample constitutes paired data, and the proper test to confirm that an improvement is not due to chance is a paired one. Without it, a gain of two percentage points and a gain from reshuffling the sample look identical. Why this test and not another: Dietterich, Approximate Statistical Tests for Comparing Supervised Classification Learning Algorithms, Neural Computation 10(7), 1998, pp. 1895-1923 (author's copy is openly available) shows that among the five tests considered for algorithms that can be run only once, only McNemar's test yields an acceptable Type I error rate.
The statistic with the continuity correction must be written as a formula, not in words: if b and c are the counts in the two discordant cells of a 2x2 contingency table, the statistic is (|b - c| - 1)² / (b + c). One is subtracted inside the parentheses, prior to squaring; a verbal phrasing invites a second, incorrect reading - "the square of the difference minus one, divided by the sum". This follows a chi-square distribution with one degree of freedom, with a critical value of 3.84 at the 0.05 significance level. In our case, Dietterich's first constraint is half lifted: the detectors are deterministic, so there is no variance from random initialization or from the choice of a training set. However, the material on which the rules were manually tuned was chosen by us, and that choice remains a source of variance - only the protocol in item 24 closes that loophole.
The boundary conditions that you must state explicitly yourself: if there are few discordant observations, the exact binomial version is required rather than the chi-square approximation; if the outcome on a sentence is not binary (counting the number of spans rather than "fired or did not fire"), this is no longer McNemar's setup; and if the sample contains multiple sentences from the same essay by the same author, the observations are not independent - within-author correlation violates the assumption. This last point is not discussed by Dietterich, so you will have to address it yourself.
And the primary limitation of applicability, which makes it easy to misapply this item. McNemar's test requires a common set of paired observations. For recall, such a set exists: the set consists of the reference errors, each version of the detector either found a given error or did not, and the denominator is identical. Yet even for this set there are two caveats. It must be declared in advance and not recomputed for each version: in the ERRANT -dt (token-based) mode this holds, as the set of reference tokens is fixed; in the -ds (span-based) mode it holds only if the segmentation of the reference into spans is not recomputed from the system's output - if it is recomputed, the pairs become misaligned and McNemar's test becomes inapplicable. Furthermore, the outcome on each unit must be strictly binary: "found or not found".
Partial span overlap (item 17) is not a binary outcome unless a rule converting it into one is declared - and that rule must be declared before the evaluation, not after. For precision, there is no common set: the two versions fire in different places and a different number of times, no pairs are formed, and McNemar's test is inapplicable to precision. Precision and F0.5 are compared via paired bootstrap or a permutation test - using the exact same clusters as in item 22 (the author, or otherwise the essay), and not sentences: sentences by the same author are dependent, and bootstrapping by sentences would reproduce the very error we escaped in item 22.
This dictates the place of this item in the work. After item 22, the primary method for comparing two versions becomes the paired cluster bootstrap, applied simultaneously to all three metrics - precision, recall, and F0.5. McNemar's test remains a supplementary test where its assumptions are met: a common set of paired binary observations that are mutually independent. On a corpus where a single author contributes multiple essays, the second assumption is violated, and citing Dietterich does not cure this - his paper does not cover such a case. Placing McNemar's test at the center of the evaluation chapter is a misplaced emphasis.
24. The evaluation protocol is in Appendix B, and is recalled here because without it the numbers from items 20-23 mean nothing: the corpus split is declared in advance and in writing (what you tune the rules on, what you check intermediate numbers on, and which part is kept locked until the end and opened only once), one modification per evaluation run, and the final number is taken from the held-out test set. If you tune a rule on the same sample on which you subsequently measure it, you have measured overfitting, not quality. And a mandatory condition: the split must be done by authors, not by texts, whenever author identifiers are present in the corpus. Otherwise, essays by the same student will end up in both the tuning set and the held-out set, their characteristic errors will leak across the boundary, and the held-out set will cease to be held-out.
This is the same clustering as in item 22, and its unit must be the same. Moreover, treating the author as the unit is itself an assumption rather than a given: essays from the same class were written for the same prompt and graded by the same instructor, meaning that dependence exists between authors as well. If such grouping (class, school, prompt) is annotated in the corpus, state which level is taken as independent and why; if it is not annotated, state this as a limitation.
BEFORE THE AUTOMATON AND AFTER THE DETECTOR: THREE TOPICS ABSENT FROM EVERY COURSE
The assignment explicitly requires these three points, yet the syllabi do not cover them. They are not theory, but without them, the measured numbers will not measure what is claimed.
25. Where the alphabet comes from. The automaton from Point 1 operates over a string of word classes, whereas the text arrives as words, and converting one into the other is a separate step with its own error rate. Many frequent English words exhibit part-of-speech ambiguity ("run", "can", "that"), and on ungrammatical text a morphological tagger, as far as we know, misfires more often than on well-formed text - however, in your paper this claim must either be backed by a citation or measured directly on your own data; right now we have neither. The proportion of ambiguous words in your data is a measurement, not a truism: the phrase "almost every word" is not a number. Consequently, some of the detector's false alarms and misses are generated not by the automaton, but by the tagger upstream of it, and these two sources must be separated empirically.
There are two honest approaches: either the tagger assigns a single class per word (in which case its own accuracy must be measured on your data and reported), or each word is mapped to a set of possible classes via a lexicon - in which case the input to the automaton is not a string, but a lattice, that is, a linear acyclic automaton, and pattern matching becomes automaton intersection (Point 2). The second approach is more complete and more expensive; whichever you choose must be declared. Moreover, on a lattice one must declare not only the input representation, but also the decision quantifier: whether it suffices for an error pattern to trigger on a single path of classes (there exists such a path), or whether it must trigger on all paths (for all). When the detector outputs a location rather than just a yes/no answer, the quantifier becomes double, and the order of the two quantifiers changes the condition.
First: on every path there is some trigger (for every path there exists a span). Second: there is a span confirmed by all paths (there exists a span that is present on every path). These are distinct requirements: if one parse flags an error on the second word, and another flags it on the fifth, the first condition is satisfied, whereas the second is not satisfied on any span. What must be declared in the report is the precise order of quantifiers, not merely the word "exists". The difference is not cosmetic: under the existential quantifier, neither recall nor the number of false alarms decreases (there may not be a strict increase - that depends on the data), because any admissible reading of a word, however improbable, triggers an alarm. This monotonicity holds for raw triggers, and it rests on a premise that must be verified empirically: it holds when the path chosen by the single-best tagger lies within the lexicon lattice.
If the tagger assigns a word a class that the lexicon does not list for that word, the lattice does not expand the set of readings, but alters it, and comparing the two modes ceases to be a comparison of "more readings versus fewer". The measurement is direct: the proportion of words for which the tagger's assigned class belongs to the lexicon set. This number should be reported alongside the monotonicity claim. Once the policies from Points 17 and 26 - merging overlapping spans and the gold-standard matching rule - are applied, monotonicity is no longer guaranteed: an extra trigger may merge with an adjacent one and add neither a true positive nor a false alarm. Therefore, monotonicity is stated where it is provable (on raw triggers), whereas on final TP and FP counts it is measured. Any claim of a strict increase is empirical in any case. The quantifier is declared prior to measurement. Tokenization belongs here as well: span boundaries in the gold standard and in the detector output must be computed by the same tokenizer, otherwise the metrics from Point 17 become incommensurable.
26. Policy on overlapping triggers. There are 182 rules, they fire independently, and within a single sentence their spans will overlap and nest inside one another. Before counting TP, FP, and FN, a policy is required: whether to merge overlapping spans, take the highest-priority rule, or count every trigger separately. Without a declared policy, the number of false alarms may depend on the order of rules in the file, rendering any comparison between two versions of the detector meaningless. Whether it depends on rule order is determined by the policy itself: merging overlapping spans is order-independent, selecting a highest-priority rule depends on the priority ordering, and "first triggered" depends directly on the line order in the file. Therefore, one declares the policy first, and from it follows whether the rule order must be fixed. This too is a design decision, not an implementation detail.
27. Quota on deferring uncertain cases. In the assignment, the automaton processes the entire volume, while the language model is invoked on at most 5% of cases - which means the first stage operates under a trigger budget, and it must be evaluated with this budget in mind. Hence the objective of the first stage: not F0.5 on its own, but recall at a fixed deferral rate (recall at a call rate of at most 5%), since precision is expected to be recovered by the second stage. Optimizing the first stage for a metric that penalizes the exact cases we intend to defer means optimizing for the wrong problem; how much this costs in numbers is shown by measuring the full pipeline, not by an assertion in a handbook. This last point is strictly an assumption, to be verified by measuring the full pipeline rather than taken on faith: on the deferred cases, the language model might fail to deliver the required precision.
From this follow three requirements for the report. First: the rule by which the detector declares uncertainty (a deterministic automaton does not by itself produce a confidence score - that is defined by a selection rule, which must be specified). Second: the denominator of the quota, that is, what exactly constitutes one hundred percent. This can be the number of texts, the number of sentences, the number of tokens, the number of detector triggers, or the number of constructions checked - these yield entirely different budgets, and the assignment does not specify the denominator. Until it is declared, the phrase "at most 5% of calls" is unverifiable. Third: a "recall versus deferral rate" curve showing whether the budget is met; moreover, there are two distinct recalls here, and they must not be conflated. Selection recall is the proportion of gold-standard errors captured within the cases deferred to the language model, out of all gold-standard errors; it measures the quality of the first stage as a sieve.
System recall is the proportion of gold-standard errors found by the entire pipeline, out of all gold-standard errors; it measures the performance of the architecture. Optimizing the former does not guarantee optimizing the latter: the sieve may pass the right cases along, yet the second stage may fail to detect them. Furthermore, prior to any optimization, one must declare the contract between the stages, because the very ceiling of what is achievable depends on it. Architecture One: the language model only re-evaluates the detector's triggers. In this case, system recall cannot exceed first-stage recall regardless of model quality - the second stage can only filter out triggers and cannot recover anything missed by the first stage, so the objective of the first stage reduces to recall under a budget. Architecture Two: the model is also passed locations where the detector did not trigger, selected by a separate rule.
In that case, this ceiling is removed, but the quota denominator is counted across all deferred cases rather than just triggers, and the first stage takes on a second job - selecting suspicious locations when the rules remain silent. Until the contract is stated, it is unclear which quantity the first stage is supposed to optimize in the first place. In the report, both recalls are called by their proper names and computed separately.
TEAM SELF-CHECK
Six questions. A team that can answer them before starting has mastered the reading list above; a team that cannot knows exactly what to read.
1. Construct the minimal automaton for the pattern-matching language "the text contains a determiner followed immediately by a noun" (an adjacent pair) and state how many states it has. Then do the same for the language "there is a determiner somewhere, and later, after an arbitrary gap, a noun" and for the language consisting of exactly two words - a determiner followed by a noun. Use complete automata, including the dead (sink) state; otherwise the state counts are incomparable. Do not expect the numbers to be different: the first two languages have the exact same number of states, while the third has more - meaning that state count does not distinguish an adjacent pair from a pair with an arbitrary gap, whereas the subregular class does. State explicitly how these three languages differ and which one your rule actually defines.
Next, name the subregular class of each of the three languages and prove its membership - this is the exact question where mistakes are easiest to make. Tie these three languages to item 12: state which one maps directly to an Aho-Corasick keyword without expansion, which one does not, and why. Finally, if your rule transitions from one class to another, formulate this as a statement with an associated cost - "the language was LT-2 and became PT-2; the cost of this transition is X false positives on sample Y" (item 7) - rather than saying "we added a gap". 2. Provide two phrases with the exact same sequence of part-of-speech tags that require different correct decisions. What does this prove, what does it not prove, and why is the Myhill-Nerode theorem irrelevant here? 3. Suppose you need the condition "there is no determiner to the left of the noun".
First, specify which language this is: "there is a noun with no determiner to its left" and "it is not the case that a determiner appears somewhere to the left of a noun" are different languages, and they already diverge on the string NDN (item 8). Then state what language operation this is, whether the language remains regular, and what price you pay for it. 4. The detector fires on token 5, while the gold standard marks the span 4-6. Is this a true positive? Declare your policy before running the evaluation, justify it, and state which ERRANT mode it corresponds to. 5. You raised recall from 12% to 19% and dropped precision from 40% to 36%. Calculate F0.5 before and after - this has a single unambiguous value, but only after you declare the denominators for precision and recall and the averaging method: micro-averaging (summing counts across all authors and dividing once) and macro-averaging (computing the metric per author and averaging) yield different numbers, and the two percentages given in the problem do not tell you which one was meant.
Then explain what this calculated difference still does not prove, and what statistical test is required to call it an improvement. 6. On what data do you tune your rules, and on what data do you measure the final score? If both come from the same authors, explain what you have actually measured and what that number does not mean.
HOW TO OBTAIN THE SOURCES
A bibliography that cannot be accessed does not turn into a finished project, so the access routes are listed separately.
Open access, requiring no subscription: everything in the ACL Anthology (CoNLL-2014, the M2 scorer, Bryant and Ng 2015, ERRANT, Choshen and Abend 2018, Heinz 2010, Heinz, Rawal, Tanner 2011, Jardine and Heinz 2016 in TACL, Lambert 2025, Sofkova Hashemi 2001), Journal of Universal Computer Science 27(4) 2021, Theoretical Linguistics 48 (Graf 2022), the preprint of Pin's chapter on syntactic semigroups, the technical reports by Hopcroft 1971 and Hopcroft-Karp 1971, the author's copy of Dietterich 1998, the open-access copy of Aho and Corasick 1975, and arXiv.
Via university subscription: ScienceDirect (Schutzenberger 1965 in Information and Control, Zalcstein 1972 in JCSS, Brzozowski and Simon 1973 in Discrete Mathematics, Cho and Huynh 1991 in TCS), SpringerLink (Simon 1975 in LNCS 33, McNaughton 1974 in Mathematical Systems Theory, McNemar 1947 in Psychometrika), Taylor and Francis or JSTOR (Wilson 1927), and MathSciNet for verifying bibliographic data.
What is not always covered by standard subscriptions, which you should know in advance: institutional access to IEEE Xplore and the ACM Digital Library varies. For our reading list, this affects a single paper - the polynomial-time algorithm for testing local testability (Kim, McNaughton, McCloskey, IEEE Transactions on Computers 40(10), 1991, pp. 1087-1093); the Aho and Corasick paper, although published in CACM, is available in their open section. The book by McNaughton and Papert 1971 is not covered by any digital subscription: it must be obtained in print from a library or via interlibrary loan, while the scan on the Internet Archive is available only under controlled digital lending.
MINIMUM PATH IF YOU HAVE NOT TAKEN AN AUTOMATA COURSE
Four chapters of HMU: Ch. 2 (DFAs, NFAs, subset construction), Ch. 4.2 (closure properties), Ch. 4.4 (minimization and Myhill-Nerode), and Ch. 4.1 (the pumping lemma). This takes one to two weeks of reading with exercises, and it is sufficient for all of Level 1 - that is, the mandatory part of the project. Level 2 is no longer a list of topics but a proof-writing skill; you should undertake the theoretical chapter only after assessing whether you have that skill. Without it, the project remains complete on the engineering side.
All articles
Free practice for every rule
Every grammar rule on the site has a trainer behind it. It is free and needs no sign-up.