DOKK Library

Exponentially Small Soundness for the Direct Product Z-test

Authors Irit Dinur, Inbal Livni Navon,

License CC-BY-3.0

Plaintext
                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56
                                        www.theoryofcomputing.org




   Exponentially Small Soundness for the
          Direct Product Z-test
                                Irit Dinurโˆ—                   Inbal Livni Navonโ€ 
                   Received July 4, 2019; Revised October 12, 2022; Published October 2, 2023




       Abstract. Given a function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ , the Z-test is a three-query test for
       checking if the function ๐‘“ is a direct product, i. e., if there are functions ๐‘”1 , . . . , ๐‘” ๐‘˜ :
       [๐‘] โ†’ [๐‘€] such that ๐‘“ (๐‘ฅ 1 , . . . , ๐‘ฅ ๐‘˜ ) = (๐‘”1 (๐‘ฅ 1 ), . . . , ๐‘” ๐‘˜ (๐‘ฅ ๐‘˜ )) for every input ๐‘ฅ โˆˆ [๐‘] ๐‘˜ .
            This test was introduced by Impagliazzo โˆš         et. al. (SICOMP 2012), who showed that
       if the test passes with probability ๐œ– > exp(โˆ’ ๐‘˜) then ๐‘“ is ฮฉ(๐œ–)-correlated to a direct
       product function in some precise sense. It remained an open question whether the
       soundness of this test can be pushed all the way down to exp(โˆ’๐‘˜) (which would
       be optimal). This is our main result: we show that whenever ๐‘“ passes the Z-test
       with probability ๐œ– > exp(โˆ’๐‘˜) , there must be a global reason for this, namely, ๐‘“ is
       ฮฉ(๐œ–)-correlated to a direct product function, in the same sense of closeness.
            Towards proving our result we analyze the related (two-query) V-test, and prove
       a โ€œrestricted global structureโ€ theorem for it. Such theorems were also proven
       in previous work on direct product testing in the small soundness regime. The
       most recent paper, by Dinur and Steurer (CCC 2014), analyzed the V-test in the
       exponentially small soundness regime. We strengthen their conclusion by moving
    A preliminary version of this paper appeared in the Proceedings of the 32nd Computational Complexity
Conference, 2017 [7].
  โˆ— Research supported in part by an ISF-UGC grant number 1399/14, and by BSF grant number 2014371.
  โ€  Research supported in part by an ISF-UGC grant number 1399/14, and by BSF grant number 2014371.



ACM Classification: F.2.2
AMS Classification: 68Q25
Key words and phrases: direct product testing, property testing, agreement


ยฉ 2023 Irit Dinur and Inbal Livni Navon
c b Licensed under a Creative Commons Attribution License (CC-BY)                        DOI: 10.4086/toc.2023.v019a003
                                  I RIT D INUR AND I NBAL L IVNI NAVON

      from an โ€œin expectationโ€ statement to a stronger โ€œconcentration of measureโ€ type of
      statement, which we prove using reverse hypercontractivity. This stronger statement
      allows us to proceed to analyze the Z-test.




1    Introduction

A function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ for ๐‘ , ๐‘€, ๐‘˜ โˆˆ โ„• is a direct product function if ๐‘“ = (๐‘”1 , . . . , ๐‘” ๐‘˜ ) , for
๐‘” ๐‘– : [๐‘] โ†’ [๐‘€], i. e., the output of ๐‘“ on each coordinate depends on the input to this coordinate
alone. Direct products appear in a variety of contexts in complexity theory, usually for hardness
amplification. In PCP constructions it underlies the Parallel Repetition Theorem [18] and
implicitly appears in other forms of gap amplification, see e. g., [4]. The specific task of testing
direct products as an abstraction of a certain element of PCP constructions was introduced by
[9].
    The combinatorial question that underlies these constructions is the direct product testing
question: given a function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ , is it a direct product function? The setting of
interest here is where we query ๐‘“ on as few inputs as possible, and decide if is it a direct product
function. Direct product testing is a type of property testing question, yet it is not in the standard
property testing parameter regime. In property testing, we are generally interested in showing
that functions that pass the test with high probability, for example 99%, are close to having the
property.
    In our case, we are interested in understanding the structure of functions that pass the test
with smallโ€”but non-trivialโ€”probability, e. g., 1%. The 1% regime is often more challenging
than the 99% regime. It plays an important role in PCPs where one needs to prove a large gap.
In such arguments, one needs to be able to deduce non-trivial structure even from a proof that
passes a verification test with small probability, e. g., 1%.
    There are very few families of tests for which 1% theorems are known. These include
algebraic low-degree tests and direct product tests. For low-degree tests there has been a
considerable amount of work in various regimes and in particular towards understanding the
extent of the 1% theorems, see, e. g., [19, 1, 3] and [2]. It is intriguing to understand more broadly
for which tests such theorems can hold. Indeed, as far as we know, there are no other tests that
exhibit such strong โ€œstructure vs. randomnessโ€ behavior, and direct product tests are natural
candidates in which to study this question.
   We remark that finding new settings where 1% theorems hold (including in particular
derandomized direct products) can potentially be useful for constructing locally testable codes
and stronger PCPs, see, e. g., the recent papers [14, 6]. Towards this goal, gaining a more
comprehensive understanding of direct product tests, as well as developing tools for proving
them, are natural objectives.
                   โˆš          Our results improve the minimal soundness of the 2-query PCP
from [13] from exp( ๐‘˜) to exp(๐‘˜).

                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                             2
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                             Test 1: Z-test with parameter ๐‘ก (3-query test)

   1. Choose ๐ด, ๐ต, ๐ถ to be a random partition of [๐‘˜],                                    ๐ด      ๐ถ         ๐ต
      such that |๐ด| = |๐ต| = ๐‘ก.                                                ๐‘ฅ

   2. Choose uniformly at random ๐‘ฅ, ๐‘ฆ, ๐‘ง โˆˆ [๐‘] ๐‘˜ such                         ๐‘ฆ
      that ๐‘ฅ ๐ด = ๐‘ฆ๐ด and ๐‘ฆ๐ต = ๐‘ง ๐ต .
                                                                              ๐‘ง
   3. Accept if ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด and ๐‘“ (๐‘ง)๐ต = ๐‘“ (๐‘ฆ)๐ต .
Denote by agr๐‘ก๐‘ ( ๐‘“ ) the success probability of ๐‘“ on this test.


1.1   Our main result
The main question we study is: if ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ passes a certain natural test (Test 1) with
non-negligible probability, what does ๐‘“ look like?
Theorem 1.1 (Main Theorem โ€“ Global Structure). For every ๐‘ , ๐‘€ > 1, there exists ๐‘ > 0 such that
for every ๐œ† > 0 and large enough ๐‘˜, if ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ is a function that passes Test 1 with probability
agr๐‘๐‘˜/10 ( ๐‘“ ) = ๐œ– โ‰ฅ eโˆ’๐‘๐œ† ๐‘˜ , then there exist functions (๐‘”1 , . . . , ๐‘” ๐‘˜ ) , ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€] such that
                         2




                                                                                          ๐œ–
                                                                                 
                                                    ๐œ†๐‘˜
                                  Pr          ๐‘“ (๐‘ฅ) โ‰ˆ (๐‘”1 (๐‘ฅ 1 ) . . . , ๐‘” ๐‘˜ (๐‘ฅ ๐‘˜ )) โ‰ฅ      ,
                                ๐‘ฅโˆˆ[๐‘] ๐‘˜                                                  10

       ๐œ†๐‘˜
where โ‰ˆ means that the strings are equal on all but at most ๐œ†๐‘˜ coordinates.
   The theorem is qualitatively tight with respect to several parameters: (i) soundness (i. e., the
parameter ๐œ–), (ii) approximate equality vs. exact equality (i. e., the parameter ๐œ†), (iii) number of
queries in the test. We discuss these next.

(i) Soundness The soundness of the theorem is the smallest success probability for which the
theorem holds. In our case it is 2โˆ’๐‘ ๐‘˜ for some constant ๐‘ > 0. This is tight up to the constant ๐‘,
as can be seen from the example below.
Example 1.2 (Random function). Let ๐‘“ : [๐‘] ๐‘˜ โ†’ {0, 1} ๐‘˜ be a random function, i. e., for each
๐‘ฅ โˆˆ [๐‘] ๐‘˜ choose ๐‘“ (๐‘ฅ) โˆˆ {0, 1} ๐‘˜ uniformly and independently. Two random strings in {0, 1} ๐‘ก are
equal with probability 2โˆ’๐‘ก , therefore agr๐‘ก๐‘ ( ๐‘“ ) โ‰ฅ 2โˆ’2๐‘ก , since the test performs two such checks.
On the other hand, since ๐‘“ is random, it is not close to any direct product function (see Section 6
for more information).
   We remark that every function ๐‘“ : [๐‘] ๐‘˜ โ†’ {0, 1} ๐‘˜ is at least 2โˆ’๐‘˜ close to a direct product
function 1, so this amount of correlation is meaningless. We conclude that in order to have direct
product theorem that is not trivial, the minimal soundness has to be larger than 2โˆ’๐‘˜ .
   1Consider the direct product function constructed incrementally by taking the most common value out of {0, 1}
on each step.


                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                 3
                                    I RIT D INUR AND I NBAL L IVNI NAVON

                             Test 2: V-test with parameter ๐‘ก (2-query test)

   1. Choose ๐ด โŠ‚ [๐‘˜] of size ๐‘ก, uniformly at random.
                                                                        ๐ด

   2. Choose uniformly at random ๐‘ฅ, ๐‘ฆ             โˆˆ [๐‘] ๐‘˜ such     ๐‘ฅ
      that ๐‘ฅ ๐ด = ๐‘ฆ๐ด .
                                                                   ๐‘ฆ
   3. Accept if ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด .
Denote by agrโˆจ๐‘ก ( ๐‘“ ) the success probability of ๐‘“ on this test.


(ii) Approximate equality vs. exact equality In the theorem, we prove that for for an ฮฉ(๐œ–)
                                          ๐œ†๐‘˜
fraction of the inputs ๐‘ฅ we have ๐‘“ (๐‘ฅ) โ‰ˆ (๐‘”1 (๐‘ฅ), . . . , ๐‘” ๐‘˜ (๐‘ฅ)) . A priori, one could hope for a stronger
conclusion in which ๐‘“ (๐‘ฅ) = (๐‘”1 (๐‘ฅ), . . . , ๐‘” ๐‘˜ (๐‘ฅ)) for an ฮฉ(๐œ–) fraction of the inputs ๐‘ฅ. However,
Example 1.3 shows that for ๐‘ก = ๐‘˜/10 , approximate equality is necessary.

Example 1.3 (Noisy direct product function). This example is from [5]. Let ๐‘“ be a direct product
function, except that on each input ๐‘ฅ we โ€œcorrupt" ๐‘“ (๐‘ฅ) on ๐œ†๐‘˜ random coordinates by changing
๐‘“ (๐‘ฅ) on these coordinates into random values. For ๐œ† > 1/10 , the probability that Test 1 on ๐‘“
misses all the corrupted coordinates is 2โˆ’ฮฉ(๐œ†๐‘˜) , in which case the test succeeds. Since we have
changed ๐‘“ (๐‘ฅ) on ๐œ†๐‘˜ coordinates into random values, no direct product function can approximate
๐‘“ on more than a (1 โˆ’ ๐œ†) fraction of the coordinates.

    From this example, we conclude that it is not possible to approximate ๐‘“ that passes Test 1
(with parameter ๐‘ก = ๐‘˜/10) with probability eโˆ’๐‘๐œ†๐‘˜ on more than a (1โˆ’๐œ†) fraction of the coordinates.
In Section 6 we prove similar bounds for different intersection sizes, and also discuss different
test variants.

(iii) Number of queries in the test The absolute minimum number of queries for any direct
product test is two. Indeed, there is a very natural 2-query test, Test 2. Dinur and Goldenberg
showed that it is not possible to have a direct product theorem with soundness lower than
1/poly(๐‘˜) using the 2-query test [5].

Example 1.4 (Localized direct product functions). In this example we assume that ๐‘ = ๐œ”(๐‘˜ 2 ) .
For every ๐‘ โˆˆ [๐‘] we choose a random function ๐‘”๐‘ : [๐‘] โ†’ [๐‘€] independently. For every input
๐‘ฅ โˆˆ [๐‘] ๐‘˜ , we choose a random ๐‘– ๐‘ฅ โˆˆ ๐‘˜, set ๐‘ = ๐‘ฅ ๐‘– and set ๐‘“ (๐‘ฅ) = (๐‘”๐‘ (๐‘ฅ 1 ), . . . , ๐‘”๐‘ (๐‘ฅ ๐‘˜ )) .
     The function ๐‘“ satisfies agrโˆจ๐‘ก ( ๐‘“ ) โ‰ฅ ๐‘ก/๐‘˜ 2 ; indeed, for ๐‘ฅ, ๐‘ฆ and ๐ด chosen in the test, if ๐‘– ๐‘ฅ = ๐‘– ๐‘ฆ
and ๐‘– ๐‘ฅ โˆˆ ๐ด, then the test will pass. The probability that ๐‘– ๐‘ฅ = ๐‘– ๐‘ฆ is 1/๐‘˜ , and the probability that
๐‘– ๐‘ฅ โˆˆ ๐ด is ๐‘ก/๐‘˜ .
     For ๐‘ = ๐œ”(๐‘˜ 2 ) , the function ๐‘“ is far from direct product, since it is made up from ๐‘ different
direct product functions, each piece consisting of roughly a 1/๐‘ fraction of the domain [๐‘] ๐‘˜ .

   For every ๐‘ก, the function described in the example satisfies agrโˆจ๐‘ก ( ๐‘“ ) โ‰ฅ 1/๐‘˜ 2 , yet there is
no direct product function that approximates ๐‘“ on ฮฉ(1/๐‘˜ 2 ) fraction of the domain. In [5] the

                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                             4
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                  Test 3: Z-test for functions over sets, with parameter ๐‘ก (3-queries)

   1. Choose random ๐‘‰ , ๐‘Š , ๐‘‹ , ๐‘Œ โŠ‚ [๐‘], such that |๐‘Š | =
      |๐‘‰ | = ๐‘ก, |๐‘‹ | = |๐‘Œ| = ๐‘˜ โˆ’ ๐‘ก and ๐‘‹ โˆฉ ๐‘Š = ๐‘Œ โˆฉ ๐‘Š =                         ๐‘‹         ๐‘Š
      ๐‘Œ โˆฉ ๐‘‰ = โˆ….

   2. Accept if ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š and                                          ๐‘Œ       ๐‘‰
      ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ = ๐‘“ (๐‘Œ โˆช ๐‘‰)๐‘Œ .
Denote by agr๐‘ก๐‘ ๐‘ ๐‘’๐‘ก ( ๐‘“ ) the success probability of ๐‘“ on this test.


conclusion from Example 1.4 was that 1/poly(๐‘˜) is the limit for small soundness for direct
product tests. However, [13] showed that by adding just one more query, this limitation goes
away. They introduced a 3-query test, similar to Test 1, and proved a direct product theorem for
           ๐›ฝ
all ๐œ– > 2โˆ’๐‘˜ for some constant ๐›ฝ โ‰ค 1/2 .

Direct product test for functions over sets Some of the previous results on direct products, such
as [13], were proven in a slightly different setting where the function tested is ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ .
                                                                                          
                                                                                       ๐‘˜
The input to ๐‘“ is an unordered set ๐‘† โŠ‚ [๐‘] of ๐‘˜ elements, and we view ๐‘“ (๐‘†) a matching that
matches each element ๐‘Ž โˆˆ ๐‘† to an element ๐‘“ (๐‘†)๐‘Ž โˆˆ [๐‘€]. The first bit of ๐‘“ (๐‘†) corresponds to
๐‘“ (๐‘†)๐‘Ž for the smallest elements ๐‘Ž โˆˆ ๐‘†, and so on. In this setting, a direct product function is
                                                 ๐‘ก
๐‘” : [๐‘] โ†’ [๐‘€], and we say that ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†) if for all but ๐‘ก of the elements ๐‘Ž โˆˆ ๐‘†, ๐‘“ (๐‘†)๐‘Ž = ๐‘”(๐‘Ž).
    In this article, we prove a direct product testing theorem also for this setting. Test 3 is the
analog of Test 1 for functions over sets. In Test 3 (see figure), we pick four sets ๐‘Š , ๐‘‹ , ๐‘Œ, ๐‘‰ โŠ‚ [๐‘],
such that ๐‘‹ โˆฉ ๐‘Š = ๐‘Œ โˆฉ ๐‘Š = ๐‘Œ โˆฉ ๐‘‰ = โˆ… (other intersections can be non-empty). The sets are
picked such that |๐‘‹ โˆช ๐‘Š | = |๐‘Œ โˆช ๐‘Š | = |๐‘Œ โˆช ๐‘‰ | = ๐‘˜ , so that they can be inputs for ๐‘“ .
Theorem 1.5 (Global Structure for Sets). There exists a constant ๐‘ > 0, such that for every ๐œ† > 0, large
enough ๐‘˜ โˆˆ โ„• and ๐‘ > e๐‘๐œ†๐‘˜ , ๐‘€ โˆˆ โ„• , if the function ๐‘“ : [๐‘]          โ†’ [๐‘€] ๐‘˜ passes Test 3 with probability
                                                                   
                                                                 ๐‘˜
agr๐‘๐‘˜/10
     ๐‘ ๐‘’๐‘ก
         ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐œ†๐‘˜ , then there exists a function ๐‘” : [๐‘] โ†’ [๐‘€] such that
                                                           
                                                     ๐œ†๐‘˜
                                         Pr ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†) โ‰ฅ ๐œ– โˆ’ 4๐œ– 2 .
                                         ๐‘†

    Notice that the bound ๐œ– โˆ’ 4๐œ– 2 is better than the bound in Theorem 1.1, and it is tight, as
demonstrated by the function ๐‘“ which is a hybrid of 1/๐œ– different direct product functions on
equal parts of the inputs. Such function ๐‘“ passes Test 3 with probability ๐œ–, and every direct
product function is close to ๐‘“ only on an ๐œ– fraction of the inputs.
    We remark that the two theorems are not the same. In Theorem 1.1, there are ๐‘˜ different
functions ๐‘”1 , . . . , ๐‘” ๐‘˜ : [๐‘] โ†’ [๐‘€] whereas in Theorem 1.5 there is a single one. Furthermore,
Theorem 1.1 holds for any ๐‘ , ๐‘€ โˆˆ โ„• and large enough ๐‘˜, and Theorem 1.5 (and other such
direct product theorems) only hold for ๐‘  ๐‘˜. The proofs of the theorems are also different, as
discussed later in the Introduction.

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                           5
                                    I RIT D INUR AND I NBAL L IVNI NAVON

    The proof of the global structure for sets uses the fact that the first query, ๐‘‹ โˆช ๐‘Š, and the last
query, ๐‘Œ โˆช ๐‘‰, are nearly independent. These queries are not completely independent, because
๐‘Œ, ๐‘Š are picked such that ๐‘Œ โˆฉ ๐‘Š = โˆ…. The difference between the distribution of ๐‘‹ โˆช ๐‘Š and
๐‘Œ โˆช ๐‘‰ and the distribution of two independent subsets of size ๐‘˜ is bounded by ๐‘˜ 2 /๐‘ . This
means that the theorem holds when ๐‘˜ 2 /๐‘  ๐œ– . For an exponentially small ๐œ–, this implies that
๐‘ = exp(๐‘˜). We have not analyzed the case where ๐‘ is smaller with respect to ๐‘˜ in this setting
(in the main theorem, when ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ , there is no requirement that ๐‘ should be large
with respect to ๐‘˜).

1.2   Restricted global structure
Our proof has two main parts, similar to the structure of the proof of [5, 13]. In the first part, we
analyze only Test 2 and prove a restricted global structure theorem for it, Theorem 1.6 below,
(this was called local structure in [13, 8]). The term โ€œrestricted global structureโ€ refers to the
case when we restrict the domain to small (but not trivial) pieces, and show that ๐‘“ is close to a
product function on each piece separately. This is the structure of the function in Example 1.4.
    More explicitly, for every ๐ด โˆˆ [๐‘˜] of size ๐‘˜/10 , ๐‘Ÿ โˆˆ [๐‘]๐ด and ๐›พ โˆˆ [๐‘€]๐ด , a restriction is a triple
๐œ = (๐ด, ๐‘Ÿ, ๐›พ). The choice of ๐‘ก = ๐‘˜/10 in Theorem 1.1 is somewhat arbitrary, the theorem can be
proven with ๐‘ก = ๐‘ ๐‘˜ for any constant ๐‘ < 1/2 . The restriction corresponds to the set of inputs

                                    ๐’ฑ๐œ = {๐‘ค โˆˆ [๐‘][๐‘˜]\๐ด | ๐‘“ (๐‘Ÿ, ๐‘ค)๐ด = ๐›พ}.

Our restricted global structure theorem is that for many restrictions ๐œ, there exists a direct
product function that is close to ๐‘“ on ๐’ฑ๐œ .
Theorem 1.6 (Restricted Global Structure โ€“ informal). There exists a constant ๐‘ > 0, such that for
every ๐›ผ > 0 and large enough ๐‘˜ โˆˆ โ„• the following holds. Let ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be a function that passes
Test 2 with probability agrโˆจ๐‘˜/10 ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐›ผ๐‘˜ . Let ๐’Ÿ be the test distribution over ๐œ, namely choosing
๐ด โŠ‚ [๐‘˜], ๐‘ฅ โˆˆ [๐‘] ๐‘˜ uniformly and setting ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) . Then with probability ฮฉ(๐œ–), there exists
a direct product function ๐‘” = (๐‘”1 , . . . , ๐‘”9๐‘˜/10 ), ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€] such that,
                                                                        
                                                   ๐›ผ๐‘˜
                           Pr           ๐‘“ (๐‘Ÿ, ๐‘ค)[๐‘˜]\๐ด โ‰ˆ ๐‘”(๐‘ค[๐‘˜]\๐ด ) ๐‘ค โˆˆ ๐’ฑ๐œ โ‰ฅ 1 โˆ’ ๐œ– 2                   (1.1)
                       ๐‘คโˆˆ[๐‘][๐‘˜]\๐ด

    A similar theorem was proven in [13] but only for soundness (i. e., ๐œ–) at least exp(โˆ’๐‘˜ ๐›ฝ ) for
a constant ๐›ฝ โ‰ค 1/2 . This was strengthened to soundness exp(โˆ’ฮฉ(๐‘˜)) in [8]. Our Theorem 1.6
improves on the conclusion of [8]. In [8] the probability in (1.1) was shown to be at least 1 โˆ’ ๐‘‚(๐›ผ)
(recall that ๐›ผ is a constant), whereas we show it is exponentially close to 1 (when ๐œ– is that
small). This difference may seem minor but in fact it is what prevented [8] from deriving global
structure via a three-query test (i. e., moving from the V-test to the Z-test). When we try to move
from restricted global structure to global structure, the consistency inside each restriction needs
to be very high for the probabilistic arguments to work, as we explain below.
    The restricted global structure gives us a direct product function that approximates ๐‘“ only
on a restricted subset of the inputs. In the proof of the global structure, we use the third query

                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                             6
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

to show that there exists a global function. A key step in the proof of the global structure is
to show that for many restrictions ๐œ, the function ๐‘”๐œ is close to ๐‘“ on a much larger subsets of
inputs. This is done, intuitively, by claiming that if ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด , then with high probability
 ๐‘“ (๐‘ฆ) โ‰ˆ ๐‘”๐œ (๐‘ฆ) for ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) . Since ๐ต is a random set and ๐‘“ (๐‘ง)๐ต = ๐‘“ (๐‘ฆ)๐ต , then ๐‘“ (๐‘ง), ๐‘”๐œ (๐‘ง)
are also close. This claim only holds if the success probability on (1.1) is more than 1 โˆ’ ๐œ–, else it
is possible that all the success probability of the test comes from ๐‘“ such that ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด , but
 ๐‘“ (๐‘ฆ), ๐‘”๐œ (๐‘ฆ) are far from each other.

1.3   Technical contribution
In terms of technical contributions our proof consists of two new components.

Domain extension Our first contribution is a new domain extension step that facilitates the proof
of the restricted global structure. The restricted global structure shows that with probability
ฮฉ(๐œ–), the function ๐‘“ is close to a direct product function on the restricted domain ๐’ฑ๐œ . A natural
way to show that a function is close to a direct product function is to define a direct product
function by majority value. However, this method fails when the agreement guaranteed for ๐‘“ is
small, as in our case.
    This is usually resolved by moving to a restricted domain in which the agreement is much
higher, and by defining majority there. The first part of our proof is to show that with probability
ฮฉ(๐œ–) over the restrictions ๐œ = (๐ด, ๐‘Ÿ, ๐›พ), the set ๐’ฑ๐œ satisfies the two properties:

   1. Its density is at least ๐œ–/2 .

   2. ๐‘“ has very high agreement in ๐’ฑ๐œ . Informally it means that taking a random pair ๐‘ค, ๐‘ฃ โˆˆ ๐’ฑ๐œ
      which agree on a random subset of coordinates ๐ฝ, then ๐‘“ (๐‘Ÿ, ๐‘ค)๐ฝ โ‰ˆ ๐‘“ (๐‘Ÿ, ๐‘ฃ)๐ฝ with probability
      greater than 1 โˆ’ ๐œ–.

We call such restrictions excellent, following [13].
    We show that for every excellent restriction ๐’ฑ๐œ , ๐‘“ is close to a direct product function on
๐’ฑ๐œ . Let ๐‘“๐œ : ๐’ฑ๐œ โ†’ [๐‘€] ๐‘˜\๐ด be the restriction of ๐‘“ to ๐’ฑ๐œ , i. e., โˆ€๐‘ค โˆˆ ๐’ฑ๐œ , ๐‘“๐œ (๐‘ค) = ๐‘“ (๐‘Ÿ, ๐‘ค)[๐‘˜]\๐ด . The
function ๐‘“๐œ has high agreement, which is good for defining majority, but unfortunately ๐’ฑ๐œ is
very sparse in [๐‘] ๐‘˜\๐ด . The density of ๐’ฑ๐œ can be as low as ๐œ–/2 , which is exponentially small,
and this is where the techniques used in [13] break down. In order to prove that ๐‘“ is close to a
direct product function on ๐’ฑ๐œ , we use a local averaging operator to extend the domain from ๐’ฑ๐œ
to [๐‘][๐‘˜]\๐ด .
    The local averaging operator ๐’ซ 3 is the majority of a 3/4-correlated neighborhood of ๐’ฑ๐œ ,
                                        4


                 โˆ€๐‘ค โˆˆ [๐‘][๐‘˜]\๐ด , ๐‘– โˆˆ [๐‘˜] \ ๐ด       ๐’ซ 3 ๐‘“๐œ (๐‘ค)๐‘– =      Plurality           { ๐‘“๐œ (๐‘ฃ)๐‘– },
                                                                   ๐‘ฃ โˆผ ๐‘ค,๐‘ฃโˆˆ๐’ฑ๐œ ,๐‘ฃ ๐‘– =๐‘ค ๐‘–
                                                      4
                                                                    3/4


where ๐‘ฃ โˆผ ๐‘ค means that for every ๐‘— โ‰  ๐‘– independently, we take ๐‘ฃ ๐‘— = ๐‘ค ๐‘— with probability 1/4 ,
          3/4
and a random value in [๐‘] else.

                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                               7
                                   I RIT D INUR AND I NBAL L IVNI NAVON

    The domain of the new function is all of [๐‘][๐‘˜]\๐ด , ๐’ซ 3 ๐‘“๐œ : [๐‘][๐‘˜]\๐ด โ†’ [๐‘€][๐‘˜]\๐ด , and it satisfies
                                                          4
the following properties:

   1. ๐’ซ 3 ๐‘“๐œ approximates ๐‘“๐œ on ๐’ฑ๐œ .
        4


   2. ๐’ซ 3 ๐‘“๐œ has high agreement, taking a random pair ๐‘ค, ๐‘ฃ โˆˆ [๐‘][๐‘˜]\๐ด such that ๐‘ค ๐ฝ = ๐‘ฃ ๐ฝ , results
        4
      in agreeing answers, ๐’ซ 3 ๐‘“๐œ (๐‘ค)๐ฝ โ‰ˆ ๐’ซ 3 ๐‘“๐œ (๐‘ฃ)๐ฝ with probability greater than 1 โˆ’ ๐œ–.
                               4              4


The main technical tool we use to prove these properties is a reverse hypercontractivity argument
from [16]. For every two sets ๐‘ˆ , ๐‘‰ โŠ‚ [๐‘] ๐‘˜ , Mossel et al. proved a lower bound on the probability
of a random ๐‘ค โˆˆ [๐‘] ๐‘˜ and ๐‘ฃ โˆผ3/4 ๐‘ค to be in ๐‘ˆ and in ๐‘‰, respectively. We use their result to
prove that for almost all of ๐‘ค โˆˆ [๐‘][๐‘˜]\๐ด , taking ๐‘ฃ โˆผ ๐‘ค ends inside ๐’ฑ๐œ with probability at least
                                                       3/4

poly(๐œ–). This allows us to prove that for almost all of ๐‘ค โˆˆ [๐‘][๐‘˜]\๐ด , ๐‘– โˆˆ [๐‘˜] \ ๐ด , the plurality
๐’ซ 3 ๐‘“๐œ (๐‘ค)๐‘– relays on many values of ๐‘“๐œ (๐‘ฃ)๐‘– , which in turn lets us to prove the two properties above.
  4
    Lastly, we define a direct product function ๐‘”๐œ by taking the plurality over ๐’ซ 3 ๐‘“๐œ , and show
                                                                                        4
that it is close to ๐‘“๐œ .


Direct product testing in a dense regime A second new element comes when stitching the
many localized functions into one global direct product function, by using the third query.
    We prove two global structure theorems, Theorem 1.1 for functions on tuples (ordered lists)
๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ and Theorem 1.5 for functions on sets ๐‘“ : [๐‘]     โ†’ [๐‘€] ๐‘˜ .
                                                                  
                                                                ๐‘˜
    When we work with ๐‘“ that is defined over sets, we can directly follow the approach of [13] to
complete the proof. However, when working with ๐‘“ defined on tuples we reach a combinatorial
question that itself resembles a direct product testing question, but in a different (dense) regime.
Luckily, the fact that this question is in a dense regime makes it easier to solve, and this leads to
our global structure theorem for tuples.


1.4   Agreement tests and direct product tests
The question of direct product testing fits into a more general family of tests called agreement
tests. We digress slightly to describe this setting formally and explain how direct product tests
fit into this framework.


Agreement tests In all efficient PCPs we break a proof into small overlapping pieces, use
relatively inefficient PCPs (i. e., PCPs that incur a large blowup) to encode each small piece,
and then through an agreement test put the pieces back together. The agreement test is needed
because given the set of pieces (their values and locations), there is no guarantee that the
different pieces come from the same underlying global proof, i. e., that the proofs of each piece
can be โ€œput back together againโ€. The PCP system needs to ensure this through agreement testing:
we take two (or more) pieces that have some overlap, and check that they agree.

                       T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                          8
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                                Figure 1: complete ๐‘˜-uniform ๐‘˜-partite graph


                                                                              โ„Žโˆˆ๐ป


                                       ๐‘
                                   vertices



                                               ๐‘‰1         ๐‘‰2                                         ๐‘‰๐‘˜


    This situation can be formulated as an agreement testing question as follows. Let ๐‘‰ be a
ground set, |๐‘‰ | = ๐‘, and let ๐ป be a collection of subsets of ๐‘‰, i. e., a set of hyperedges. Let [๐‘€]
be a finite set of colors, where it is sufficient to think of ๐‘€ = 2.
    A local assignment is a set ๐‘Ž = {๐‘Ž ๐‘  } of local colorings ๐‘Ž ๐‘  : ๐‘  โ†’ [๐‘€], one per subset ๐‘  โˆˆ ๐ป. A
local assignment is called global if there is a global coloring ๐‘” : ๐‘‰ โ†’ [๐‘€] such that

                                                โˆ€๐‘  โˆˆ ๐ป,                   ๐‘Ž ๐‘  โ‰ก ๐‘”| ๐‘  .

   An agreement check for a tuple of subsets ๐‘  1 , . . . , ๐‘  ๐‘ž checks whether their local functions agree
on any point in the intersection, denoted agree(๐‘Ž ๐‘ 1 , . . . , ๐‘Ž ๐‘  ๐‘ž ) . Formally,

             agree(๐‘Ž ๐‘ 1 , . . . , ๐‘Ž ๐‘  ๐‘ž )     โ‡”            โˆ€๐‘–, ๐‘— โˆˆ [๐‘ž], ๐‘ฅ โˆˆ ๐‘  ๐‘– โˆฉ ๐‘  ๐‘— ,                 ๐‘Ž ๐‘  ๐‘– (๐‘ฅ) = ๐‘Ž ๐‘  ๐‘— (๐‘ฅ) .

A local assignment that is global passes all agreement checks. The converse is also true: a local
assignment that passes all agreement checks must be global.
    An agreement test is specified by giving a distribution ๐’Ÿ over tuples of subsets ๐‘  1 , . . . , ๐‘  ๐‘ž . We
define the agreement of a local assignment to be the probability of agreement,

                                                                       agree(๐‘Ž ๐‘ 1 , . . . , ๐‘Ž ๐‘  ๐‘ž ) .
                                                                                                
                                    agr(๐‘Ž) =         Pr
                                      ๐’Ÿ        (๐‘  1 ,...,๐‘  ๐‘ž )โˆผ๐’Ÿ

An agreement theorem shows that if ๐‘Ž is a local assignment with agr๐’Ÿ (๐‘Ž) > ๐œ– then ๐‘Ž is somewhat
close to a global assignment. Agreement theorems can be studied for any hypergraph and
in this article we prove such theorems for two specific hypergraphs: the ๐‘˜-uniform complete
hypergraph, and the ๐‘˜-uniform ๐‘˜-partite complete hypergraph.

Relation to direct product testing Theorem 1.5 is readily interpretted as an agreement test
theorem. As for Theorem 1.1, we next describe a hypergraph on which it can also be interpreted
โ€œgeometricallyโ€ as an agreement test theorem. Consider complete ๐‘˜-uniform ๐‘˜-partite hypergraph
(see Figure 1). Let ๐บ = (๐‘‰ = ๐‘‰1 , . . . , ๐‘‰๐‘˜ , ๐ป) be the complete ๐‘˜-partite hypergraph with |๐‘‰๐‘– | = ๐‘
for ๐‘– โˆˆ [๐‘˜], and
                             ๐ป = {(๐‘ฃ 1 , . . . , ๐‘ฃ ๐‘˜ ) | โˆ€๐‘– โˆˆ [๐‘˜], ๐‘ฃ ๐‘– โˆˆ ๐‘‰๐‘– } .

                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                   9
                                   I RIT D INUR AND I NBAL L IVNI NAVON

