arXiv:2609.35746cs.DSSep 2026

Manuscript Offprint

arXiv:2609.35746

Near-Optimal Bounds for Testing Residual-String Equality and Parenthesis Languages

Hadar Strauss

Abstract

Residual-String Equality, denoted ResStringEq, is the property consisting of all pairs of strings over {0,1,∗}\{0,1,*\} that are equal after deleting all ‘*’ symbols from them. This property was first introduced by Fischer, Magniez, and Starikovskaya (SODA 2018), who used it to show a lower bound on testing the Dyck languages, where Dyckm_m is the language consisting of balanced sequences of parentheses over mm parenthesis types. They showed that testing ResStringEq on inputs of length nn requires Ω(n1/5)\Omega(n^{1/5}) queries, and presented a reduction from testing ResStringEq to testing Dyckm_m where m≥2m \geq 2. Furthermore, they showed that Dyckm_m can be tested with O(n2/5+δ)O(n^{2/5+\delta}) queries for every constant proximity parameter, where δ>0\delta > 0 is an arbitrarily small constant.

In this work, we nearly close the remaining gap, by showing that testing ResStringEq, and hence Dyck m_{m} where m≥2m \geq 2, requires Ω(n2/5)\Omega(n^{2/5}) queries. We also show a stronger lower bound of Ω(n)\Omega(\sqrt{n}) for testers that make non-adaptive queries. We establish that the Ω(n)\Omega(\sqrt{n}) bound is nearly tight, by presenting a non-adaptive tester for ResStringEq that uses O(n1/2+δ)O(n^{1/2+\delta}) queries for an arbitrarily small constant δ>0\delta > 0. Furthermore, we extend this non-adaptive tester to the Dyck languages, with the same query complexity. Finally, we improve the dependence on the proximity parameter ϵ\epsilon in the tester of Fischer, Magniez, and Starikovskaya, reducing it from O(1/ϵ)poly(1/δ)O(1/\epsilon)^{\text{poly}(1/\delta)} to O(1/ϵ)O(log⁡(1/δ))O(1/\epsilon)^{O(\log(1/\delta))}.

Contents

1 Introduction 3
1.1 Our results 3
1.2 Organization 5

2 Technical overview 5
2.1 The lower bound 5
2.1.1 An Ω(n1/4)\Omega(n^{1/4}) lower bound 5
2.1.2 Improving the lower bound to Ω(n2/5)\Omega(n^{2/5}) 9
2.2 A non-adaptive tester 10

3 Preliminaries 13

4 Lower bound 14
4.1 The two distributions 14
4.2 The non-adaptive case 15
4.3 The adaptive case 16
4.3.1 Proof of Lemma 4.8 17

5 A non-adaptive tester for ResStringEq 23
5.1 A warm-up 23
5.1.1 A basic adaptive tester 23
5.1.2 Correctness 24
5.1.3 Making the basic tester non-adaptive 25
5.2 The actual non-adaptive tester 27
5.2.1 Query complexity 30
5.2.2 Correctness 30
5.3 On the adaptive tester for ResStringEq 33

6 Extending the non-adaptive tester to the Dyck languages 33
6.1 Preliminaries 34
6.2 The excess parentheses matching procedure 37
6.3 The tester 39
6.3.1 Query complexity 40
6.3.2 Correctness 40
6.4 On the adaptive tester for the Dyck languages 41

Acknowledgments 42

References 42

Appendices 43

A A reduction to the equal-length case in ResStringEq 43

B Proof of Fact 4.7 43