1 First steps in automatic complexity
The Kolmogorov complexity of a finite word is, roughly speaking, the length of the shortest description of in a fixed formal language. The description can be thought of as an optimally compressed version of . Motivated by the non-computability of Kolmogorov complexity, Shallit and Wang
[
19
]
studied a deterministic finite automaton analogue.
Their notion of automatic complexity is an automata-based and length-conditional analogue of Sipser’s distinguishing complexity (
[
21
]
,
[
15
,
Definition 7.1.4
]
). This was pointed out by Mia Minnes in a review in the Bulletin of Symbolic Logic from 2012. Another precursor is the length-conditional Kolmogorov complexity
[
15
,
Definition 2.2.2
]
.
The automatic complexity of Shallit and Wang is the minimal number of states of an automaton accepting only a given word among its equal-length peers. Finding such an automaton is analogous to the protein folding problem where one looks for a minimum-energy configuration. The protein folding problem may be NP-complete
[
3
]
, depending on how one formalizes it as a mathematical problem. For automatic complexity, the computational complexity is not known, but a certain generalization to equivalence relations gives an NP-complete decision problem
[
12
]
.
In this chapter we start to develop the properties of automatic complexity.
1.1 Words
The set of all natural numbers is . Following the von Neumann convention, each natural number is considered to be the set of its predecessors:
The power set of a set is the set of all the subsets of :
If is an alphabet (a set), a word (sometimes called string) is a sequence of elements of .
For computer implementations it is often convenient to use an alphabet that is an interval in . When we want to emphasize that 0, 1, etc. are playing the role of symbols rather than numbers, we often typeset them as , etc., respectively.
We denote concatenation of words by or by juxtaposition . In the word , is called a subword or factor of . Infinite words are denoted in boldface. For example, there is a unique infinite word such that , and we write .
Let denote the prefix relation, so that iff is a prefix of , iff there is a word such that .
The concatenation of a word and a symbol is written if is appended on the right, and if is appended on the left. It may seem most natural to define by induction using , at least for speakers of languages where one reads from left to right. The Lean proof assistant
[
4
]
(version 3) uses . That approach fits well with co-induction, if infinite words are ordered in order type
[
13
]
.
For , is the set of words of length over . We may view is a function with domain and range .
We view functions as subsets of the cartesian product ,
The set is both the set of functions from to and the cartesian product if . The empty word is denoted and the first symbol in a word is denoted .
We can define . More properly, the set is defined recursively by the rule that , and whenever and , then . We define concatenation by structural induction: for ,
Definition
1
The length of a word is defined by induction:
If and then is the restriction of to .
The word is also denoted . By convention, instead of we write simply .
1.1.1 Occurrences and powers
In this subsection we state some results from the subject “combinatorics on words” that will be used frequently.
The statement that occurs in position within may be defined by induction on :
The number of occurrences can be defined, without defining a notion of “occurrence”, as the cardinality of . To define disjoint occurrences, so we should have a notion of “occurrence”.
Definition
4
Two occurrences of words (starting at position ) and (starting at position ) in a word are disjoint if where are words and , .
Type-theoretically
[
2
]
we may say that an occurrence of in is a pair where is a proof that . Of course, we could also say that the occurrence is simply the number , or even the triple but in that case the object does not have its defining property within it, so to speak: the number , and the triple , exist even when does not occur at position in .
To naturally speak of disjoint occurrences we make Definition 5. Note that we primarily use zero-based words in this book, i.e., other things being equal we prefer to call the first letter of a word , rather than .
Definition
5
A word , or an infinite word , with each , is viewed as a function with . An occurrence of in is a function such that for each .
For , let . Two occurrences , are disjoint if .
If moreover then the occurrences are strongly disjoint.
A subword that occurs at least twice in a word is a repeated subword of . Let , . A word , , is -rainbow if it has no repeated subword of length : there are no with . A 1-rainbow word is also known simply as rainbow.
In particular, the empty word occurs everywhere in every word. However, each word has exactly one occurrence of , since all empty functions are considered to be equal (in set theory, at any rate).
Having properly defined “occurrence” in Definition 5, we can state and prove the trivial Lemma 6.
Lemma
6
Suppose are positive integers with . A word of length has occurrences of subwords of length .
Proof
▶
Let be a word of length . The occurrences of subwords of length are
Theorem
7
Let with . In an alphabet of cardinality , a -rainbow word has length at most .
Proof
▶
There are words of length . Thus, by Lemma 6, for a -rainbow word of length we have .
Theorem 7 has a converse, Theorem 9. To prove it we shall require the notion of a de Bruijn word.
Definition
8
A de Bruijn word of order over an alphabet is a sequence such that every occurs exactly once as a cyclic substring of .
Theorem
9
Let with . In an alphabet of cardinality , there exists a -rainbow word of length .
Proof
▶
Case : indeed, the empty word is a 0-rainbow word of length 0. Case : A 1-rainbow word of length exists, namely any permutation of the symbols in (Definition 5). For , let be a de Bruijn word of length and let .
Definition
10
Let be a word of length , and let be the letter of for . We define the power of for certain values of (the set of nonnegative rational numbers) as follows. For :
The word is -power-free if no nonempty -power, , occurs (Definition 5) in . In particular, 2-power-free is called square-free and 3-power-free is called cube-free. Let be an infinite word over the alphabet , and let be a finite word over . Let be a rational number. The word is said to occur in with exponent if occurs in (Definition 5).
The reader may note that the definition of -power-free is perhaps not obvious. For example, the word is not -power-free: while it contains no -power, it contains a -power. This way of defining things enables Theorem 12 and goes back at least to Krieger
[
14
,
page 71
]
.
Definition
11
The critical exponent of an infinite word is defined by
Theorem
12
Krieger
[
14
]
The critical exponent of is equal to
Proof
▶
Let
Paying careful attention to Definition 10, the word is -power-free iff for all , contains no -power. Therefore, is upward closed. On the other hand, is an upward dense subset of the complement of . Therefore, .
As an example of Definition 10, we have . Note that the expected Power Rule for Exponents fails for word exponentiation. In general, , for instance
Fix an alphabet , and let denote the set of nonempty words over .
Lemma
13
Lyndon and Schützenberger
[
16
]
; see
[
18
,
Theorem 2.3.2
]
Let . The equation holds iff there exist a nonempty word , a word , and a natural number such that , , and .
Theorem
14
Lyndon and Schützenberger
[
16
]
; see
[
18
,
Theorem 2.3.3
]
Let . Then the following four conditions are equivalent:
.
There exists and integers such that and .
There exist integers such that .
1.2 Automata
In Definition 15, some basic objects of study in this book are introduced.
Definition
15
Let be a finite alphabet and let be a finite set whose elements are called states. A nondeterministic finite automaton (NFA) is a 5-tuple The transition function maps each to a subset of . Within we find the initial state and the set of final states . The function is extended to a function by structural induction:
Overloading notation, we may also write . The language accepted by is
A deterministic finite automaton (DFA) is also a 5-tuple In this case, is a total function and is extended to by
If the domain of is a subset of , is an incomplete DFA. In this case, coincides with an NFA with a special property which we can check for effectively. We denote a partial function from to by or .
Finally, the set of words accepted by is
Automata may be viewed as an instance of graph theory, where the automaton is a directed graph (digraph) with labeled edges, a state is a vertex and a transition is an edge. This point of view we introduce now, and return to frequently.
Definition
16
A digraph consists of a set of vertices and a set of edges . Let . Let , . A walk of length from to is a function such that , , and for each .
A cycle of length in is a walk from to , for some , such that . Two cycles are disjoint if their ranges are disjoint.
Equation 1 may be viewed as a closure property: if then . Formally, then, is the intersection of all functions that contain (viewing symbols as length-1 strings) and is closed under this closure property. Using the fact that is well-ordered and is the range of the length function on strings, we can define to be restricted to words of length , and then is defined from by , where
Note that so that the third clause does not occur in our application. Since is the empty function, we need to carve out the special case .
Theorem 17 is the special case of the wellorder from Schimmerling
[
17
,
Theorem 3.8
]
. We apply it with .
Theorem
17
Let be a set and let be the set of all partial functions from to . For each , there is a unique function such that
for all .
Definition
19
Let be an alphabet. Let DFA denote the class of all DFAs over and let partDFA denote the class of all partial DFAs over . If a DFA over has the property that it accepts a string , but no other strings of length , i.e.,
then we say that accepts uniquely. Let with . Define , the automatic complexity of (with respect to ) to be the least number of states in any such that accepts uniquely.
If we consider to be a function , then where . We define .
Similarly, we define , the partial automatic complexity of , to be the least number of states in any such that .
In most cases below, if we write we intend .
Theorem
20
Let be a word in a finite alphabet . We have . If and then .
Proof
▶
The inequality follows from the inclusion . Assume and . Without much loss of generality, and . The witnessing partial DFA for is shown in 5, and the witnessing DFA for is shown in 6. □
Let be the language recognized by the automaton . Let be a finite word. The (unique-acceptance) nondeterministic automatic complexity of is the minimum number of states of an NFA such that accepts and the number of walks along which accepts words of length is 1.
The exact-acceptance nondeterministic automatic complexity of is the minimum number of states of an NFA such that accepts and .