There is a bฤณection between ๐ป and [๐‘] ๐‘˜ . We shall interpret ๐‘“ (๐‘ฅ1 , . . . , ๐‘ฅ ๐‘˜ ) as a local coloring of
the vertices ๐‘ฅ 1 , . . . , ๐‘ฅ ๐‘˜ . In this way, we have the following equivalence
                            ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜           โ‡โ‡’     ๐‘Ž = {๐‘Ž ๐‘ฅ } ๐‘ฅโˆˆ๐ป .
Moreover, local assignments which are global, i. e., ๐‘Ž such that ๐‘Ž ๐‘ฅ = ๐‘”| ๐‘ฅ for some global
coloring ๐‘” : ๐‘‰1 โˆช ยท ยท ยท โˆช ๐‘‰๐‘˜ โ†’ [๐‘€], correspond exactly to functions ๐‘“ which are direct products,
๐‘“ = (๐‘”1 , . . . , ๐‘” ๐‘˜ ) where ๐‘” ๐‘– = ๐‘”|๐‘‰๐‘– ,
                              ๐‘“ = (๐‘”1 , . . . , ๐‘” ๐‘˜ )   โ‡โ‡’      ๐‘Ž is global.
     Finally, Test 2 can be described as taking 2 hyperedges that intersect on ๐‘ก vertices, and check
if their local functions agree on the intersection. Similarly, Test 1 can be described as picking
three hyperedges, โ„Ž 1 , โ„Ž2 , โ„Ž3 โˆˆ ๐ป such that โ„Ž 1 , โ„Ž2 intersect on ๐‘ก vertices, and โ„Ž2 , โ„Ž3 intersect on a
disjoint set of ๐‘ก vertices, and checking agreement.
     Our main theorem, Theorem 1.1, is equivalent to an agreement theorem showing that if a
local assignment ๐‘Ž passes a certain 3-query agreement test with non-negligible probability, then
there exists a global assignment ๐‘” : ๐‘‰ โ†’ [๐‘€] with which it agrees non-negligibly.
     The ๐‘˜-uniform complete hypergraph (it is non-partite, in contrast to the above), is related to
Theorem 1.5. In this hypergraph the vertex set is [๐‘] and there is a hyperedge for every possible
๐‘˜-element subset of [๐‘]. Now we have a similar equivalence between local assignments and
functions over sets, i. e., functions where the input is a set ๐‘† โŠ‚ [๐‘] of size ๐‘˜,
                                   
                              [๐‘]
                          ๐‘“ :     โ†’ [๐‘€] ๐‘˜               โ‡โ‡’     ๐‘Ž = {๐‘Ž ๐‘  } ๐‘ โˆˆ([๐‘]) .
                               ๐‘˜                                               ๐‘˜

An agreement theorem for this hypergraph is equivalent to Theorem 1.5, in which ๐‘“ is defined
not on the set of tuples [๐‘] ๐‘˜ but on the set of subsets [๐‘]   . A global assignment ๐‘Ž on this graph
                                                             
                                                           ๐‘˜
is equivalent to a direct product function over sets, i. e., ๐‘“ = ๐‘” : [๐‘] โ†’ [๐‘€] .

1.5   Organization of the paper
Section 2 contains preliminary notation and definitions. In Section 3 we prove the restricted
global structure, Theorem 1.6. Section 4 is dedicated to the global structure for functions on
sets. We show how to deduce a variant of Theorem 1.6 for sets rather than tuples and then
prove the global structure theorem for sets, Theorem 1.5. In Section 5 we prove the global
structure theorem for tuples, Theorem 1.1. Lastly, in Section 6 we discuss lower bounds for
various 3-query direct product tests that were not presented in the introduction.
    The conference version of this paper had a small gap in the proof that has been thankfully
caught by the careful reviewers and editor, and this has been corrected in Appendix A by
referencing to [12].


2     Preliminaries
For a set ๐ด โŠ‚ [๐‘˜] we denote by ๐ดยฏ the set [๐‘˜] \ ๐ด.

                       T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                            10
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

Definition 2.1. For every 2 strings ๐‘ฅ, ๐‘ฆ โˆˆ [๐‘] ๐‘˜ we say that
         ๐‘ก
   1. ๐‘ฅ โ‰ˆ ๐‘ฆ if ๐‘ฅ, ๐‘ฆ differ in at most ๐‘ก coordinates.
         ๐‘ก
   2. ๐‘ฅ 0 ๐‘ฆ if ๐‘ฅ, ๐‘ฆ differ in more than ๐‘ก coordinates.

     Notice that the distance in the above definition is not relative, but it is the number of
coordinates in which the two strings differ.
     For a set ๐ด โŠ‚ [๐‘˜], we denote by ๐‘Ÿ โˆˆ [๐‘]๐ด a matching from every ๐‘– โˆˆ ๐ด to an element in [๐‘].
                            ยฏ
For ๐‘Ÿ โˆˆ [๐‘]๐ด and ๐‘ค โˆˆ [๐‘]๐ด , the string (๐‘Ÿ, ๐‘ค) โˆˆ [๐‘] ๐‘˜ is the string created by taking for each ๐‘– โˆˆ ๐ด
the element matched to ๐‘– in ๐‘Ÿ, and for each ๐‘– โˆ‰ ๐ด the element matched to ๐‘– in ๐‘ค.
     Let ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , we denote by ๐‘ฅ ๐ด โˆˆ [๐‘]๐ด the matching which matches each ๐‘– โˆˆ ๐ด the element
๐‘ฅ ๐‘– โˆˆ [๐‘].
                                         ๐‘ก
   For ๐‘ฅ, ๐‘ฆ โˆˆ [๐‘]๐ด , we say that ๐‘ฅ โ‰ˆ ๐‘ฆ if for all except at most ๐‘ก coordinates ๐‘– โˆˆ ๐ด, ๐‘ฅ, ๐‘ฆ match the
same value to ๐‘–.

Definition 2.2 (Plurality). The plurality of a function ๐‘“ on a distribution ๐’Ÿ is its most frequent
value                                                                
                            Plurality( ๐‘“ (๐‘ฅ)) = arg max         Pr [ ๐‘“ (๐‘ฅ) = ๐›ฝ] .
                               ๐‘ฅโˆผ๐’Ÿ                         ๐›ฝ   ๐‘ฅโˆˆ๐’Ÿ

    We use a few different Bernstein-Chernoff-type concentration bounds, stated below.
                                                                                                     ร๐‘˜
Fact 2.3 (Chernoff bound). Let ๐‘‹1 , . . . , ๐‘‹ ๐‘˜ be independent random variables in {0, 1}, let ๐‘‹ =    ๐‘–=1 ๐‘‹๐‘–
and denote ๐œ‡ = ๐”ผ[๐‘‹]. Then for every ๐›ฟ โˆˆ (0, 1),

                                                                     ๐›ฟ2 ๐œ‡
                                         Pr        [๐‘‹ โˆ’ ๐œ‡ โ‰ฅ ๐›ฟ๐œ‡] โ‰ค eโˆ’ 3                                    (2.1)
                                     ๐‘‹1 ,...,๐‘‹ ๐‘˜
                                                                         ๐›ฟ2 ๐œ‡
                                         Pr        [๐‘‹ โˆ’ ๐œ‡ โ‰ค โˆ’๐›ฟ๐œ‡] โ‰ค eโˆ’ 2 .                                 (2.2)
                                     ๐‘‹1 ,...,๐‘‹ ๐‘˜

    Inequality (2.1) appears as [10, Eq. (6)] and [15, Thm. 4.4.2]. Inequality (2.2) appears as [10,
Eq. (7)] and [15, Thm. 4.5.2].
    We use two variants of this bound for sampling without replacement. The next variant
follows from combining Fact 2.3, Eq. (2.2) with Hoeffdingโ€™s generic reduction from sampling
without replacement to a sum of independent variables, [11, Theorem 4].

Fact 2.4 (Hoeffding bound for random subset.). Let ๐ถ be a set, and let ๐ต โŠ‚ ๐ถ be subset. Suppose we
pick a random subset ๐‘† โŠ‚ ๐ถ of size ๐‘› < |๐ถ|, then for every ๐›ฟ โˆˆ (0, 1)
                                                                
                                                      |๐ต|๐‘›    โˆ’
                                                                |๐ต|๐‘›๐›ฟ 2
                                 Pr |๐ต โˆฉ ๐‘†| โ‰ค (1 โˆ’ ๐›ฟ)      โ‰ค e 2|๐ถ| .
                                 ๐‘†                     |๐ถ|

    We also use the following result by Hoeffding.

                       T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                 11
                                        I RIT D INUR AND I NBAL L IVNI NAVON

Fact 2.5 (Hoeffdingโ€™s inequality for random sampling without replacement, [11, Theorems 1 and
4] ). Let ๐ถ = {๐‘1 , . . . ๐‘ ๐‘˜ } be a multiset of ๐‘˜ values, ๐‘ ๐‘– โˆˆ [0, 1], and let ๐‘‹1 , . . . , ๐‘‹๐‘› be ๐‘› random samples
                                             ร๐‘˜
without replacement from ๐ถ. Let ๐‘‹ = ๐‘–=1            ๐‘‹๐‘– and denote ๐œ‡ = ๐”ผ[๐‘‹], then

                                                                                              2๐‘ก 2
                                                    Pr        [๐‘‹ โˆ’ ๐œ‡ > ๐‘ก] โ‰ค eโˆ’ ๐‘› .
                                                ๐‘‹1 ,...,๐‘‹ ๐‘˜

   The random variables in Hoeffdingโ€™s bounds for random variables without replacement
are not independent, but they are not independent in a very specific way, of being without
replacement. In addition to these bounds we also have the following bound for random variables
that are not independent. This bound appears as Theorem 1.1 in [12].

Fact 2.6 (Generalized Chernoff bound [12, 17]). Let ๐‘‹1 , . . . , ๐‘‹ ๐‘˜ be random variables in {0, 1}, let
     ร๐‘˜
๐‘‹ = ๐‘–=1    ๐‘‹๐‘– . If there exists ๐œ‚ โˆˆ (0, 1) such that for every ๐‘† โІ [๐‘˜], Pr[โˆง๐‘–โˆˆ๐‘† ๐‘‹๐‘– = 1] โ‰ค ๐œ‚ |๐‘†| , then for every
๐›พ โˆˆ (๐œ‚, 1),

                                                          [๐‘‹ โ‰ฅ ๐›พ๐‘˜] โ‰ค eโˆ’2๐‘˜(๐›พโˆ’๐œ‚) .
                                                                                                     2
                                                  Pr
                                            ๐‘‹1 ,...,๐‘‹ ๐‘˜


2.1     Reverse hypercontractivity
Definition 2.7 (๐œŒ-correlated distribution). For every string ๐‘ฅ โˆˆ [๐‘] ๐‘˜ and constant ๐œŒ โˆˆ (0, 1), the
๐œŒ-correlated distribution from ๐‘ฅ, denoted by ๐‘ฆ โˆผ ๐‘ฅ, is defined as follows. Each ๐‘– โˆˆ [๐‘˜] is inserted
                                                                        ๐œŒ,๐ฝ
into ๐ฝ with probability ๐œŒ, independently. The string ๐‘ฆ is chosen such that ๐‘ฅ ๐ฝ = ๐‘ฆ ๐ฝ , and the rest is
uniform. In some cases, we omit the subscript ๐ฝ.

      We quote Proposition 9.2 from [16]:
                                                                                                             ๐‘Ž2                         ๐‘2
Proposition 2.8. Let ๐ด, ๐ต โІ [๐‘] ๐‘˜ of sizes Pr๐‘คโˆˆ[๐‘]๐‘˜ [๐‘ค โˆˆ ๐ด] = eโˆ’ 2 and Pr๐‘คโˆˆ[๐‘]๐‘˜ [๐‘ค โˆˆ ๐ต] = eโˆ’ 2 .
Then
                                                                                        (2โˆ’๐œŒ)(๐‘Ž 2 +๐‘ 2 )    ๐œŒ๐‘Ž๐‘
                                                                                   โˆ’                     โˆ’ 2(1โˆ’๐œŒ)
                                       Pr         [๐‘ฅ โˆˆ ๐ด, ๐‘ฆ โˆˆ ๐ต] โ‰ฅ e                       4(1โˆ’๐œŒ)                   .
                                   ๐‘ฅโˆˆ[๐‘] ๐‘˜ ,๐‘ฆโˆผ๐‘ฅ
                                            ๐œŒ


      By changing notation and simplifying, we get the following corollary.

Corollary 2.9. For ๐ด, ๐ต โІ [๐‘] ๐‘˜ , |๐ด| โ‰ฅ |๐ต|,
                                                                                             ๐œŒ                               3๐œŒ
                                 [๐‘ฅ โˆˆ ๐ด, ๐‘ฆ โˆˆ ๐ต] โ‰ฅ Pr [๐‘ฅ โˆˆ ๐ด]                                             Pr [๐‘ฅ โˆˆ ๐ต]                 .
                                                                                    1+ 2(1โˆ’๐œŒ)                           1+ 2(1โˆ’๐œŒ)
                      Pr
                  ๐‘ฅโˆˆ[๐‘] ๐‘˜ ,๐‘ฆโˆผ๐‘ฅ                                ๐‘ฅโˆˆ[๐‘] ๐‘˜                                ๐‘ฅโˆˆ[๐‘] ๐‘˜
                            ๐œŒ



Proof. |๐ด| โ‰ฅ |๐ต| implies ๐‘Ž โ‰ค ๐‘, we know that

                                            ๐œŒ๐‘Ž๐‘                 ๐œŒ๐‘ 2                                     ๐œŒ
                                         โˆ’ 2(1โˆ’๐œŒ)         โˆ’ 2(1โˆ’๐œŒ)
                                       e            โ‰ฅe                  = Pr [๐‘ฅ โˆˆ ๐ต] 1โˆ’๐œŒ .
                                                                              ๐‘ฅโˆˆ[๐‘] ๐‘˜


                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                         12
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

Similarly
                                                                                                ๐œŒ
                                                                                                               
                                 (2โˆ’๐œŒ)(๐‘Ž 2 +๐‘ 2 )
                                                                ยท โˆ’ ๐‘Ž2 โˆ’ ๐‘2                1+ 2(1โˆ’๐œŒ) ยท โˆ’ ๐‘Ž2 โˆ’ ๐‘2
                                                          2โˆ’๐œŒ        2    2                                 2   2
                             โˆ’
                            e       4(1โˆ’๐œŒ)          =e   2(1โˆ’๐œŒ)
                                                                                  =e                                    =
                                                           ๐œŒ                                      ๐œŒ
                                Pr [๐‘ฅ โˆˆ ๐ต]                           Pr [๐‘ฅ โˆˆ ๐ด]                         .
                                                     1+ 2(1โˆ’๐œŒ)                              1+ 2(1โˆ’๐œŒ)
                            ๐‘ฅโˆˆ[๐‘] ๐‘˜                              ๐‘ฅโˆˆ[๐‘] ๐‘˜

Together we get
                                                                                       ๐œŒ                                    3๐œŒ
                    Pr [๐‘ฅ โˆˆ ๐ด, ๐‘ฆ โˆˆ ๐ต] โ‰ฅ Pr [๐‘ฅ โˆˆ ๐ด]                                               Pr [๐‘ฅ โˆˆ ๐ต]                      .
                                                                                  1+ 2(1โˆ’๐œŒ)                         1+ 2(1โˆ’๐œŒ)
                    ๐‘ฅ,๐‘ฆ                                  ๐‘ฅโˆˆ[๐‘] ๐‘˜                              ๐‘ฅโˆˆ[๐‘] ๐‘˜

                                                                                                                                             


3    Restricted global structure
In this section we prove the restricted global structure theorem, Theorem 1.6, which we restate
formally below as Theorem 3.9. Let ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be a function that passes Test 2 with
probability ๐œ–, i. e.,
                                      agrโˆจ๐‘˜/10 ( ๐‘“ ) = ๐œ– โ‰ฅ eโˆ’๐‘๐›ผ๐‘˜ .
We show that such ๐‘“ already has some direct product structure, namely that there are restrictions
of the domain [๐‘] ๐‘˜ such that ๐‘“ is close to a direct product function on each of the restricted
parts.

Definition 3.1 (Restriction). A restriction is a triple ๐œ = (๐ด, ๐‘Ÿ, ๐›พ), for ๐ด โŠ‚ [๐‘˜], |๐ด| = ๐‘˜/10 , ๐‘Ÿ โˆˆ [๐‘]๐ด
and ๐›พ โˆˆ [๐‘€]๐ด .
                                                                                                                                         ยฏ
Definition 3.2 (Consistent strings). For every restriction ๐œ = (๐ด, ๐‘Ÿ, ๐›พ), a string ๐‘ค โˆˆ [๐‘]๐ด is
consistent with ๐œ if ๐‘“ (๐‘Ÿ, ๐‘ค)๐ด = ๐›พ. For every ๐œ, let ๐’ฑ๐œ be the set of consistent strings,
                                                     n                                                  o
                                                                      ยฏ
                                           ๐’ฑ๐œ = ๐‘ค โˆˆ [๐‘]๐ด                      ๐‘“ (๐‘Ÿ, ๐‘ค)๐ด = ๐›พ .

                                                                                                                                     ยฏ
Definition 3.3 (Restricted function). For each restriction ๐œ = (๐ด, ๐‘Ÿ, ๐›พ), let ๐‘“๐œ : ๐’ฑ๐œ โ†’ [๐‘€]๐ด be the
function
                                        ๐‘“๐œ (๐‘ค) = ๐‘“ (๐‘Ÿ, ๐‘ค)๐ดยฏ .

Definition 3.4 (Distribution over restrictions). Let ๐’Ÿ be the following distribution over re-
strictions ๐œ. Pick a uniform set ๐ด โŠ‚ [๐‘˜] of size ๐‘˜/10 , pick a uniform ๐‘ฅ โˆˆ [๐‘] ๐‘˜ and output
๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) .

    Note that the distribution ๐’Ÿ depends on the function ๐‘“ .
    We define good restriction in an analogous way to the definitions of [13].

Definition 3.5 (Good restriction). A restriction ๐œ = (๐ด, ๐‘Ÿ, ๐›พ) is good, if Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐’ฑ๐œ ] โ‰ฅ ๐œ–/2 .

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                               13
                                 I RIT D INUR AND I NBAL L IVNI NAVON

Definition 3.6 (๐›ผ-DP restriction). A restriction ๐œ = (๐ด, ๐‘Ÿ, ๐›พ) is an ๐›ผ-DP restriction if it is good,
and there exist functions ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€] for each ๐‘– โˆˆ ๐ดยฏ such that, denoting ๐‘” = (๐‘” ๐‘– )๐‘–โˆˆ๐ดยฏ ,
                                                                       
                                                  ๐›ผ๐‘˜
                                 Pr          ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ โ‰ค ๐œ– 2 .
                               ๐‘คโˆˆ[๐‘]๐ดยฏ

Remark 3.7. The parameter ๐›ผ can be viewed as slack. It is the amount of disagreement we are
willing to tolerate between two tuples, while still considering them in agreement.
   We define a local averaging operator. Notice that the operator is not linear.
Definition 3.8 (Local averaging operator). For every ๐œŒ โˆˆ [0, 1], let ๐’ซ๐œŒ be the following (non-linear)
                                      ยฏ                                ยฏ
operator. For every subset ๐’ฑ๐œ โŠ‚ [๐‘]๐ด and function โ„Ž : ๐’ฑ๐œ โ†’ [๐‘€]๐ด , the operator takes โ„Ž to the
                    ยฏ        ยฏ               ยฏ ๐‘ค โˆˆ [๐‘]๐ดยฏ ,
function ๐’ซ๐œŒ โ„Ž : [๐‘]๐ด โ†’ [๐‘€]๐ด satisfies โˆ€๐‘– โˆˆ ๐ด,
                                      ๐’ซ๐œŒ โ„Ž(๐‘ค)๐‘– = Plurality (โ„Ž(๐‘ฃ)๐‘– ) .
                                                       ๐‘ฃ โˆผ ๐‘ค s.t. ๐‘–โˆˆ๐ฝ
                                                        ๐œŒ,๐ฝ


We define plurality over an empty set to be an arbitrary value.
   In the proof of the restricted global structure we use the operator ๐’ซ๐œŒ with ๐œŒ = 3/4 , which
we denote by ๐’ซ to simplify notation. Clearly 3/4 is an arbitrary constant, our proof works for
any constant ๐œŒ > 1/2 .
   Our main theorem of this section asserts that (a) a non-negligible fraction of restrictions are
good, and that (b) almost all good restrictions are DP restrictions.
Theorem 3.9 (Restricted Global Structure, formal). There exists a small constant ๐‘ > 0, such that for
every constant ๐›ผ > 0 and large enough ๐‘˜ โˆˆ โ„• the following holds. For every function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ ,
if agrโˆจ๐‘˜/10 ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐›ผ๐‘˜ , then
                                                                ๐œ–
                                             Pr [๐œ is good] โ‰ฅ
                                            ๐œโˆผ๐’Ÿ                 2
and
                              Pr [๐œ is an ๐›ผ-DP restriction | ๐œ is good] โ‰ฅ 1 โˆ’ ๐œ– 2 .
                         ๐œโˆผ๐’Ÿ
    A similar theorem was proven in [8] under the name โ€œlocal structureโ€. Under the same
assumptions [8] showed that ๐‘“ must be close to a product function for many pieces ๐’ฑ๐œ of
the domain. However, the closeness was considerably weaker: unlike in our definition of
a DP restriction, in [8] even in the restricted part of the domain, ๐’ฑ๐œ โŠ‚ [๐‘] ๐‘˜ , there could be
a (small) constant fraction of the inputs on which ๐‘“ differs from the product function ๐‘”. In
contrast, we only allow an ๐œ–2 fraction of disagreeing inputs, which is necessary for the ensuing
global-structure argument.

Parameters. In the proof of the theorem we use several values for the slack parameter ๐›ผ, that
are constant multiples of each other, which we denote by ๐›ผ0 , ๐›ผ 1 etc. These constant factors are
not important, and the reader can treat all ๐›ผ ๐‘– as โ€œsimilar to ๐›ผโ€.
    We prove the theorem in Section 3.1, using lemmas that are proven on Section 3.2, Section 3.3
and Section 3.4.

                      T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                          14
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

3.1     Proof of Theorem 3.9
Let ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be a function that passes Test 2 with probability ๐œ–. The test can also be
                                                            ยฏ
written as: choose ๐œ = (๐ด, ๐‘Ÿ, ๐›พ) โˆผ ๐’Ÿ and a uniform ๐‘ค โˆˆ [๐‘]๐ด , and accept if ๐‘“ (๐‘Ÿ, ๐‘ค)๐ด = ๐›พ.
                                                                       ๐œ–
                    ๐œ– = Pr test passes ๐œ is chosen โ‰ค Pr ๐œ is good ยท 1 + ,
                                                              
                       ๐œโˆผ๐’Ÿ                           ๐œโˆผ๐’Ÿ               2

because the success probability of the test on a restriction ๐œ which is not good is at most ๐œ–/2 .
Therefore,
                                                                            ๐œ–
                                                      Pr ๐œ is good โ‰ฅ          .
                                                                       
                                                                                                           (3.1)
                                                    ๐œโˆผ๐’Ÿ                     2

      Fix ๐›ผ0 = 1600
                1
                    ๐›ผ.

Definition 3.10 (Excellent restriction). A good restriction ๐œ = (๐ด, ๐‘Ÿ, ๐›พ) is excellent if for ๐œŒ = 3/4
                                                         ยฏ
and for ๐œŒ = 9/32 the following holds. Choose ๐‘ค โˆˆ [๐‘]๐ด uniformly and ๐‘ฃ โˆผ ๐‘ค then,
                                                                                                     ๐œŒ,๐ฝ


                                                                    ๐›ผ0 ๐‘˜
                                                                                 
                                                                                          ๐›ผ0 ๐‘˜   ฮ”
                           Pr         ๐‘ค, ๐‘ฃ โˆˆ ๐’ฑ๐œ and ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ค eโˆ’ 40 = ๐œ‡ .                        (3.2)
                          ๐‘ค,๐‘ฃ,๐ฝ


Lemma 3.11. A good ๐œ โˆผ ๐’Ÿ is excellent with probability at least 1 โˆ’ ๐œ– 2 .

    The proof of the lemma appears on Section 3.2.
    To prove Theorem 3.9 it is enough to show that every excellent restriction is an ๐›ผ-DP
restriction. A natural idea is to define a direct product function by taking the plurality of ๐‘“๐œ on
๐’ฑ๐œ , because the agreement of ๐‘“๐œ inside ๐’ฑ๐œ is almost 1. However, it is difficult to prove that this
function is close to ๐‘“๐œ because the set ๐’ฑ๐œ is very sparse. Instead, we prove that ๐’ซ ๐‘“๐œ is close to ๐‘“๐œ ,
and that ๐’ซ ๐‘“๐œ is close to a direct product function. Fix ๐›ผ1 = 10๐›ผ 0 .

Lemma 3.12. For every excellent ๐œ,
                                                                                     
                                                          ๐›ผ1 ๐‘˜
                                       Pr         ๐‘“๐œ (๐‘ค) 0 ๐’ซ ๐‘“๐œ (๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ โ‰ค ๐œ– 3 .
                                  ๐‘คโˆˆ[๐‘]๐ดยฏ

      The proof appears in Section 3.3 and relies on reverse hypercontractivity.
      Fix ๐›ผ2 = 1500๐›ผ 0 .

Lemma 3.13. For every excellent restriction ๐œ there exists a direct product function ๐‘” = (๐‘”1 , . . . , ๐‘” ๐ดยฏ ) ,
๐‘” ๐‘– : [๐‘] โ†’ [๐‘€] such that                                 
                                                                 ๐›ผ2 ๐‘˜
                                              Pr       ๐’ซ ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค) โ‰ค 3๐œ– 4 .
                                            ๐‘คโˆˆ[๐‘]๐ดยฏ

      The proof is in Section 3.4.
      The two lemmas above, Lemma 3.12 and Lemma 3.13, imply the following claim.

                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                15
                                              I RIT D INUR AND I NBAL L IVNI NAVON

Claim 3.14. Every excellent restriction ๐œ is an ๐›ผ-DP restriction.

Proof. Fix an excellent restriction ๐œ. Let ๐‘” = (๐‘”1 , . . . , ๐‘” ๐ดยฏ ) , ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€] be the direct product
function promised from Lemma 3.13. For an excellent ๐œ, Pr๐‘ค [๐‘ค โˆˆ ๐’ฑ๐œ ] โ‰ฅ 2๐œ– . Therefore, the
                              ๐›ผ2 ๐‘˜
probability of ๐’ซ ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค) is small even when conditioning on ๐‘ค โˆˆ ๐’ฑ๐œ . By Lemma 3.13
                                                                              
                                                            ๐›ผ2 ๐‘˜
                        3๐œ– โ‰ฅ
                           4
                                         Pr        ๐’ซ ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค)
                                     ๐‘คโˆˆ[๐‘]๐ดยฏ
                                                                                                                          
                                                                                              ๐›ผ2 ๐‘˜
                                โ‰ฅ        Pr [๐‘ค โˆˆ ๐’ฑ๐œ ] Pr                       ๐’ซ ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ
                                     ๐‘คโˆˆ[๐‘]๐ดยฏ                ๐‘คโˆˆ[๐‘]๐ดยฏ

                                  ๐œ–
                                                                                                    
                                                     ๐›ผ2 ๐‘˜
                                โ‰ฅ     Pr    ๐’ซ ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ .                                                                      (3.3)
                                  2 ๐‘คโˆˆ[๐‘]๐ดยฏ

      By the triangle inequality,
                                                                                                                        
                        (๐›ผ 1 +๐›ผ2 )๐‘˜                                                        ๐›ผ1 ๐‘˜
            Pr ๐‘“๐œ (๐‘ค)         0          ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ โ‰ค Pr ๐‘“๐œ (๐‘ค) 0 ๐’ซ ๐‘“๐œ (๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ
                ๐‘ค                                                      ๐‘ค
                                                                                                                              
                                                                                                   ๐›ผ2 ๐‘˜
                                                                   + Pr ๐’ซ ๐‘“๐œ (๐‘ค) 0 ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ
                                                                           ๐‘ค

                                                                โ‰ค๐œ– + 6๐œ– 3 < ๐œ–2 .
                                                                       3
                                                                                                                      (by (3.3) and Lemma 3.12)

      By definition, ๐‘“๐œ (๐‘ค) = ๐‘“ (๐‘ฅ ๐ด , ๐‘ค)๐ดยฏ , so from the above equation
                                                                                                                                
                               (๐›ผ 1 +๐›ผ 2 )๐‘˜                                                       (๐›ผ1 +๐›ผ2 )๐‘˜
           Pr ๐‘“ (๐‘ฅ ๐ด , ๐‘ค)๐ดยฏ          0        ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ = Pr ๐‘“๐œ (๐‘ค)                                    0     ๐‘”(๐‘ค) ๐‘ค โˆˆ ๐’ฑ๐œ < ๐œ–2 .
            ๐‘ค                                                                  ๐‘ค


Since ๐›ผ1 + ๐›ผ2 < ๐›ผ we are done.                                                                                                               

    In the proof we see that a random restriction ๐œ โˆผ ๐’Ÿ is good with probability ๐œ–/2, and
that a good restriction is excellent with probability 1 โˆ’ ๐œ– 2 . From the claim above, an excellent
restriction ๐œ is an ๐›ผ-DP restriction, which finishes the proof.
                                                                                                                                             

3.2     Good restrictions are excellent with high probability
In this section we prove Lemma 3.11, which states that a good restriction is excellent with high
probability. We start by showing that when averaging over ๐œ, ๐‘“๐œ is consistent in ๐’ฑ๐œ .
                                                                                       ยฏ
Claim 3.15. For every ๐œŒ โˆˆ (0, 1), let ๐œ โˆผ ๐’Ÿ , ๐‘ค โˆˆ [๐‘]๐ด and ๐‘ฃ โˆผ ๐‘ค, then
                                                                                                  ๐œŒ,๐ฝ


                                                                                   ๐›ผ0 ๐‘˜
                                                                                                    
                                                                                                               ๐›ผ0 ๐‘˜
                                       Pr          ๐‘ค, ๐‘ฃ โˆˆ ๐’ฑ๐œ , ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ค eโˆ’ 20 .
                                     ๐œ,๐‘ค,๐‘ฃ,๐ฝ


                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                                16
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

Proof. Denote ๐œ = (๐‘Ÿ, ๐ด, ๐›พ). Let ๐ธ1 (๐‘Ÿ, ๐ด, ๐‘ค, ๐‘ฃ, ๐ฝ, ๐›พ) be the event that we are interested in bounding
its probability, namely, the event

                                                                               ๐›ผ0 ๐‘˜
                         ๐‘“ (๐‘Ÿ, ๐‘ค)๐ด = ๐‘“ (๐‘Ÿ, ๐‘ฃ)๐ด = ๐›พ          and    ๐‘“ (๐‘Ÿ, ๐‘ค)๐ฝ 0 ๐‘“ (๐‘Ÿ, ๐‘ฃ)๐ฝ .

When ๐‘Ÿ, ๐‘ค, ๐‘ฃ, ๐ด, ๐ฝ are all random, the probability of a uniform ๐ด, ๐ฝ to be such that ๐‘“ (๐‘Ÿ, ๐‘ค), ๐‘“ (๐‘Ÿ, ๐‘ฃ)
are equal on ๐ด but are far on ๐ฝ is very small.
                                                                                                                 ๐›ผ0 ๐‘˜
    Let ๐ธ2 (๐ด, ๐‘Ÿ, ๐‘ฃ, ๐‘ค, ๐ฝ) โІ ๐ธ1 (๐ด, ๐‘Ÿ, ๐‘ฃ, ๐‘ค, ๐ฝ, ๐›พ) be the event that ๐‘“ (๐‘Ÿ, ๐‘ค)๐ด = ๐‘“ (๐‘Ÿ, ๐‘ฃ)๐ด and ๐‘“ (๐‘Ÿ, ๐‘ค)๐ฝ 0
๐‘“ (๐‘Ÿ, ๐‘ฃ)๐ฝ .
    Fix ๐œŒ โˆˆ (0, 1). We start by bounding the probability of ๐ธ2 under the distribution ๐œ โˆผ ๐’Ÿ ,
            ยฏ
๐‘ค โˆˆ [๐‘]๐ด uniformly and ๐‘ฃ โˆผ ๐‘ค. Writing the distribution explicitly:
                                  ๐œŒ,๐ฝ


   1. Pick ๐ด โŠ‚ [๐‘˜] of size ๐‘˜/10 .

   2. Pick ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , set ๐‘Ÿ = ๐‘ฅ ๐ด and ๐›พ = ๐‘“ (๐‘ฅ)๐ด .

   3. Pick ๐ฝ โŠ‚ ๐ดยฏ of size โ„ฌ(9๐‘˜/10, ๐œŒ) (binomial random variable).
                                        ยฏ
   4. Pick uniform ๐‘ค, ๐‘ฃ โˆˆ [๐‘]๐ด such that ๐‘ค ๐ฝ = ๐‘ฃ ๐ฝ .

Notice that ๐ธ2 is independent of ๐›พ, so it does not matter how ๐›พ is chosen. We can define an
equivalent process for producing the same distribution (without ๐›พ):

   1. Pick a set ๐ด0 โŠ‚ [๐‘˜] of size ๐‘˜/10 + โ„ฌ(9๐‘˜/10, ๐œŒ).

   2. Pick ๐‘ฆ, ๐‘ง โˆˆ [๐‘] ๐‘˜ such that ๐‘ฆ๐ด0 = ๐‘ง ๐ด0 .

   3. Pick ๐ด โІ ๐ด0 of size ๐‘˜/10 .

   4. Set ๐‘Ÿ = ๐‘ฆ๐ด , ๐‘ค = ๐‘ฆ๐ดยฏ and ๐‘ฃ = ๐‘ง ๐ดยฏ .

   Let
                                            ๐ท = {๐‘– โˆˆ ๐ด0 | ๐‘“ (๐‘ฆ)๐‘– โ‰  ๐‘“ (๐‘ง)๐‘– } .
๐ธ2 occurs only if ๐ด โˆฉ ๐ท = โˆ… yet |๐ท| โ‰ฅ ๐›ผ0 ๐‘˜.
   As the second random process allows us to see, ๐ด is a uniform subset of ๐ด0. Let ๐‘–1 , . . . ๐‘– |๐ด| be
an arbitrary order over the elements of ๐ด. We can think of ๐ด as being chosen incrementally,
each ๐‘– ๐‘— is chosen randomly from ๐ด0 \ {๐‘–1 , . . . , ๐‘– ๐‘—โˆ’1 } .

       Pr [๐ด โˆฉ ๐ท = โˆ…] = Pr ๐‘–1 , . . . , ๐‘– |๐ด| โˆ‰ ๐ท
                                                     
                                                                                                                (3.4)
         ๐ด
                         = Pr [๐‘–1 โˆ‰ ๐ท] ยท Pr [๐‘–2 โˆ‰ ๐ท | ๐‘–1 โˆ‰ ๐ท] ยท ยท ยท Pr ๐‘– |๐ด| โˆ‰ ๐ท ๐‘–1 , . . . , ๐‘– |๐ด|โˆ’1 โˆ‰ ๐ท
                                                                                                           

                         โ‰ค(1 โˆ’ ๐›ผ 0 )|๐ด| โ‰ค eโˆ’๐›ผ0 |๐ด|

where we use the fact that for every ๐‘– ๐‘— , Pr ๐‘– ๐‘— โˆ‰ ๐ท ๐‘–1 . . . ๐‘– ๐‘—โˆ’1 โˆ‰ ๐ท โ‰ค 1 โˆ’ ๐›ผ0 , since |๐ท| โ‰ฅ ๐›ผ0 ๐‘˜.
                                                                                     


                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                      17
                                           I RIT D INUR AND I NBAL L IVNI NAVON

                                                                                       ๐›ผ0 ๐‘˜
      The bound in (3.4) holds for each ๐ด0 such that ๐‘“ (๐‘ฆ)๐ด0 0 ๐‘“ (๐‘ง)๐ด0 , therefore also on average,

                                                               ๐›ผ0 ๐‘˜
                                                                                                         
                      Pr [๐ธ2 ] =      Pr            ๐‘“ (๐‘ฆ)๐ด0 0 ๐‘“ (๐‘ง)๐ด0 and ๐‘“ (๐‘ฆ)๐ด = ๐‘“ (๐‘ง)๐ด โ‰ค eโˆ’๐›ผ0 |๐ด| .
                                    ๐‘ฆ,๐‘ง,๐ด0 ,๐ด

                                                                                ๐›ผ0 ๐‘˜
      We conclude that Pr[๐ธ1 ] โ‰ค Pr[๐ธ2 ] โ‰ค eโˆ’๐›ผ0 |๐ด| โ‰ค eโˆ’ 20 .                                                         
                                                                                              ยฏ
Proof of Lemma 3.11. For every restriction ๐œ and ๐‘ค, ๐‘ฃ โˆˆ [๐‘]๐ด let ๐ธ(๐œ, ๐‘ค, ๐‘ฃ, ๐ฝ) be the event that
                             ๐›ผ0 ๐‘˜
๐‘ค, ๐‘ฃ โˆˆ ๐’ฑ๐œ and ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐‘“๐œ (๐‘ฃ)๐ฝ .
    For every ๐œ that is good but not excellent, there is ๐œŒ โˆˆ {3/4, 9/32} such that

                                                        Pr [๐ธ(๐œ, ๐‘ค, ๐‘ฃ, ๐ฝ)] > ๐œ‡ .
                                                      ๐‘ค,๐‘ฃ โˆผ ๐‘ค
                                                         ๐œŒ,๐ฝ


In this case we say that ๐œ is bad for ๐œŒ.
    Assume for a contradiction that Pr๐œโˆผ๐’Ÿ ๐œ is good but not excellent > ๐œ–3 /2 . These fail to be
                                                                         
excellent because of at least one of the choices of ๐œŒ, so either for ๐œŒ = 3/4 or for ๐œŒ = 9/32 ,

                                                                                       ๐œ–3
                                                      Pr [๐œ is bad for ๐œŒ] โ‰ฅ               .
                                                     ๐œโˆผ๐’Ÿ                               4
For this ๐œŒ,

                                                                                                              ๐œ–3
          Pr         [๐ธ(๐œ, ๐‘ค, ๐‘ฃ, ๐ฝ)] โ‰ฅ Pr [๐œ is bad for ๐œŒ] Pr [๐ธ(๐œ, ๐‘ค, ๐‘ฃ, ๐ฝ) | ๐œ is bad for ๐œŒ] โ‰ฅ                 ๐œ‡.
      ๐œโˆผ๐’Ÿ,๐‘ค,๐‘ฃ โˆผ ๐‘ค                          ๐œโˆผ๐’Ÿ                             ๐‘ค,๐‘ฃ โˆผ ๐‘ค                            4
               ๐œŒ,๐ฝ                                                             ๐œŒ,๐ฝ


                                                                               ๐›ผ๐‘˜
This contradicts Claim 3.15, because ๐œ–3 /4 ยท ๐œ‡ โ‰ฅ eโˆ’ 20 , as ๐›ผ0 = 1600๐›ผ. Therefore, we conclude
that Pr๐œโˆผ๐’Ÿ ๐œ is good but not excellent โ‰ค ๐œ– 3 /2 .
           
   Finally, since ๐œ โˆผ ๐’Ÿ is good with probability at least ๐œ–/2 , by averaging a good ๐œ โˆผ ๐’Ÿ is
excellent with probability at least 1 โˆ’ ๐œ– 2 .                                                 

3.3     Local averaging operator
In this section we prove Lemma 3.12, which states that for every excellent ๐œ, ๐’ซ ๐‘“๐œ approximates
๐‘“๐œ .
                                        ยฏ                                      ยฏ
     Fix an excellent ๐œ, and let ๐ฟ โŠ‚ [๐‘]๐ด be the set of โ€œlonelyโ€ strings in [๐‘]๐ด , those that have a
sparse neighborhood in ๐’ฑ๐œ . We fix te sparsity parameter ๐œ‚ = ๐œ– 50 , and define
                                                (                                                 )
                                                                  ๐ดยฏ
                                        ๐ฟ = ๐‘ค โˆˆ [๐‘]                     Pr [๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ค ๐œ‚              .
                                                                       ๐‘ฃ โˆผ ๐‘ค
                                                                       3/4,๐ฝ


There is a trade off between the โ€œsparsityโ€ parameter ๐œ‚ and the bound on the size of ๐ฟ. The
sparsity parameter is chosen to make sure that Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐ฟ] < ๐œ– 10 . These powers of ๐œ–

                            T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                      18
                  E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

are derived from our arbitrary choice of defining ๐’ซ ๐‘“๐œ as the plurality of a 3/4-correlated
neighborhood.
    In addition, the success probability of the test ๐œ– should be large enough to promise that ๐œ‡/๐œ‚2
is small.

Claim 3.16. Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐ฟ] < ๐œ–10

