Property testing in the dense graph model #
In the dense graph model of Goldreich, Goldwasser and Ron a tester
for graphs on the vertex set Fin n accesses the graph only through its adjacency matrix: it asks
whether two vertices are adjacent and receives one bit Goldreich, Chapter 8.
Here a tester is a probabilistic oracle program (Tester n, a ProbOracleComp) that tosses
private coins and asks vertex-pair queries adaptively; it runs against the deterministic adjacency
oracle of the graph (adjOracle), and acceptProb T G is the probability that it outputs
true.
The distance between two graphs on the same finite vertex set is the number of vertex pairs on
which they differ (editDist, the number of edges of their symmetric difference). A graph is
ε-far from a property P when every graph with property P differs from it in more than ε n²
pairs (IsFar). Goldreich normalizes by the n² ordered entries of the adjacency matrix, each
changed pair accounting for two entries, so his distance ε corresponds to IsFar G P (ε / 2)
here. A
one-sided tester (IsOneSidedTester) makes at most q queries on every run, accepts every graph
with the property with probability one and accepts every ε-far graph with probability at most
1 / 3; a family of properties is OneSidedTestable with query bound q if every proximity
ε > 0 and every number of vertices admits a one-sided tester with q ε queries, independent
of n. Goldreich restricts property testing to graph properties that are invariant under graph
isomorphism. The definitions IsOneSidedTester and OneSidedTestable here do not require
isomorphism invariance, allowing arbitrary predicates P : SimpleGraph (Fin n) → Prop; this is
a harmless generalization that specializes to isomorphism-invariant properties.
The far notion is related to Mathlib's deletion distance: an ε-far graph is
ε n²-delete-far (IsFar.deleteFar), in particular ε-far from triangle-free in the sense of
SimpleGraph.FarFromTriangleFree (IsFar.farFromTriangleFree); conversely, for a property that is
closed under taking subgraphs, deletion distance more than ε n² implies ε-far
(isFar_of_deleteFar, isFar_of_farFromTriangleFree).
Repetition (OracleComp.repeatAll) runs independent copies of a tester and accepts when all of them
accept; its acceptance probability is the power of the single-run acceptance probability
(acceptProb_repeatAll). This turns a perfectly complete q-query test that rejects far graphs
with probability at least δ into a one-sided tester after k runs with 2 ≤ δ k
(isOneSidedTester_repeatAll).
This file bounds queries only; it makes no claim about running time.
Main definitions #
Cslib.DenseGraphTesting.Tester: probabilistic oracle programs asking vertex-pair queries.Cslib.DenseGraphTesting.acceptProb: the acceptance probability of a tester on a graph.Cslib.DenseGraphTesting.editDist: the number of vertex pairs on which two graphs differ.Cslib.DenseGraphTesting.IsFar:ε-far from a property, relative ton².Cslib.DenseGraphTesting.IsOneSidedTester: one-sided testers with a worst-case query bound.Cslib.DenseGraphTesting.OneSidedTestable: testability with a query bound depending only on the proximity parameter.
Main results #
Cslib.DenseGraphTesting.IsFar.deleteFar,IsFar.farFromTriangleFree,isFar_of_deleteFar,isFar_of_farFromTriangleFree: comparison with Mathlib's deletion distance.Cslib.DenseGraphTesting.acceptProb_repeatAll,isQueryBounded_repeatAll: repetition withOracleComp.repeatAllmultiplies acceptance probabilities and query bounds.Cslib.DenseGraphTesting.isOneSidedTester_repeatAll: amplification of a perfectly complete test.
References #
Vertex-pair queries: the query (u, v) is answered by one bit, whether u and v are
adjacent.
A tester for graphs on Fin n: a probabilistic oracle program that asks vertex-pair queries
and outputs true (accept) or false (reject).
The adjacency oracle of a graph: it answers the query (u, v) deterministically with whether
u and v are adjacent.
The probability that the tester T accepts the graph G, with its coins uniform and its
queries answered by the adjacency oracle of G.
Unfolding lemma for acceptProb.
The adjacency oracle answers the query (u, v) with the adjacency bit.
The edit distance of two graphs on the same finite vertex set: the number of vertex pairs that
are an edge of exactly one of them. The finite vertex type ensures that Nat.card counts differing
pairs rather than returning 0 on an infinite symmetric difference.
G is ε-far from the property P: every graph with property P differs from G in more
than ε n² vertex pairs, where n is the number of vertices.
T is a one-sided tester for the property P of graphs on Fin n with proximity ε and
query bound q: every run asks at most q vertex-pair queries, every graph with property P is
accepted with probability one, and every graph ε-far from P is accepted with probability at
most 1 / 3. The property P need not be isomorphism-invariant: this generalizes Goldreich's
definition, which restricts to invariant graph properties.
- queryBounded : ProbOracleComp.IsQueryBounded T q
Every run of the tester asks at most
qvertex-pair queries. Perfect completeness: graphs with the property are always accepted.
Soundness: graphs
ε-far from the property are accepted with probability at most1 / 3.
The family of graph properties P n (one for each number n of vertices) is one-sided
testable with query bound q: for every proximity ε > 0 and every n there is a one-sided
tester for P n with proximity ε asking at most q ε queries, a bound independent of n.
The properties P n need not be isomorphism-invariant; this harmlessly generalizes Goldreich's
definition.
Edit distance #
Relabelling both graphs by the same bijection preserves their edit distance.
On a finite vertex set the edit distance is the size of the symmetric difference of the edge sets.
Deleting a set s of edges of G changes exactly the pairs in s.
Far graphs and deletion distance #
A graph with property P is not ε-far from P for any ε ≥ 0.
An ε-far graph is ε n²-delete-far: at least ε n² edges must be deleted to reach the
property.
A graph ε-far from triangle-free is ε-far from triangle-free in the sense of Mathlib's
triangle removal lemma.
For a property closed under taking subgraphs, more than ε n² deletion distance implies
ε-far: the edges of G that a graph H with the property lacks can be deleted from G, and
the result is a subgraph of H.
On a nonempty vertex set, being ε'-far from triangle-free in the sense of Mathlib implies
being ε-far from triangle-free for every ε < ε'.
Queries and repetition #
Ask whether the vertices u and v are adjacent.
The adjacency oracle answers a pair query with the adjacency bit.
A one-sided tester never rejects a graph with the property.
Independent repetition multiplies acceptance probabilities.
k repetitions of a q-query tester ask at most q k queries.
Amplification: if the q-query tester T accepts every graph with property P with
probability one and accepts every ε-far graph with probability at most 1 - δ, then k
independent repetitions with 2 ≤ δ k form a one-sided tester with q k queries.