Finite lopsided triangle queries as matrix products #
Two outer parts have n vertices each; the finite middle part embeds into Fin D.
The matrices count common neighbors at every outer pair. Only pairs in W are graph edges,
so only those counts are triangle counts. Answers outside W are unconstrained.
This mathematical interface gives no native program, preprocessing cost, sparsity bound, fast solver or subquadratic running time.
Main definitions #
LopsidedGraph: two adjacency relations, a finite middle part and queried outer edges.LopsidedGraph.matX,LopsidedGraph.matY: padded biadjacency matrices.LopsidedGraph.signedBitInstance: four sign choices for each pair of binary digits.
Main results #
LopsidedGraph.matX_mul_matY_apply: entries count common middle neighbors.LopsidedGraph.matX_mul_matY_apply_ne_zero_iff: nonzero entries detect common neighbors.LopsidedGraph.mul_apply_eq_commonNeighborCount_ofMatrices: the converse for zero/one matrices.LopsidedGraph.mul_apply_eq_sum_signedBitInstance_counts: signed products from4 * β²counts.
References #
The lopsided matrix interface is used in [AlmanWilliams2026, Section 3].
Adapted from Anthropic's MatrixLanguage.lean
and the lopsided definitions in PaperStatements.lean.
The adaptation uses Set.EqOn, pointwise signed parts, and direct finite cardinalities.
An unweighted tripartite graph whose outer parts each have n vertices.
- M : Type
The middle vertices.
The middle part is finite.
Edges from the first outer part to the middle.
Edges from the middle to the second outer part.
Queried outer edges.
Instances For
On a pair in W, a common middle neighbor closes a triangle.
For a pair outside W, this predicate does not assert an outer edge.
Instances For
Number of common middle neighbors. At pairs in W this is the triangle count.
Instances For
Two thin matrices describe adjacency where their entries equal one.
The theorem mul_apply_eq_commonNeighborCount_ofMatrices requires zero/one entries.
Instances For
A middle part of cardinality at most D admits the required numbering.
A pair has a common neighbor if and only if its count is nonzero.
Every product entry counts common middle neighbors, independently of the numbering.
A nonzero product entry detects a common middle neighbor.
Counts on queried edges provide their detection answers.
For zero/one matrices, each product entry is the count in the graph they describe.
One of four sign choices for a pair of binary digits; true selects the negative part.
Every instance has exactly D middle vertices and the original queried edges W.
Instances For
The finite family of sign/digit instances for a magnitude width β.
Different slots may describe the same graph.
Instances For
Signed bounded product entries are weighted sums of four count instances per digit
pair, with signs +, −, −, +. Only counts at the same queried edge are needed. The absolute
bounds are strict; β = 0 therefore permits only zero entries.