Proof. We prove the claim by using Corollary 2.9 on the sets ๐ฟ,๐’ฑ๐œ . Denote by ๐‘ ๐ฟ = Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ
๐ฟ] and ๐‘ = Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐’ฑ๐œ ] . Since ๐œ is excellent, ๐‘ โ‰ฅ ๐œ–/2 .
    Assume for a contradiction that |๐ฟ| > |๐’ฑ๐œ | , i. e., ๐‘ ๐ฟ โ‰ฅ ๐‘. By Corollary 2.9

                                                                                 5              ๐œ–  52  ๐œ–  112
                                               [๐‘ค โˆˆ ๐ฟ, ๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ฅ ๐‘ ๐ฟ2 ๐‘ 2 โ‰ฅ                                            .
                                                                                      11
                                    Pr
                              ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค                                                    2           2
                                         3/4


By the definition of ๐ฟ

                                                  Pr        [๐‘ค โˆˆ ๐ฟ, ๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ค ๐‘ ๐ฟ ๐œ– 50 ,                                      (3.5)
                                         ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค
                                                   3/4


and we reach a contraction.
   Therefore, ๐‘ ๐ฟ < ๐‘. By Corollary 2.9,

                                                                                     11           ๐œ–  52       11
                                                   [๐‘ค โˆˆ ๐ฟ, ๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ฅ ๐‘ ๐ฟ2 ๐‘ 2 โ‰ฅ                            ๐‘ ๐ฟ2 .
                                                                                           5
                                     Pr
                                ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค                                                      2
                                            3/4



Equation (3.5) still holds, so combining the two bounds on Pr๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค [๐‘ค โˆˆ ๐ฟ, ๐‘ฃ โˆˆ ๐’ฑ๐œ ] ,
                                                                                                                 3/4


                                                           ๐œ–  52     11
                                                                     ๐‘ ๐ฟ2 โ‰ค ๐‘ ๐ฟ ๐œ– 50 ,
                                                            2

That is ๐‘ ๐ฟ โ‰ค 2๐œ– 2 (50โˆ’ 2 ) < ๐œ–10 .
                  9     5
                                                                                                                                  

    The local averaging operator ๐’ซ ๐‘“๐œ takes the plurality vote over ๐‘ฃ โˆผ ๐‘ค, conditioning on
                                                                                                                       3/4,๐ฝ
๐‘ฃ โˆˆ ๐’ฑ๐œ . If we pick ๐‘ฃ โˆผ ๐‘ค without conditioning on ๐‘ฃ โˆˆ ๐’ฑ๐œ , then each ๐‘– is in ๐ฝ with probability
                            3/4,๐ฝ
3/4 . For ๐‘ค โˆ‰ ๐ฟ, taking ๐‘ฃ โˆผ ๐‘ค conditioning on ๐‘ฃ โˆˆ ๐’ฑ๐œ , we get that for most ๐‘–, ๐‘– โˆˆ ๐ฝ with
                                    3/4,๐ฝ
probability that is close to 3/4 .
                                                                       ยฏ
Claim 3.17. For every ๐‘ค โˆ‰ ๐ฟ and all except ๐›ผ0 ๐‘˜ of the coordinates ๐‘– โˆˆ ๐ด,

                                                                                     3   1
                                                  Pr [๐ฝ 3 ๐‘–|๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ฅ                 โˆ’   .
                                               ๐‘ฃ โˆผ ๐‘ค                                 4 10
                                                  3/4,๐ฝ



                            T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                 19
                                          I RIT D INUR AND I NBAL L IVNI NAVON

Proof. Fix ๐‘ค โˆ‰ ๐ฟ. Let ๐ท be
                                         (                                                                             )
                                                                  3  1
                                ๐ท = ๐‘– โˆˆ [๐‘˜]   Pr [๐ฝ 3 ๐‘–|๐‘ฃ โˆˆ ๐’ฑ๐œ ] < โˆ’                                                       .
                                            ๐‘ฃ โˆผ ๐‘ค                 4 10
                                                             3/4,๐ฝ


   Assume for a contradiction that the claim does not hold, i. e., |๐ท| > ๐›ผ0 ๐‘˜.
                                                                                                                                         ๐›ผ0 ๐‘˜
   By the Chernoff bound (Fact 2.3), Pr๐‘ฃ โˆผ ๐‘ค |๐ท โˆฉ ๐ฝ | โ‰ค                                                                            โ‰ค eโˆ’ 900 . For ๐‘ค โˆ‰ ๐ฟ,
                                                                                                                             
                                                                                                          4 โˆ’ 20       |๐ท|
                                                                                                          3    1
                                                                     3/4,๐ฝ
conditioning on ๐‘ฃ โˆˆ ๐’ฑ๐œ increases the above probability by a factor of at most 1/๐œ‚ . That is,
                                                                                                       
                                                    3   1             1 ๐›ผ0 ๐‘˜
                                Pr       |๐ท โˆฉ ๐ฝ | โ‰ค   โˆ’   |๐ท| ๐‘ฃ โˆˆ ๐’ฑ๐œ โ‰ค eโˆ’ 900 .
                            ๐‘ฃ โˆผ ๐‘ค                   4 20              ๐œ‚
                             3/4,๐ฝ


                                                                                                                   ๐›ผ0 ๐‘˜                    ๐›ผ0 ๐‘˜
The constant ๐‘ in is chosen to be small enough to promise that ๐œ‚1 eโˆ’ 900 = ๐œ– โˆ’50 ยท eโˆ’ 900 โ‰ค ๐œ–. That is,
|๐ฝ โˆฉ ๐ท| โ‰ฅ 34 โˆ’ 20
                     
                  1
                     |๐ท| almost always.
    If ๐ฝ is such that |๐ฝ โˆฉ ๐ท| โ‰ฅ 34 โˆ’ 20   |๐ท| , then a random ๐‘– โˆˆ ๐ท has probability of at least
                                                                                                                                                              
                                                                                                                                                      4 โˆ’ 20
                                     1                                                                                                                3   1

to be in ๐ฝ. Therefore,
                                                                                                                                             
                                                                               3   1                                                     3   1
                Pr       [๐‘– โˆˆ ๐ฝ | ๐‘ฃ โˆˆ ๐’ฑ] โ‰ฅ Pr                       |๐ท โˆฉ ๐ฝ | โ‰ค   โˆ’   |๐ท| ๐‘ฃ โˆˆ ๐’ฑ๐œ                                            โˆ’
           ๐‘ฃ โˆผ ๐‘ค,๐‘–โˆˆ๐ท                                ๐‘ฃ โˆผ ๐‘ค                      4 20                                                      4 20
            3/4,๐ฝ                                    3/4,๐ฝ
                                                                                    
                                                          3   1  3  1
                                                 โ‰ฅ(1 โˆ’ ๐œ–)   โˆ’   > โˆ’   ,
                                                          4 20   4 10

which is a contradiction to the definition of ๐ท.                                                                                                           

Proof of Lemma 3.12. Fix an excellent restriction ๐œ. Recall that for an excellent restriction ๐œ,
Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐’ฑ๐œ ] โ‰ฅ ๐œ–/2 and

                                                                                              ๐›ผ0 ๐‘˜
                                                                                                             
                                     Pr          ๐‘ค, ๐‘ฃ โˆˆ ๐’ฑ๐œ and โ„Ž(๐‘ค)๐ฝ 0 โ„Ž(๐‘ฃ)๐ฝ โ‰ค ๐œ‡ .                                                                      (3.6)
                                 ๐‘ค,๐‘ฃ โˆผ ๐‘ค
                                     3/4,๐ฝ


   Let ๐ต be the set of โ€œbadโ€ inputs,
                            (                                                                                                      )
                                                                                                                             ๐œ‚
                                                                                                                      
                                                                                                     ๐›ผ๐‘˜
                         ๐ต = ๐‘ค โˆˆ ๐’ฑ๐œ               Pr         ๐‘ฃ โˆˆ ๐’ฑ๐œ and ๐‘“๐œ (๐‘ฃ)๐ฝ 0 ๐‘“๐œ (๐‘ค)๐ฝ                                  โ‰ฅ    .
                                             ๐‘ฃ โˆผ ๐‘ค                                                                           10
                                                 3/4,๐ฝ



By averaging on equation (3.6), Pr๐‘คโˆˆ๐’ฑ๐œ [๐‘ค โˆˆ ๐ต] โ‰ค                                      ๐œ‚ โ‰ค 2๐œ– .
                                                                                     10๐œ‡  1 3

   Recall ๐ฟ is the set of lonely inputs. By Claim 3.16, Pr๐‘คโˆˆ[๐‘]๐‘˜ [๐‘ค โˆˆ ๐ฟ] โ‰ค ๐œ–10 . Since ๐œ is excellent,

                                                                                     ๐œ– 10         ๐œ–3
                                                    Pr [๐‘ค โˆˆ ๐ฟ] โ‰ค                      ๐œ–       <      .
                                                  ๐‘คโˆˆ๐’ฑ๐œ                                2           2

                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                                            20
                          E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

    Together, the probability that a random ๐‘ค โˆˆ ๐’ฑ๐œ is in ๐ต or in ๐ฟ is smaller than ๐œ– 3 . Therefore,
                                                                                                                       ๐›ผ1 ๐‘˜
to prove the lemma it is enough to prove that for every ๐‘ค โˆˆ ๐’ฑ๐œ \ {๐ต โˆช ๐ฟ} , ๐‘“๐œ (๐‘ค) โ‰ˆ ๐’ซ ๐‘“๐œ (๐‘ค).
    Fix ๐‘ค โˆˆ ๐’ฑ๐œ \ (๐ต โˆช ๐ฟ). Denote by ๐ท the set of coordinates on which ๐‘“๐œ (๐‘ค), ๐’ซ ๐‘“๐œ (๐‘ค) differ,
                                                    ๐ท = ๐‘– โˆˆ ๐ดยฏ           ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– .
                                                             

                                                                                               ยฏ
    Assume for a contradiction that |๐ท| > ๐›ผ1 ๐‘˜ . For ๐‘ฃ โˆˆ [๐‘]๐ด , ๐ฝ โŠ‚ ๐ดยฏ and ๐‘– โˆˆ ๐ด,
                                                                               ยฏ let ๐ธ(๐‘ฃ, ๐ฝ, ๐‘–) be
the event
                                ๐‘– โˆˆ ๐ฝ and ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ)๐‘– .
We reach a contradiction by upper bounding and lower bounding the probability of ๐ธ under the
distribution ๐‘– โˆˆ ๐ท and ๐‘ฃ โˆผ ๐‘ค, given that ๐‘ฃ โˆˆ ๐’ฑ๐œ .
                                    3/4,๐ฝ



Lower bound.               The function ๐’ซ ๐‘“๐œ takes the most common value ๐‘“๐œ (๐‘ฃ)๐‘– for ๐‘ฃ โˆผ ๐‘ค. By definition,
                                                                                                           3/4,๐ฝ
the set ๐ท contains all of the coordinates ๐‘– such that ๐‘“๐œ (๐‘ค)๐‘– is not the most probable value ๐‘“๐œ (๐‘ฃ)๐‘– ,
when ๐‘ฃ โˆผ ๐‘ค. Therefore for every ๐‘– โˆˆ ๐ท,
            3/4,๐ฝ

                                                                                                     1
                                            Pr [ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ)๐‘– | ๐‘– โˆˆ ๐ฝ, ๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ฅ                 .                      (3.7)
                                       ๐‘ฃ โˆผ ๐‘ค                                                         2
                                            3/4,๐ฝ

    To lower bound the probability of ๐ธ we need to lower bound the probability of ๐‘– โˆˆ ๐ฝ. When
picking ๐‘ฃ โˆผ ๐‘ค, each ๐‘– is in ๐ฝ with probability 3/4 . From Claim 3.17, for all except ๐›ผ0 ๐‘˜ coordinates,
              3/4,๐ฝ
the probability of ๐‘– to be in ๐ฝ is not much different, it is at least 3/4 โˆ’ 1/10 . Let ๐ท 0 โŠ‚ [๐‘˜] be the set
of coordinates in which Pr[๐‘– โˆˆ ๐ฝ] is lower than 3/4 โˆ’ 10      1
                                                                , then |๐ท 0 | โ‰ค ๐›ผ0 ๐‘˜ < 1/10|๐ท| . Together
we get that                                                                  
                                                                 0    3   1      1
                           Pr      [๐‘– โˆˆ ๐ฝ | ๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ฅ Pr [๐‘– โˆ‰ ๐ท ]      โˆ’       > .
                       ๐‘–โˆˆ๐ท,๐‘ฃ โˆผ ๐‘ค                       ๐‘–โˆˆ๐ท            4 10       2
                                     3/4,๐ฝ

    From the two equations above,
       Pr           [๐ธ(๐‘ฃ, ๐ฝ, ๐‘–) | ๐‘ฃ โˆˆ ๐’ฑ๐œ ] =                 Pr     [๐‘– โˆˆ ๐ฝ and ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ)๐‘– | ๐‘ฃ โˆˆ ๐’ฑ๐œ ]
  ๐‘ฃ โˆผ ๐‘ค,๐‘–โˆˆ๐ท                                             ๐‘ฃ โˆผ ๐‘ค,๐‘–โˆˆ๐ท
   3/4,๐ฝ                                                3/4,๐ฝ

                                                    =        Pr     [๐‘– โˆˆ ๐ฝ | ๐‘ฃ โˆˆ ๐’ฑ๐œ ] Pr [ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ)๐‘– | ๐‘– โˆˆ ๐ฝ, ๐‘ฃ โˆˆ ๐’ฑ๐œ ]
                                                        ๐‘ฃ โˆผ ๐‘ค,๐‘–โˆˆ๐ท                     ๐‘ฃ โˆผ ๐‘ค
                                                        3/4,๐ฝ                          3/4,๐ฝ

                                                 1 1 1
                                                > ยท = .
                                                 2 2 4

Upper Bound. For ๐‘ค โˆˆ ๐’ฑ๐œ \ (๐ต โˆช ๐ฟ) , the following two equations hold: Pr๐‘ฃ โˆผ ๐‘ค [๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ฅ ๐œ‚
                                                                                                               3/4,๐ฝ
                                                     ๐›ผ0 ๐‘˜
                                                                   
                                                                          ๐œ‚
and Pr๐‘ฃ โˆผ ๐‘ค ๐‘ฃ โˆˆ ๐’ฑ๐œ and ๐‘“๐œ (๐‘ฃ)๐ฝ 0 ๐‘“๐œ (๐‘ค)๐ฝ โ‰ค 10 . Combining the two equations,
           3/4,๐ฝ

                                                                  ๐›ผ0 ๐‘˜
                                                                                        
                                                                                                   1
                                              Pr             ๐‘“๐œ (๐‘ฃ)๐ฝ 0 ๐‘“๐œ (๐‘ค)๐ฝ ๐‘ฃ โˆˆ ๐’ฑ๐œ โ‰ค               .                       (3.8)
                                            ๐‘ฃ โˆผ ๐‘ค                                                  10
                                             3/4,๐ฝ




                                T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                             21
                                            I RIT D INUR AND I NBAL L IVNI NAVON

                            ๐›ผ0 ๐‘˜
    Suppose ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ˆ ๐‘“๐œ (๐‘ค)๐ฝ , our assumption is that |๐ท| > ๐›ผ1 ๐‘˜ = 10๐›ผ0 ๐‘˜ , so a uniform ๐‘– โˆˆ ๐ท is
in the ๐›ผ0 ๐‘˜ coordinates in which ๐‘“๐œ (๐‘ฃ)๐ฝ , ๐‘“๐œ (๐‘ค)๐ฝ differ with probability at most 10
                                                                                   1
                                                                                      . This lets us
bound the probability of ๐ธ:

                                                                          ๐›ผ0 ๐‘˜
                                                                                                      
      Pr          [๐ธ(๐‘ฃ, ๐ฝ, ๐‘–) | ๐‘ฃ โˆˆ ๐’ฑ๐œ ] โ‰ค Pr               ๐‘“๐œ (๐‘ฃ)๐ฝ 0 ๐‘“๐œ (๐‘ค)๐ฝ ๐‘ฃ โˆˆ ๐’ฑ๐œ
๐‘ฃ โˆผ ๐‘ค,๐‘–โˆˆ๐ท                                   ๐‘ฃ โˆผ ๐‘ค
 3/4,๐ฝ                                      3/4,๐ฝ
                                                                                                                                       
                                                                                   ๐›ผ0 ๐‘˜
                                        +         Pr                ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ˆ ๐‘“๐œ (๐‘ค)๐ฝ and ๐‘– โˆˆ ๐ฝ and ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ)๐‘– ๐‘ฃ โˆˆ ๐’ฑ๐œ
                                            ๐‘ฃ โˆผ ๐‘ค,๐‘–โˆˆ๐ท
                                            3/4,๐ฝ

                                            1   1  1
                                        โ‰ค     +   < .
                                            10 10 4
The upper and lower bounds contradict each other so for all ๐‘ค โˆˆ ๐’ฑ๐œ \ (๐ต โˆช ๐ฟ), |๐ท| โ‰ค ๐›ผ1 ๐‘˜ and
           ๐›ผ1 ๐‘˜
๐‘“๐œ (๐‘ค) โ‰ˆ ๐’ซ ๐‘“๐œ (๐‘ค) . Since Pr๐‘ค [๐‘ค โˆˆ ๐ต โˆช ๐ฟ] โ‰ค ๐œ– 3 we finish the proof.                                                                   

3.4        Direct product function
In this section we prove that ๐’ซ ๐‘“๐œ is close to a direct product function, proving Lemma 3.13.
    We start by defining the candidate direct product function, which is the plurality vote of
๐’ซ ๐‘“๐œ .
                                                                                                   ยฏ           ยฏ
Definition 3.18. For every excellent ๐œ = (๐ด, ๐‘Ÿ, ๐›พ), let ๐‘”๐œ : [๐‘]๐ด โ†’ [๐‘€]๐ด be the following function:
for every ๐‘– โˆ‰ ๐ด and ๐‘ โˆˆ [๐‘],

                                            ๐‘”๐œ,๐‘– (๐‘) =                Plurality {๐’ซ ๐‘“๐œ (๐‘ค)๐‘– } ,
                                                                 ๐‘คโˆˆ[๐‘]๐ดยฏ s.t. ๐‘ค ๐‘– =๐‘

ties are broken arbitrarily.

      Set ๐›ผ3 = 20๐›ผ0 .

Claim 3.19. For every excellent ๐œ,
                                                                                              
                                                                                   ๐›ผ3 ๐‘˜
                                         Pr                  ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ โ‰ˆ ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ฅ 1 โˆ’ 3๐œ–10 .
                                   ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ    โˆผ ๐‘ค
                                                1/2,๐ฝ


Proof. The proof is similar to the proof of Lemma 3.12. Its main idea is that if ๐’ซ ๐‘“๐œ (๐‘ค) and ๐’ซ ๐‘“๐œ (๐‘ฃ)
disagree on a lot of coordinates, then a large fraction of their 3/4-correlated neighborhoods also
disagree on a lot of coordinates. This can only happen for very few inputs ๐‘ค, ๐‘ฃ, otherwise we
contradict the fact that ๐œ is excellent.
    Fix an excellent ๐œ. Let ๐ถ be a set of โ€œbadโ€ triplets,

                                                                                                               ๐›ผ0 ๐‘˜             ๐œ‚2
                                                                                                                               
                                                                                   0      0                0          0
             ๐ถ = (๐‘ค, ๐‘ฃ, ๐ฝ) ๐‘ค ๐ฝ = ๐‘ฃ ๐ฝ and                      Pr                  ๐‘ค , ๐‘ฃ โˆˆ ๐’ฑ๐œ and ๐‘“๐œ (๐‘ค )๐ฝหœ 0 ๐‘“๐œ (๐‘ฃ )๐ฝหœ        โ‰ฅ    ,
                                                        ๐‘ค 0 ,๐ฝ 0 ,๐‘ฃ 0 ,๐ฝ 00                                                     10

                              T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                     22
                     E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

where ๐‘ค 0 โˆผ 0 ๐‘ค, ๐‘ฃ 0 โˆผ 00 ๐‘ฃ and ๐ฝหœ = ๐ฝ โˆฉ ๐ฝ 0 โˆฉ ๐ฝ 00.
             3/4,๐ฝ       3/4,๐ฝ
                                                                                                         ยฏ
    If (๐‘ค, ๐‘ฃ, ๐ฝ) are distributed such that ๐‘ค is uniform in [๐‘]๐ด and ๐‘ฃ โˆผ ๐‘ค, then the marginal
                                                                                                                         1/2,๐ฝ
distribution over ๐‘ค 0 is uniform, and ๐‘ฃ 0 โˆผ ๐‘ค 0 . This is because for every ๐‘– independently, the
                                                                      9/32, ๐ฝหœ

probability of ๐‘– to be in ๐ฝหœ = ๐ฝ โˆฉ ๐ฝ 0 โˆฉ ๐ฝ 00 is (3/4) 2 ยท (1/2) = 9/32 .
                                                                                                             ๐›ผ0 ๐‘˜
                                                                                                                                
    Since ๐œ is excellent, Pr๐‘ค0 โˆˆ[๐‘]๐ดยฏ ,๐‘ฃ0 โˆผ ๐‘ค0                               ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ , ๐‘“๐œ (๐‘ค 0)๐ฝหœ       0    ๐‘“๐œ (๐‘ฃ 0)๐ฝหœ       โ‰ค ๐œ‡. Therefore by
                                                           9/32, ๐ฝหœ

averaging, Pr๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค [(๐‘ค, ๐‘ฃ, ๐ฝ) โˆˆ ๐ถ] โ‰ค ๐œ‚2 < ๐œ–10 .
                                                                           10๐œ‡
                            1/2,๐ฝ
   Recall that ๐ฟ is the set of โ€œlonelyโ€ inputs, those with sparse neighborhood. From Claim 3.16,
Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐ฟ] < ๐œ–10 .
                                                                                                                                            ๐›ผ3 ๐‘˜
   We prove next that for every ๐‘ค, ๐‘ฃ, ๐ฝ such that (๐‘ค, ๐‘ฃ, ๐ฝ) โˆ‰ ๐ถ and ๐‘ค, ๐‘ฃ โˆ‰ ๐ฟ, ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ โ‰ˆ ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ .
This proves the claim since by a union bound argument,

                                         Pr             [(๐‘ค, ๐‘ฃ, ๐ฝ) โˆˆ ๐ถ or ๐‘ค โˆˆ ๐ฟ or ๐‘ฃ โˆˆ ๐ฟ]
                           ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค
                                                1/2,๐ฝ

                            โ‰ค 2 Pr [๐‘ค โˆˆ ๐ฟ] +                                     Pr           [(๐‘ค, ๐‘ฃ, ๐ฝ) โˆˆ ๐ถ] โ‰ค 3๐œ– 10 .
                                      ๐‘คโˆˆ[๐‘]๐ดยฏ                           ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ     โˆผ ๐‘ฃ
                                                                                      1/2,๐ฝ


    Fix ๐‘ค, ๐‘ฃ, ๐ฝ such that ๐‘ค ๐ฝ = ๐‘ฃ ๐ฝ , ๐‘ค, ๐‘ฃ โˆ‰ ๐ฟ and (๐‘ค, ๐‘ฃ, ๐ฝ) โˆ‰ ๐ถ. Let ๐ท โІ ๐ฝ be the set

                                                    ๐ท = {๐‘– โˆˆ ๐ฝ | ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– } .

Assume for a contradiction that |๐ท| โ‰ฅ ๐›ผ3 ๐‘˜.
                          ยฏ ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ and ๐‘– โˆˆ ๐ด,
   For every ๐ฝ 0 , ๐ฝ 00 โŠ‚ ๐ด,                      ยฏ let ๐ธ(๐ฝ 0 , ๐ฝ 00 , ๐‘ค 0 , ๐‘ฃ 0 , ๐‘–) be the following event:

                                                   ๐‘“๐œ (๐‘ค 0)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ 0)๐‘–              and      ๐‘– โˆˆ ๐ฝ 0 โˆฉ ๐ฝ 00 .

We reach a contradiction by giving an upper bound and a lower bound of this event, under the
distribution ๐‘– โˆˆ ๐ท, ๐‘ค 0 โˆผ 0 ๐‘ค and ๐‘ฃ 0 โˆผ 00 ๐‘ฃ, given that ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ .
                                 3/4,๐ฝ                    3/4,๐ฝ



Lower Bound. For every ๐‘– โˆˆ ๐ท, ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– , i. e., the most frequent value ๐‘“๐œ (๐‘ค 0)๐‘– for
๐‘ค 0 โˆผ ๐‘ค is different from the most frequent value ๐‘“๐œ (๐‘ฃ 0)๐‘– for ๐‘ฃ 0 โˆผ ๐‘ฃ . Therefore, for every ๐‘– โˆˆ ๐ท,
   3/4                                                                                                   3/4


                                                                                                                                 1
                                 Pr             [ ๐‘“๐œ (๐‘ค 0)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ 0)๐‘– | ๐‘– โˆˆ ๐ฝ 0 โˆฉ ๐ฝ 00 , ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ ] โ‰ฅ                      ,                 (3.9)
                          ๐‘ค 0 ,๐ฝ 0 ,๐‘ฃ 0 ,๐ฝ 00                                                                                    2

where ๐‘ค 0 โˆผ 0 ๐‘ค and ๐‘ฃ 0 โˆผ 00 ๐‘ฃ .
             3/4,๐ฝ                3/4,๐ฝ
    To finish the lower bound, we need to lower bound the probability of ๐‘– โˆˆ ๐ฝ 0 โˆฉ ๐ฝ 00 , for ๐‘ค 0 โˆผ 0 ๐‘ค
                                                                                                                                                   3/4,๐ฝ
and ๐‘ฃ 0 โˆผ 00 ๐‘ฃ given that ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ . Without conditioning on ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ , each ๐‘– is in ๐ฝ 0 โˆฉ ๐ฝ 00
         3/4,๐ฝ

with probability (3/4)2 . We show that the probability is not much lower even when conditioning

                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                                            23
                                                                        I RIT D INUR AND I NBAL L IVNI NAVON

on ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ . From Claim 3.17, for all except ๐›ผ0 ๐‘˜ of the coordinates ๐‘– โˆˆ ๐ด, ยฏ the probability of ๐‘–
to be in ๐ฝ is at least 3/4 โˆ’ 1/10 . Let ๐ท๐ฝ 0 be the set of coordinates such that Pr[๐‘– โˆˆ ๐ฝ 0] โ‰ค 34 โˆ’ 10
             0                                                                                         1

and let ๐ท๐ฝ 00 be the equivalent set for ๐ฝ . Then |๐ท \ (๐ท๐ฝ 0 โˆช ๐ท๐ฝ 00 )| โ‰ฅ 20๐›ผ 0 ๐‘˜ โˆ’ ๐›ผ0 ๐‘˜ โˆ’ ๐›ผ0 ๐‘˜ .
                                         00

                                                                                                                                                                               2
                                                                                           0           00
                                                                                                                                                                  3     1                1
                                                                          [๐‘– โˆˆ ๐ฝ โˆฉ ๐ฝ ] โ‰ฅ Pr ๐‘– โˆ‰ ๐ท โˆฉ ๐ท                                                                                 >     .
                                                                                                                            
                                               Pr                                                                                             ๐ฝ0          ๐ฝ 00         โˆ’
                                  ๐‘–โˆˆ๐ท,๐‘ค 0 โˆผ ๐‘ค,๐‘ฃ 0 โˆผ ๐‘ฃ                                                               ๐‘–โˆˆ๐ท                                               4 10                3
                                          3/4,๐ฝ 0            3/4,๐ฝ 00


    Combining the two equations, we lower bound the probability of ๐ธ, under the distribution
๐‘– โˆˆ ๐ท, ๐‘ค 0 โˆผ 0 ๐‘ค and ๐‘ฃ 0 โˆผ 00 ๐‘ฃ,
                        3/4,๐ฝ                    3/4,๐ฝ


       Pr               [๐ธ(๐ฝ 0 , ๐ฝ 00 , ๐‘ค 0 , ๐‘ฃ 0 , ๐‘–) | ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ ] =                                         Pr              [๐‘– โˆˆ ๐ฝ 0 โˆฉ ๐ฝ 00 | ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ ]
