Testing triangle-freeness with a constant number of queries #
The triangle tester samples a uniformly random ordered vertex triple (u, v, w), queries the
three pairs (u, v), (v, w) and (u, w), and rejects exactly when all three are edges
(triangleTrial); triangleTester n k repeats this k times independently and accepts when no
sampled triple is a triangle. Its acceptance probability is exact
(acceptProb_triangleTester): a trial on a graph on n vertices with t triangles accepts with
probability 1 - 6 t / n³, since each triangle is hit by 6 ordered triples
(card_orderedTriangles).
A triangle-free graph is therefore always accepted. A graph ε-far from triangle-free (IsFar)
is in particular ε-far in the sense of Mathlib's SimpleGraph.FarFromTriangleFree, so by the
triangle removal lemma SimpleGraph.FarFromTriangleFree.le_card_cliqueFinset it has at least
triangleRemovalBound ε * n³ triangles. A trial thus rejects it with probability at least
6 · triangleRemovalBound ε, and k trials with 1 ≤ 3 · triangleRemovalBound ε · k form a
one-sided tester with 3 k queries (isOneSidedTester_triangleTester). The number of trials
depends only on ε, so triangle-freeness is one-sided testable with a query bound independent of
the number of vertices (oneSidedTestable_cliqueFree_three). This removal-lemma argument for
testing triangle-freeness goes back to
Alon, Duke, Lefmann, Rödl and Yuster; see also
Alon, Fischer, Krivelevich and Szegedy and
Goldreich, Section 8.4.2 for subgraph-freeness testers in the dense graph model.
The query bound inherits the constant of Mathlib's removal lemma, which comes from Szemerédi's
regularity lemma and is of tower type in 1 / ε. The results bound queries only, not running
time.
Main definitions #
Cslib.DenseGraphTesting.triangleTrial: one trial, three random vertices and three queries.Cslib.DenseGraphTesting.triangleTester:kindependent trials.
Main results #
Cslib.DenseGraphTesting.card_orderedTriangles: ordered triangles number six times the triangles.Cslib.DenseGraphTesting.acceptProb_triangleTrial,acceptProb_triangleTester: exact acceptance probabilities.Cslib.DenseGraphTesting.isOneSidedTester_triangleTester: the tester is a one-sided tester for triangle-freeness.Cslib.DenseGraphTesting.oneSidedTestable_cliqueFree_three: triangle-freeness is one-sided testable with3 ⌈(3 · triangleRemovalBound ε)⁻¹⌉queries.
References #
Counting ordered triangles #
Each triangle of G is hit by exactly six ordered vertex triples (u, v, w) with u v,
v w and u w edges.
The triangle tester #
The triangle tester with k independent trials. The graph on no vertices is accepted
without queries.
A trial asks three queries.
The tester with k trials asks at most 3 k queries.
A trial accepts a graph on m + 1 vertices with t triangles with probability
1 - 6 t / (m + 1)³.
The tester with k trials accepts a graph on n vertices with t triangles with
probability (1 - 6 t / n³) ^ k.
Soundness via the removal lemma #
Triangle-freeness is testable. For ε > 0, the triangle tester with k trials, where
1 ≤ 3 · triangleRemovalBound ε · k, is a one-sided tester for triangle-freeness with proximity
ε and 3 k queries.
Triangle-freeness is one-sided testable with a constant number of queries: with
3 ⌈(3 · triangleRemovalBound ε)⁻¹⌉ queries, a bound that depends on the proximity ε but not on
the number of vertices.