Documentation

CslibFrontier.Computability.PropertyTesting.DenseGraph.TriangleFree

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 #

Main results #

References #

Counting ordered triangles #

theorem Cslib.DenseGraphTesting.card_orderedTriangles (V : Type u_1) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] :
(∑ u : V, ∑ v : V, ∑ w : V, if G.Adj u v ∧ G.Adj v w ∧ G.Adj u w then 1 else 0) = 6 * (G.cliqueFinset 3).card

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 #

One trial of the triangle tester on Fin (m + 1): sample three uniform vertices u, v, w, query the pairs (u, v), (v, w) and (u, w), and reject exactly when all three are edges.

The triangle tester with k independent trials. The graph on no vertices is accepted without 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 #

theorem Cslib.DenseGraphTesting.isOneSidedTester_triangleTester {n : ℕ} {ε : ℝ} (hε : 0 < ε) {k : ℕ} (hk : 1 ≤ 3 * SimpleGraph.triangleRemovalBound ε * ↑k) :
IsOneSidedTester (triangleTester n k) (fun (G : SimpleGraph (Fin n)) => G.CliqueFree 3) ε (3 * k)

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.