๐‘–,๐‘ค 0 ,๐ฝ 0 ,๐‘ฃ 0 ,๐ฝ 00                                                                                       ๐‘–,๐‘ค 0 ,๐ฝ 0 ,๐‘ฃ 0 ,๐ฝ 00

                                                                                                            ยท          Pr               [ ๐‘“๐œ (๐‘ค 0)๐‘– โ‰  ๐‘“๐œ (๐‘ฃ 0)๐‘– | ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ , ๐‘– โˆˆ ๐ฝ 0 โˆฉ ๐ฝ 00]
                                                                                                                ๐‘–,๐‘ค 0 ,๐ฝ 0 ,๐‘ฃ 0 ,๐ฝ 00
                                                                                                                   1 1 1
                                                                                                            โ‰ฅ       ยท โ‰ฅ .
                                                                                                                   3 2 6

Upper Bound.                           The fixed ๐‘ค, ๐‘ฃ, ๐ฝ satisfy Pr๐‘ฃ0 โˆผ ๐‘ฃ [๐‘ฃ 0 โˆˆ ๐’ฑ๐œ ] โ‰ฅ ๐œ‚ and
                                                                                                                 3/4,๐ฝ 00


                                                                                                                                                   ๐›ผ0 ๐‘˜                        ๐œ‚2
                                                                                                                                                                         
                                                                                       0       0                                          0                       0
                                                        Pr 0                       ๐‘ค , ๐‘ฃ โˆˆ ๐’ฑ๐œ and ๐‘“๐œ (๐‘ค )๐ฝหœ 0 ๐‘“๐œ (๐‘ฃ )๐ฝหœ โ‰ค                                                         ,
                                         ๐‘ค 0 โˆผ ๐‘ค,๐‘ฃ                 โˆผ ๐‘ฃ                                                                                                         10
                                              3/4,๐ฝ 0           3/4,๐ฝ 00


where ๐ฝหœ = ๐ฝ โˆฉ ๐ฝ 0 โˆฉ ๐ฝ 00 .
  Therefore,
                                                                                                            ๐›ผ0 ๐‘˜
                                                                                                                                                                     
                                                                                                   0                            0              0     0                        1
                                                             Pr                        ๐‘“๐œ (๐‘ค )๐ฝหœ 0 ๐‘“๐œ (๐‘ฃ )๐ฝหœ ๐‘ค , ๐‘ฃ โˆˆ ๐’ฑ๐œ โ‰ค                                                        .
                                              ๐‘ค 0 โˆผ ๐‘ค,๐‘ฃ 0 โˆผ ๐‘ฃ                                                                                                                 10
                                                   3/4,๐ฝ 0          3/4,๐ฝ 00


                                ๐›ผ0 ๐‘˜
    If ๐‘“๐œ (๐‘ค 0)๐ฝหœ โ‰ˆ ๐‘“๐œ (๐‘ฃ 0)๐ฝหœ , then a uniform ๐‘– โˆˆ ๐ท has probability of at most ๐›ผ|๐ท|
                                                                                   0๐‘˜    ๐›ผ0 ๐‘˜
                                                                                      โ‰ค 20๐›ผ 0๐‘˜
                                                                                               โ‰ค 1/20 to
be in a coordinate in which ๐‘“๐œ (๐‘ค ), ๐‘“๐œ (๐‘ฃ ) differ. Therefore,
                                         0     0


                                                                                                                                                                      1   1  1
                                                Pr                            [๐ธ(๐ฝ 0 , ๐ฝ 00 , ๐‘ค 0 , ๐‘ฃ 0 , ๐‘–) | ๐‘ค 0 , ๐‘ฃ 0 โˆˆ ๐’ฑ๐œ ] โ‰ค                                       +   < ,
                                   ๐‘–โˆˆ๐ท,๐‘ค 0     โˆผ       ๐‘ค,๐‘ฃ 0     โˆผ ๐‘ฃ                                                                                                  10 20 6
                                             3/4,๐ฝ 0           3/4,๐ฝ 00


which contradicts the lower bound. This completes the proof of Claim 3.19.                                                                                                                      
Claim 3.20. For every excellent ๐œ,

                                                         Pr                   [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– | ๐‘ค ๐‘– = ๐‘ฃ ๐‘– ] โ‰ฅ 1 โˆ’ 10๐›ผ 3 .
                                                          ๐ด               ยฏ
                                                ยฏ
                                             ๐‘–โˆˆ ๐ด,๐‘ค,๐‘ฃโˆˆ[๐‘]

Proof. Fix an excellent ๐œ. Claim 3.19 proves the agreement of ๐’ซ ๐‘“๐œ on correlated inputs. In this
claim, we prove its agreement on uncorrelated inputs.
                                                        ยฏ
    Let ๐’Ÿ 0 be the distribution of picking ๐‘ข, ๐‘ฃ, ๐‘ค โˆˆ [๐‘]๐ด and ๐‘– โˆˆ ๐ดยฏ defined as follows.

                                             T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                                                               24
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

   1. Pick a uniform ๐‘– โˆˆ ๐ดยฏ .
                                       ยฏ
   2. Pick uniform ๐‘ค, ๐‘ฃ โˆˆ [๐‘]๐ด such that ๐‘ค ๐‘– = ๐‘ฃ ๐‘– .

   3. For every ๐‘— โ‰  ๐‘–, insert ๐‘— into ๐ฝ with probability 12 independently.
                                       (
                                 ๐‘ค๐‘—                ๐‘—โˆˆ๐ฝ
   4. For every ๐‘— โˆˆ ๐ดยฏ set ๐‘ข ๐‘— =                        .
                                 ๐‘ฃ๐‘—                else

The distribution ๐’Ÿ 0 produces ๐‘ค, ๐‘ฃ that are uncorrelated except that ๐‘ค ๐‘– = ๐‘ฃ ๐‘– . The pair ๐‘ค, ๐‘ข are
nearly 1/2-correlated (the only difference is the coordinate ๐‘– in which ๐‘ข๐‘– = ๐‘ค ๐‘– with probability 1).
We prove the claim by applying Claim 3.19 on the correlated pairs ๐‘ข, ๐‘ค and ๐‘ข, ๐‘ฃ, and get that with
high probability ๐’ซ ๐‘“๐œ (๐‘ข)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– and ๐’ซ ๐‘“๐œ (๐‘ข)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– , deducing that ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– .
   The marginal distribution on ๐‘ค, ๐‘ข in ๐’Ÿ 0 is very close to 1/2-correlated. The only difference
between the marginal distribution of ๐‘ค, ๐‘ข, ๐ฝ, ๐‘– โˆผ ๐’Ÿ 0 and ๐‘ข โˆผ ๐‘ค is that in ๐’Ÿ 0 , ๐‘ค ๐‘– = ๐‘ข๐‘– with
                                                                                                     1/2
probability 1 and not 1/2 . In Claim 3.23 we prove that the probability of any event on ๐‘ข โˆผ ๐‘ค
                                                                                                                                    1/2,๐ฝ
can increase by at most a factor of 2, for ๐‘ข, ๐‘ค, ๐ฝ โˆช {๐‘–} produced by ๐’Ÿ 0 .
   Therefore, we can use Claim 3.19 on ๐‘ค, ๐‘ข, ๐ฝ, ๐‘– โˆผ ๐’Ÿ 0 and pay a factor of 2,

                                                                 ๐›ผ3 ๐‘˜
                                                                                                
                                  Pr            ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝโˆช{๐‘–} 0 ๐’ซ ๐‘“๐œ (๐‘ข)๐ฝโˆช{๐‘–} โ‰ค2 ยท 3๐œ– 10 .                                          (3.10)
                              ๐‘ค,๐‘ข,๐ฝ,๐‘–โˆผ๐’Ÿ 0


The same holds also for ๐‘ฃ, ๐‘ข, ๐ดยฏ \ ๐ฝ, ๐‘– โˆผ ๐’Ÿ 0 .
   For ๐‘ค, ๐‘ข, ๐ฝ, ๐‘– โˆผ ๐’Ÿ 0 ,the coordinate ๐‘– is a random coordinate in ๐ฝ โˆช {๐‘–}. Therefore, if
              ๐›ผ3 ๐‘˜
๐’ซ ๐‘“๐œ (๐‘ค)๐ฝโˆช{๐‘–} โ‰ˆ ๐’ซ ๐‘“๐œ (๐‘ข)๐ฝโˆช{๐‘–} , then the probability of ๐‘– be be such that ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ข)๐‘– is
           ๐›ผ3 ๐‘˜
at most |๐ฝโˆช{๐‘–}| . Each ๐‘— โ‰  ๐‘– is in ๐ฝ with probability 1/2 independently, which lets us bound the
                                                                             1    1     ยฏ
                                                                                      | ๐ด|
size of ๐ฝ by the Chernoff bound, Pr๐ฝ [|๐ฝ | < ๐‘˜/4] โ‰ค e 3ยท52 2 < ๐œ– . If |๐ฝ | > ๐‘˜/4 , then the probability
of a random ๐‘– โˆˆ ๐ฝ to fall into the ๐›ผ 3 ๐‘˜ disagreeing coordinates is at most 4๐›ผ3 ๐‘˜ . Therefore,

                                                                                  ๐‘˜                 ๐›ผ3 ๐‘˜
                                                                                                                              
            Pr        [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ข)๐‘– ] โ‰ค            Pr              |๐ฝ | < or ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝโˆช{๐‘–} 0 ๐’ซ ๐‘“๐œ (๐‘ข)โˆช{๐‘–}
        ๐‘ค,๐‘ข,๐ฝ,๐‘–โˆผ๐’Ÿ 0                                   ๐‘ค,๐‘ข,๐ฝ,๐‘–โˆผ๐’Ÿ 0                 4
                                                    + 4๐›ผ3 ๐‘˜ โ‰ค 6๐œ–10 + ๐œ– + 4๐›ผ3 ๐‘˜ < 5๐›ผ3 ๐‘˜.                                             (3.11)

The same holds also for ๐‘ฃ, ๐‘ข, ๐ดยฏ \ ๐ฝ, ๐‘– .
   Therefore, from equation (3.11) on ๐‘ค, ๐‘ข, ๐ฝ, ๐‘– and ๐‘ฃ, ๐‘ข, ๐ดยฏ \ ๐ฝ, ๐‘–,

           Pr        [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– | ๐‘ค ๐‘– = ๐‘ฃ ๐‘– ] โ‰ฅ                  Pr              [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ข)๐‘– ]
           ๐‘–โˆˆ ๐ดยฏ                                                    ๐‘–,๐‘ค,๐‘ฃ,๐‘ขโˆผ๐’Ÿ 0
                 ยฏ
        ๐‘ค,๐‘ฃโˆˆ[๐‘]๐ด

                                                                 โ‰ฅ1 โˆ’ 5๐›ผ3 โˆ’ 5๐›ผ3 .

                                                                                                                                            

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                              25
                                                       I RIT D INUR AND I NBAL L IVNI NAVON

Claim 3.21. For every excellent ๐œ,

                                                       Pr          [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– = ๐‘”๐œ (๐‘ค)๐‘– ] โ‰ฅ 1 โˆ’ 20๐›ผ3 .
                                                  ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘–โˆˆ ๐ดยฏ

Proof. Fix an excellent ๐œ. The function ๐‘”๐œ is defined as the plurality of ๐’ซ ๐‘“๐œ . This means that
                   ยฏ
for every ๐‘ค โˆˆ [๐‘]๐ด and ๐‘– โˆˆ ๐ด,ยฏ if ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘”๐œ (๐‘ค)๐‘– , then ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– is not the most frequent value
๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– among all ๐‘ฃ such that ๐‘ฃ ๐‘– = ๐‘ค ๐‘– , i. e., Pr๐‘ฃโˆˆ[๐‘]๐ดยฏ [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– = ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– |๐‘ค ๐‘– = ๐‘ฃ ๐‘– ] โ‰ค 1/2 .
    This implies that

                                                                                                1
                             Pr           [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ฃ)๐‘– | ๐‘ค ๐‘– = ๐‘ฃ ๐‘– ] โ‰ฅ                     Pr        [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘”๐œ (๐‘ค)๐‘– ] .
                       ๐‘ค,๐‘ฃโˆˆ[๐‘]๐ดยฏ ,๐‘–โˆˆ ๐ดยฏ                                                         2 ๐‘คโˆˆ[๐‘]๐ด ,๐‘–โˆˆ๐ดยฏ

Therefore, by Claim 3.20,

                                                         Pr            [๐’ซ ๐‘“๐œ (๐‘ค)๐‘– โ‰  ๐‘”๐œ (๐‘ค)๐‘– ] โ‰ค 20๐›ผ3 ๐‘˜ .                                  
                                                   ๐‘คโˆˆ[๐‘]๐ด ,๐‘–โˆˆ ๐ดยฏ

                                                          ยฏ
Proof of Lemma 3.13. Fix an excellent ๐œ. For every ๐‘ค โˆˆ [๐‘]๐ด , let ๐ท๐‘ค โŠ‚ ๐ดยฏ be the set of coordinates

                                                      ๐ท๐‘ค = ๐‘– โˆˆ ๐ดยฏ ๐‘”๐œ (๐‘ค)๐‘– โ‰  ๐’ซ ๐‘“๐œ (๐‘ค)๐‘– .
                                                                   

                                  ยฏ
       Let ๐ถ โŠ‚ [๐‘]๐ด be the set of inputs in which ๐‘”๐œ is close to ๐’ซ ๐‘“๐œ ,
                                                              n                                               o
                                                                               ยฏ
                                                       ๐ถ = ๐‘ค โˆˆ [๐‘]๐ด                        |๐ท๐‘ค | โ‰ค 25๐›ผ3 ๐‘˜ .

By Claim 3.21 and averaging, Pr๐‘ค [๐‘ค โˆˆ ๐ถ] โ‰ฅ 1/5 .
               ยฏ
   Let ๐ต โŠ‚ [๐‘]๐ด be the set of inputs in which ๐‘”๐œ , ๐’ซ ๐‘“๐œ are far from each other,

                                                         ๐ต = ๐‘ค โˆˆ [๐‘] ๐‘˜
                                                                                   0
                                                                                            |๐ท๐‘ค | โ‰ฅ ๐›ผ2 ๐‘˜ .
                                                               

Notice that ๐ต โˆฉ ๐ถ = ๐œ™ but there can be inputs that are neither in ๐ต nor in ๐ถ (because ๐›ผ 2 = 1500๐›ผ 0
and ๐›ผ3 = 20๐›ผ0 ).
   By Corollary 2.9,

                                                                                                                  1
                                  [๐‘ค โˆˆ ๐ต, ๐‘ฃ โˆˆ ๐ถ] โ‰ฅ            Pr [๐‘ฃ โˆˆ ๐ถ] 2                   Pr [๐‘ค โˆˆ ๐ต] 2 โ‰ฅ            Pr [๐‘ค โˆˆ ๐ต] 2 .
                                                                                       3                      5                   5
                          Pr
                   ๐‘ค,๐‘ฃ โˆผ ๐‘ค                                  ๐‘ฃโˆˆ[๐‘]๐ดยฏ                        ๐‘คโˆˆ[๐‘]๐ดยฏ                        ยฏ
                                                                                                                  12 ๐‘คโˆˆ[๐‘]๐ด
                          1/2,๐ฝ



We will show that ๐’ซ ๐‘“๐œ has large disagreement on almost every 12 -correlated pair ๐‘ค, ๐‘ฃ such that
๐‘ค โˆˆ ๐ต, ๐‘ฃ โˆˆ ๐ถ, which lets us bound the size of ๐ต.
   Typically, for ๐‘ฃ โˆผ ๐‘ค, we get that |๐ฝ โˆฉ ๐ท๐‘ค | โ‰ˆ |๐ท๐‘ค |/2 . The probability of |๐ฝ โˆฉ ๐ท๐‘ค | โ‰ฅ
                                          1/2,๐ฝ
(1/2 โˆ’ 1/10) |๐ท๐‘ค | is nearly 1, by the Chernoff bound, Pr๐‘ฃ โˆผ ๐‘ค [|๐ฝ โˆฉ ๐ท๐‘ค | < (1/2 โˆ’ 1/10) |๐ท๐‘ค |] โ‰ค
                                                                                                      1/2,๐ฝ
      1 1
           |๐ท๐‘ค |
e   3ยท52 2         .

                                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                            26
                             E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                                                                                                                                                  ๐›ผ3 ๐‘˜
    If ๐‘ค โˆˆ ๐ต and ๐‘ฃ โˆˆ ๐ถ and |๐ฝ โˆฉ๐ท๐‘ค | โ‰ฅ (1/2 โˆ’ 1/10) |๐ท๐‘ค | , it must be that ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ . This
                                                     25๐›ผ 3 ๐‘˜
is because for ๐‘ฃ โˆˆ ๐ถ, ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ                          โ‰ˆ ๐‘”๐œ (๐‘ค)๐ฝ . For ๐‘ค โˆˆ ๐ต, |๐ท๐‘ค | โ‰ฅ ๐›ผ2 ๐‘˜, if |๐ฝ โˆฉ ๐ท๐‘ค | โ‰ฅ (1/2 โˆ’ 1/10) ๐›ผ2 ๐‘˜,
                                                                               30๐›ผ 3 ๐‘˜
then |๐ฝ โˆฉ ๐ท๐‘ค | โ‰ฅ 30๐›ผ3 ๐‘˜, i. e., ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ                                          0       ๐‘”๐œ (๐‘ค)๐ฝ . The function ๐‘”๐œ is a product function,
                                                                             30๐›ผ3 ๐‘˜                                             25๐›ผ3 ๐‘˜
so ๐‘”๐œ (๐‘ค)๐ฝ = ๐‘”๐œ (๐‘ฃ)๐ฝ . So if ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ                                         0       ๐‘”๐œ (๐‘ค)๐ฝ and ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ                      โ‰ˆ        ๐‘”๐œ (๐‘ค)๐ฝ , it must be that
                 ๐›ผ3 ๐‘˜
๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ .
    From the two equations above,
                                                                                                               
                                                          1   1         1
                             ๐‘ค โˆˆ ๐ต, ๐‘ฃ โˆˆ ๐ถ and |๐ฝ โˆฉ ๐ท๐‘ค | โ‰ฅ                    Pr [๐‘ค โˆˆ ๐ต] 2 โˆ’ eโˆ’๐›ผ0 ๐‘˜ . (3.12)
                                                                                        5
            Pr                                              โˆ’   |๐ท๐‘ค | โ‰ฅ
 ๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค                                           2 10                  ยฏ
                                                                        12 ๐‘คโˆˆ[๐‘]๐ด
                 1/2,๐ฝ


                                                           ๐›ผ3 ๐‘˜
                                                                                      
That is, Pr๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ฅ 12 Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐ต] 2 โˆ’ eโˆ’๐›ผ๐‘˜ .
                                                  1                                                                              5

                                1/2,๐ฝ
                                                                                           ๐›ผ3 ๐‘˜
                                                                                                                 
    From Claim 3.19, Pr๐‘คโˆˆ[๐‘]๐ดยฏ ,๐‘ฃ โˆผ ๐‘ค ๐’ซ ๐‘“๐œ (๐‘ค)๐ฝ 0 ๐’ซ ๐‘“๐œ (๐‘ฃ)๐ฝ โ‰ค 3๐œ– 10 . Therefore,
                                                         1/2,๐ฝ


                                                         1
                                                              Pr [๐‘ค โˆˆ ๐ต] 2 โˆ’ eโˆ’๐›ผ๐‘˜ โ‰ค 3๐œ– 10 .
                                                                         5
                                                                                                                                                              (3.13)
                                                         12 ๐‘คโˆˆ[๐‘]๐ดยฏ

This means that Pr๐‘คโˆˆ[๐‘]๐ดยฏ [๐‘ค โˆˆ ๐ต] โ‰ค 3๐œ– 4 , and completes the proof of Lemma 3.13.                                                                                 

    Finally, we are left with proving the following claim, relating the standard 1/2-correlated
distribution to an almost correlated version in which one extra random coordinate is identical.
                                                                     ยฏ
Definition 3.22. For every ๐‘ฅ โˆˆ [๐‘]๐ด , we say that ๐‘ฆ is almost 1/2-correlated with ๐‘ฅ, denoted by
๐‘ฆ โˆผ ๐‘ฅ i it is chosen by the following process:
  1/2,๐ฝ ๐ด


    โ€ข Choose a uniform ๐‘– โˆˆ ๐ดยฏ and set ๐ฝ = {๐‘–}.
    โ€ข Insert any ๐‘— โ‰  ๐‘– into ๐ฝ with probability 1/2 independently.
    โ€ข Set ๐‘ฆ ๐ฝ = ๐‘ฅ ๐ฝ , set the rest of ๐‘ฆ to be uniform.
                                                                                                  ยฏ
Claim 3.23. For any event ๐ธ(๐‘ฆ, ๐‘ฅ, ๐ฝ) over ๐‘ฅ, ๐‘ฆ โˆˆ [๐‘]๐ด and ๐ฝ โІ ๐ด,
                                                              ยฏ

                                                 Pr [๐ธ(๐‘ฆ, ๐‘ฅ, ๐ฝ)] โ‰ค 2                              Pr                  [๐ธ(๐‘ฆ, ๐‘ฅ, ๐ฝ)] .
                                              ๐‘ฆ โˆผ ๐‘ฅ                                         ๐‘ฆโˆˆ[๐‘] ๐‘˜ ,๐‘ฅ โˆผ ๐‘ฆ
                                               1/2,๐ฝ ๐ด                                                    1/2,๐ฝ


Proof. Fix ๐ธ(๐‘ฅ, ๐‘ฆ, ๐ฝ) to be any event. For every ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , let ๐ต ๐‘ฅ contain the tuples (๐‘ฅ, ๐ฝ) such that
๐ธ(๐‘ฅ, ๐‘ฆ, ๐ฝ) happens.
   Fix ๐‘ฅ โˆˆ [๐‘] ๐‘˜ . For each (๐‘ฆ, ๐ฝ) โˆˆ ๐ต ๐‘ฆ , by the definition of 12 -correlation,
                                                                                               |๐ฝ |   ๐‘˜โˆ’|๐ฝ |                ๐‘˜โˆ’|๐ฝ |
                                                                 0     1                                    1               1
                                               Pr [(๐‘ง, ๐ฝ ) = (๐‘ฆ, ๐ฝ)] =                                                                     .
                                             ๐‘ง โˆผ ๐‘ฅ
                                                 0
                                                                       2                                    2               ๐‘
                                             1/2,๐ฝ



                                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                                     27
                                               I RIT D INUR AND I NBAL L IVNI NAVON

For ๐‘ง, ๐ฝ 0 that are almost 12 -correlated to ๐‘ฆ:
                                                                                |๐ฝ |โˆ’1   ๐‘˜โˆ’|๐ฝ |         ๐‘˜โˆ’|๐ฝ |
                                                 0   |๐ฝ | 1                               1             1
                             Pr [(๐‘ง, ๐ฝ ) = (๐‘ฅ, ๐ฝ)] =                                                                   .
                           ๐‘ง โˆผ ๐‘ฅ
                              0๐ด
                                                      ๐‘˜ 2                                 2             ๐‘
                            1/2,๐ฝ


Therefore,
                                      Pr       [(๐‘ง, ๐ฝ 0) = (๐‘ฅ, ๐ฝ)] โ‰ค 2 Pr [(๐‘ง, ๐ฝ 0) = (๐‘ฅ, ๐ฝ)] .
                               ๐‘ง โˆผ ๐‘ฆ                                            ๐‘ง โˆผ ๐‘ฆ
                                    1/2,๐ฝ 0๐ด                                    1/2,๐ฝ 0


This implies that

                           [๐ธ(๐‘ฆ, ๐‘ฅ, ๐ฝ)] =                                    (๐‘ฅ, ๐ฝ) โˆˆ ๐ต ๐‘ฆ โ‰ค 2                              (๐‘ฅ, ๐ฝ) โˆˆ ๐ต ๐‘ฆ ,
                                                                                                                                   
              Pr                                              Pr                                        Pr
         ๐‘ฆโˆˆ[๐‘] ๐‘˜ ,๐‘ฅ โˆผ ๐‘ฆ                              ๐‘ฆโˆˆ[๐‘] ๐‘˜ ,๐‘ฅ โˆผ ๐‘ฆ                              ๐‘ฆโˆˆ[๐‘] ๐‘˜ ,๐‘ฅ โˆผ ๐‘ฆ
                 1/2,๐ฝ ๐ด                                       1/2,๐ฝ ๐ด                                        1/2,๐ฝ



which finishes the proof.                                                                                                                   


4    Global structure for sets
Up until now we have considered functions ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ whose inputs are ordered tuples
(๐‘ฅ 1 . . . , ๐‘ฅ ๐‘˜ ) โˆˆ [๐‘] ๐‘˜ . We now move to consider functions ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ whose inputs are
                                                                       
                                                                    ๐‘˜
unordered sets {๐‘ฅ 1 , . . . , ๐‘ฅ ๐‘˜ } โˆˆ [๐‘]     . In this setting assume that ๐‘  ๐‘˜ (for tuples no such
                                                          
                                          ๐‘˜
assumption is made).
    To each subset ๐‘† = {๐‘  1 , . . . , ๐‘  ๐‘˜ } the function ๐‘“ assigns ๐‘“ (๐‘†) โˆˆ [๐‘€] ๐‘˜ . We view ๐‘“ (๐‘†) as a โ€œlocal
functionโ€ on ๐‘†, assigning a value in [๐‘€] to every ๐‘Ž โˆˆ ๐‘†. We denote by ๐‘“ (๐‘†)๐‘Ž the value that ๐‘“ (๐‘†)
assigns to ๐‘Ž. For a subset ๐‘Š โŠ‚ ๐‘†, we denote by ๐‘“ (๐‘†)๐‘Š the outputs of ๐‘“ corresponding to the
elements in ๐‘Š.
    There are straightforward analogs to Theorem 1.1 and Theorem 3.9 which we present and
prove in this section. Interestingly, in the case of sets deducing global structure from restricted
global structure is quite easier than it is for tuples.
    First, let us present the Z-test for sets from [13] when ๐‘ก = ๐‘˜/10 . Let agr๐‘๐‘˜/10   ๐‘ ๐‘’๐‘ก
                                                                                           ( ๐‘“ ) be the success
probability of this test. This is the same test as Test 3 from the introduction with ๐‘ก = ๐‘˜/10 .
    For convenience, we write again Theorem 1.5 from the introduction.

Theorem 4.1 (Global Structure for Sets, restated). There exist a small constant ๐‘ > 0, such that for
every constant ๐œ† > 0, large enough ๐‘˜ โˆˆ โ„• and ๐‘ > e๐‘๐œ†๐‘˜ , ๐‘€ โˆˆ โ„• , if the function ๐‘“ : [๐‘]              โ†’ [๐‘€] ๐‘˜
                                                                                                   
                                                                                                 ๐‘˜
passes Test 3 with probability agr๐‘๐‘˜/10
                                    ๐‘ ๐‘’๐‘ก
                                        ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐œ†๐‘˜ , then there exists a function ๐‘” : [๐‘] โ†’ [๐‘€] such
that                                                     
                                                                   ๐œ†๐‘˜
                                                     Pr ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†) โ‰ฅ ๐œ– โˆ’ 4๐œ– 2 .
                                                      ๐‘†

    To prove the theorem, we first โ€œtranslateโ€ the restricted global structure theorem for tuples
to a theorem on sets, and then use it to prove the global structure.

                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                             28
                    E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                    Test 4: Z-test for functions over sets, with ๐‘ก = ๐‘˜/10 (3-query test)

   1. Choose a random set ๐‘Š โŠ‚ [๐‘] of size ๐‘˜/10 .
                                                                               ๐‘‹             ๐‘Š
   2. Choose random ๐‘‰ , ๐‘Š , ๐‘‹ , ๐‘Œ โŠ‚ [๐‘], such that
      |๐‘Š | = |๐‘‰ | = ๐‘˜/10 , |๐‘‹ | = |๐‘Œ| = 9๐‘˜/10 and
      ๐‘‹ โˆฉ๐‘Š = ๐‘Œ โˆฉ๐‘Š = ๐‘Œ โˆฉ๐‘‰ = โˆ….
                                                                                        ๐‘Œ      ๐‘‰
   3. Accept if ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š and
      ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ = ๐‘“ (๐‘Œ โˆช ๐‘‰)๐‘Œ .
Denote by agr๐‘๐‘˜/10
               ๐‘ ๐‘’๐‘ก
                   ( ๐‘“ ) the success probability of ๐‘“ on this test.


4.1   Restricted global structure for sets
We define analogous definitions for good restrictions and DP
                                                            restrictions
                                                                         for functions on sets.
To make the reduction proof simpler, we use a constant ๐œ‚ โˆˆ 1 โˆ’ ๐‘˜ /๐‘ , 1 (i. e., almost 1). Fix a
                                                                 2

function ๐‘“ : [๐‘] โ†’ [๐‘€] ๐‘˜ such that agr๐‘๐‘˜/10
                                        ๐‘ ๐‘’๐‘ก
                                            ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐œ†๐‘˜ .
                     
              ๐‘˜

Definition 4.2 (Good pair). A pair ๐‘‹ , ๐‘Š โŠ‚ [๐‘], |๐‘‹ | = 9๐‘˜/10, |๐‘Š | = ๐‘˜/10, ๐‘‹ โˆฉ ๐‘Š = โˆ… is good if
                                                                               ๐œ–
                            Pr [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š | ๐‘Œ โˆฉ ๐‘Š = โˆ…] >          ๐œ‚.
                            ๐‘Œ                                                  2
Definition 4.3 (๐›ผ-DP pair). A pair ๐‘‹ , ๐‘Š โŠ‚ [๐‘], |๐‘‹ | = 9๐‘˜/10, |๐‘Š | = ๐‘˜/10, ๐‘‹ โˆฉ ๐‘Š = โˆ… is an ๐›ผ-DP
pair if it is good, and if there exists a function ๐‘” ๐‘‹ ,๐‘Š : [๐‘] โ†’ [๐‘€] such that
                                                                                       
                                3๐›ผ๐‘˜
            Pr ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ 0 ๐‘” ๐‘‹ ,๐‘Š (๐‘Œ) ๐‘Œ โˆฉ ๐‘Š = โˆ…, ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š โ‰ค 2๐œ– 2 .
            ๐‘Œ


    Notice that in the case of a function on sets, there is a single function ๐‘” ๐‘‹ ,๐‘Š : [๐‘] โ†’ [๐‘€],
instead of 9๐‘˜/10 different functions in the case of tuples.

Lemma 4.4 (Restricted global structure for sets). There exists a small constants ๐‘ > 0, such that for
every constant ๐›ผ > 0, large enough ๐‘˜ โˆˆ โ„• and ๐‘ > e๐‘๐œ†๐‘˜ , ๐‘€ โˆˆ โ„• , the following holds.
    For every function ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ , if agr๐‘๐‘˜/10
                                                   ๐‘ ๐‘’๐‘ก
                                                       ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐›ผ๐‘˜ , then at least (1 โˆ’ ๐œ– 2 โˆ’ ๐‘˜ 2 /๐‘) of
                               
                             ๐‘˜
the good pairs ๐‘Š , ๐‘‹ are ๐›ผ-DP pairs.

     This lemma is an analog to Theorem 3.9, and we prove it by a reduction from it. For every
 ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ we define a function ๐‘“ 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ โˆช โŠฅ that equals โŠฅ if the input has two
         
      ๐‘˜
identical coordinates, and identifies with ๐‘“ everywhere else. For ๐‘  ๐‘˜, almost all inputs donโ€™t
have two identical coordinates, and ๐‘“ 0 , ๐‘“ are equal on these inputs.
     Using Theorem 3.9, we derive a restricted global structure on ๐‘“ 0 . Since ๐‘“ equals ๐‘“ 0 almost
always, we find an equivalence between an ๐›ผ-DP pair ๐‘‹ , ๐‘Š to an ๐›ผ-DP restriction ๐œ. For every
๐›ผ-DP restriction ๐œ we have the direct product function ๐‘”๐œ = (๐‘” ๐‘– )๐‘–โˆˆ๐ดยฏ , ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€]. We build

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                             29
                                   I RIT D INUR AND I NBAL L IVNI NAVON

a restricted global function ๐‘” ๐‘‹ ,๐‘Š : [๐‘] โ†’ [๐‘€] by taking the most frequent value among the
functions (๐‘” ๐‘– )๐‘–โˆˆ๐ดยฏ . Note that even though ๐‘“ 0 is permutation invariant, the functions (๐‘” ๐‘– )๐‘–โˆˆ๐ดยฏ are
not necessarily identical.
    Since the proof is technical, and its main points are described in the paragraph above, we
defer it to Appendix A.

4.2   Global structure for sets
The proof is very similar to the proof of lemma 3.16 in [13].

Proof of Theorem 1.5. Fix a function ๐‘“ : [๐‘]  โ†’ [๐‘€] ๐‘˜ that passes Test 4 with probability ๐œ–, denote
                                                      
                                          ๐‘˜
๐›ผ = ๐œ†/5 . Let ๐‘Š , ๐‘‹ โŠ‚ [๐‘] be the subsets chosen on Test 4.
    If Pr๐‘Œ [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š | ๐‘Œ โˆฉ ๐‘Š = โˆ…] < 2๐œ– ๐œ‚ , then the test rejects with probability at
least 1 โˆ’ 2๐œ– ๐œ‚ . The function ๐‘“ passes the test with probability ๐œ–, so the test must succeed with
probability at least ๐œ– on ๐‘Š , ๐‘‹ such that Pr๐‘Œ [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š | ๐‘Œ โˆฉ ๐‘Š = โˆ…] > 2๐œ– ๐œ‚ , i. e.,
on good pairs.
    Using Lemma 4.4, at least (1 โˆ’ 2๐œ– 2 โˆ’ ๐‘˜ 2 /๐‘) of the good pairs are ๐›ผ-DP pairs. Fix an ๐›ผ-DP
pair ๐‘Š , ๐‘‹, and let ๐‘” = ๐‘” ๐‘‹ ,๐‘Š : [๐‘] โ†’ [๐‘€] be the direct product function associated with ๐‘Š , ๐‘‹.
Let ๐’ฑ be all the sets ๐‘Œ that are consistent with ๐‘Š , ๐‘‹,
                                                                                     
                         [๐‘]
                  ๐’ฑ= ๐‘Œโˆˆ                            ๐‘Œ โˆฉ ๐‘Š = โˆ…, ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š       .
                        9๐‘˜/10
    We use the third query to show that this ๐‘” is in fact a global direct product function which is
