# Two-Dimensional Pattern Matching Against Basic Picture Languages

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11601)

## Abstract

Given a two-dimensional array of symbols and a picture language over a finite alphabet, we study the problem of finding rectangular subarrays of the array that belong to the picture language. We formulate four particular problems – finding maximum, minimum, any or all match(es) – and describe algorithms solving them for basic classes of picture languages, including local picture languages and picture languages accepted by deterministic on-line tessellation automata or deterministic four-way finite automata. We also prove that the matching problems cannot be solved for the class of local picture languages in linear time unless the problem of triangle finding is solvable in quadratic time. This shows there is a fundamental difference in the pattern matching complexity regarding the one-dimensional and two-dimensional setting.

## Keywords

Two-dimensional pattern matching Picture languages Local picture languages Two-dimensional finite-state automata

## References

1. 1.
Abboud, A., Backurs, A., Williams, V.V.: If the current clique algorithms are optimal, so is Valiant’s parser. In: Guruswami, V. (ed.) FOCS 2015, pp. 98–117. IEEE Computer Society (2015).
2. 2.
Aho, A.V.: Algorithms for finding patterns in strings. In: van Leeuwen, J. (ed.) Algorithms and Complexity, Handbook of Theoretical Computer Science, vol. A, pp. 255–300. The MIT Press, Cambridge (1990)Google Scholar
3. 3.
Anselmo, M., Giammarresi, D., Madonia, M.: From determinism to non-determinism in recognizable two-dimensional languages. In: Harju, T., Karhumäki, J., Lepistö, A. (eds.) DLT 2007. LNCS, vol. 4588, pp. 36–47. Springer, Heidelberg (2007).
4. 4.
Baeza-Yates, R., Régnier, M.: Fast two-dimensional pattern matching. Inf. Process. Lett. 45(1), 51–57 (1993).
5. 5.
Blum, M., Hewitt, C.: Automata on a 2-dimensional tape. In: SWAT 1967, pp. 155–160. IEEE Computer Society (1967).
6. 6.
Borchert, B., Reinhardt, K.: Deterministically and sudoku-deterministically recognizable picture languages. In: Loos, R., Fazekas, S., Martín-Vide, C. (eds.) LATA 2007, pp. 175–186. Report 35/07, Tarragona (2007)Google Scholar
7. 7.
Giammarresi, D., Restivo, A.: Two-dimensional languages. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, pp. 215–267. Springer, Heidelberg (1997).
8. 8.
Han, Y.-S., Průša, D.: Template-based pattern matching in two-dimensional arrays. In: Brimkov, V.E., Barneva, R.P. (eds.) IWCIA 2017. LNCS, vol. 10256, pp. 79–92. Springer, Cham (2017).
9. 9.
Inoue, K., Nakamura, A.: Some properties of two-dimensional on-line tessellation acceptors. Inf. Sci. 13(2), 95–121 (1977).
10. 10.
Itai, A., Rodeh, M.: Finding a minimum circuit in a graph. In: Hopcroft, J.E., Friedman, E.P., Harrison, M.A. (eds.) STOC 1977, pp. 1–10. ACM (1977).
11. 11.
Karp, R.M., Rabin, M.O.: Efficient randomized pattern-matching algorithms. IBM J. Res. Dev. 31(2), 249–260 (1987).
12. 12.
Lee, L.: Fast context-free grammar parsing requires fast Boolean matrix multiplication. J. ACM 49(1), 1–15 (2002).
13. 13.
Morgan, C.: Programming from Specifications. Prentice Hall International Series in Computer Science, 2nd edn. Prentice Hall, Upper Saddle River (1994)
14. 14.
de Oliveira Oliveira, M., Wehar, M.: Intersection non-emptiness and hardness within polynomial time. In: Hoshi, M., Seki, S. (eds.) DLT 2018. LNCS, vol. 11088, pp. 282–290. Springer, Cham (2018).
15. 15.
Potechin, A., Shallit, J.: Lengths of words accepted by nondeterministic finite automata. CoRR abs/1802.04708 (2018). http://arxiv.org/abs/1802.04708
16. 16.
Průša, D., Mráz, F., Otto, F.: Two-dimensional Sgraffito automata. RAIRO Theor. Inf. Appl. 48, 505–539 (2014).
17. 17.
Richards, D., Liestman, A.L.: Finding cycles of a given length. In: Alspach, B., Godsil, C. (eds.) Annals of Discrete Mathematics (27): Cycles in Graphs, North-Holland Mathematics Studies, vol. 115, pp. 249–255, North-Holland (1985)Google Scholar
18. 18.
Siromoney, G., Siromoney, R., Krithivasan, K.: Abstract families of matrices and picture languages. Comput. Graph. Image Process. 1(3), 284–307 (1972)
19. 19.
Sun, X., Nobel, A.B.: On the size and recovery of submatrices of ones in a random binary matrix. J. Mach. Learn. Res. 9(Nov), 2431–2453 (2008)
20. 20.
Toda, M., Inoue, K., Takanami, I.: Two-dimensional pattern matching by two-dimensional on-line tessellation acceptors. Theor. Comput. Sci. 24, 179–194 (1983).
21. 21.
Williams, V.V.: Multiplying matrices faster than Coppersmith-Winograd. In: STOC 2012, pp. 887–898. ACM, New York (2012).
22. 22.
Williams, V.V.: Hardness of easy problems: basing hardness on popular conjectures such as the strong exponential time hypothesis (invited talk). In: Husfeldt, T., Kanj, I.A. (eds.) IPEC 2015. LIPIcs, vol. 43, pp. 17–29. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2015).
23. 23.
Yuster, R., Zwick, U.: Finding even cycles even faster. SIAM J. Discrete Math. 10(2), 209–222 (1997).