Abstract
In this paper, we study arbitrary subword-closed languages over the alphabet (binary subword-closed languages). For the set of words of the length n belonging to a binary subword-closed language L, we investigate the depth of the decision trees solving the recognition and the membership problems deterministically and nondeterministically. In the case of the recognition problem, for a given word from , we should recognize it using queries, each of which, for some , returns the ith letter of the word. In the case of the membership problem, for a given word over the alphabet of the length n, we should recognize if it belongs to the set using the same queries. With the growth of n, the minimum depth of the decision trees solving the problem of recognition deterministically is either bounded from above by a constant or grows as a logarithm, or linearly. For other types of trees and problems (decision trees solving the problem of recognition nondeterministically and decision trees solving the membership problem deterministically and nondeterministically), with the growth of n, the minimum depth of the decision trees is either bounded from above by a constant or grows linearly. We study the joint behavior of the minimum depths of the considered four types of decision trees and describe five complexity classes of binary subword-closed languages.
1. Introduction
In this paper, we study arbitrary binary languages (languages over the alphabet ) that are subword closed: if a word belongs to a language, then the word belongs to this language. Subword-closed languages have attracted the attention of researchers in the field of formal languages for many years [1,2,3,4,5].
For the set of words of the length n belonging to a binary subword-closed language L, we investigate the depth of the decision trees solving the recognition and the membership problems deterministically and nondeterministically. In the case of the recognition problem, for a given word from , we should recognize it using queries, each of which, for some , returns the ith letter of the word. In the case of the membership problem, for a given word over the alphabet E of the length n, we should recognize if it belongs to using the same queries.
For an arbitrary binary subword-closed language, with the growth of n, the minimum depth of the decision trees solving the problem of recognition deterministically is either bounded from above by a constant or grows as a logarithm, or linearly. For other types of trees and problems (decision trees solving the problem of recognition nondeterministically and decision trees solving the membership problem deterministically and nondeterministically), with the growth of n, the minimum depth of decision trees is either bounded from above by a constant or grows linearly. We study the joint behavior of the minimum depths of the considered four types of decision trees and describe five complexity classes of binary subword-closed languages.
In [6], the following results were announced without proof. For an arbitrary regular language, with the growth of n, (i) the minimum depth of the decision trees solving the problem of recognition deterministically is either bounded from above by a constant or grows as a logarithm, or linearly, and (ii) the minimum depth of the decision trees solving the problem of recognition nondeterministically is either bounded from above by a constant or grows linearly. Proofs for the case of decision trees solving the problem of recognition deterministically can be found in [7,8]. To apply the considered results to a given regular language, it is necessary to know a deterministic finite automaton (DFA) accepting this language.
Each subword-closed language over a finite alphabet is a regular language [3]. In this paper, we do not assume that binary subword-closed languages are given by DFAs. So, we cannot use the results from [6,7,8]. Instead of this, for binary subword-closed languages, we describe simple criteria for the behavior of the minimum depths of decision trees solving the problems of recognition and membership deterministically and nondeterministically.
This paper is a theoretical work related to the field of formal languages. It has no direct applications. In the theory of formal languages, various parameters of languages are studied, in particular the growth of the number of words of the language with the growth of the length of words and, for regular languages, the minimum number of states of the automaton accepting the language. For many years, the author has been introducing new parameters of languages into scientific use: the minimum depth of deterministic and nondeterministic decision trees for the recognition and membership problems related to the language [6,7,8,9]. The present paper continues this line of research.
There is now an extensive collection of methods for constructing decision trees. It includes (i) a variety of greedy heuristics based on measures of uncertainty, such as entropy and the Gini index [10,11,12], (ii) exact optimization algorithms based on dynamic programming, branch-and-bound search, SAT-based methods, etc., [13,14,15,16], and (iii) approximate optimization algorithms with bounds of accuracy that are applicable to obtain theoretical results about the complexity of decision trees [8,17].
In this paper, we found simple combinatorial parameters of binary subword-closed languages, which made it possible to obtain bounds on the depth of the decision trees without using the effective but rather complicated methods developed in the monographs [8,17].
2. Main Notions
Let be the set of nonnegative integers and . By , we denote the set of all finite words over the alphabet E, including the empty word . Any subset L of the set is called a binary language. This language is called subword closed if, for any word belonging to L, the word belongs to L, where , , , . For any natural n, we denote by the set of words from L, for which length is equal to n. We consider two problems related to the set . The problem of recognition: for a given word from , we should recognize it using attributes (queries) , where , , is a function from to E such that for any word . The problem of membership: for a given word from , we should recognize if this word belongs to the set using the same attributes. To solve these problems, we use decision trees over .
A decision tree over is a marked finite directed tree with the root, which has the following properties:
- The root and the edges leaving the root are not labeled.
- Each node, which is not the root or terminal node, is labeled with an attribute from the set .
- Each edge leaving a node, which is not a root, is labeled with a number from E.
A decision tree over is called deterministic if it satisfies the following conditions:
- Exactly one edge leaves the root.
- For any node, which is not the root nor terminal node, the edges leaving this node are labeled with pairwise different numbers.
Let be a decision tree over . A complete path in is any sequence of nodes and edges of such that is the root, is a terminal node, is the initial, and is the terminal node of the edge for . We define a subset of the set in the following way: if , then . Let , the attribute be assigned to the node and be the number assigned to the edge , . Then,
Let . We say that a decision tree over solves the problem of recognition for nondeterministically if satisfies the following conditions:
- Each terminal node of is labeled with a word from .
- For any word , there exists a complete path in the tree such that .
- For any word and for any complete path in the tree such that , the terminal node of the path is labeled with the word w.
We say that a decision tree over solves the problem of recognition for deterministically if is a deterministic decision tree, which solves the problem of recognition for nondeterministically.
We say that a decision tree over solves the problem of membership for nondeterministically if satisfies the following conditions:
- Each terminal node of is labeled with a number from E.
- For any word , there exists a complete path in the tree such that .
- For any word and for any complete path in the tree such that , the terminal node of the path is labeled with the number 1 if and with the number 0, otherwise.
We say that a decision tree over solves the problem of membership for deterministically if is a deterministic decision tree which solves the problem of membership for nondeterministically.
Let be a decision tree over . We denote by the maximum number of nodes in a complete path in that are not the root nor terminal node. The value is called the depth of the decision tree .
We denote by () the minimum depth of a decision tree, which solves the problem of recognition for nondeterministically (deterministically). If , then .
We denote by () the minimum depth of a decision tree, which solves the problem of membership for nondeterministically (deterministically). If , then .
3. Main Results
Let L be a binary subword-closed language. For any and , we denote by the word of the length i (if , then ). For any , let if and if .
We define the parameter of the language L, which is called the homogeneity dimension of the language L. If for each natural number m, there exists such that the word belongs to L, then . Otherwise, is the maximum number such that there exists for which the word belongs to L. If , then .
We now define the parameter of the language L, which is called the heterogeneity dimension of the language L. If for each natural number m, there exists such that the word belongs to L, then . Otherwise, is the maximum number such that there exists for which the word belongs to L. If , then .
Theorem 1.
Let L be a binary subword-closed language.
- (a)
- If , then and .
- (b)
- If and , then and .
- (c)
- If and , then and .
Example 1.
Let us consider the binary subword-closed language . One can show that and . By Theorem 1, and .
For a binary subword-closed language L, we denote by its complementary language . The notation means that L is an infinite language, and the notation means that L is a finite language.
Theorem 2.
Let L be a binary subword-closed language.
- (a)
- If and , then and .
- (b)
- If or , then and .
Example 2.
One can show that, for the binary subword-closed language , considered in Example 1, and . By Theorem 2, and .
To study all possible types of joint behavior of functions , , , and for binary subword-closed languages L, we consider five classes of languages described in the columns 2–5 of Table 1. In particular, consists of all binary subword-closed languages L with and . It is easy to show that the complexity classes are pairwise disjointed, and each binary subword-closed language belongs to one of these classes. The behavior of functions , , , and for languages from these classes is described in the last four columns of Table 1. For each class, the results considered in Table 1 follow from Theorems 1 and 2 and the following three remarks: (i) from the condition , it follows , (ii) from the condition , it follows , and (iii) from the condition , it follows .
Table 1.
Joint behavior of functions , , , and for binary subword-closed languages.
We now show that the classes are nonempty. To this end, we consider the following five binary subword-closed languages:
It is easy to see that for .
4. Proofs of Theorems 1 and 2
In this section, we prove Theorems 1 and 2. First, we consider two auxiliary statements. For a word we denote by its length.
Lemma 1.
Let L be a binary subword-closed language for which . Then, any word w from L can be represented in the form
where , , and , , are words from with length at most each.
Proof.
Denote . Then, the words and do not belong to L. Let w be a word from L. Then, for any , any entry of the letter a in w has at most ms to the left of this entry (we call it l-entry of a) or at most ms to the right of this entry (we call it r-entry of a). Let . We say that w is (i) a-l-word if any entry of a in w is l-entry; (ii) a-r-word if any entry of a in w is r-entry; and (iii) a-b-word if w is not a-l-word and is not a-r-word. Let . We say that w is -word if w is 0-c-word and 1-d-word. There are nine possible pairs . We divide them into four groups: (a) and , (b) and , (c) , , , and , and (d) , and consider them separately. Let
We assume that w contains both 0s and 1s. Otherwise, w can be represented in the form (1).
(a) Let w be -word. Let and be the rightmost entry of 1 in w. Because w is -word, there are at most m 1s to the left of and at most m 0s to the left of . Denote . Then, contains at most m 0s and at most m 1s, i.e., the length of is at most . Moreover, to the right of , there are only 0s. Thus, , where , i.e., w can be represented in the form (1).
Let and be the rightmost entry of 0 in w. Denote . Then, contains at most m 0s and at most m 1s, i.e., . Moreover, to the right of , there are only 1s. Thus, , i.e., w can be represented in the form (1).
One can prove in a similar way that any -word can be represented in the form (1).
(b) Let w be -word, be the rightmost entry of 0, and be the leftmost entry of 1. Then, either or . Let . Then, , i.e., w can be represented in the form (1). Let now . Denote . The word w has at most m 0s to the right of and at most m 1s to the left of . Therefore, and , i.e., w can be represented in the form (1).
One can prove in a similar way that any -word can be represented in the form (1).
(c) Let w be -word; be the rightmost entry of 1 such that to the left of this entry, we have at most m 0s; and be the next after entry of 1. It is clear that to the right of , there are at most m 0s, , and all letters are equal to 0. Let be the rightmost entry of 0. Then, to the left of , there are at most m 1s. It is clear that either or . Denote . Then, . Let . In this case, , i.e., w can be represented in the form (1). Let . Denote . Then, . We have , i.e., w can be represented in the form (1).
One can prove in a similar way that any - or - or -word can be represented in the form (1).
(d) Let w be -word, be the rightmost entry of 0 such that there are at most m 1s to the left of this entry, and be the next after entry of 0. Then, there are at most m 1s to the right of , , and . Denote , , and . Let be the rightmost entry of 1 such that there are at most m 0s to the left of this entry and be the next after entry of 1. Then, there are at most m 0s to the right of , , and .
There are four possible types of location of and : (i) and , (ii) and (the combination and is impossible because all letters with indices from B are 1s, but all letters between and are 0s), (iii) and (the combination and is impossible because all letters with indices from B are 1s, but all letters between and are 0s), and (iv) and . We now consider cases (i)–(iv) in detail.
(i) Let and . Then, . Denote , , and . The length of is at most because from the left of , there are at most m 0s, and from the left of , there are at most m 1s. We can prove in a similar way that and . Therefore, w can be represented in the form (1).
(ii) Let and . Then, and
where and . Denote and . It is easy to show that and . Therefore, w can be represented in the form (1).
(iii) Let and . Then, and
where and . Denote and . It is easy to show that and . Therefore, w can be represented in the form (1).
(iv) Let and . Then, . Denote , , and . It is easy to show that , , and . Therefore, w can be represented in the form (1). □
Lemma 2.
Let L be a binary subword-closed language for which and . Then, there exists natural p such that for any natural n.
Proof.
Denote . Then, the words and do not belong to L. Using Lemma 1, we obtain that each word w from L can be represented in the form , where , the length of is at most for , , and or . We now evaluate the number of such words, for which length is equal to n. Let . Then, the number of different words is at most . Let us assume that the words , , and are fixed and . Then, the number of different words of the length is at most because or . Thus, the number of words in is at most . □
Proof of Theorem 1.
It is clear that for any natural n.
(a) Let and n be a natural number. Then, there exists such that . Therefore, for . Let be a decision tree over , which solves the problem of recognition for nondeterministically and has the minimum depth , and be a complete path in such that . Let us assume that there is such that the attribute is not attached to any node of , which is not the root nor the terminal node. Then, , which is impossible. Therefore, and . It is easy to show that . Thus, for any natural n.
(b) Let and . By Lemma 1, each word from L can be represented in the form , where , the length of is at most for , and . Note that either or is a word of the kind .
Let n be a natural number such that . We now describe the work of a decision tree over , which solves the problem of recognition for deterministically. Let . We represent this word as follows: , where the length of each word is equal to t. First, we recognize all letters in the words using queries (attributes). We now consider four cases.
(i) Let for some . Then, , and the word w is recognized.
(ii) Let for some , and contains both 0 and 1. Then, has an intersection with the word . It is clear that has no intersection with the word A and . We recognize all letters of the word . As a result, the word w will be recognized.
(iii) Let for some , and contains both 0 and 1. Then, has an intersection with the word . It is clear that has no intersection with the word A and . We recognize all letters of the word . As a result, the word w will be recognized.
(iv) Let and for some . Then, we need to recognize the position of the word and the word itself. Beginning with the left, we divide and, probably, a prefix of into blocks of the length t. As a result, we have blocks. We recognize all letters in the block with the number . If all letters in this block are equal to , then we apply the same procedure to the blocks with numbers . If all letters in this block are equal to a, then we apply the same procedure to the blocks with numbers . If the considered block contains both 0 and 1, then we recognize t letters before this block and t letters after this block and, as a result, recognize both the word and its position. After each iteration, the number of blocks is at most one-half of the previous number of blocks. Let q be the whole number of iterations. Then, after the iteration , we have at least one unchecked block. Therefore, and .
In case (i), to recognize the word w, we make queries. In cases (ii) and (iii), we make queries. In case (iv), we make at most queries. As a result, we have .
Because , for any natural n, the set contains for some words for . Then, , and each decision tree over solving the problem of recognition for deterministically has at least terminal nodes. One can show that the number of terminal nodes in is at most . Therefore, . Thus, and .
We now prove that . To this end, it is enough to show that there is a natural number c such that, for each natural n and for each word , there exists a subset of the set of attributes such that and, for any word different from w, there exists an attribute for which . We now show that as c, we can use the number . In case (i), in the capacity of the set , we can choose all attributes corresponding to letters from the subwords , , , and . In case (ii), we can choose all attributes corresponding to letters from the subwords , , , , and . In case (iii), we can choose all attributes corresponding to letters from the subwords , , , , and . In case (iv), in the capacity of the set , we can choose all attributes corresponding to letters from the subwords , , , and , and letters from the block containing both 0 and 1 and from the blocks that are its left and right neighbors.
(c) Let and . By Lemma 2, there exists natural p such that for any natural n. Let n be a natural number. Then, the set contains at most p words, and there exists a subset B of the set of attributes such that and, for any two different words , there exists an attribute for which . It is easy to construct a decision tree over which solves the problem of recognition for deterministically by sequentially computing attributes from B. The depth of this tree is at most . Therefore, and . □
Proof of Theorem 2.
It is clear that for any natural n.
(a) Let , , and be a word with the minimum length from . Because , for any natural n. Let n be a natural number such that and be a decision tree over that solves the problem of membership for nondeterministically and has the minimum depth. Let and be a complete path in such that . Then, the terminal node of is labeled with the number 1. Let us assume that the number of nodes labeled with attributes in is at most . Then, we can change at most letters in the word w such that the obtained word will satisfy the following conditions: is a subword of and . However, it is impossible because in this case and , but the terminal node of is labeled with the number 1. Therefore, the depth of is greater than . Thus, . It is easy to construct a decision tree over that solves the problem of membership for deterministically and has a depth equal to n. Therefore, . Thus, and .
(b) Let . Then, there exists natural m such that for any natural . Therefore, for each natural , and .
Let , n be a natural number, and be a decision tree over which consists of the root, a terminal node labeled with and an edge that leaves the root and enters the terminal node. One can show that solves the problem of membership for deterministically and has a depth equal to 0. Therefore, and . □
5. Conclusions
In this paper, we studied arbitrary binary subword-closed languages. For the set of words of the length n belonging to a binary subword-closed language L, we investigated the depth of the decision trees solving the recognition and the membership problems deterministically and nondeterministically. We proved that with the growth of n, the minimum depth of the decision trees solving the problem of recognition deterministically is either bounded from above by a constant or grows as a logarithm, or linearly. For other types of trees and problems, with the growth of n, the minimum depth of the decision trees is either bounded from above by a constant or grows linearly. We also studied the joint behavior of the minimum depths of the considered four types of decision trees and described five complexity classes of binary subword-closed languages.
In this paper, we did not assume that a binary subword-closed language is given by a deterministic finite automaton accepting this language. So, we could not use the parameters of the automaton for the study of decision tree complexity as it was done in [6,7,8,9]. Instead of this, for binary subword-closed languages, we described simple combinatorial criteria for the behavior of the minimum depths of the decision trees solving the problems of recognition and membership deterministically and nondeterministically.
In the future, we are planning to generalize this approach to some other classes of formal languages.
Funding
Research funded by the King Abdullah University of Science and Technology.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Acknowledgments
Research reported in this publication was supported by the King Abdullah University of Science and Technology (KAUST).
Conflicts of Interest
The author declares no conflict of interest.
References
- Atminas, A.; Lozin, V.V. Deciding Atomicity of Subword-Closed Languages. In Lecture Notes in Computer Science, Proceedings of the Developments in Language Theory-26th International Conference, DLT 2022, Tampa, FL, USA, 9–13 May 2022, Proceedings; Diekert, V., Volkov, M.V., Eds.; Springer: Berlin/Heidelberg, Germany, 2022; Volume 13257, pp. 69–77. [Google Scholar]
- Brzozowski, J.A.; Jirásková, G.; Zou, C. Quotient Complexity of Closed Languages. Theory Comput. Syst. 2014, 54, 277–292. [Google Scholar] [CrossRef]
- Haines, L.H. On Free Monoids Partially Ordered by Embedding. J. Comb. Theory 1969, 6, 94–98. [Google Scholar] [CrossRef]
- Hospodár, M. Power, positive closure, and quotients on convex languages. Theor. Comput. Sci. 2021, 870, 53–74. [Google Scholar] [CrossRef]
- Okhotin, A. On the State Complexity of Scattered Substrings and Superstrings. Fundam. Inform. 2010, 99, 325–338. [Google Scholar] [CrossRef]
- Moshkov, M. Complexity of Deterministic and Nondeterministic Decision Trees for Regular Language Word Recognition. In Aristotle University of Thessaloniki, Proceedings of the 3rd International Conference Developments in Language Theory, Thessaloniki, Greece, 20–23 July 1997; Bozapalidis, S., Ed.; DLT: Toronto, ON, Canada, 1997; pp. 343–349. [Google Scholar]
- Moshkov, M. Decision Trees for Regular Language Word Recognition. Fundam. Inform. 2000, 41, 449–461. [Google Scholar] [CrossRef]
- Moshkov, M. Time Complexity of Decision Trees. In Trans. Rough Sets III; Peters, J.F., Skowron, A., Eds.; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2005; Volume 3400, pp. 244–459. [Google Scholar]
- Moshkov, M. Decision trees for regular factorial languages. Array 2022, 15, 100203. [Google Scholar] [CrossRef]
- Breiman, L.; Friedman, J.H.; Olshen, R.A.; Stone, C.J. Classification and Regression Trees; Chapman and Hall/CRC: Boca Raton, FL, USA, 1984. [Google Scholar]
- Quinlan, J.R. C4.5: Programs for Machine Learning; Morgan Kaufmann: Burlington, MA, USA, 1993. [Google Scholar]
- Rokach, L.; Maimon, O. Data Mining with Decision Trees-Theory and Applications; Series in Machine Perception and Artificial Intelligence; World Scientific: Singapore, 2007; Volume 69. [Google Scholar]
- AbouEisha, H.; Amin, T.; Chikalov, I.; Hussain, S.; Moshkov, M. Extensions of Dynamic Programming for Combinatorial Optimization and Data Mining; Intelligent Systems Reference Library; Springer: Berlin/Heidelberg, Germany, 2019; Volume 146. [Google Scholar]
- Aglin, G.; Nijssen, S.; Schaus, P. Learning optimal decision trees using caching branch-and-bound search. In Proceedings of the 34th AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; pp. 3146–3153. [Google Scholar]
- Narodytska, N.; Ignatiev, A.; Pereira, F.; Marques-Silva, J. Learning optimal decision trees with SAT. In Proceedings of the 27th International Joint Conference on Artificial Intelligence, Stockholm, Sweden, 13–19 July 2018; pp. 1362–1368. [Google Scholar]
- Verwer, S.; Zhang, Y. Learning optimal classification trees using a binary linear program formulation. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence, AAAI 2019, Washington, DC, USA, 7–14 February 2019; pp. 1625–1632. [Google Scholar]
- Moshkov, M. Comparative Analysis of Deterministic and Nondeterministic Decision Trees; Intelligent Systems Reference Library; Springer: Berlin/Heidelberg, Germany, 2020; Volume 179. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).