close to ๐‘“ , i.e that ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†) for about an ๐œ–-fraction of the sets ๐‘† โˆˆ [๐‘]
                                                                               
                                                                            ๐‘˜
                                                                                 .
    Let ๐ถ be the set of inputs for which ๐‘“ , ๐‘” are close,
                                                                      
                                          [๐‘]                     ๐œ†๐‘˜
                                    ๐ถ= ๐‘†โˆˆ                     ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†) .
                                           ๐‘˜
Suppose that instead of running Test 4 as is, we choose ๐‘Œ, ๐‘‰ by the following process:
                                  [๐‘]
   1. Choose a uniform ๐‘† โˆˆ         ๐‘˜
                                       .
   2. Choose ๐‘Œ to be a uniform 9๐‘˜/10 subset of ๐‘†.
   3. Set ๐‘‰ = ๐‘† \ ๐‘Œ and return (๐‘Œ, ๐‘‰).
If the process outputs ๐‘Œ such that ๐‘Œ โˆฉ ๐‘Š โ‰  โˆ…, we assume that the test rejects. The probability of
this event is less than ๐‘˜ 2 /๐‘ , and if it does not happen, the process generates the test distribution.
Therefore, ๐‘“ passes the test where ๐‘Œ, ๐‘‰ are chosen using the above process with probability
at least ๐œ– โˆ’ ๐‘˜ 2 /๐‘ . We prove the claim by proving that conditioning on ๐‘† โˆ‰ ๐ถ, the success
probability of the test is much lower than ๐œ–. We deduce that the probability of ๐‘† โˆˆ ๐ถ must be
close to ๐œ–.
     The test passes if ๐‘Œ โˆˆ ๐’ฑ and ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ = ๐‘“ (๐‘Œ โˆช ๐‘‰)๐‘Œ . We prove that for ๐‘† โˆ‰ ๐ถ, with high
                              3๐›ผ๐‘˜                               3๐›ผ๐‘˜
probability both ๐‘“ (๐‘Œ โˆช ๐‘‰)๐‘Œ 0 ๐‘”(๐‘Œ) and ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ โ‰ˆ ๐‘”(๐‘Œ), and the test fails.

                      T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                           30
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                                                                                                 3๐›ผ๐‘˜
   1. If ๐‘Œ โˆ‰ ๐’ฑ, the test fails. For every ๐‘Œ โˆˆ ๐’ฑ, Lemma 4.4 states that ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ โ‰ˆ ๐‘”(๐‘Œ) with
      probability 1 โˆ’ 2๐œ– 2 . Conditioning on ๐‘† โˆ‰ ๐ถ does not increase the probability by much
      (where we assume that ๐ถ is small, else there is nothing to prove),
                                                                      
                                       3๐›ผ๐‘˜                                         1
                      Pr ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ 0 ๐‘”(๐‘Œ) ๐‘Œ โˆˆ ๐’ฑ, ๐‘† โˆ‰ ๐ถ โ‰ค 2๐œ– 2                           โ‰ค 3๐œ– 2 .            (4.1)
                      ๐‘Œ                                                        Pr[๐‘† โˆ‰ ๐ถ]

   2. For every set ๐‘† let ๐ท๐‘† = {๐‘– โˆˆ [๐‘˜] | ๐‘“ (๐‘†)๐‘– โ‰  ๐‘“ (๐‘†)๐‘– } . For ๐‘† โˆ‰ ๐ถ, |๐ท๐‘† | > 5๐›ผ๐‘˜. The set ๐‘Œ is
      a random subset of ๐‘† of size 9๐‘˜/10 . Therefore, for ๐‘† โˆ‰ ๐ถ, by the tail bound (Fact 2.4),
                                          ๐›ผ๐‘˜                                                           3๐›ผ๐‘˜
      Pr๐‘ŒโŠ‚๐‘† [|๐‘Œ โˆฉ ๐ท๐‘† | โ‰ค 3๐›ผ๐‘˜ | ] โ‰ค eโˆ’ 4 . By definition,
                                                         if |๐‘Œ โˆฉ ๐ท๐‘† | โ‰ฅ 3๐›ผ๐‘˜, then ๐‘“ (๐‘†)๐‘Œ 0 ๐‘”(๐‘Œ) .
                                             3๐›ผ๐‘˜                 ๐›ผ๐‘˜
     That is, for ๐‘† โˆ‰ ๐ถ, Pr๐‘ŒโŠ‚๐‘† ๐‘“ (๐‘†)๐‘Œ โ‰ˆ ๐‘”(๐‘Œ) โ‰ค eโˆ’ 4 .


   From the two items above,

             Pr[Test passes|๐‘† โˆ‰ ๐ถ] = Pr [๐‘Œ โˆˆ ๐’ฑ and ๐‘“ (๐‘Š โˆช ๐‘Œ)๐‘Œ = ๐‘“ (๐‘‰ โˆช ๐‘Œ)๐‘Œ | ๐‘† โˆ‰ ๐ถ]
                                                                                            
                                                                 3๐›ผ๐‘˜
                                       โ‰ค Pr ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ 0 ๐‘”(๐‘Œ) and ๐‘Œ โˆˆ ๐’ฑ ๐‘† โˆ‰ ๐ถ
                                          ๐‘Œ
                                                                          
                                                           3๐›ผ๐‘˜
                                      + Pr         ๐‘“ (๐‘†)๐‘Œ โ‰ˆ ๐‘”(๐‘Œ) ๐‘† โˆˆ ๐ถ
                                         ๐‘ŒโŠ‚๐‘†
                                                      ๐›ผ๐‘˜
                                       โ‰ค 3๐œ– 2 + eโˆ’ 4 .

   We assume that ๐‘“ passes the test with probability ๐œ– โˆ’ ๐‘˜ 2 /๐‘ ,

             Pr[Test passes] = Pr[Test passes and ๐‘† โˆˆ ๐ถ] + Pr[Test passes and ๐‘† โˆ‰ ๐ถ] .

Therefore,
                                                    ๐‘˜2
                               Pr[๐‘† โˆˆ ๐ถ] โ‰ฅ ๐œ– โˆ’         โˆ’ 3๐œ– 2 โˆ’ eโˆ’ 4 ๐›ผ๐‘˜ โ‰ฅ ๐œ– โˆ’ 4๐œ–2 ,
                                                                   1

                                                    ๐‘
which finishes the proof.                                                                                       

   In the introduction, we stressed that in order to extend the restricted global structure into a
global structure, the restricted global structure theorem has to be โ€œstrong,โ€ i. e., the probability
                3๐›ผ๐‘˜
of ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ 0 ๐‘” ๐‘‹ ,๐‘Š (๐‘Œ) should be strictly smaller than ๐œ–, it is 2๐œ– 2 in our case. If the local
structure was not strong and the bound in (4.1) would have been larger than ๐œ–, then all the
                                                                                      5๐›ผ๐‘˜
success probability of the test could come from sets such that ๐‘“ (๐‘†) 0 ๐‘”(๐‘†). In this case, we
could not have deduced that ๐ถ is large and ๐‘” is close to a direct product function. This is the
situation in the local structure theorem of [8].

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                 31
                                      I RIT D INUR AND I NBAL L IVNI NAVON

5    Global structure for tuples
In this section, we prove our main theorem โ€“ global structure for tuples. The proof uses the
restricted global structure, Theorem 3.9. For convenience, we write again the test and theorem
from the introduction.

                            Test 1: Z-test with parameter ๐‘ก = ๐‘˜/10 (3-query test)

    1. Choose ๐ด, ๐ต, ๐ถ to be a random partition of [๐‘˜],                                      ๐ด       ๐ถ   ๐ต
       such that |๐ด| = |๐ต| = ๐‘˜/10 .                                              ๐‘ฅ

    2. Choose uniformly at random ๐‘ฅ, ๐‘ฆ, ๐‘ง โˆˆ [๐‘] ๐‘˜ such                           ๐‘ฆ
       that ๐‘ฅ ๐ด = ๐‘ฆ๐ด and ๐‘ฆ๐ต = ๐‘ง ๐ต .
                                                                                 ๐‘ง
    3. Accept if ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด and ๐‘“ (๐‘ง)๐ต = ๐‘“ (๐‘ฆ)๐ต .
Denote by agr๐‘๐‘˜/10 ( ๐‘“ ) the success probability of ๐‘“ on this test.


    Let ๐’Ÿ z be the distribution over ๐ด, ๐ต, ๐ถ, ๐‘ฅ, ๐‘ฆ, ๐‘ง as described above in the test.

Theorem 5.1 (Main theorem โ€“ Global Structure for tuples, restated). For every ๐‘ , ๐‘€ > 1, there
exists a small constant ๐‘ > 0 such that for every constant ๐œ† > 0 and large enough ๐‘˜, if ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜
is a function that passes Test 1 with probability ๐œ– = agr๐‘๐‘˜/10 ( ๐‘“ ) โ‰ฅ eโˆ’๐‘๐œ† ๐‘˜ , then there exist functions
                                                                            2


(๐‘”1 , . . . , ๐‘” ๐‘˜ ) , ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€] such that

                                                                                             ๐œ–
                                                                                    
                                                      ๐œ†๐‘˜
                                    Pr          ๐‘“ (๐‘ฅ) โ‰ˆ (๐‘”1 (๐‘ฅ 1 ), . . . , ๐‘” ๐‘˜ (๐‘ฅ ๐‘˜ )) โ‰ฅ      .
                                  ๐‘ฅโˆˆ[๐‘] ๐‘˜                                                   10

    Fix a function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ , such that agr๐‘๐‘˜/10 ( ๐‘“ ) = ๐œ– โ‰ฅ eโˆ’๐‘๐œ† ๐‘˜ .
                                                                                                2


    Similar to the proof of the restricted global structure, in the proof we use several values for
the slack parameter ๐œ†. These are constant multiples of each other, and are denoted by ๐œ†0 , ๐œ†1 etc.
    Our proof of Theorem 1.1 relies on Theorem 3.9. The theorem states that many restrictions ๐œ
are DP restrictions (see Definition 3.6). Fix ๐œ†0 = ๐œ†/10000 . We apply theorem Theorem 3.9 with
the slack parameter ๐›ผ = ๐œ†0 . For every ๐œ†0 -DP restriction ๐œ, we denote by ๐‘”๐œ the direct product
function corresponding to ๐œ.
    For the proof, we need a few definitions.

Definition 5.2 (Successful set). For every ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , a set ๐ด โŠ‚ [๐‘˜], |๐ด| = ๐‘˜/10 , is successful with
respect to ๐‘ฅ if

    1. Pr ๐‘ฆ,๐ต,๐‘งโˆผ๐’Ÿ z
                  |๐ด,๐‘ฅ
                         [Test 1 succeeds] โ‰ฅ ๐œ–/3 .

    2. ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) is a ๐œ†0 -DP-restriction.

                            T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                            32
                  E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

Definition 5.3 (Consistent functions). Let ๐‘†1 , ๐‘†2 โŠ‚ [๐‘˜] and let ๐‘” : [๐‘]๐‘†1 โ†’ [๐‘€]๐‘†1 and ๐‘” 0 :
[๐‘]๐‘†2 โ†’ [๐‘€]๐‘†2 be two direct product functions. We say that ๐‘”, ๐‘” 0 are ๐›ฝ-consistent if for a
uniform ๐‘– โˆˆ ๐‘†1 โˆฉ ๐‘†2 and ๐‘ โˆˆ [๐‘],
                                                 Pr ๐‘” ๐‘– (๐‘) โ‰  ๐‘” 0๐‘– (๐‘) โ‰ค ๐›ฝ .
                                                                   
                                                 ๐‘–,๐‘

   We prove the main theorem in Section 5.1, and prove the lemmas used in the proof in the
next sections.

5.1        Proof of Theorem 1.1
Let ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be a function that passes Test 1 with probability ๐œ–.
    By Theorem 3.9, a restriction ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) is a ๐œ†0 -DP-restriction with probability at
                                             ยฏ        ยฏ
least ๐œ–/2 ยท (1 โˆ’ ๐œ–2 ) . We denote by ๐‘”๐œ : [๐‘]๐ด โ†’ [๐‘€]๐ด the DP function associated with ๐œ.
    We start by finding a single string ๐‘ฅ which is โ€œglobally goodโ€. Fix ๐œ†1 = 60๐œ†0 .
Lemma 5.4. There exists ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , such that
   1. Pr๐ด [๐ด is successful with respect to ๐‘ฅ] โ‰ฅ ๐œ–/4 .
   2. Pr๐ด ,๐ด โˆˆ [๐‘˜] [๐ด1 , ๐ด2 are successful w.r.t. ๐‘ฅ and ๐‘”๐œ1 , ๐‘”๐œ2 are ๐œ†1 -consistent] โ‰ฅ ๐œ– 5 , where the tu-
          1 2 ( ๐‘˜/10)

      ples are ๐œ1 = (๐ด1 , ๐‘ฅ ๐ด1 , ๐‘“ (๐‘ฅ)๐ด1 ) and ๐œ2 = (๐ด2 , ๐‘ฅ ๐ด2 , ๐‘“ (๐‘ฅ)๐ด2 ) .
      The proof appears on Section 5.2.
      We fix the string ๐‘ฅ โˆˆ [๐‘] ๐‘˜ promised from Lemma 5.4. Let ๐’œ โŠ‚                   [๐‘˜] 
                                                                                    ๐‘˜/10
                                                                                           be the set of sets that
                                                                               ยฏ        ๐ดยฏ
are successful with respect to ๐‘ฅ. For every ๐ด โˆˆ ๐’œ, let ๐‘” ๐ด : [๐‘]๐ด โ†’ [๐‘€] be the direct product
function ๐‘”๐œ , for ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) .
Theorem 5.5. For all integers ๐‘ , ๐‘€ โˆˆ โ„• and large enough ๐‘˜ โˆˆ โ„• , and all small constants ๐›ฝ, ๐œˆ > 0
such that ๐œˆ > eโˆ’ 3 ๐›ฝ ๐‘˜ , the following holds. Let ๐’œ โŠ‚ ๐‘˜/10
                                                                                                     ยฏ
                                                       [๐‘˜] 
                                                             be a set of sets, and let โ„ฑ = {๐‘” ๐ด : [๐‘]๐ด โ†’
                 1 2


       ยฏ
[๐‘€]๐ด } ๐ดโˆˆ๐’œ be a family of direct product functions. If
                             Pr         [๐ด1 , ๐ด2 โˆˆ ๐’œ and ๐‘” ๐ด1 , ๐‘” ๐ด2 are ๐›ฝ-consistent] โ‰ฅ ๐œˆ ,
                                  [๐‘˜]
                       ๐ด1 ,๐ด2 โˆˆ( ๐‘˜/10)

then there exists a global function ๐‘” : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ such that
                                                                          1
                               Pr [๐ด โˆˆ ๐’œ and ๐‘” ๐ด , ๐‘” are 50๐›ฝ-consistent] โ‰ฅ ๐œˆ .
                                  [๐‘˜]                                     4
                             ๐ดโˆˆ( ๐‘˜/10)

   We prove the theorem in Section 5.3 (in fact we prove a slightly stronger statement).
   The family {๐‘” ๐ด } ๐ดโˆˆ๐’œ satisfies the conditions of the theorem, with parameters ๐œˆ = ๐œ– 5 and
๐›ฝ = ๐œ†1 . Let ๐‘” : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be the direct product function promised from the theorem. Fix
๐œ†3 = 160๐œ†1 . We finally claim that ๐‘” is the required global DP function,
                                            
                                  ๐œ†3 ๐‘˜
                                    ๐œ–
Lemma 5.6. Pr๐‘งโˆˆ[๐‘]๐‘˜ ๐‘“ (๐‘ง) โ‰ˆ ๐‘”(๐‘ง) โ‰ฅ 10 .

      The proof appears in Section 5.4. This finishes the proof since ๐œ†3 < ๐œ† .

                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                   33
                                     I RIT D INUR AND I NBAL L IVNI NAVON

5.2     Consistency between restricted global functions
In this section we find a string ๐‘ฅ โˆˆ [๐‘] ๐‘˜ which is โ€œglobally goodโ€, proving Lemma 5.4.
Claim 5.7. There exists ๐‘ฅ โˆˆ [๐‘] ๐‘˜ such that
   1. Pr๐ด,๐‘ฆ,๐ต,๐‘งโˆผ๐’Ÿ z [Test 1 passes] โ‰ฅ ๐œ–/3 and,
                    |๐‘ฅ

   2. Pr๐ด [๐ด is successful w.r.t. ๐‘ฅ] โ‰ฅ 3๐œ– .

Proof. Let ๐บ = (๐ฟ โˆช ๐‘…, ๐ธ) be the full bipartite graph, with vertex sets ๐ฟ = ๐‘˜/10  [๐‘˜]
                                                                                       and ๐‘… = [๐‘] ๐‘˜ .
                                                                                                 

Let ๐œ” : ๐ธ โ†’ [0, 1] be a function matching each edge (๐ด, ๐‘ฅ) the success probability of Test 1 given
that ๐ด, ๐‘ฅ are chosen, i. e., ๐œ”(๐ด, ๐‘ฅ) = Pr ๐‘ฆ,๐ต,๐‘งโˆผ๐’Ÿ z [Test 1 passes] . Then ๐”ผ(๐ด,๐‘ฅ)โˆˆ๐ธ [๐œ”(๐ด, ๐‘ฅ)] โ‰ฅ ๐œ– .
                                                  |๐ด,๐‘ฅ
    Suppose that for each edge ๐‘’ with ๐œ”(๐‘’) โ‰ค ๐œ–/2 , we change ๐œ”(๐‘’) to 0. The expected value of ๐œ”
is reduced by at most ๐œ–/2 , i. e., ๐”ผ(๐ด,๐‘ฅ)โˆˆ๐ธ [๐œ”(๐ด, ๐‘ฅ)] โ‰ฅ ๐œ–/2 . All the edges (๐ด, ๐‘ฅ) that remain with
positive value ๐œ” are of edges (๐ด, ๐‘ฅ) such that ๐œ = (๐ด, ๐‘ฅ, ๐‘“ (๐‘ฅ)๐ด ) is good2.
    We further change ๐œ”(๐‘’) to 0 for all edges ๐‘’ = (๐ด, ๐‘ฅ) such that ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) is not a
๐œ†0 -DP restriction. From Theorem 3.9, a good ๐œ โˆผ ๐’Ÿ is a DP-restriction with probability at least
1 โˆ’ ๐œ– 2 . The distribution ๐œ โˆผ ๐’Ÿ corresponds to a uniform choice of (๐ด, ๐‘ฅ) โˆˆ ๐ธ. Therefore, we
have changed ๐œ”(๐‘’) to 0 on at most ๐œ– 2 fraction of the edges. The maximal value of ๐œ” is 1, so this
step reduces the expectation of ๐œ” over ๐ธ by at most ๐œ– 2 , and ๐”ผ(๐ด,๐‘ฅ)โˆˆ๐ธ [๐œ”(๐ด, ๐‘ฅ)] โ‰ฅ ๐œ–/2 โˆ’ ๐œ– 2 โ‰ฅ ๐œ–/3 .
    Let ๐‘ฅ be a vertex which maximizes ๐”ผ๐ด [๐œ”(๐ด, ๐‘ฅ)], then
                                                                         ๐œ–
                                Pr z Test 1 passes โ‰ฅ ๐”ผ [๐œ”(๐ด, ๐‘ฅ)] โ‰ฅ .
                                                      
                            ๐ด,๐‘ฆ,๐ต,๐‘งโˆผ๐’Ÿ |๐‘ฅ                  ๐ด              3

      All edges (๐ด, ๐‘ฅ) such that ๐œ”(๐ด, ๐‘ฅ) > 0 are such that ๐ด is successful with respect to ๐‘ฅ, so
                                                                                      ๐œ–
                          Pr [๐ด is successful w.r.t. ๐‘ฅ] = Pr [๐œ”(๐ด, ๐‘ฅ) > 0] โ‰ฅ            ,
                           ๐ด                                   ๐ด                      3
where the last inequality holds because the maximal value of ๐œ” is 1.                                               
    In the rest of this subsection, we fix an ๐‘ฅ satisfying the properties of Claim 5.7. For every
                                                                  ยฏ          ยฏ
set ๐ด that is successful with respect to ๐‘ฅ, denote by ๐‘” ๐ด : [๐‘]๐ด โ†’ [๐‘€]๐ด the function ๐‘”๐œ for
๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) . Denote by ๐’ต๐ด the set
                                           (                       ๐œ†1 ๐‘˜
                                                                              )
                                   ๐’ต๐ด = ๐‘ง โˆˆ [๐‘] ๐‘˜         ๐‘“ (๐‘ง)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ง ๐ดยฏ ) .
                                                                    3




Note that the set ๐’ต๐ด might be all of [๐‘] ๐‘˜ .
    We prove in the next claim that if ๐ด is successful with respect to ๐‘ฅ, then ๐‘” ๐ด is consistent
with the original function ๐‘“ . This consistency is much stronger than what is guaranteed by
Theorem     3.9. By Theorem 3.9, ๐‘” ๐ด , ๐‘“ are consistent on a set of inputs contained in the set
  ๐‘ค โˆˆ [๐‘] ๐‘˜ ๐‘ค ๐ด = ๐‘ฅ ๐ด . In the claim below, we prove that ๐‘” ๐ด , ๐‘“ are consistent on ฮฉ(๐œ–) fraction


of [๐‘] ๐‘˜ , which is a much larger set.
   2There may also be good tuples with value 0, if Test 2 passes with probability larger than ๐œ–/2 but Test 1 doesnโ€™t.


                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                     34
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

Claim 5.8. For every ๐ด that is successful with respect to ๐‘ฅ,
                                                                                 ๐œ–
                                                       Pr [๐‘ง โˆˆ ๐’ต๐ด ] โ‰ฅ              .
                                                  ๐‘งโˆˆ[๐‘] ๐‘˜                        4

Proof. Fix an ๐ด that is successful with respect to
                                                  ๐‘ฅ, and assume for a contradiction that
Pr๐‘งโˆˆ[๐‘]๐‘˜ [๐‘ง โˆˆ ๐’ต๐ด ] < ๐œ–/4 . For every ๐‘ง, let ๐ท๐‘ง = ๐‘– โˆˆ ๐ดยฏ ๐‘“ (๐‘ง)๐‘– โ‰  ๐‘” ๐ด,๐‘– (๐‘ง ๐‘– ) , then for ๐‘ง โˆ‰ ๐’ต๐ด ,
|๐ท๐‘ง | โ‰ฅ ๐‘˜๐œ†1 /3 .
                                                                                              ๐œ†0 ๐‘˜
    Let ๐‘ฆ, ๐‘ง, ๐ต โˆผ ๐’Ÿ z |๐ด, ๐‘ฅ . Suppose ๐‘ฆ is such that ๐‘“ (๐‘ฆ)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ฆ๐ดยฏ ) . The test passes if
๐‘“ (๐‘ฆ)๐ต = ๐‘“ (๐‘ง)๐ต , which implies (since ๐ต โŠ‚ ๐ด)  ยฏ that also ๐‘“ (๐‘ง)๐ต ๐œ†โ‰ˆ0 ๐‘˜ ๐‘” ๐ด (๐‘ฆ ยฏ )๐ต . The function ๐‘” ๐ด is a
                                                                              ๐ด
product function and ๐‘ฆ๐ต = ๐‘ง ๐ต , so ๐‘” ๐ด (๐‘ฆ๐ดยฏ )๐ต = ๐‘” ๐ด (๐‘ง ๐ดยฏ )๐ต and we get from the previous inequality
that
                                          ๐œ†0 ๐‘˜
                                   ๐‘“ (๐‘ง)๐ต โ‰ˆ ๐‘” ๐ด (๐‘ฆ๐ดยฏ )๐ต = ๐‘” ๐ด (๐‘ง ๐ดยฏ )๐ต .
From the definition of ๐ท๐‘ง , this only happens if |๐ท๐‘ง โˆฉ ๐ต| โ‰ค ๐œ†0 ๐‘˜ . To summarize, if the test passes
                               ๐œ†0 ๐‘˜
and ๐‘ฆ is such that ๐‘“ (๐‘ฆ)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ฆ๐ดยฏ ) , it must be that |๐ท๐‘ง โˆฉ ๐ต| โ‰ค ๐œ†0 ๐‘˜ .
   From the above paragraph,

                                                                                                     ๐œ†0 ๐‘˜
                                                                                                                   
            Pr         [Test passes|๐‘ง โˆ‰ ๐’ต๐ด ] = Pr                     Test passes and ๐‘“ (๐‘ฆ)๐ดยฏ 0 ๐‘” ๐ด (๐‘ฆ๐ดยฏ ) ๐‘ง โˆ‰ ๐’ต๐ด
        ๐ต,๐‘ฆ,๐‘งโˆผ๐’Ÿ |๐ด,๐‘ฅ
                z                                      ๐ต,๐‘ฆ,๐‘ง
                                                                                                                   
                                                                                                     ๐œ†0 ๐‘˜
                                                  + Pr                Test passes and ๐‘“ (๐‘ฆ)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ฆ๐ดยฏ ) ๐‘ง โˆ‰ ๐’ต๐ด
                                                       ๐ต,๐‘ฆ,๐‘ง
                                                                          ๐œ†0 ๐‘˜
                                                                                                             
                                                  โ‰ค Pr ๐‘“ (๐‘ฆ)๐ดยฏ 0 ๐‘” ๐ด (๐‘ฆ๐ดยฏ ) ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด , ๐‘ง โˆ‰ ๐’ต๐ด
                                                        ๐‘ฆ

                                                       + Pr [|๐ต โˆฉ ๐ท๐‘ง | โ‰ค ๐œ†0 ๐‘˜ | ๐‘ง โˆ‰ ๐’ต๐ด ] .
                                                            ๐ต,๐‘ง

    We bound the two expressions. For the first, from Theorem 3.9,

                                                ๐œ†0 ๐‘˜
                                                                                             
                                Pr ๐‘“ (๐‘ฆ)๐ดยฏ 0 ๐‘” ๐ด (๐‘ฆ๐ดยฏ ) ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด โ‰ค ๐œ– 2 .
                                 ๐‘ฆ


Conditioning on ๐‘ง โˆ‰ ๐’ต๐ด , which occurs with probability at least 1 โˆ’ 4๐œ– , increases the probability
by a factor of at most 1โˆ’1 ๐œ– < 2 .
                           4
   For the second expression, the set ๐ต is a random subset of ๐ดยฏ of size ๐‘˜/10 , and |๐ท๐‘ง | โ‰ฅ ๐‘˜๐œ†1 /3 =
20๐œ†0 ๐‘˜ . Using the Hoeffding bound for random subset (Fact 2.4),
                                                                                       ๐œ†1 ๐‘˜
                                 Pr [|๐ต โˆฉ ๐ท๐‘ง | โ‰ค ๐œ†0 ๐‘˜ | ๐‘ง โˆ‰ ๐’ต๐ด ] โ‰ค eโˆ’ 20 < ๐œ–2 .
                                 ๐ต,๐‘ง

    We conclude that
                                           Pr         [Test passes|๐‘ง โˆ‰ ๐’ต๐ด ] โ‰ค 3๐œ– 2 .
                                       ๐ต,๐‘ฆ,๐‘งโˆผ๐’Ÿ |๐ด,๐‘ฅ
                                               z




                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                         35
                                        I RIT D INUR AND I NBAL L IVNI NAVON

This implies that

                    Pr          [Test passes] โ‰ค            Pr        [Test passes|๐‘ง โˆ‰ ๐’ต๐ด ] + Pr[๐‘ง โˆˆ ๐’ต๐ด ]
                ๐ต,๐‘ฆ,๐‘งโˆผ๐’Ÿ |๐ด,๐‘ฅ
                        z
                                                     ๐ต,๐‘ฆ,๐‘งโˆผ๐’Ÿ |๐ด,๐‘ฅ
                                                             z                                           ๐‘ง

                                                               ๐œ–  ๐œ–
                                                   โ‰ค3๐œ– 2 +       < .
                                                               4  3
This contradicts ๐ด being successful with respect to ๐‘ฅ.                                                                                     
   In the introduction, we explained the difference between our restricted global structure
and the result of [8]. In our result, Theorem 3.9, ๐‘“ (๐‘ฆ)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ฆ) for 1 โˆ’ ๐œ– 2 of ๐‘ฆ โˆˆ ๐’ฑ๐œ (for
๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ (๐‘ฅ)๐ด ) , whereas in their result this probability was not as overwhelmingly close to 1.
We require this for proving the above claim, as well as for proving the global structure.
Claim 5.9.
                                               ๐œ–2 ๐‘˜                                   ๐œ–2
                                                                                                              
                     Pr         |๐’ต๐ด1 โˆฉ ๐’ต๐ด2 | โ‰ฅ    ๐‘ ๐ด1 , ๐ด2 are successful w.r.t. ๐‘ฅ โ‰ฅ    .
                          [๐‘˜]                  32                                     32
                ๐ด1 ,๐ด2 โˆˆ(๐‘˜/10 )

Proof. Let ๐ด1 , ๐ด2 be two uniform sets that are successful with respect to ๐‘ฅ, then
                                                               ร•
                            ๐”ผ [|๐’ต๐ด1 โˆฉ ๐’ต๐ด2 |] =                           ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด1 โˆฉ ๐’ต๐ด2 )]
                          ๐ด1 ,๐ด2                                     ๐ด1 ,๐ด2
                                                           ๐‘งโˆˆ[๐‘] ๐‘˜
                                                               ร•
                                                       =                 ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด1 )๐•€(๐‘ง โˆˆ ๐’ต๐ด2 )]
                                                                     ๐ด1 ,๐ด2
                                                           ๐‘งโˆˆ[๐‘] ๐‘˜
                                                               ร•
                                                       =             ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด )]2 ,
                                                                     ๐ด
                                                           ๐‘งโˆˆ[๐‘] ๐‘˜

where ๐•€ is an indicator. The last equality holds since ๐ด1 , ๐ด2 are independent uniform sets that
are successful with respect to ๐‘ฅ.
    By Cauchy Schwarz,
                                                           2
                  ยฉ ร• โˆ’ 2๐‘˜                    ยฉ ร• โˆ’๐‘˜ ยช ยฉ ร•
                          ๐‘ ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด )]ยฎ โ‰ค ยญ        ๐‘ ยฎยญ          ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด )]2 ยฎ
                                          ยช                                          ยช
                  ยญ
                            ๐ด                                        ๐ด
                  ยซ๐‘งโˆˆ[๐‘]๐‘˜                 ยฌ   ยซ๐‘งโˆˆ[๐‘]
                                                  ร•
                                                     ๐‘˜
                                                           ยฌ ยซ๐‘งโˆˆ[๐‘]๐‘˜                 ยฌ
                                            =1 ยท        ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด )] .
                                                                       2
                                                                               ๐ด
                                                                     ๐‘งโˆˆ[๐‘] ๐‘˜

   From Claim 5.8, for every ๐ด which is successful with respect to ๐‘ฅ, Pr๐‘ง [๐‘ง โˆˆ ๐’ต๐ด ] โ‰ฅ ๐œ–/4 . This
means that for every such ๐ด, ๐‘ง ๐•€(๐‘ง โˆˆ ๐’ต๐ด ) โ‰ฅ ๐‘ ๐‘˜ ๐œ–/4 . This also holds for a uniform ๐ด that is
                               ร
successful with respect to ๐‘ฅ. Combining it together with the above equations,
                                                                                                               !2
                                                                                                                        ๐œ–        2
                                                                                       โˆ’ 2๐‘˜                                   ๐‘˜
                                      ร•                                       ร•
         ๐”ผ [|๐’ต๐ด1 โˆฉ ๐’ต๐ด2 |] =                    ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด )] โ‰ฅ      2
                                                                                   ๐‘          ๐”ผ [๐•€(๐‘ง โˆˆ ๐’ต๐ด )]        โ‰ฅ        ๐‘2        .
       ๐ด1 ,๐ด2                                  ๐ด                                              ๐ด                          4
                                     ๐‘งโˆˆ[๐‘] ๐‘˜                                   ๐‘ง



                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                            36
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

    The maximal value of |๐’ต๐ด1 โˆฉ ๐’ต๐ด2 | is ๐‘ ๐‘˜ , therefore by averaging

                                                                        ๐œ–2 ๐‘˜   ๐œ–2
                                                                                   
                                            Pr           |๐’ต๐ด1 โˆฉ ๐’ต๐ด2 | โ‰ฅ    ๐‘ โ‰ฅ    .
                                         ๐ด1 ,๐ด2                         32     32
                                                                                                                        
Claim 5.10. For every ๐ด1 , ๐ด2 โˆˆ                 [๐‘˜] 
                                               ๐‘˜/10
                                                      such that |๐’ต๐ด1 โˆฉ ๐’ต๐ด2 | โ‰ฅ ๐‘ ๐‘˜ ๐œ– 2 /32 , the functions ๐‘” ๐ด1 , ๐‘” ๐ด2 are
๐œ†1 -consistent.
Proof. Fix ๐ด1 , ๐ด2 such that |๐’ต๐ด1 โˆฉ ๐’ต๐ด2 | โ‰ฅ ๐‘ ๐‘˜ ๐œ– 2 /32 . Let ๐‘† = [๐‘˜] \ {๐ด1 โˆช ๐ด2 } . ๐‘† is the set of
coordinates both ๐‘” ๐ด1 , ๐‘” ๐ด2 are defined on, and |๐‘†| โ‰ฅ 0.8๐‘˜ .
   Assume for a contradiction that ๐‘” ๐ด1 , ๐‘” ๐ด2 are not ๐œ†1 -consistent, i. e.,

                                                   Pr      [๐‘” ๐ด1 ,๐‘– (๐‘) โ‰  ๐‘” ๐ด2 ,๐‘– (๐‘)] > ๐œ†1 .
                                            ๐‘–โˆˆ๐‘†,๐‘โˆˆ[๐‘]

By the Chernoff tail bound (Fact 2.3),

                                                                 3 ๐œ†1 ๐‘˜
                                                                2
                                                                                    
                                                   ๐‘” ๐ด1 (๐‘ง ๐ดยฏ1 )๐‘† โ‰ˆ ๐‘” ๐ด2 (๐‘ง ๐ดยฏ2 )๐‘† โ‰ค eโˆ’ 10 ๐œ†1 ๐‘˜ .
                                                                                            1
                                       Pr                                                                           (5.1)
                                     ๐‘งโˆˆ[๐‘] ๐‘˜

We can use the Chernoff bound on the different coordinates ๐‘– โˆˆ ๐‘† because the functions ๐‘” ๐ด1 , ๐‘” ๐ด2
are direct product functions, so their output on different coordinates is independent.
                                                                          3 ๐œ†1 ๐‘˜                        3 ๐œ†1
                                                                          1                             1

    Any input ๐‘ง โˆˆ ๐’ต1 โˆฉ ๐’ต2 satisfies both ๐‘“ (๐‘ง)๐ดยฏ1 โ‰ˆ ๐‘” ๐ด1 (๐‘ง ๐ดยฏ1 ) and ๐‘“ (๐‘ง)๐ดยฏ2 โ‰ˆ ๐‘” ๐ด2 (๐‘ง ๐ดยฏ2 ) which
                         3 ๐œ†1 ๐‘˜
                         2

implies that ๐‘” ๐ด1 (๐‘ง ๐‘† ) โ‰ˆ ๐‘” ๐ด2 (๐‘ง ๐‘† ) . That is,

                                               3 ๐œ†1 ๐‘˜                                               ๐œ–2
                                              2
                                                                     
                    Pr           ๐‘” ๐ด1 (๐‘ง ๐ดยฏ1 )๐‘† โ‰ˆ ๐‘” ๐ด2 (๐‘ง ๐ดยฏ2 )๐‘† โ‰ฅ Pr [๐‘ง โˆˆ ๐’ต๐ด1 โˆฉ ๐’ต๐ด2 ] โ‰ฅ               ,
                  ๐‘งโˆˆ[๐‘] ๐‘˜                                                 ๐‘งโˆˆ[๐‘] ๐‘˜                   32

which contradicts (5.1).                                                                                                
Proof of Lemma 5.4. Let ๐‘ฅ โˆˆ [๐‘] ๐‘˜ be the input promised from Claim 5.7.
   A set ๐ด is successful with respect to ๐‘ฅ with probability at least 3๐œ– . From Claim 5.9,

                                             ๐œ–2 ๐‘˜                                   ๐œ–2
                                                                                                   
                   Pr         |๐’ต๐ด1 โˆฉ ๐’ต๐ด2 | โ‰ฅ    ๐‘ ๐ด1 , ๐ด2 are successful w.r.t. ๐‘ฅ โ‰ฅ    .
                        [๐‘˜]                  32                                     32
              ๐ด1 ,๐ด2 โˆˆ(
                      ๐‘˜/10  )

By Claim 5.10, such sets ๐ด1 , ๐ด2 are ๐œ†1 consistent, i. e.,
                             ๐ด ๐ด                                                        ๐œ–2
                 Pr          ๐‘” 1 , ๐‘” 2 are ๐œ†1 consistent ๐ด1 , ๐ด2 are successful w.r.t. ๐‘ฅ โ‰ฅ    .
                       [๐‘˜]                                                                 32
            ๐ด1 ,๐ด2 โˆˆ( ๐‘˜/10)


Therefore, the probability of ๐ด1 , ๐ด2 to be successful with respect to ๐‘ฅ and ๐œ†1 consistent is at least
 ๐œ– 2 ๐œ–2
     32 > ๐œ– .
   
 4
           5                                                                                        

                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                          37
                                 I RIT D INUR AND I NBAL L IVNI NAVON

5.3   Agreement theorem in the dense case
In this section we prove Theorem 5.5, which is an agreement theorem for functions. In fact, we
prove a more general version of the theorem, Theorem 5.13 below.
    Let ฮฃ be an alphabet with a distance function dist : ฮฃ ร— ฮฃ โ†’ [0, 1] that satisfies the triangle
inequality, i. e., dist(๐‘ฅ, ๐‘ฆ) + dist(๐‘ฆ, ๐‘ง) โ‰ฅ dist(๐‘ฅ, ๐‘ง) for all ๐‘ฅ, ๐‘ฆ, ๐‘ง โˆˆ ฮฃ. We look at a family of
functions โ„ฑ = { ๐‘“๐‘† : ๐‘† โ†’ ฮฃ} ๐‘†โˆˆ [๐‘˜] .
                                 (9๐‘˜/10)
Definition 5.11. The difference between ๐‘“๐‘†1 , ๐‘“๐‘†2 โˆˆ โ„ฑ , denoted by ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 ) , is defined by the
equation
                            ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 ) = ๐”ผ [dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†1 (๐‘–))] .
                                                ๐‘–โˆˆ๐‘†1 โˆฉ๐‘†2

The difference between ๐‘“๐‘† โˆˆ โ„ฑ and a function ๐‘” : [๐‘˜] โ†’ ฮฃ is defined by the equation

                                   ฮ”( ๐‘“๐‘† , ๐‘”) = ๐”ผ [dist( ๐‘“๐‘† (๐‘–), ๐‘”(๐‘–))] .
                                                     ๐‘–โˆˆ๐‘†

Definition 5.12. The agreement of the collection of local functions โ„ฑ regarding the uniform
distribution with parameter ๐›ฝ, denoted by agree๐›ฝ (โ„ฑ ) is defined by the equation

                                agree๐›ฝ (โ„ฑ ) =           Pr         [ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 ) < ๐›ฝ] .
                                                    ๐‘“๐‘†1 , ๐‘“๐‘†2 โˆˆโ„ฑ


Theorem 5.13. For every small constant ๐›ฝ โˆˆ (0, 1), large enough ๐‘˜ โˆˆ โ„• , every ๐œˆ > eโˆ’ 3 ๐›ฝ ๐‘˜ , and every
                                                                                                      1 2


alphabet ฮฃ with a distance measure ๐‘‘๐‘–๐‘ ๐‘ก : ฮฃ ร— ฮฃ โ†’ [0, 1] the following holds.
    If a collection of local functions โ„ฑ = { ๐‘“๐‘† : ๐‘† โ†’ ฮฃ} ๐‘†โˆˆ [๐‘˜] has agree๐›ฝ (โ„ฑ ) > ๐œˆ , then there exists a
                                                           (9๐‘˜/10)
global function ๐‘” : [๐‘˜] โ†’ ฮฃ such that
                                                             1
                                      Pr [ฮ”( ๐‘“๐‘† , ๐‘”) โ‰ค 50๐›ฝ] โ‰ฅ ๐œˆ .
                                        [๐‘˜]                  4
                                    ๐‘†โˆˆ(9๐‘˜/10)

Claim 5.14. Theorem 5.13 implies Theorem 5.5.
                                            ๐‘˜]                                                              ยฏ    ยฏ
Proof. Let ๐‘ , ๐‘€, ๐‘˜ โˆˆ โ„• , and let ๐’œ โŠ‚ ๐‘˜/10      be a set of sets. Let {๐‘” ๐ด } ๐ดโˆˆ๐’œ , โˆ€๐ด, ๐‘” ๐ด : [๐‘]๐ด โ†’ [๐‘€]๐ด
                                                

be a family of direct product functions satisfying the conditions of Theorem 5.5.
                                                                                                ยฏ      ยฏ
    Set ฮฃ = [๐‘€]๐‘ โˆช โŠฅ. For every ๐ด โˆˆ ๐’œ and every direct product function ๐‘” ๐ด : [๐‘]๐ด โ†’ [๐‘€]๐ด ,
๐‘” ๐ด = (๐‘” ๐‘– )๐‘–โˆˆ๐ดยฏ , we define ๐‘“๐ดยฏ : ๐ดยฏ โ†’ [๐‘€]๐‘ by

                                โˆ€๐‘– โˆˆ ๐ดยฏ   ๐‘“๐ดยฏ (๐‘–) = the truth table of ๐‘” ๐‘– .

Since ๐‘” ๐‘– : [๐‘] โ†’ [๐‘€], its truth table is in [๐‘€]๐‘ . For every ๐ด โˆ‰ ๐’œ we set ๐‘“๐ดยฏ to equal โŠฅ on all
inputs.
   We define the distance measure inside ฮฃ as follows,
                                                       (
                          0                 0              Pr๐‘–โˆˆ[๐‘] [๐œŽ๐‘– โ‰  ๐œŽ0๐‘– ]         if ๐œŽ, ๐œŽ0 โ‰  โŠฅ
                    โˆ€๐œŽ, ๐œŽ โˆˆ ฮฃ     dist(๐œŽ, ๐œŽ ) =
                                                           1                           otherwise.


                      T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                      38
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

The distance is the normalized Hamming distance for strings that are not โŠฅ.
    We show that the collection of functions { ๐‘“๐‘† } ๐‘†โˆˆ [๐‘˜] satisfies the conditions of Theorem 5.13.
                                                         (9๐‘˜/10)
If ๐ด1 , ๐ด2 โˆˆ ๐’œ and ๐‘” ๐ด1 , ๐‘” ๐ด2 are ๐›ฝ-consistent, then by definition ฮ”( ๐‘“๐ดยฏ1 , ๐‘“๐ดยฏ2 ) < ๐›ฝ , thus by the
assumptions of Theorem 5.5, agree๐›ฝ (โ„ฑ ) > ๐œˆ.
    Let ๐‘” : [๐‘˜] โ†’ ฮฃ be the function promised from Theorem 5.13. Then ฮ”( ๐‘“๐‘† , ๐‘”) โ‰ค 50๐›ฝ for at
                                       [๐‘˜] 
least a ๐œˆ/4 fraction of the sets ๐‘† โˆˆ 9๐‘˜/10   , let this set of functions be โ„ฑ 0 . Every function ๐‘“๐‘† โˆˆ โ„ฑ 0
must correspond to some ๐‘”๐‘†ยฏ for ๐‘†ยฏ โˆˆ ๐’œ, since for other sets ๐‘†, ๐‘“๐‘† equals โŠฅ and is at distance 1
from any other function.
    Let ๐‘” 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be the direct product function that for every ๐‘– โˆˆ [๐‘˜] has ๐‘” 0๐‘– : [๐‘] โ†’ [๐‘€]
be the functions defined by ๐‘”(๐‘–). If there is ๐‘– such that ๐‘”(๐‘–) = โŠฅ, we define ๐‘” 0๐‘– arbitrarily. By
Theorem 5.13, for every ๐‘“๐‘† โˆˆ ๐ถ, ๐‘†ยฏ โˆˆ ๐’œ and ๐‘”๐‘†ยฏ , ๐‘” are 50๐›ฝ-consistent.                                 
   We now prove Theorem 5.13. In order to prove the theorem, it is helpful to look at the sets
     [๐‘˜] 
๐‘† โˆˆ 9๐‘˜/10  as vertices in a graph. Let ๐’ข = (๐‘‰ , ๐ธ๐‘† โˆช ๐ธ๐‘Š ) to be the graph with the vertex set
     [๐‘˜]
๐‘‰ = 9๐‘˜/10
          
          , and two edge sets, weak edges and strong edges.

Definition 5.15. For every two sets ๐‘†1 , ๐‘†2 โˆˆ ๐‘‰ ,

   1. ๐‘†1 , ๐‘†2 are connected by a strong edge, denoted by ๐‘†1 โˆ’ ๐‘†2 , if ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 ) < ๐›ฝ.

   2. ๐‘†1 , ๐‘†2 are connected by a weak edge, denoted by ๐‘†1 โˆผ ๐‘†2 , if ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 ) < 10๐›ฝ.

If ๐‘†1 , ๐‘†2 are not connected by a weak edge, we denote ๐‘†1 6โˆผ ๐‘†2 .

   We want to find a very dense set of vertices in ๐’ข. Such a subset will allow us to define a
global function ๐‘”. We start by showing that there are many vertices with high degree in ๐’ข.

Claim 5.16. There exists a set ๐’ฎ โŠ‚ ๐‘‰ of measure at least ๐œˆ/2 , such that for every ๐‘† โˆˆ ๐’ฎ

                                                                   1
                                                 Pr [๐‘† โˆ’ ๐‘†0] โ‰ฅ       ๐œˆ.
                                                 ๐‘† โˆˆ๐‘‰
                                                 0                 2
Proof. Let                                                               
                                                                   0  1
                                         ๐’ฎ= ๐‘†โІ๐‘‰         Pr0 [๐‘† โˆ’ ๐‘† ] โ‰ฅ ๐œˆ .
                                                        ๐‘†             2
By averaging

              ๐œˆ โ‰ค Pr [๐‘†1 โˆ’ ๐‘†2 ]
                 ๐‘†1 ,๐‘†2
               โ‰ค Pr [๐‘†1 โˆˆ ๐’ฎ] Pr [๐‘†1 โˆ’ ๐‘†2 | ๐‘†1 โˆˆ ๐’ฎ] + Pr [๐‘†1 โˆ‰ ๐’ฎ] Pr [๐‘†1 โˆ’ ๐‘†2 | ๐‘†1 โˆ‰ ๐’ฎ]
                  ๐‘†1            ๐‘†1 ,๐‘†2                        ๐‘†1          ๐‘†1 ,๐‘†2
                                                         
                              1
               โ‰ค Pr [๐‘†1 โˆˆ ๐’ฎ] + ๐œˆ 1 โˆ’ Pr [๐‘†1 โˆˆ ๐’ฎ] .
                 ๐‘†1           2      ๐‘†1

Then Pr๐‘†1 [๐‘†1 โˆˆ ๐’ฎ] โ‰ฅ ๐œˆ/2 .                                                                            

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                        39
                                        I RIT D INUR AND I NBAL L IVNI NAVON

   Strong connectivity is not transitive, but we can have an โ€œalmost transitiveโ€ property by
considering both strong and weak edges.

Claim 5.17. For ๐‘†, ๐‘†1 , ๐‘†2 โˆˆ ๐‘‰ uniformly and independently,

                                      Pr [๐‘† โˆ’ ๐‘†1 , ๐‘† โˆ’ ๐‘†2 , ๐‘†1 6โˆผ ๐‘†2 ] โ‰ค 2eโˆ’๐›ฝ ๐‘˜ .
                                                                                             2

                                    ๐‘†,๐‘†1 ,๐‘†2

     From the claim we get that if ๐‘† is connected to ๐‘†1 , ๐‘†2 by a strong edge, then almost always
๐‘†1 , ๐‘†2 are connected by a weak edge.

Proof. Fix ๐‘†1 , ๐‘†2 โˆˆ ๐‘‰ to be two vertices such that ๐‘†1 6โˆผ ๐‘†2 (if there are no such vertices, the
probability is 0 and we are done). For every ๐‘– โˆˆ [๐‘˜] let ๐‘‘ ๐‘– โˆˆ [0, 1] be
                                           (
                                               dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†2 (๐‘–))           if ๐‘– โˆˆ ๐‘†1 โˆฉ ๐‘†2
                                   ๐‘‘๐‘– =
                                               0                                 otherwise.

Since ๐‘†1 6โˆผ ๐‘†2 , ๐‘–โˆˆ[๐‘˜] ๐‘‘ ๐‘– โ‰ฅ (8๐‘˜/10) ยท 10๐›ฝ = 8๐›ฝ๐‘˜ (the minimal size of ๐‘†1 โˆฉ ๐‘†2 is 8๐‘˜/10).
                ร
   If ๐‘† is a set that is strongly connected to both ๐‘†1 and ๐‘†2 , then by the triangle inequality
            ร•                                         ร•
                     dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†2 (๐‘–)) โ‰ค                  dist( ๐‘“๐‘† (๐‘–), ๐‘“๐‘†1 (๐‘–)) + dist( ๐‘“๐‘† (๐‘–), ๐‘“๐‘†2 (๐‘–)) โ‰ค 2๐›ฝ๐‘˜ .
        ๐‘–โˆˆ๐‘†โˆฉ๐‘†1 โˆฉ๐‘†2                                ๐‘–โˆˆ๐‘†โˆฉ๐‘†1 โˆฉ๐‘†2

That is, ๐‘–โˆˆ๐‘† ๐‘‘ ๐‘– โ‰ค 2๐›ฝ๐‘˜ .
        ร
   The set ๐‘† is a uniform subset of [๐‘˜] of size 9๐‘˜/10 . Using the Hoeffding bound for random
sampling without replacement (Fact 2.5)
                                                                      "                  #
                                                                          ร•
                            Pr [๐‘† โˆ’ ๐‘†1 and ๐‘† โˆ’ ๐‘†2 ] โ‰ค Pr                        ๐‘‘ ๐‘– โ‰ค 2๐›ฝ๐‘˜ โ‰ค eโˆ’2๐›ฝ ๐‘˜ .
                                                                                                  2

                            ๐‘†                                     ๐‘†
                                                                          ๐‘–โˆˆ๐‘†

Since the bound holds for every ๐‘†1 6โˆผ ๐‘†2 , then it holds also for the uniform distribution over sets
๐‘†1 , ๐‘†2 .                                                                                         

    From the last two claims, Claim 5.16 and Claim 5.17, we conclude that there is a high degree
vertex in ๐‘‰ whose neighbors form a very dense graph with respect to weak edges.

Claim 5.18. There exists a set ๐‘† โˆˆ ๐’ฎ such that

                                      Pr        [๐‘†1 โˆผ ๐‘†2 | ๐‘†1 โˆ’ ๐‘†, ๐‘†2 โˆ’ ๐‘†] โ‰ฅ 1 โˆ’ ๐›ฝ .
                                   ๐‘†1 ,๐‘†2 โˆˆ๐’ฑ

Proof. From Claim 5.16, we know that if we choose ๐‘†, ๐‘†1 , ๐‘†2 โˆˆ ๐‘‰ independently,
                                                                                                          ๐œˆ 3
                Pr [๐‘† โˆˆ ๐’ฎ, ๐‘† โˆ’ ๐‘†1 , ๐‘† โˆ’ ๐‘†2 ] โ‰ฅ Pr [๐‘† โˆˆ ๐’ฎ] Pr [๐‘† โˆ’ ๐‘†1 | ๐‘† โˆˆ ๐’ฎ]2 โ‰ฅ                                  .
             ๐‘†,๐‘†1 ,๐‘†2                                       ๐‘†                   ๐‘†,๐‘†1                      2

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                            40
                    E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

From Claim 5.17, on the same distribution

                                           Pr [๐‘† โˆ’ ๐‘†1 , ๐‘† โˆ’ ๐‘†2 , ๐‘†1 6โˆผ ๐‘†2 ] โ‰ค eโˆ’2๐›ฝ ๐‘˜ .
                                                                                                     2

                                         ๐‘†,๐‘†1 ,๐‘†2

Therefore                                                                                      3
                                                                                                 2
                               Pr [๐‘†1 6โˆผ ๐‘†2 | ๐‘† โˆˆ ๐’ฎ, ๐‘† โˆ’ ๐‘†1 , ๐‘† โˆ’ ๐‘†2 ] โ‰ค                                 eโˆ’2๐›ฝ ๐‘˜ .
                                                                                                                2

                             ๐‘†,๐‘†1 ,๐‘†2                                                            ๐œˆ

Since ๐œˆ > eโˆ’ 3 ๐›ฝ ๐‘˜ , the bound on the probability ๐œˆ2 eโˆ’2๐›ฝ ๐‘˜ is tiny and surely smaller than ๐›ฝ.
                 1 2                                                        3         2


   By averaging, there must be ๐‘† โˆˆ ๐’ฎ that achieves this bound.                                 
Claim 5.19. Let ๐ถ โŠ‚ ๐‘‰ satisfy Pr๐‘†โˆˆ๐‘‰ [๐‘† โˆˆ ๐ถ] โ‰ฅ ๐œˆ/2 , then the number of indices ๐‘– โˆˆ ๐‘˜ such that
Pr๐‘†โˆˆ๐ถ [๐‘– โˆˆ ๐‘†] โ‰ค 1/2 is at most ๐›ฝ๐‘˜.
Proof. Let ๐ท โŠ‚ [๐‘˜] be the set
                                                                                            
                                                                       1
                                              ๐ท = ๐‘– โˆˆ [๐‘˜] Pr [๐‘– โˆˆ ๐‘†] โ‰ค                           .
                                                          ๐‘†โˆˆ๐ถ          2
                                                            [๐‘˜] 
   If we pick a completely uniform ๐‘† โˆˆ                            , then ๐”ผ๐‘† [|๐‘† โˆฉ ๐ท|] = 10
                                                                                         9
                                                                                           |๐ท|.
                                                            10 ๐‘˜
                                                             9
                                                                                                                                   |๐ท|
     Using the the Hoeffding bound for random subset (Fact 2.4), Pr๐‘† |๐‘† โˆฉ ๐ท| โ‰ค 23 |๐ท| โ‰ค eโˆ’ 100 .
                                                                                                                             

If instead we pick a uniform subset in ๐‘† โˆˆ ๐ถ, the probability of the event |๐‘† โˆฉ ๐ท| โ‰ค 32 |๐ท| may
increase by a factor of 2/๐œˆ .                     
                                               2       2 |๐ท|
                                Pr |๐‘† โˆฉ ๐ท| โ‰ค |๐ท| โ‰ค eโˆ’ 100 .
                               ๐‘†โˆˆ๐ถ             3       ๐œˆ
By the definition of ๐ท, for each ๐‘– โˆˆ ๐ท, Pr๐‘†โˆˆ๐ถ [๐‘– โˆˆ ๐‘†] โ‰ค 21 , so ๐”ผ๐‘†โˆˆ๐ถ [|๐‘† โˆฉ ๐ท|] โ‰ค |๐ท|/ . From
averaging Pr๐‘†โˆˆ๐ถ [|๐‘† โˆฉ ๐ท| โ‰ค 2|๐ท|/3] โ‰ฅ 1/4.
                                                                              |๐ท|
   Combining the two bounds, we get that 2/๐œˆ ยท eโˆ’ 100 โ‰ฅ 1/4 , which means that |๐ท| โ‰ค ๐›ฝ๐‘˜ (recall
that ๐œˆ > eโˆ’๐›ฝ ๐‘˜ and ๐›ฝ is a small constant).
            2
                                                                                             
Proof of Theorem 5.5. Let ๐‘†หœ โˆˆ ๐’ฎ be the vertex promised from Claim 5.18, and denote by ๐ถ its
strong neighbors,
                                      ๐ถ = ๐‘† โˆˆ ๐‘‰ ๐‘† โˆ’ ๐‘†หœ .
                                          

The measure of ๐ถ is at least ๐œˆ2 and Pr๐‘†1 ,๐‘†2 โˆˆ๐ถ [๐‘†1 6โˆผ ๐‘†2 ] โ‰ค ๐›ฝ, which implies that

        ๐”ผ        [ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 )] โ‰ค1 ยท      Pr       [๐‘†1 6โˆผ ๐‘†2 ] +        ๐”ผ         [ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 ) | ๐‘†1 โˆผ ๐‘†2 ] โ‰ค ๐›ฝ + 10๐›ฝ .       (5.2)
     ๐‘†1 ,๐‘†2 โˆˆ๐ถ                           ๐‘†1 ,๐‘†2 โˆˆ๐ถ                   ๐‘†1 ,๐‘†2 โˆˆ๐ถ

   We define our direct product function ๐‘” : [๐‘˜] โ†’ ฮฃ as follows.
                                                                                                               
                             โˆ€๐‘– โˆˆ [๐‘˜] ๐‘”(๐‘–) = arg min                          ๐”ผ         [dist( ๐‘“๐‘† (๐‘–), ๐œŽ)] .
                                                             ๐œŽโˆˆฮฃ         ๐‘†โˆˆ๐ถ s.t. ๐‘–โˆˆ๐‘†

Ties are broken arbitrarily. If there is no ๐‘† โˆˆ ๐ถ such that ๐‘– โˆˆ ๐‘†, we set ๐‘”(๐‘–) to an arbitrary value.

                            T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                    41
                                       I RIT D INUR AND I NBAL L IVNI NAVON

     We prove that the function ๐‘” satisfies the theorem requirements. It is enough to prove that
ฮ”(๐‘”, ๐‘“๐‘† ) < 50๐›ฝ for half of the sets ๐‘† โˆˆ ๐ถ.
     We want to bound the expected difference ๐”ผ๐‘†โˆˆ๐ถ [ฮ”(๐‘”, ๐‘“๐‘† )] . If we could say that ๐”ผ๐‘†โˆˆ๐ถ [ฮ”(๐‘”, ๐‘“๐‘† )] โ‰ค
๐”ผ๐‘†1 ,๐‘†2 โˆˆ๐ถ [ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 )] , then by (5.2) we would be done. Unfortunately there is a slight complication,
which we explain and solve below. We write the two expectations explicitly.

   1. ๐”ผ๐‘†โˆˆ๐ถ [ฮ”(๐‘”, ๐‘“๐‘† )] = ๐”ผ๐‘†โˆˆ๐ถ,๐‘–โˆˆ๐‘† [dist(๐‘”(๐‘–), ๐‘“๐‘† (๐‘–)]. Let ๐’Ÿ1 : [๐‘˜] โ†’ [0, 1] be the distribution over ๐‘– in
      this expectation, i. e., picking ๐‘† โˆˆ ๐ถ and then a uniform ๐‘– โˆˆ ๐‘†.

   2. ๐”ผ๐‘†1 ,๐‘†2 โˆˆ๐ถ [ฮ”( ๐‘“๐‘†1 , ๐‘“๐‘†2 )] = ๐”ผ๐‘†1 ,๐‘†2 โˆˆ๐ถ,๐‘–โˆˆ๐‘†1 โˆฉ๐‘†2 [dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†2 (๐‘–))]. Let ๐’Ÿ2 : [๐‘˜] โ†’ [0, 1] be the distri-
      bution over ๐‘– described in this expectation, i. e., picking ๐‘†1 , ๐‘†2 โˆˆ ๐ถ and then ๐‘– โˆˆ ๐‘†1 โˆฉ ๐‘†2 .

We prove that the two distributions are rather similar. Let ๐ท be the set of โ€œbad locationsโ€, which
appear too little in ๐ถ,                                       
                                                             1
                                ๐ท = ๐‘– โˆˆ [๐‘˜] Pr [๐‘– โˆˆ ๐‘†] <         .
                                                ๐‘†โˆˆ๐ถ          2
By Claim 5.19, |๐ท| โ‰ค ๐›ฝ๐‘˜, and clearly also Pr๐‘–โˆผ๐’Ÿ1 [๐‘– โˆˆ ๐ท] โ‰ค ๐›ฝ.
   For every ๐‘– โˆ‰ ๐ท, the index ๐‘– appears in at least half of the sets ๐‘† โˆˆ ๐ถ. This means that for
every such ๐‘–, ๐’Ÿ2 (๐‘–) โ‰ฅ ๐’Ÿ1 (๐‘–)/2 .
   For every ๐‘– โˆˆ [๐‘˜], by the definition of ๐‘”,

                   ๐”ผ [dist( ๐‘“๐‘† (๐‘–), ๐‘”(๐‘–))|๐‘– โˆˆ ๐‘†] โ‰ค            ๐”ผ [dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†2 (๐‘–))|๐‘– โˆˆ ๐‘†1 โˆฉ ๐‘†2 ] .         (5.3)
                   ๐‘†โˆˆ๐ถ                                     ๐‘†1 ,๐‘†2 โˆˆ๐ถ

      Therefore,

             ๐”ผ [ฮ”(๐‘”, ๐‘“๐‘† )] =       ๐”ผ       [dist(๐‘”(๐‘–), ๐‘“๐‘† (๐‘–)|๐‘– โˆˆ ๐‘†]
            ๐‘†โˆˆ๐ถ                ๐‘–โˆผ๐’Ÿ1 ,๐‘†โˆˆ๐ถ
                            โ‰ค Pr [๐‘– โˆˆ ๐ท] +                ๐”ผ     [dist(๐‘”(๐‘–), ๐‘“๐‘† (๐‘–))|๐‘– โˆ‰ ๐ท, ๐‘– โˆˆ ๐‘†]
                               ๐‘–โˆผ๐’Ÿ1                ๐‘–โˆผ๐’Ÿ1 ,๐‘†โˆˆ๐ถ
                            โ‰ค๐›ฝ +           ๐”ผ         [dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†2 (๐‘–))|๐‘– โˆ‰ ๐ท, ๐‘– โˆˆ ๐‘†1 โˆฉ ๐‘†2 ]         (by (5.3))
                                   ๐‘–โˆผ๐’Ÿ1 ,๐‘†1 ,๐‘†2 โˆˆ๐ถ
                            โ‰ค๐›ฝ + 2             ๐”ผ         [dist( ๐‘“๐‘†1 (๐‘–), ๐‘“๐‘†2 (๐‘–))|๐‘– โˆ‰ ๐ท, ๐‘– โˆˆ ๐‘†1 โˆฉ ๐‘†2 ]
                                       ๐‘–โˆผ๐’Ÿ2 ,๐‘†1 ,๐‘†2 โˆˆ๐ถ
                            โ‰ค๐›ฝ + 2 ยท 11๐›ฝ โ‰ค 25๐›ฝ .                                                           (by (5.2))

    To finish the proof, the only thing left is a Markov argument. If ๐”ผ๐‘†โˆˆ๐ถ [ฮ”( ๐‘“๐‘† , ๐‘”)] โ‰ค 25๐›ฝ , then
at least half of the sets ๐‘† โˆˆ ๐ถ satisfies ฮ”( ๐‘“๐‘† , ๐‘”) โ‰ค 50๐›ฝ, and we finish the proof.               

5.4     Global direct product function
Proof of Lemma 5.6. Recall ๐’œ is the set of sets which are successful with respect to our fixed
string ๐‘ฅ. From Lemma 5.4,

                           Pr         [๐ด1 , ๐ด2 โˆˆ ๐’œ and ๐‘” ๐ด1 , ๐‘” ๐ด2 are ๐œ†1 -consistent] โ‰ฅ ๐œ– 5 .
                                 [๐‘˜]
                      ๐ด1 ,๐ด2 โˆˆ( ๐‘˜/10)


                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                      42
                E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

We apply Theorem 5.5 on the family of functions โ„ฑ = {๐‘” ๐ด } ๐ดโˆˆ๐’œ . Let ๐‘” : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be the
global direct product function promised from the theorem. Fix ๐œ†2 = 50๐œ†1 and let ๐’œ โˆ— be
                          ๐’œ โˆ— = {๐ด | ๐ด โˆˆ ๐’œ, ๐‘” ๐ด is ๐œ†2 -consistent with ๐‘”} .
From the theorem, Pr๐ดโˆˆ [๐‘˜] [๐ด โˆˆ ๐’œ โˆ— ] โ‰ฅ ๐œ– 5 /4 .
                         (๐‘˜/10)
   For every ๐‘ง โˆˆ [๐‘] ๐‘˜ , ๐ด โˆˆ ๐’œ โˆ— , let ๐ธ(๐ด, ๐‘ง) be the event
                                         ๐œ†1 ๐‘˜                                   2๐œ†2 ๐‘˜
                            ๐‘“ (๐‘ง)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ง ๐ดยฏ )                and    ๐‘” ๐ด (๐‘ง ๐ดยฏ ) โ‰ˆ ๐‘”(๐‘ง)๐ดยฏ .
For every ๐ด โˆˆ ๐’œ โˆ— , the direct product functions ๐‘” ๐ด , ๐‘” are ๐œ†2 -consistent. By the Chernoff bound
(Fact 2.3), for a uniform input ๐‘ง โˆˆ [๐‘] ๐‘˜ ,
                                                             2๐œ†2 ๐‘˜               ๐œ†2 ๐‘˜
                                             Pr[๐‘” ๐ด (๐‘ง ๐ดยฏ ) 0 ๐‘”(๐‘ง)๐ดยฏ ] โ‰ค eโˆ’ 3 .
                                             ๐‘ง

                                                                 ๐œ†1 ๐‘˜
From Claim 5.8, for every ๐ด โˆˆ ๐’œ, Pr๐‘ง [ ๐‘“ (๐‘ง)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ง ๐ดยฏ )] โ‰ฅ ๐œ–/4 .
   Therefore, for every ๐ด โˆˆ ๐’œ โˆ— ,
                                                  ๐œ†1 ๐‘˜                             2๐œ†2 ๐‘˜         ๐œ–     ๐œ†2 ๐‘˜
              Pr [๐ธ(๐ด, ๐‘ง)] โ‰ฅ Pr[ ๐‘“ (๐‘ง)๐ดยฏ โ‰ˆ ๐‘” ๐ด (๐‘ง ๐ดยฏ )] โˆ’ Pr[๐‘” ๐ด (๐‘ง) 0 ๐‘”(๐‘ง)๐ดยฏ ] โ‰ฅ                  โˆ’ eโˆ’ 3 .
            ๐‘งโˆˆ[๐‘] ๐‘˜               ๐‘ง                                     ๐‘ง                        4
The same bound holds also for a uniform ๐ด โˆˆ ๐’œ โˆ— .
   Let ๐’ต be the set of inputs,
                                                                                     ๐œ–
                                                                                          
                                                             ๐‘˜
                                  ๐’ต = ๐‘ง โˆˆ [๐‘]                       Pr โˆ— [๐ธ(๐ด, ๐‘ง)] โ‰ฅ   .
                                                                   ๐ดโˆˆ๐’œ               8
From averaging,
                                                                            ๐œ–
                             Pr        [๐ธ(๐ด, ๐‘ง)] โ‰ค Pr[๐‘ง โˆˆ ๐’ต] ยท 1 + Pr[๐‘ง โˆ‰ ๐’ต] .
                        ๐‘งโˆˆ[๐‘] ๐‘˜ ,๐ดโˆˆ๐’œ โˆ—              ๐‘ง               ๐‘ง       8
                                      ๐œ†2 ๐‘˜
That is, Pr๐‘ง [๐‘ง โˆˆ ๐’ต] โ‰ฅ ๐œ–/4 โˆ’ eโˆ’ 3 โˆ’ ๐œ–/8 โ‰ฅ ๐œ–/10 . Fix ๐œ†3 = 3/2 (๐œ†1 + 2๐œ†2 ) . We prove that for every
             ๐œ†3 ๐‘˜
๐‘ง โˆˆ ๐’ต , ๐‘“ (๐‘ง) โ‰ˆ ๐‘”(๐‘ง) , which finishes the proof.
    Fix ๐‘ง โˆˆ ๐’ต and let ๐ท โŠ‚ [๐‘˜] be the set
                                             ๐ท = {๐‘– โˆˆ [๐‘˜] | ๐‘“ (๐‘ง)๐‘– โ‰  ๐‘”(๐‘ง)๐‘– } .
                                                  ๐œ†3 ๐‘˜
Assume for a contradiction that ๐‘“ (๐‘ง) 0 ๐‘”(๐‘ง), i. e., |๐ท| > ๐œ†3 ๐‘˜ .
                                                                                                        ๐œ†1 ๐‘˜+2๐œ†2 ๐‘˜
   For each ๐ด โˆˆ ๐’œ โˆ— such that ๐ธ(๐ด, ๐‘ง) happen, by the triangle inequality, ๐‘“ (๐‘ง)๐ดยฏ          โ‰ˆ  ๐‘”(๐‘ง)๐ดยฏ .
This can only happen if ๐ด is such that | ๐ดยฏ โˆฉ ๐ท| โ‰ค ๐œ†1 ๐‘˜ + 2๐œ†2 ๐‘˜ = 2|๐ท|/3 . The set ๐ด is a
uniform subset of [๐‘˜] of size ๐‘˜/10 . By the Hoeffding bound for random subset (Fact 2.4),
                               ๐‘˜                                                       ๐‘˜
Pr๐ด [| ๐ดยฏ โˆฉ ๐ท| โ‰ค 2|๐ท|/3] โ‰ค eโˆ’ 20 ๐œ†3 . We conclude that Pr๐ด [๐ด โˆˆ ๐’œ โˆ— and ๐ธ(๐ด, ๐‘ง)] โ‰ค eโˆ’ 20 ๐œ†3 .
   This contradicts ๐‘ง โˆˆ ๐’ต , because for ๐‘ง โˆˆ ๐’ต ,
                                                                                                 1 5 ๐œ–
              Pr[๐ด โˆˆ ๐’œ โˆ— and ๐ธ(๐ด, ๐‘ง)] โ‰ฅ Pr[๐ด โˆˆ ๐’œ โˆ— ] Pr[๐ธ(๐ด, ๐‘ง)|๐ด โˆˆ ๐’œ โˆ— ] โ‰ฅ                        ๐œ– ยท .             
               ๐ด                                         ๐ด               ๐ด                       4    8

                      T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                           43
                                    I RIT D INUR AND I NBAL L IVNI NAVON

6     Lower bounds for approximate equality
In this section we prove lower bounds for different variants of the direct product test. The lower
bounds are proven by finding a function that passes the test with some probability ๐œ–, but is far
from any direct product function.
    We start by defining when a function is far from any direct product function.
Definition 6.1. Two functions ๐‘“1 , ๐‘“2 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ are (๐œ–, ๐œ†) close, if
                                                                    
                                                            ๐œ†๐‘˜
                                           Pr          ๐‘“1 (๐‘ฅ) โ‰ˆ ๐‘“2 (๐‘ฅ) โ‰ฅ ๐œ– .
                                         ๐‘ฅโˆˆ[๐‘] ๐‘˜

A function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ is (๐œ–, ๐œ†) close to a direct product function if there are functions
๐‘”1 , . . . , ๐‘” ๐‘˜ : [๐‘] โ†’ [๐‘€] such that (๐‘”1 , . . . , ๐‘” ๐‘˜ ) is (๐œ–, ๐œ†) close to ๐‘“ . Otherwise, ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ is
(๐œ–, ๐œ†) far from any direct product function.
   Our direct product theorem states that if a function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ passes Test 1 with
๐‘ก = ๐‘˜/10 with probability ๐œ– > eโˆ’๐‘๐œ† ๐‘˜ , then ๐‘“ is (๐œ–/10, ๐œ†) close to a direct product function.
                                     2


Ideally, we want the even stronger conclusion that ๐‘“ is (ฮฉ(๐œ–), 0) close to a direct product function.
However, we next show that this is not possible.
Claim 6.2. For every ๐‘ โˆˆ โ„• and large enough ๐‘˜, the following holds. Let ๐‘“ : [๐‘] ๐‘˜ โ†’ {0, 1} ๐‘˜ be a
random function, i. e., such that ๐‘“ (๐‘ฅ) is a uniformly chosen string in [๐‘€] ๐‘˜ for each ๐‘ฅ independently.
With high probability, ๐‘“ is (2eโˆ’๐‘˜/10 , ๐‘˜/10) far from any direct product function.
Proof. Fix a direct product function ๐‘” : [๐‘] ๐‘˜ โ†’ {0, 1} ๐‘˜ . For every ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , by the Chernoff
                    ๐‘˜/10                                                       ๐‘˜/10
bound, Pr ๐‘“ [ ๐‘“ (๐‘ฅ) โ‰ˆ ๐‘”(๐‘ฅ)] โ‰ค eโˆ’๐‘˜/10 . The probability that ๐‘“ (๐‘ฅ) โ‰ˆ ๐‘”(๐‘ฅ) on more than 2eโˆ’๐‘˜/10 of
                                        1 ๐‘˜ โˆ’๐‘˜/10      1 ๐‘ ๐‘˜
the inputs ๐‘ฅ โˆˆ [๐‘] ๐‘˜ is smaller than eโˆ’ 3 ๐‘ ยทe    โ‰ค eโˆ’ 3 ( 2 ) .
   There are 2๐‘ ๐‘˜ different direct product functions ๐‘” : [๐‘] ๐‘˜ โ†’ {0, 1} ๐‘˜ . By union bound, with
                                 1 ๐‘ ๐‘˜
probability at least 1 โˆ’ 2๐‘ ๐‘˜ eโˆ’ 3 ( 2 ) , the random function ๐‘“ is (2eโˆ’๐‘˜/10 , ๐‘˜/10) far from any direct
product function.                                                                                              

6.1   Testing different intersection sizes.
We next analyze a family of tests, parameterized by ๐‘ก1 , ๐‘ก2 โˆˆ [๐‘˜], that generalize our basic ๐‘-test
and appear as Test 5. We show that there is no direct product testing theorem for these tests,
with (ฮฉ(๐œ–), 0) closeness, for an exponentially small ๐œ–.
Claim 6.3. For every constant ๐›ฟ > 0, large enough ๐‘˜, ๐‘ , ๐‘€ โˆˆ โ„• such that ๐‘ โ‰ฅ ๐‘€ โ‰ฅ ๐‘˜ 12 and every
๐‘ก1 , ๐‘ก2 โˆˆ [๐‘˜] such that ๐‘ก1 + ๐‘ก2 โ‰ค ๐‘˜, there exists a constant ๐›ฝ > 0 and a function ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ , such
                                                     ๐›ฝ
that agr๐‘ก๐‘1 ,๐‘ก2 ( ๐‘“ ) = ๐œ– โ‰ฅ eโˆ’๐›ฟ๐‘˜ , but ๐‘“ is (๐œ– 2 , log ๐‘˜ ) far from any direct product function.

Proof. Let ๐›ฝ be a constant that will be determined later, and denote โ„“ = log ๐‘˜ . Let โ„Ž : [๐‘] โ†’
                                                                                         2๐›ฝ๐‘˜

[๐‘€] \ {1} be any function satisfying: for every ๐‘Ž โˆˆ [๐‘€] \ {1}, Pr๐‘โˆˆ[๐‘] [โ„Ž(๐‘) = ๐‘Ž] โ‰ค 2/๐‘€ .

                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                               44
                  E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                            Test 5: Z-test with parameters ๐‘ก1 , ๐‘ก2 (3-query test)

   1. Choose ๐ด, ๐ต, ๐ถ to be a random partition of [๐‘˜],                                   ๐ด                ๐ถ           ๐ต
      such that |๐ด| = ๐‘ก1 , |๐ต| = ๐‘ก2 .
                                                                             ๐‘ฅ
   2. Choose uniformly at random ๐‘ฅ, ๐‘ฆ, ๐‘ง โˆˆ [๐‘] ๐‘˜ such                        ๐‘ฆ
       that ๐‘ฅ ๐ด = ๐‘ฆ๐ด and ๐‘ฆ๐ต = ๐‘ง ๐ต .
                                                                             ๐‘ง
   3. Accept if ๐‘“ (๐‘ฅ)๐ด = ๐‘“ (๐‘ฆ)๐ด and ๐‘“ (๐‘ง)๐ต = ๐‘“ (๐‘ฆ)๐ต .
Denote by agr๐‘ก๐‘1 ,๐‘ก2 ( ๐‘“ ) the success probability of ๐‘“ on this test.


   Let ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ be the following function: for every ๐‘ฅ โˆˆ [๐‘] ๐‘˜ let ๐‘–1 , . . . , ๐‘–โ„“ , ๐‘—1 , . . . , ๐‘—โ„“ โˆˆ [๐‘˜]
be different random coordinates.
                                                  (
                                                      โ„Ž(๐‘ฅ ๐‘—๐‘Ÿ )       if ๐‘– = ๐‘– ๐‘Ÿ for some ๐‘Ÿ โˆˆ [โ„“ ]
                         โˆ€๐‘– โˆˆ [๐‘˜],     ๐‘“ (๐‘ฅ)๐‘– =
                                                      1              otherwise.

The function ๐‘“ has โ„“ random โ€œcorruptedโ€ coordinates per input, ๐‘–1 , . . . , ๐‘–โ„“ , in which ๐‘“ (๐‘ฅ)๐‘– ๐‘Ÿ is
determined by the value of ๐‘ฅ ๐‘—๐‘Ÿ .
   We analyze the success probability of Test 5 with parameters ๐‘ก1 , ๐‘ก2 on ๐‘“ . We divide into two
cases.
   1. In case max{๐‘ก1 , ๐‘ก2 } โ‰ค 0.4๐‘˜. Let ๐‘ฅ, ๐‘ฆ, ๐‘ง, ๐ด, ๐ต be the sets and strings chosen by the test. Then
                                                                                                          ๐‘ฆ
      |๐ด โˆช ๐ต| โ‰ค 0.8๐‘˜. Let ๐‘–1๐‘ฅ , . . . , ๐‘–โ„“๐‘ฅ be the corrupted coordinates of ๐‘ฅ (and ๐‘– ๐‘Ÿ , ๐‘– ๐‘Ÿ๐‘ง for ๐‘ฆ, ๐‘ง). If
                           ๐‘ฆ            ๐‘ฆ
      ๐‘–1๐‘ฅ , . . . , ๐‘–โ„“๐‘ฅ , ๐‘–1 , . . . , ๐‘–โ„“ , ๐‘–1๐‘ง , . . . , ๐‘–โ„“๐‘ง โˆ‰ ๐ด โˆช ๐ต, the test โ€œmissesโ€ all of the corrupted coordinates,
      so the test passes.

           Pr[๐‘–1๐‘ฅ , . . . ๐‘–โ„“๐‘ฅ โˆ‰ ๐ด โˆช ๐ต] = Pr[๐‘–1๐‘ฅ โˆ‰ ๐ด โˆช ๐ต] ยท ยท ยท Pr[๐‘–โ„“๐‘ฅ โˆ‰ ๐ด โˆช ๐ต|๐‘–1๐‘ฅ . . . , ๐‘–โ„“๐‘ฅโˆ’1 โˆ‰ ๐ด โˆช ๐ต] โ‰ฅ (0.1)โ„“ ,
            ๐‘“                            ๐‘“                       ๐‘“

       where the last inequality is because |๐ด โˆช ๐ต| โ‰ค 0.8๐‘˜ and โ„“ < 0.1๐‘˜. Therefore, even
       conditioning on ๐‘–1๐‘ฅ . . . , ๐‘–โ„“๐‘ฅโˆ’1 โˆ‰ ๐ด โˆช ๐ต, the probability of ๐‘–โ„“๐‘ฅ โˆ‰ ๐ด โˆช ๐ต is at least 0.1. The same
       inequality holds also for ๐‘ฆ and ๐‘ง, and we get that ๐‘“ passes Test 5 with probability at least
       (0.1)3โ„“ .
   2. In case max{๐‘ก1 , ๐‘ก2 } > 0.4๐‘˜. The test is symmetric with respect to ๐‘ก1 , ๐‘ก2 , so we can assume
      w.l.o.g. that ๐‘ก1 โ‰ฅ ๐‘ก2 . Let ๐‘ฅ, ๐‘ฆ, ๐‘ง, ๐ด, ๐ต be the sets and strings chosen by the test. Let
      ๐‘–1๐‘ฅ , . . . , ๐‘–โ„“๐‘ฅ and ๐‘—1๐‘ฅ , . . . , ๐‘—โ„“๐‘ฅ be the chosen coordinates of ๐‘ฅ, and the same for ๐‘ฆ and ๐‘ง. If for all
                           ๐‘ฆ                   ๐‘ฆ
      ๐‘Ÿ โˆˆ [โ„“ ], ๐‘– ๐‘Ÿ๐‘ฅ = ๐‘– ๐‘Ÿ and ๐‘—๐‘Ÿ๐‘ฅ = ๐‘—๐‘Ÿ and also ๐‘–1๐‘ฅ , . . . , ๐‘–โ„“๐‘ฅ โˆˆ ๐ด and ๐‘—1๐‘ฅ , . . . , ๐‘—๐‘Ÿ๐‘ฅ โˆˆ ๐ด, then the corrupted
      coordinates of ๐‘ฅ and ๐‘ฆ are corrupted to the same value. If in addition ๐‘–1๐‘ง , . . . , ๐‘–โ„“๐‘ง โˆˆ ๐ด, then
      the corrupted coordinates of ๐‘ง are not checked, and the test passes. We lower bound the
      probability of these events.
                                                                                                      2โ„“
                                            ๐‘ฆ            ๐‘ฆ    1  1          1                        1
                     Pr[โˆ€๐‘Ÿ โˆˆ [โ„“ ], ๐‘– ๐‘Ÿ๐‘ฅ = ๐‘– ๐‘Ÿ and ๐‘—๐‘Ÿ๐‘ฅ = ๐‘—๐‘Ÿ ] = ยท    ยทยทยท            โ‰ฅ                         .
                      ๐‘“                                       ๐‘˜ ๐‘˜โˆ’1     ๐‘˜ โˆ’ 2โ„“ + 1                   ๐‘˜

                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                           45
                                          I RIT D INUR AND I NBAL L IVNI NAVON

                                                               ๐‘ฆ                                                 ๐‘ฆ
      This is because the probability of ๐‘–1๐‘ฅ = ๐‘–1 is 1๐‘˜ , and the probability of ๐‘–2๐‘ฅ = ๐‘–2 given that
             ๐‘ฆ
      ๐‘–1๐‘ฅ = ๐‘–1 is 1/(๐‘˜ โˆ’ 1) , and so forth.

                                            Pr[๐‘–1๐‘ฅ , . . . , ๐‘–โ„“๐‘ฅ โˆˆ ๐ด and ๐‘—1๐‘ฅ , . . . ๐‘—โ„“๐‘ฅ โˆˆ ๐ด]
                                             ๐‘“


                       = Pr[๐‘–1๐‘ฅ โˆˆ ๐ด] ยท ยท ยท Pr[๐‘—โ„“๐‘ฅ โˆˆ ๐ด|๐‘–1๐‘ฅ , . . . , ๐‘–โ„“๐‘ฅ , ๐‘—1๐‘ฅ , . . . , ๐‘—โ„“๐‘ฅโˆ’1 โˆˆ ๐ด] โ‰ฅ (0.3)2โ„“ ,
                           ๐‘“                     ๐‘“

      where the last inequality is because |๐ด| โ‰ฅ 0.4๐‘˜, and โ„“ < 0.05๐‘˜. Therefore, ๐‘“ passes the
      test with probability at least (1/๐‘˜)2โ„“ ยท (0.3)2โ„“ ยท (0.3)2โ„“ . We pick the constant ๐›ฝ such that
      โ„“ = 2๐›ฝ๐‘˜/(log ๐‘˜) satisfies (1/๐‘˜)2โ„“ ยท (0.3)4โ„“ โ‰ฅ eโˆ’๐›ฟ๐‘˜ .

   We prove next that ๐‘“ is (๐œ– 2 , ๐›ฝ/(log ๐‘˜)) far from any direct product function. For every
๐‘† โŠ‚ [๐‘˜], |๐‘†| = โ„“2 , ๐‘ค โˆˆ [๐‘]๐‘† and ๐›พ โˆˆ ([๐‘€] \ {1})๐‘† , let ๐’ฎ๐‘†,๐‘ค,๐›พ = ๐‘ฅ โˆˆ [๐‘] ๐‘˜ ๐‘ฅ ๐‘† = ๐‘ค, ๐‘“ (๐‘ฅ)๐‘† = ๐›พ .
                                                                

   We say that ๐‘“ is balanced if for every ๐‘†, ๐‘ค, ๐›พ,

                                                                                       โ„“2
                                                                     2๐‘˜
                                           Pr[๐‘ฅ โˆˆ ๐’ฎ๐‘†,๐‘ค,๐›พ |๐‘ฅ ๐‘† = ๐‘ค] โ‰ค                          .
                                            ๐‘ฅ                        ๐‘€

     We prove that ๐‘“ is balanced. Fix any ๐‘†, ๐‘ค and ๐›พ. For every ๐‘ฅ, ๐‘“ (๐‘ฅ)๐‘† = ๐›พ only if for every
๐‘– โˆˆ ๐‘†, ๐‘“ (๐‘ฅ)๐‘– is chosen to be corrupted to some โ„Ž(๐‘ฅ ๐‘— ) = ๐›พ๐‘– . If there is no ๐‘— such that โ„Ž(๐‘ฅ ๐‘— ) = ๐›พ๐‘– ,
it is not possible that ๐‘“ (๐‘ฅ)๐‘† = ๐›พ. For each ๐›พ๐‘– , the probability over ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , ๐‘ฅ ๐‘† = ๐‘ค that ๐‘ฅ ๐‘†ยฏ
contains a coordinate ๐‘— such that โ„Ž(๐‘ฅ ๐‘— ) = ๐›พ๐‘– is smaller than 2๐‘˜/๐‘€ . Therefore, the probability
over ๐‘ฅ that there are โ„“2 different coordinates ๐‘—1 , . . . , ๐‘— โ„“ โˆˆ ๐‘†ยฏ such that for all ๐‘–, โ„Ž(๐‘ฅ ๐‘—๐‘– ) = ๐›พ๐‘– is
                                                                           2
                   โ„“
less than (2๐‘˜/๐‘€) (if ๐›พ๐‘– = ๐›พ๐‘Ÿ , then ๐‘ฅ needs to contain two different coordinates ๐‘—๐‘– , ๐‘—๐‘Ÿ such
                   2

that โ„Ž(๐‘ฅ ๐‘—๐‘– ) = โ„Ž(๐‘ฅ ๐‘—๐‘Ÿ ) = ๐›พ๐‘– ). From this we deduce that for every ๐‘† โŠ‚ [๐‘˜], |๐‘†| = โ„“2 , ๐‘ค โˆˆ [๐‘]๐‘† ,
                                             โ„“
Pr๐‘ฅ [๐‘ฅ โˆˆ ๐’ฎ๐‘†,๐‘ค,๐›พ |๐‘ฅ ๐‘† = ๐‘ค] โ‰ค (2๐‘˜/๐‘€) 2 , and ๐‘“ is balanced.
    We prove that a balanced function ๐‘“ is far from any direct product function. Fix a direct
                                                                                                  โ„“ /2
product function ๐‘” : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ , and let ๐น = ๐‘ฅ โˆˆ [๐‘] ๐‘˜                         ๐‘“ (๐‘ฅ) โ‰ˆ ๐‘”(๐‘ฅ) . For every ๐‘ฅ โˆˆ ๐น, ๐‘“ (๐‘ฅ)
and ๐‘”(๐‘ฅ) are equal on at least โ„“ /2 โ€œcorruptedโ€ coordinates, i. e., for every ๐‘ฅ โˆˆ ๐น there exists a set
๐‘† โŠ‚ [๐‘˜], |๐‘†| = โ„“ /2 such that ๐‘“ (๐‘ฅ)๐‘† = ๐‘”(๐‘ฅ)๐‘† โˆˆ ([๐‘€] \ {1})๐‘† .
   For every ๐‘† โŠ‚ [๐‘˜], |๐‘†| = โ„“2 and ๐‘ค โˆˆ [๐‘]๐‘† let
                                    n                                                                    o
                        ๐น๐‘†,๐‘ค = ๐‘ฅ โˆˆ ๐น             ๐‘ฅ ๐‘† = ๐‘ค, ๐‘“ (๐‘ฅ)๐‘† = ๐‘”(๐‘ฅ)๐‘† โˆˆ ([๐‘€] \ {1})๐‘† .

From above, ๐น โŠ‚ โˆช๐‘†,๐‘ค ๐น๐‘†,๐‘ค . The function ๐‘” is a direct product function, so for every ๐‘† and ๐‘ค
there is a single ๐›พ such that ๐‘”(๐‘ฅ)๐‘† = ๐›พ for all ๐‘ฅ such that ๐‘ฅ ๐‘† = ๐‘ค. That is, ๐น๐‘†,๐‘ค โŠ‚ ๐’ฎ๐‘†,๐‘ค,๐›พ for some
๐›พ โˆˆ ([๐‘€] \ {1})๐‘† . Together we get that |๐น| โ‰ค ๐‘†,๐‘ค |๐น๐‘†,๐‘ค | โ‰ค ๐‘˜โ„“ ยท (2๐‘˜/๐‘€)โ„“ /2 ๐‘ ๐‘˜ . Since ๐‘€, ๐‘ โ‰ฅ ๐‘˜ 12
                                                ร                
                                                                                   2
                                ๐‘˜
we get that Pr๐‘ฅ [๐‘ฅ โˆˆ ๐น] โ‰ค       โ„“       (2๐‘˜/๐‘€)โ„“ /2 โ‰ค (2/๐‘˜)5โ„“ โ‰ค ๐œ– 2 .                                                  
                                2



                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                        46
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

6.2   The triangle test for functions over sets.
In Test 5 with ๐‘ก1 + ๐‘ก2 = ๐‘˜, we check ๐‘“ (๐‘ฆ) on all coordinates, but only part of the coordinates of
 ๐‘“ (๐‘ฅ), ๐‘“ (๐‘ง). What if we check all coordinates of all three inputs? This brings us to the triangle
test, Test 6, for functions over sets. In this test, every two out of the three inputs in the test share
a joint subset of size 2๐‘˜ . For this test we must assume that ๐‘˜ is even.
     We remark that Test 5 can only be defined on a function ๐‘“ : [๐‘]             โ†’ [๐‘€] ๐‘˜ , and it is not
                                                                               
                                                                             ๐‘˜
possible to define such test on a function on tuples. This is because for ๐‘“ : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ ,
if we choose inputs ๐‘ฅ, ๐‘ฆ, ๐‘ง such that ๐‘ฅ ๐ด = ๐‘ฆ๐ด , ๐‘ฆ๐ต = ๐‘ง ๐ต , it is not possible to compare ๐‘“ (๐‘ฅ)๐ต
to ๐‘“ (๐‘ง)๐ด , since these are different coordinates. We remark that it is possible to define a 4-
query test on functions over tuples, similar to the triangle test, with inputs ๐‘ฅ, ๐‘ฆ, ๐‘ง, ๐‘ค such that
๐‘ฅ ๐ด = ๐‘ฆ๐ด , ๐‘ง ๐ด = ๐‘ค ๐ด , ๐‘ฅ ๐ต = ๐‘ง ๐ต , ๐‘ฆ๐ต = ๐‘ค ๐ต , but we do not analyze it here.
     We define distance from a direct product function in a similar way to functions over tuples.
Definition 6.4. A function ๐‘“ : [๐‘] โ†’ [๐‘€] ๐‘˜ is (๐œ–, ๐œ†) far from any direct product function, if for
                                        
                                ๐‘˜
every ๐‘” : [๐‘] โ†’ [๐‘€],
                                                          ๐œ†๐‘˜
                                              Pr [ ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†)] โ‰ค ๐œ–.
                                            ๐‘†โˆˆ([๐‘]
                                                ๐‘˜ )



                             Test 6: Triangle test (3-query test, for even ๐‘˜)


   1. Choose disjoint ๐‘Š , ๐‘‹ , ๐‘Œ โŠ‚ [๐‘] of size 2๐‘˜ .
                                                                                        ๐‘Š       ๐‘Œ
   2. Accept if ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š , ๐‘“ (๐‘‹ โˆช ๐‘Œ)๐‘Œ =
      ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ and ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘‹ = (๐‘‹ โˆช ๐‘Œ)๐‘‹ .                                                ๐‘‹


Denote by agrฮ” ( ๐‘“ ) the success probability of ๐‘“ on this test.

Claim 6.5. For every constant ๐›ฟ > 0, large enough ๐‘˜, ๐‘ , ๐‘€ โˆˆ โ„• such that ๐‘ โ‰ฅ ๐‘€ โ‰ฅ ๐‘˜ 30 there exists a
                                                                                                      ๐›ฝ
constant ๐›ฝ > 0 and a function ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ , such that agrฮ” ( ๐‘“ ) = ๐œ– > eโˆ’๐›ฟ๐‘˜ , and ๐‘“ is (๐œ– 2 , log ๐‘˜ ) far
                                      
                                   ๐‘˜
from any direct product function.
Proof. We prove the claim by constructing a function ๐‘“ that passes the test but is far from any
direct product function.
    Let ๐›ฝ > 0 be a constant that will be decided later, and let โ„“ = ๐›ฝ๐‘˜/(log ๐‘˜) . We describe a
function ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ with 2โ„“ โ€œcorruptedโ€ elements per input. Let โ„Ž : [๐‘] โ†’ [๐‘€] \ {1} be
                 
              ๐‘˜
an arbitrary function such that for every ๐›พ โˆˆ [๐‘€] \ {1}, Pr๐‘โˆˆ[๐‘] [โ„Ž(๐‘) = ๐›พ] โ‰ค 2/๐‘€ . For every
๐‘† โˆˆ [๐‘]   we pick 2โ„“ elements to corrupt ๐‘“ on ๐‘Ž 1 , . . . , ๐‘Ž 2โ„“ and 2โ„“ index elements ๐‘1 , . . . , ๐‘ 2โ„“ โˆˆ ๐‘†.
        
      ๐‘˜
The function ๐‘“ is defined by:
                                                (
                                                    โ„Ž(๐‘ ๐‘– ) if ๐‘’ = ๐‘Ž ๐‘– for some ๐‘– โˆˆ [2โ„“ ]
                         โˆ€๐‘’ โˆˆ ๐‘†,     ๐‘“ (๐‘†)๐‘’ =
                                                    1       otherwise.

                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                47
                                      I RIT D INUR AND I NBAL L IVNI NAVON

                                Figure 2: The set ๐‘‹ โˆช ๐‘Œ is marked in gray.




                                                      ๐‘Ž๐‘Š       ๐‘Ž๐‘Œ
                                                    ๐‘Š          ๐‘Œ
                                                    ๐‘๐‘Š               ๐‘๐‘Œ
                                                           ๐‘‹
                                                      ๐‘Ž๐‘‹        ๐‘๐‘‹


    We analyze the success probability of the test. Let ๐‘Š , ๐‘‹ , ๐‘Œ be the sets chosen by the test
algorithm. Let ๐‘Ž 1๐‘‹ , . . . , ๐‘Žโ„“๐‘‹ , ๐‘1๐‘‹ , . . . , ๐‘โ„“๐‘‹ โˆˆ ๐‘‹ be arbitrary 2โ„“ elements in ๐‘‹, and the same for ๐‘Œ, ๐‘Š.
If ๐‘“ is such that

    1. In ๐‘“ (๐‘Š โˆช ๐‘‹), the corrupted elements are ๐‘Ž 1๐‘‹ , . . . , ๐‘Žโ„“๐‘‹ and ๐‘Ž1๐‘Š , . . . , ๐‘Žโ„“๐‘Š , and the index
       elements are ๐‘1๐‘‹ , . . . , ๐‘โ„“๐‘‹ and ๐‘1๐‘Š , . . . , ๐‘โ„“๐‘Š .

    2. In ๐‘“ (๐‘‹ โˆช ๐‘Œ), the corrupted elements are ๐‘Ž 1๐‘‹ , . . . , ๐‘Žโ„“๐‘‹ and ๐‘Ž 1๐‘Œ , . . . , ๐‘Žโ„“๐‘Œ , and the index elements
       are ๐‘ 1๐‘‹ , . . . , ๐‘โ„“๐‘‹ and ๐‘ 1๐‘Œ , . . . , ๐‘โ„“๐‘Œ .

    3. In ๐‘“ (๐‘Š โˆช๐‘Œ), the corrupted elements are ๐‘Ž 1๐‘Š , . . . , ๐‘Žโ„“๐‘Š and ๐‘Ž 1๐‘Œ , . . . , ๐‘Žโ„“๐‘Œ , and the index elements
       are ๐‘ 1๐‘Š , . . . , ๐‘โ„“๐‘Š and ๐‘1๐‘Œ , . . . , ๐‘โ„“๐‘Œ .

Then the corrupted elements are corrupted to the same value on all three queries ๐‘“ (๐‘‹ โˆช๐‘Š), ๐‘“ (๐‘‹ โˆช
๐‘Œ) and ๐‘“ (๐‘Œ โˆช ๐‘Š) and the test passes. See Figure 2 for an illustration (with โ„“ = 1).
    The probability that in ๐‘“ (๐‘‹ โˆช ๐‘Š), the 2โ„“ corrupted elements are ๐‘Ž 1๐‘‹ , . . . , ๐‘Žโ„“๐‘‹ and ๐‘Ž 1๐‘Š , . . . , ๐‘Žโ„“๐‘Š
and the index elements are ๐‘1๐‘‹ , . . . , ๐‘โ„“๐‘‹ and ๐‘1๐‘Š , . . . , ๐‘โ„“๐‘Š is larger than ๐‘˜14โ„“ . Therefore, ๐‘“ satisfies
                                                                                                ๐›ฝ๐‘˜
agrฮ” ( ๐‘“ ) โ‰ฅ ๐‘˜ 12โ„“
               1
                   . We choose the constant ๐›ฝ to be small enough such that for โ„“ = log ๐‘˜ , agrฮ” ( ๐‘“ ) โ‰ฅ
  1
๐‘˜ 12โ„“
        โ‰ฅ eโˆ’๐›ฟ๐‘˜ .
                                  ๐›ฝ
        We prove that ๐‘“ is (๐œ– 2 , log ๐‘˜ )-far from any direct product function. For every ๐ฟ โŠ‚ [๐‘], |๐ฟ| = โ„“
                                        n                                      o
and ๐›พ โˆˆ ([๐‘€] \ {1})๐ฟ , let ๐’ฎ๐ฟ,๐›พ = ๐‘† โˆˆ          [๐‘]
                                                ๐‘˜
                                                       ๐ฟ โŠ‚ ๐‘†, ๐‘“ (๐‘†)๐ฟ = ๐›พ .
   We say that the function ๐‘“ :             [๐‘]
                                             ๐‘˜
                                                   โ†’ [๐‘€] ๐‘˜ is balanced if for every ๐ฟ โŠ‚ [๐‘], |๐ฟ| = โ„“ and
๐›พ โˆˆ ([๐‘€] \ {1})๐ฟ ,
                                                                         โ„“
                                                              4๐‘˜
                                        Pr[๐‘† โˆˆ ๐’ฎ๐ฟ,๐›พ |๐ฟ โŠ‚ ๐‘†] โ‰ค                  .
                                        ๐‘†                     ๐‘€
    We claim that ๐‘“ is balanced. Fix ๐ฟ and ๐›พ, a set ๐‘† โˆˆ ๐’ฎ๐ฟ,๐›พ if for every ๐‘Ž โˆˆ ๐ฟ, ๐‘“ (๐‘†)๐‘Ž is corrupted
to โ„Ž(๐‘) = ๐›พ๐‘Ž , if ๐‘† doesnโ€™t contain ๐‘ such that โ„Ž(๐‘) = ๐›พ๐‘Ž then its not possible that ๐‘“ (๐‘†)๐‘Ž = ๐›พ๐‘Ž . For
every ๐›พ๐‘Ž , the probability of ๐‘† โŠ‚ [๐‘], ๐ฟ โŠ‚ ๐‘† to be such that ๐‘† \ ๐ฟ contains a coordinate ๐‘ satisfying
                          ๐‘
โ„Ž(๐‘) = ๐›พ๐‘Ž is at most 2๐‘˜
                      ๐‘€ ๐‘โˆ’โ„“ (the requirement that ๐‘ โˆ‰ ๐ฟ can increase the probability of โ„Ž(๐‘) = ๐›พ๐‘Ž


                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                 48
                 E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

                        ๐‘
by a factor of at most ๐‘โˆ’โ„“ < 2). The probability that ๐‘† \ ๐ฟ contains โ„“ elements ๐‘ 1 , . . . , ๐‘โ„“ such
                                                                                                  โ„“        โ„“
                                                                                             ๐‘
that for all ๐‘Ž there is a different ๐‘ ๐‘Ž satisfying โ„Ž(๐‘ ๐‘Ž ) = ๐›พ๐‘Ž is at most              ๐‘€ ยท ๐‘โˆ’2โ„“
                                                                                        2๐‘˜
                                                                                                        โ‰ค   4๐‘˜
                                                                                                            ๐‘€        , so the
                                    ๐‘
function ๐‘“ is balanced (the factor ๐‘โˆ’2โ„“ is because we require that the ๐‘ ๐‘– โˆ‰ ๐ฟ, and are different).
    We prove that a balanced ๐‘“ is far from every direct product function. Fix a direct product
                                                                                โ„“
                                                         n                                  o
                                                                 [๐‘]
function ๐‘” : [๐‘] โ†’ [๐‘€], and let ๐น be the set ๐น = ๐‘† โˆˆ              ๐‘˜
                                                                         ๐‘“ (๐‘†) โ‰ˆ ๐‘”(๐‘†) . For every ๐‘† โˆˆ ๐น, there
is a set ๐ฟ โŠ‚ ๐‘† of size โ„“ such that for every ๐‘Ž โˆˆ ๐ฟ, ๐‘“ (๐‘†)๐‘Ž = ๐‘”(๐‘Ž) โ‰  1. Therefore, ๐น โŠ‚ โˆช๐ฟโˆˆ([๐‘]) ๐’ฎ๐ฟ,๐‘”(๐ฟ) ,
                                                                                                                 โ„“
and ๐‘”(๐ฟ) is different from 1 on all elements. This implies an upper bound on |๐น|,
                                                              โ„“                   โ„“  
                                                  ๐‘                  ๐‘ โˆ’โ„“                   ๐‘
                               ร•                                        
                                                         4๐‘˜                 4๐‘˜
                       |๐น| โ‰ค         |๐’ฎ๐ฟ,๐‘”(๐ฟ) | โ‰ค                         โ‰ค                   .
                                                  โ„“      ๐‘€           ๐‘˜ โˆ’โ„“   ๐‘€               ๐‘˜
                             ๐ฟโˆˆ([๐‘]
                                 โ„“ )


For our choice of parameters ๐‘ , ๐‘€ โ‰ฅ ๐‘˜ 30 and ๐‘“ is (๐œ– 2 , โ„“๐‘˜ ) far from any direct product function.                       

A     Tuples to sets restricted global structure proof
In this section we prove Lemma 4.4, restricted global structure for sets, which we restate below.
Lemma A.1 (Lemma 4.4, restated). There exists a small constant ๐‘ > 0, such that for every constant
๐›ผ > 0, large enough ๐‘˜ โˆˆ โ„• and ๐‘ > e๐‘๐œ†๐‘˜ , ๐‘€ โˆˆ โ„• , the following holds.
    For every function ๐‘“ : [๐‘]   โ†’ [๐‘€] ๐‘˜ , if agr๐‘๐‘˜/10
                                                   ๐‘ ๐‘’๐‘ก
                                                       ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐›ผ๐‘˜ , then at least (1 โˆ’ ๐œ– 2 โˆ’ ๐‘˜ 2 /๐‘) of
                               
                            ๐‘˜
the good pairs ๐‘Š , ๐‘‹ are ๐›ผ-DP pairs.
   The restricted global structure only uses the first two queries of the test. For convenience, we
rewrite the test such that the two checks are not preformed in the same step.

                  Test 7: Z-test for functions over sets, with ๐‘ก = ๐‘˜/10 (3-query test)

    1. Choose a random set ๐‘Š โŠ‚ [๐‘] of size ๐‘˜/10 .
                                                                                        ๐‘‹               ๐‘Š
    2. Choose ๐‘‹ , ๐‘Œ โŠ‚ [๐‘] \ ๐‘Š of size 9๐‘˜/10 .

    3. If ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š โ‰  ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š reject.
                                                                                                   ๐‘Œ        ๐‘‰
    4. Choose ๐‘‰ โŠ‚ [๐‘] \ ๐‘Œ of size ๐‘˜/10 .

    5. If ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ โ‰  ๐‘“ (๐‘Œ โˆช ๐‘‰)๐‘Œ reject, else accept.
Denote by agr๐‘๐‘˜/10
               ๐‘ ๐‘’๐‘ก
                   ( ๐‘“ ) the success probability of ๐‘“ on this test.

    We prove the lemma by a reduction from Theorem 3.9.
Definition A.2. We associate each ๐‘† โŠ‚ [๐‘] with the tuple ๐‘†ยฎ โˆˆ [๐‘]|๐‘†| obtained by sorting the
elements of ๐‘† in increasing order. For every string ๐‘ฅ โˆˆ [๐‘] ๐‘˜ , we define ๐‘ˆ(๐‘ฅ) = 1 if ๐‘ฅ has distinct
coordinates, i. e., there is no ๐‘– โ‰  ๐‘— such that ๐‘ฅ ๐‘– = ๐‘ฅ ๐‘— , else ๐‘ˆ(๐‘ฅ) = 0.

                        T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                              49
                                       I RIT D INUR AND I NBAL L IVNI NAVON

    For a string ๐‘  = (๐‘  1 , . . . , ๐‘  ๐‘˜ ) and a permutation ๐œ‹ : [๐‘˜] โ†’ [๐‘˜] let ๐‘  ๐œ‹ = (๐‘  ๐œ‹(1) , . . . , ๐‘  ๐œ‹(๐‘˜) ).

Definition A.3. Given a function ๐‘“ :              [๐‘]
                                                   ๐‘˜
                                                       โ†’ [๐‘€] ๐‘˜ , let ๐‘“ 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ โˆช โŠฅ be defined as
follows. If ๐‘ˆ(๐‘ฅ) = 0 we set ๐‘“ 0(๐‘ฅ) = โŠฅ. If ๐‘ˆ(๐‘ฅ) = 1 then if ๐‘ฅ = ๐‘‹    ยฎ (namely ๐‘ฅ 1 < ๐‘ฅ 2 < ยท ยท ยท < ๐‘ฅ ๐‘˜ )
we let ๐‘“ (๐‘ฅ) = ๐‘“ (๐‘‹). Otherwise there is some permutation ๐œ‹ such that ๐‘ฅ = (๐‘‹)       ยฎ ๐œ‹ and we let
            ยฎ ๐œ‹ . We call ๐œ‹ the sorting permutation for the tuple ๐‘ฅ.
๐‘“ 0(๐‘ฅ) = ๐‘“ (๐‘‹)
   When testing the function ๐‘“ 0 , whenever the tester queries an input ๐‘ฅ such that ๐‘“ 0(๐‘ฅ) = โŠฅ, we
assume the tester rejects.
                               [๐‘]     [๐‘]     [๐‘] 
Definition A.4. Let ๐’Ÿ :        ๐‘˜/10
                                     ร— 9๐‘˜/10  ร— 9๐‘˜/10  โ†’ [0, 1] be the following distribution:

   1. Choose ๐‘Š โŠ‚ [๐‘] of size ๐‘˜/10 .
   2. Choose ๐‘‹ โŠ‚ [๐‘] of size 9๐‘˜/10 such that ๐‘‹ โˆฉ ๐‘Š = โˆ….
   3. Choose ๐‘Œ โŠ‚ [๐‘] of size 9๐‘˜/10 such that ๐‘Œ โˆฉ ๐‘Š = โˆ….
Let ๐’Ÿ 0 :    [๐‘˜] 
            ๐‘˜/10
                   ร— [๐‘] ๐‘˜ ร— [๐‘] ๐‘˜ โ†’ [0, 1] be the following distribution:

   1. Choose a set ๐ด โŠ‚ [๐‘˜] of size ๐‘˜/10 .
   2. Choose ๐‘ฅ โˆˆ [๐‘] ๐‘˜ such that ๐‘ˆ(๐‘ฅ) = 1.
   3. Choose ๐‘ฆ โˆˆ [๐‘] ๐‘˜ such that ๐‘ฅ ๐ด = ๐‘ฆ๐ด and ๐‘ˆ(๐‘ฆ) = 1.
    The distribution (๐‘Š , ๐‘‹ , ๐‘Œ) โˆผ ๐’Ÿ is the distribution used in Test 4. The distribution (๐ด, ๐‘ฅ, ๐‘ฆ) โˆผ
๐’Ÿ 0 is the distribution of Test 2, conditioning on ๐‘ˆ(๐‘ฅ) = ๐‘ˆ(๐‘ฆ) = 1.
                                                                   [๐‘˜] 
    If we pick (๐‘Š , ๐‘‹ , ๐‘Œ) โˆผ ๐’Ÿ, a random set ๐ด โˆˆ ๐‘˜/10                    and random permutations ๐œ‹1 โˆˆ
๐’ฎ๐‘˜/10 , ๐œ‹2 , ๐œ‹3 โˆˆ ๐’ฎ9๐‘˜/10 , then ๐‘ฅ = ((๐‘Šยฎ ๐œ‹1 ) ๐ด , ( ๐‘‹
                                                    ยฎ ๐œ‹2 ) ยฏ ) and ๐‘ฆ = ((๐‘Š ยฎ ๐œ‹1 )๐ด , (๐‘Œ
                                                                                      ยฎ ๐œ‹3 ) ยฏ ) , are distributed
                                                          ๐ด                                 ๐ด
according to ๐’Ÿ .  0

    Let ๐‘ 1 = Pr๐‘ฅโˆˆ[๐‘]๐‘˜ [๐‘ˆ(๐‘ฅ) = 0] . We bound its value. Choosing a uniform ๐‘ฅ โˆˆ [๐‘] ๐‘˜ can be done
coordinate by coordinate. For each coordinate ๐‘–, the probability that ๐‘ฅ ๐‘– = ๐‘ฅ ๐‘— for some ๐‘— < ๐‘– is at
most ๐‘–โˆ’1๐‘ , therefore
                                                                ๐‘˜
                                                                ร• ๐‘–โˆ’1             ๐‘˜2
                                  ๐‘ 1 = Pr [๐‘ˆ(๐‘ฅ) = 0] โ‰ค                      โ‰ค       .
                                        ๐‘ฅโˆˆ[๐‘] ๐‘˜                        ๐‘         2๐‘
                                                                 ๐‘–=1

    Fix an arbitrary ๐‘ฅ โˆˆ [๐‘] ๐‘˜ such that ๐‘ˆ(๐‘ฅ) = 1 and a set ๐ด โŠ‚ [๐‘˜]. Let
                                       ๐‘ 2 = Pr [๐‘ˆ(๐‘ฆ) = 0 | ๐‘ฆ๐ด = ๐‘ฅ ๐ด ] .
                                             ๐‘ฆโˆˆ[๐‘] ๐‘˜

We note that the value of ๐‘ 2 does not depend on ๐‘ฅ, ๐ด. We can think of ๐‘ฆ as being chosen by
starting from ๐‘ฆ๐ด , and choosing the rest of the coordinates one by one.
                                                                       ๐‘˜
                                                                       ร• ๐‘–โˆ’1              ๐‘˜2
                            ๐‘ 2 = Pr [๐‘ˆ(๐‘ฆ) = 0 | ๐‘ฆ๐ด = ๐‘ฅ ๐ด ] โ‰ค                      โ‰ค         .
                                   ๐‘ฆ                                         ๐‘           2๐‘
                                                                    ๐‘–=๐‘˜/10


                         T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                     50
                   E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

   We prove two claims connecting the test success probability on ๐‘“ : [๐‘]      โ†’ [๐‘€] ๐‘˜ to the
                                                                                                       
                                                                          ๐‘˜
success probability of the two-query test on the function ๐‘“ 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ โˆช โŠฅ. Recall the
notation of agrโˆจ๐‘˜/10 (ยท) from Test 2.

Claim A.5. For every function ๐‘“ :             [๐‘]
                                               ๐‘˜
                                                       โ†’ [๐‘€] ๐‘˜ , the function ๐‘“ 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ โˆช โŠฅ from
Definition A.3 satisfies
                         agrโˆจ๐‘˜/10 ( ๐‘“ 0) = (1 โˆ’ ๐‘ 1 )(1 โˆ’ ๐‘2 ) Pr[ ๐‘“ passes Item 3 of Test 4].

Proof. Choose ๐‘ฅ, ๐‘ฆ, ๐ด according to the distribution of Test 2. If ๐‘ˆ(๐‘ฅ) = 0 or ๐‘ˆ(๐‘ฆ) = 0 the test fails
by definition. When we condition on ๐‘ˆ(๐‘ฅ) = ๐‘ˆ(๐‘ฆ) = 1, the test distribution is (๐ด, ๐‘ฅ, ๐‘ฆ) โˆผ ๐’Ÿ 0 .
     Denote by ๐‘Š the set of elements in ๐‘ฅ ๐ด , by ๐‘‹ the set of elements in ๐‘ฅ ๐ดยฏ and by ๐‘Œ the set of
elements in ๐‘ฆ๐ดยฏ . Let ๐œ‹1 โˆˆ ๐’ฎ๐‘˜/10 be the sorting permutation for ๐‘ฅ ๐ด . Then ๐‘“ , ๐‘“ 0 satisfy ๐‘“ 0(๐‘ฅ)๐ด =
( ๐‘“ (๐‘‹ , ๐‘Š)๐‘Š )๐œ‹1 , and ๐‘“ 0(๐‘ฆ)๐ด = ( ๐‘“ (๐‘Œ, ๐‘Š)๐‘Š )๐œ‹1 . Therefore, ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด โ‡โ‡’ ๐‘“ (๐‘‹ , ๐‘Š)๐‘Š =
๐‘“ (๐‘Œ, ๐‘Š)๐‘Š .
       Pr[ ๐‘“ 0 passes Test 2] = Pr [ ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด | ๐‘ฅ ๐ด = ๐‘ฆ๐ด ]
                                    ๐ด,๐‘ฅ,๐‘ฆ

                                 = Pr [๐‘ˆ(๐‘ฅ) = ๐‘ˆ(๐‘ฆ) = 1 | ๐‘ฅ ๐ด = ๐‘ฆ๐ด ]                  Pr        [ ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด ]
                                    ๐ด,๐‘ฅ,๐‘ฆ                                        (๐ด,๐‘ฅ,๐‘ฆ)โˆผ๐’Ÿ 0

                                 =(1 โˆ’ ๐‘ 1 )(1 โˆ’ ๐‘ 2 )        Pr        [ ๐‘“ (๐‘‹ , ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ, ๐‘Š)๐‘Š ]
                                                         (๐‘Š ,๐‘‹ ,๐‘Œ)โˆผ๐’Ÿ

                                 =(1 โˆ’ ๐‘ 1 )(1 โˆ’ ๐‘ 2 ) Pr[ ๐‘“ passes Item 3 of Test 4]
where Pr๐ด,๐‘ฅ,๐‘ฆ [๐‘ˆ(๐‘ฅ) = ๐‘ˆ(๐‘ฆ) = 1 | ๐‘ฅ ๐ด = ๐‘ฆ๐ด ] = (1 โˆ’ ๐‘1 )(1 โˆ’ ๐‘ 2 ) by the definition of ๐‘ 1 , ๐‘2 .                      

Claim A.6. For every function ๐‘“ :             [๐‘]
                                               ๐‘˜
                                                       โ†’ [๐‘€] ๐‘˜ , the function ๐‘“ 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ โˆช โŠฅ from
                                                                                [๐‘] 
                                                                                 [๐‘] 
Definition A.3 satisfies the following. For every disjoint ๐‘Š โˆˆ                   ๐‘˜/10
                                                                               9๐‘˜/10
                                                                                       ,๐‘‹
                                                                                      , every set ๐ด โŠ‚
                                                                                               โˆˆ
[๐‘˜], |๐ด| = ๐‘˜/10 and every pair of permutations ๐œ‹1 โˆˆ ๐‘† ๐‘˜/10 , ๐œ‹2 โˆˆ ๐‘†9๐‘˜/10 , let ๐‘ฅ = ((๐‘Š ยฎ ๐œ‹1 ) ๐ด , ( ๐‘‹
                                                                                                    ยฎ ๐œ‹2 ) ยฏ )
                                                                                                          ๐ด
where the notation (๐‘ฆ๐ด , ๐‘ง ๐ดยฏ ) means that we put the elements of ๐‘ฆ in order in coordinates ๐ด, and we put
the elements of ๐‘ง in order in the remaining coordinates. Then
            Pr [ ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด | ๐‘ฆ๐ด = ๐‘ฅ ๐ด ] = (1 โˆ’ ๐‘ 2 )        Pr      [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š ] .
            ๐‘ฆ                                                   ๐‘Œโˆผ๐’Ÿ |๐‘Š ,๐‘‹

                                                   [๐‘]            [๐‘] 
Proof. Fix two disjoint subsets ๐‘Š โˆˆ                ๐‘˜/10
                                                         ,๐‘‹    โˆˆ  9๐‘˜/10
                                                                         , a subset ๐ด โŠ‚ [๐‘˜], |๐ด| = ๐‘˜/10 , and
permutations ๐œ‹1 โˆˆ ๐‘† ๐‘˜/10 , ๐œ‹2 โˆˆ ๐‘†9๐‘˜/10 . Set ๐‘ฅ                  = ((๐‘Š  ๐œ‹        ยฎ ๐œ‹2 ) ยฏ ) , since ๐‘‹ , ๐‘Š are disjoint,
                                                                     ยฎ 1 )๐ด , ( ๐‘‹
                                                                                      ๐ด
๐‘ˆ(๐‘ฅ) = 1.
     Let ๐‘ฆ โˆˆ [๐‘] ๐‘˜ be a random string such that ๐‘ฅ ๐ด = ๐‘ฆ๐ด . If ๐‘ˆ(๐‘ฆ) = 0, then ๐‘“ 0(๐‘ฆ) = โŠฅ and
๐‘“ 0(๐‘ฅ)๐ด โ‰  ๐‘“ 0(๐‘ฆ)๐ด . Conditioning on ๐‘ˆ(๐‘ฆ) = 1, the distribution over ๐‘ฆ is ๐’Ÿ 0 |๐ด, ๐‘ฅ. If we take ๐‘Œ to
be the elements of ๐‘ฆ๐ดยฏ , then the distribution over ๐‘Œ is ๐’Ÿ |๐‘Š , ๐‘‹.
     Clearly, ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด โ‡โ‡’ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š , so
        Pr [ ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด | ๐‘ฆ๐ด = ๐‘ฅ ๐ด ] = Pr [๐‘ˆ(๐‘ฆ) = 0 | ๐‘ฅ ๐ด = ๐‘ฆ๐ด ]              Pr        [ ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด ]
        ๐‘ฆ                                          ๐‘ฆ                              ๐‘ฆโˆผ๐’Ÿ 0 |๐ด,๐‘ฅ

                                               =(1 โˆ’ ๐‘ 2 )         Pr     [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š ] .                
                                                              ๐‘Œโˆผ๐’Ÿ |๐‘Š ,๐‘‹


                          T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                         51
                                   I RIT D INUR AND I NBAL L IVNI NAVON

Proof of Lemma 4.4. Let ๐‘“ : [๐‘] โ†’ [๐‘€] ๐‘˜ be a function such that agr๐‘๐‘˜/10
                                                                     ๐‘ ๐‘’๐‘ก
                                                                         ( ๐‘“ ) = ๐œ– > eโˆ’๐‘๐›ผ๐‘˜ , and let
                                   
                             ๐‘˜
๐‘“ 0 : [๐‘] ๐‘˜ โ†’ [๐‘€] ๐‘˜ โˆช โŠฅ be the function from Definition A.3. The constant ๐‘ is chosen to be small
enough so that we can apply Theorem 3.9 with ๐›ผ = 1/200. Therefore, we can safely assume that
๐›ผ โ‰ค 1/200.
     By Claim A.5, ๐‘“ 0 passes Test 2 with probability ๐œ–0 = (1 โˆ’ ๐‘ 1 )(1 โˆ’ ๐‘ 2 )๐œ– โ‰ฅ eโˆ’๐‘ ๐›ผ๐‘˜ . Theorem 3.9
                                                                                      0


holds for the function ๐‘“ 0 with success probability ๐œ–0 and distance parameter ๐›ผ.
                                             [๐‘]         [๐‘] 
     By Claim A.6, for every disjoint ๐‘Š โˆˆ ๐‘˜/10     , ๐‘‹ โˆˆ 9๐‘˜/10  ,

          Pr [ ๐‘“ 0(๐‘ฅ)๐ด = ๐‘“ 0(๐‘ฆ)๐ด | ๐‘ฆ๐ด = ๐‘ฅ ๐ด ] = (1 โˆ’ ๐‘ 2 )     Pr      [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š ] .
           ๐‘ฆ                                                 ๐‘Œโˆผ๐’Ÿ๐‘Š ,๐‘‹

   Setting ๐œ‚ = 1 โˆ’ ๐‘ 1 , this means that if ๐‘‹ , ๐‘Š are good, i. e., they satisfy
                                                                             ๐œ–
                                 Pr [ ๐‘“ (๐‘‹ โˆช ๐‘Š)๐‘Š = ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Š ] โ‰ฅ ๐œ‚
                                  ๐‘Œ                                          2
then for every set ๐ด โŠ‚ [๐‘˜] and permutations ๐œ‹1 , ๐œ‹2 , the restriction ๐œ = (๐ด, ๐‘ฅ ๐ด , ๐‘“ 0(๐‘ฅ)๐ด ) is good,
for ๐‘ฅ = ((๐‘Šยฎ ๐œ‹1 ) ๐ด , ( ๐‘‹
                        ยฎ ๐œ‹2 ) ยฏ ).
                              ๐ด
    Theorem 3.9 states that with probability 1 โˆ’ ๐œ–02 a good restriction is an ๐›ผ-DP restriction. Every
pair ๐‘Š , ๐‘‹ corresponds to the same number of pairs (๐ด, ๐‘ฅ), so for at least (1โˆ’๐œ–02 ) โ‰ฅ (1โˆ’๐œ– 2 โˆ’๐‘˜ 2 /๐‘) of
the pairs ๐‘Š , ๐‘‹, there exists at least one set ๐ด and permutations ๐œ‹1 , ๐œ‹2 such that ๐œ = (๐ด, ๐‘ฅ, ๐‘“ 0(๐‘ฅ)๐ด )
is an ๐›ผ-DP restriction, for ๐‘ฅ = ((๐‘Š  ยฎ ๐œ‹1 ) ๐ด , ( ๐‘‹
                                                  ยฎ ๐œ‹2 ) ยฏ ).
                                                        ๐ด
    Fix such a pair ๐‘Š , ๐‘‹. We prove that it is an ๐›ผ-DP pair. Let ๐‘”๐œ = (๐‘”๐œ,๐‘– )๐‘–โˆˆ๐ดยฏ be the direct product
function promised from ๐œ being an ๐›ผ-DP restriction.
    We set ๐‘”๐‘Š ,๐‘‹ : [๐‘] โ†’ [๐‘€] to be the following function:

                             โˆ€๐‘Ž โˆˆ [๐‘] ๐‘”๐‘Š ,๐‘‹ (๐‘Ž) = Plurality {๐‘”๐œ,๐‘– (๐‘Ž)} ๐‘–โˆˆ๐ดยฏ .

   Let                                                                                
                                [๐‘]
                   ๐’ฑ๐‘Š ,๐‘‹ = ๐‘Œ โˆˆ                  ๐‘Œ โˆฉ ๐‘Š = โˆ…, ๐‘“ (๐‘Œ, ๐‘Š)๐‘Š = ๐‘“ (๐‘‹ , ๐‘Š)๐‘Š .
                               9๐‘˜/10
We show next that ๐‘”๐‘Š ,๐‘‹ approximates ๐‘“ on ๐’ฑ๐‘Š ,๐‘‹ .
                                          3๐›ผ๐‘˜
    Fix ๐‘Œ โˆˆ ๐’ฑ๐‘Š ,๐‘‹ such that ๐‘”๐‘Š ,๐‘‹ (๐‘Œ) 0 ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ . We show that many of the tuples (๐‘ฅ ๐ด , ๐‘ค ๐ดยฏ )
obtained by permuting ๐‘Œ โˆช ๐‘Š are โ€œnot DPโ€, namely ๐‘“ (๐‘ฅ ๐ด , ๐‘ค ๐ดยฏ )๐ดยฏ is far from ๐‘”๐œ (๐‘ค) for ๐‘ค = ๐‘Œ   ยฎ ๐œ‹3
for many choices of the permutation ๐œ‹3 . Since ๐œ is a DP-restriction this must be a rare event,
allowing us to upper bound the fraction of such ๐‘Œ.
    Let ๐ต โŠ‚ ๐‘Œ be a set of exactly 3๐›ผ๐‘˜ elements on which ๐‘”๐‘Š ,๐‘‹ (๐‘Œ) and ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ differ. That is,
|๐ต| = 3๐›ผ๐‘˜ and for each ๐‘ โˆˆ ๐ต, ๐‘”๐‘Š ,๐‘‹ (๐‘) โ‰  ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘ .
    For every ๐‘ โˆˆ ๐ต, since ๐‘”๐‘Š ,๐‘‹ (๐‘) is the most frequent value among ๐‘”๐œ,๐‘– (๐‘), for at least half of
the coordinates ๐‘– โˆˆ ๐ด,ยฏ ๐‘”๐œ,๐‘– (๐‘) โ‰  ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘ . We call such coordinates ๐‘– bad (for ๐‘), and the rest
of the coordinates good. Let ๐œ‹3 be a random permutation on 9๐‘˜/10 elements, so ๐‘ค = ๐‘Œ       ยฎ ๐œ‹3 places
the element ๐‘ in a random location. Let ๐ผ๐‘ be the random variable indicating that ๐‘ is mapped,
via ๐œ‹3 , into a good location.

                       T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                            52
                     E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

    We will show that with high probability, a non-trivial portion of the elements in ๐ต are sent to
a bad location. For this we will apply the tail bound in Fact 2.6. We prove that {๐ผ๐‘ } ๐‘โˆˆ๐ต satisfy the
conditions of the fact. Fix a set ๐‘† ( ๐ต, denote |๐‘†| = ๐‘ก and denote the elements of ๐‘† by ๐‘1 . . . , ๐‘ ๐‘ก
using an arbitrary order. Fix some ๐‘ 0 โˆˆ ๐ต \ ๐‘†, then,
                                              ร•
 Pr[๐ผ๐‘0 = 1| โˆง๐‘–โˆˆ[๐‘ก] ๐ผ๐‘ ๐‘– = 1] =                                 Pr โˆ€๐‘— โˆˆ [๐‘ก], ๐œ‹3 (๐‘ ๐‘— ) = ๐‘– ๐‘— Pr ๐ผ๐‘0 = 1|โˆ€๐‘— โˆˆ [๐‘ก], ๐œ‹3 (๐‘ ๐‘— ) = ๐‘– ๐‘—
                                                                                                                                            
 ๐œ‹3                                                             ๐œ‹3                                              ๐œ‹3
                                                    ยฏ ๐‘— โ‰ ๐‘– ๐‘—0
                                     ๐‘– 1 ,...,๐‘– ๐‘ก โˆˆ ๐ด,๐‘–
                                                                                                                            
                                                                    Pr ๐ผ๐‘0 = 1|โˆ€๐‘— โˆˆ [๐‘ก], ๐œ‹3 (๐‘ ๐‘— ) = ๐‘– ๐‘—
                                                                                                                        
                                 โ‰ค            max
                                                    ยฏ ๐‘— โ‰ ๐‘– ๐‘—0
                                     ๐‘– 1 ,...,๐‘– ๐‘ก โˆˆ ๐ด,๐‘–             ๐œ‹3

                                            ยฏ
                                       0.5| ๐ด|
                                 โ‰ค             โ‰ค 0.51.
                                       ยฏ โˆ’ |๐‘†|
                                     | ๐ด|
The last inequality is because |๐‘†| โ‰ค |๐ต| โ‰ค 3๐›ผ๐‘˜, and we used that ๐›ผ โ‰ค 1/200. Using this inequality
we get that for every ๐‘† โІ ๐ต, Pr๐œ‹3 [โˆง๐‘โˆˆ๐‘† ๐ผ๐‘ = 1] โ‰ค (0.51)|๐‘†| . By Fact 2.6,
                                         "                           #
                                             ร•                                                     2
                                                   ๐ผ๐‘ โ‰ฅ 2๐›ผ๐‘˜ โ‰ค eโˆ’3๐›ผ๐‘˜ยท2( 3 โˆ’0.51) โ‰ค e0.14๐›ผ๐‘˜ .
                                                                                            2
                                 Pr
                                 ๐œ‹3
                                             ๐‘โˆˆ๐ต

                                                                                                                                          ๐›ผ๐‘˜
Whenever ๐œ‹3 is a permutation with                                   ๐‘โˆˆ๐ต ๐ผ๐‘      < 2๐›ผ๐‘˜, it follows that ๐‘“ 0(๐‘ฅ ๐ด , ๐‘ค)๐ดยฏ 0 ๐‘”๐œ (๐‘ค) (for
                                                            ร
     ยฎ ๐œ‹3 ). Therefore, we get that
๐‘ค = (๐‘Š)
                                                                                                                                  
                             3๐›ผ๐‘˜                                                                                                ๐›ผ๐‘˜
                                                                              โˆ’0.14๐›ผ๐‘˜
         Pr          ๐‘”๐‘Š ,๐‘‹ (๐‘Œ) 0 ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ                      1โˆ’e                        โ‰ค Pr           ๐‘“ (๐‘ฅ ๐ด , ๐‘ค)๐ดยฏ 0 ๐‘”๐œ (๐‘ค) โ‰ค ๐œ–02 .
                                                                                                            0
       ๐‘Œโˆˆ๐’ฑ๐‘Š ,๐‘‹                                                                                  ๐‘คโˆˆ๐’ฑ๐œ

This implies that
                                                                                       
                                                         3๐›ผ๐‘˜
                            Pr           ๐‘”๐‘Š ,๐‘‹ (๐‘Œ) 0 ๐‘“ (๐‘Œ โˆช ๐‘Š)๐‘Œ โ‰ค ๐œ–02 + eโˆ’0.14๐›ผ๐‘˜ โ‰ค 2๐œ– 2 .                                                      
                          ๐‘Œโˆˆ๐’ฑ๐‘Š ,๐‘‹


Acknowledgement
The authors wish to thank Lรกszlรณ Babai for his infinite precision and hyper attention to detail,
and for pointing out Bernsteinโ€™s work that predated Chernoff by decades.


References
 [1] Sanjeev Arora and Madhu Sudan: Improved low-degree testing and its applications.
     Combinatorica, 23(3):365โ€“426, 2003. Preliminary version in STOCโ€™97. [doi:10.1007/s00493-
     003-0025-0, ECCC:TR97-003] 2
 [2] Vitaly Bergelson, Terence Tao, and Tamar Ziegler: An inverse theorem for the uniformity
     seminorms associated with the action of ๐”ฝ ๐‘โˆž . Geom. Funct. Anal. (GAFA), 19(6):1539โ€“1596,
     2010. [doi:10.1007/s00039-010-0051-1, arXiv:0901.2602] 2

                           T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                                                                53
                               I RIT D INUR AND I NBAL L IVNI NAVON

 [3] Amey Bhangale, Irit Dinur, and Inbal Livni Navon: Cube vs. cube low degree test. In
     Proc. 8th Innovations in Theoret. Comp. Sci. Conf. (ITCSโ€™17), pp. 40:1โ€“31. Schloss Dagstuhlโ€“
     Leibniz-Zentrum fuer Informatik, 2017. [doi:10.4230/LIPIcs.ITCS.2017.40, arXiv:1612.07491,
     ECCC:TR16-205] 2

 [4] Irit Dinur: The PCP theorem by gap amplification. J. ACM, 54(3):12, 2007. Preliminary
     version in STOCโ€™06. [doi:10.1145/1236457.1236459, ECCC:TR05-046] 2

 [5] Irit Dinur and Elazar Goldenberg: Locally testing direct product in the low error range.
     In Proc. 49th FOCS, pp. 613โ€“622. IEEE Comp. Soc., 2008. [doi:10.1109/FOCS.2008.26] 4, 6

 [6] Irit Dinur, Subhash Khot, Guy Kindler, Dor Minzer, and Muli Safra: Towards a proof
     of the 2-to-1 games conjecture? In Proc. 50th STOC, pp. 376โ€“389. ACM Press, 2018.
     [doi:10.1145/3188745.3188804, ECCC:TR16-198] 2

 [7] Irit Dinur and Inbal Livni Navon: Exponentially small soundness for the direct product
     Z-test. In Proc. 32nd Comput. Complexity Conf. (CCCโ€™17), pp. 29:1โ€“50. Schloss Dagstuhlโ€“
     Leibniz-Zentrum fuer Informatik, 2017. [doi:10.4230/LIPIcs.CCC.2017.29] 1

 [8] Irit Dinur and David Steurer: Direct product testing. In Proc. 29th IEEE Conf. on Comput.
     Complexity (CCCโ€™14), pp. 188โ€“196. IEEE Comp. Soc., 2014. [doi:10.1109/CCC.2014.27,
     ECCC:TR13-179] 6, 14, 31, 36

 [9] Oded Goldreich and Shmuel Safra: A combinatorial consistency lemma with application
     to proving the PCP theorem. SIAM J. Comput., 29(4):1132โ€“1154, 2000. Preliminary version
     in RANDOMโ€™97. [doi:10.1137/S0097539797315744, ECCC:TR96-047] 2

[10] Torben Hagerup and Christine Rรผb: A guided tour of Chernoff bounds. Inform. Process.
     Lett., 33(6):305โ€“308, 1990. [doi:10.1016/0020-0190(90)90214-I] 11

[11] Wassily Hoeffding: Probability inequalities for sums of bounded random variables. J. Amer.
     Statistical Association, 58(301):13โ€“30, 1963. Also available in The Collected Works of Wassily
     Hoeffding, 1994, pp. 409โ€“426, Springer and at JSTOR. [doi:10.1080/01621459.1963.10500830]
     11, 12

[12] Russell Impagliazzo and Valentine Kabanets: Constructive proofs of concentration
     bounds. In Proc. 14th Internat. Workshop on Randomization and Computation (RANDOMโ€™10),
     pp. 617โ€“631. Springer, 2010. [doi:10.1007/978-3-642-15369-3_46] 10, 12

[13] Russell Impagliazzo, Valentine Kabanets, and Avi Wigderson: New direct-product testers
     and 2-query PCPs. SIAM J. Comput., 41(6):1722โ€“1768, 2012. Preliminary version in STOCโ€™09.
     [doi:10.1137/09077299X, ECCC:TR09-090] 2, 5, 6, 7, 8, 13, 28, 30

[14] Subhash Khot, Dor Minzer, and Muli Safra: On independent sets, 2-to-2 games,
     and Grassmann graphs.       In Proc. 49th STOC, pp. 576โ€“589. ACM Press, 2017.
     [doi:10.1145/3055399.3055432, ECCC:TR16-124] 2

                     T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                       54
              E XPONENTIALLY S MALL S OUNDNESS FOR THE D IRECT P RODUCT Z- TEST

[15] Michael Mitzenmacher and Eli Upfal: Probability and Computing: Randomized Algorithms
     and Probabilistic Analysis. Cambridge Univ. Press, 2005. [doi:10.1017/CBO9780511813603]
     11

[16] Elchanan Mossel, Krzysztof Oleszkiewicz, and Arnab Sen: On reverse hypercontrac-
     tivity. Geom. Funct. Anal. (GAFA), 23(3):1062โ€“1097, 2013. [doi:10.1007/s00039-013-0229-4,
     arXiv:1108.1210] 8, 12

[17] Alessandro Panconesi and Aravind Srinivasan: Randomized distributed edge coloring
     via an extension of the chernoff-hoeffding bounds. SIAM J. Comput., 26(2):350โ€“368, 1997.
     [doi:10.1137/S0097539793250767] 12

[18] Ran Raz: A parallel repetition theorem. SIAM J. Comput., 27(3):763โ€“803, 1998. Preliminary
     version in STOCโ€™95. [doi:10.1137/S0097539795280895] 2

[19] Ran Raz and Shmuel Safra: A sub-constant error-probability low-degree test, and a
     sub-constant error-probability PCP characterization of NP. In Proc. 29th STOC, pp. 475โ€“484.
     ACM Press, 1997. [doi:10.1145/258533.258641] 2


AUTHORS

     Irit Dinur
     Professor
     Department of Applied Mathematics
      and Computer Science
     The Weizmann Institute of Science
     Rehovot, Israel
     irit dinur weizmann ac il
     http://www.wisdom.weizmann.ac.il/~dinuri/


     Inbal Livni Navon
     Postdoc
     Department of Computer Science
     Stanford University
     Stanford, CA, USA
     inballn stanford edu
     http://inballn.su.domains/




                    T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                     55
                             I RIT D INUR AND I NBAL L IVNI NAVON

ABOUT THE AUTHORS

    Irit Dinur is a professor at the Weizmann Institute of Science. She is interested
        broadly in theoretical computer science and mathematics, and more specifically in
        complexity theory, probabilistically checkable proofs, hardness of approximation,
        and most recently in the growing area of high dimensional expansion. She has a
        wife and three kids.


    Inbal Livni Navon is a postdoc at Stanford University. She received her Ph. D.
       in 2023 from the Weizmann Institute of Science where she was advised by
       Irit Dinur. She is interested in Algorithmic fairness and in expander graphs
       and their applications in different areas in theoretical computer science. She
       is also interested in property testing, error correcting codes and hardness of
       approximation.




                   T HEORY OF C OMPUTING, Volume 19 (3), 2023, pp. 1โ€“56                     56