Brian TheoryApplied AI & R&DRequest a fit call ↗
Explore the siteWorkServicesEngagementsAboutCVInsights
Selected work/Project 01

Correspondence Matrices / implementation

Correspondence Matrices in code.

Working code, independent checks and measured decisions.

Independent R&D · Self-directed

I developed Correspondence Matrices and built exact Boolean workflows around the representation. The public implementation and audit show where the evaluator is promising, where complete calls cost more, and when another method is the better engineering choice.

Public implementation · Reproducible results · Independent checks

Film 2 · 5:12

CM Benchmarking Video

An engineering account of exact-computation improvements across Correspondence Matrices, common-subexpression elimination, BitSet and related methods.

Click the picture to play. Full screen and volume are available in the controls.
Open the video file ↗
Read the narration transcript

This transcript follows the spoken narration. The figures and written evidence below provide additional visual context.

When exact-analysis software feels slow, the bottleneck may be setup, repeated input handling, or work on results that will never be selected. Research around Correspondence Matrices produced several practical engineering improvements. The useful question is: which expensive step can we remove while preserving the required answer?

The evidence combines deliberately synthetic stress cases with public application-derived and benchmark-derived artifacts from error correction, hardware circuits, and software configuration. In this measured workflow, the evaluators were not the bottleneck. A shared preparation step was. We removed the intermediate expansion, and complete one-query sessions ran two

point four nine times as fast through the public CM path, three point two three times through structural CSE, and three point eight three times through direct BitSet, with the tested ordered outputs unchanged. That is disciplined optimization: find the real constraint, prove the gain,

and define exactly where it applies. With sixty-four queries, the gains fell to about one point two times, and warm cache hits were unchanged. These are improvements over each path's earlier implementation, not a ranking between them.

On a GNU Radio error-correction matrix with eighteen hundred variables, profiling pointed to repeated input validation and lookup. Using an existing name-to-column index for validation cut an eight-query session from one hundred three point nine to twenty-nine milliseconds. The task was counting compatible assignments under fixed inputs, not decoding

messages. For a client, the lesson is concrete: a mathematically demanding tool may benefit more from cheaper input handling than from a faster mathematical kernel. Another study looked for compact, exact descriptions of Boolean functions.

The revised workflow shared matrix layouts and reserved full validation and reconstruction for the leading candidates. It still evaluated every candidate description and preserved the same selected best artifact within the bounded search. Against the earlier exhaustive implementation, the measured whole path ran three

point five five times as fast on Windows and three point one eight times as fast in a Linux confirmation. Later frozen slices from public EPFL and General Boolean Function Suite benchmarks reproduced the improvement; one also showed lower observed memory use on Windows.

This could matter where repeated structure analysis is expensive. It is an improvement to this software, not a new general decomposition algorithm or a win over external tools. Packed polynomial analysis offers another example. On an EPFL-derived corpus of one hundred eighty-eight functions, cached packed

analysis ran one point three one times as fast on the held-out test and one point six four times as fast on a circuit-disjoint confirmation split of the same corpus, compared with truth-vector analysis. All functions retained the exact classification and canonical partition.

This could help tools repeatedly searching for separable logic, where duplicated polynomial work is the bottleneck. Not every faster inner step became a useful implementation. In a fifteen-stage folding study, a deliberately fold-rich synthetic benchmark made one lowering stage about forty-two percent faster, but source construction made

the complete path more than twice as slow. A later sealed test across synthetic cases and public circuit-benchmark cones still lost to direct lowering, so the optimization was not promoted. The next redesign passed its fresh semantic checks, but produced no accepted timing evidence, so no performance claim was made.

On a public printer-configuration model, arrays reduced an eight-query exact-counting session from one hundred twenty-one point two to twenty-nine point eight milliseconds. But an existing native decision-diagram method took just four point six six milliseconds. That comparison matters: a useful engineering decision can be improving the

implementation, or choosing a better-suited existing method. The transferable process is to measure the complete workflow, locate the expensive step, change the smallest mechanism that explains it, and verify the answer. A focused pilot starts with representative inputs, the required output, cold

versus repeated calls, target hardware, and latency or memory goals. Compare the current implementation with suitable alternatives, then report where the improvement holds, where it does not, and the correctness checks behind it. The public repository, full findings, and P-series study guide are available

for review.

Download English captions (WebVTT)
2n canonical truth assignments5 documented comparison paths123 default reproducible seedPython implementation & reports
Role

Originator of the representation and lead for its implementation and evaluation.

Deliverable

Python compilers, benchmark tooling, generated reports and independent truth-table checks.

Result

An original structural representation became runnable, comparable and independently checkable.

Evidence

A public repository, published audit and independently checked examples.

01 / The decision

When does a new representation earn its place?

A new algorithmic idea becomes useful only when it produces the required answer correctly and its full workflow holds up against alternatives. The work here turns a mathematical representation into runnable compilers and evaluators, then compares their behavior under stated workloads.

The evaluation keeps construction, computation and checking visible so that a fast inner operation is not mistaken for a fast complete call. The companion theory page explains how the representation works.

02 / From representation to implementation

01Expression AST

One shared symbolic representation

02Align & combine

Broadcast sub-expressions by variable

03Materialize

Construct the canonical matrix once

04Validate

Compare with independent truth-table evaluation

The lazy path aligns sub-expressions through size-one axes and broadcasting, then materializes the canonical matrix at the end. Eager construction remains available as a fallback.

03 / The computational boundary

Make the scale visible.
Keep the claim narrow.

The full truth space grows exponentially with the number of variables. The benchmark driver therefore records compilation and evaluation work by operation and backend, and documents when particular validation paths are capped or skipped.

State-space scale

Truth assignments grow as 2n.

Log-scaled bars
4 variables16
8 variables256
16 variables65,536
The repository documents sweeps at 4, 8 and 16 variables. Counts show possible truth assignments, not benchmark speed or a performance advantage.
04

Reproducible comparison

The driver generates Boolean expressions and compares the CM path with SymPy logic simplification, an in-repository ROBDD, optional dd.autoref, Espresso and a canonical BDD-to-SOP baseline. Seeded runs write per-trial CSVs and summaries, collected through the published results and audit site.

05

Correctness outside the clock

Backend results are checked against explicit vectorized truth-table evaluation outside the timing windows. This separates “did it compute the same function?” from “how long did this specific implementation take?”

Implementation evidence

The check and the measurement boundary.

A worked expression shows independent agreement; the audit separates evaluator measurements from complete-call behavior.

Expression-to-correspondence-matrix figure showing a four-variable Boolean expression, its four-by-four matrix and an independent truth-table comparison with all 16 cells agreeing.
Expression, matrix and independent agreement

A worked example shows the matrix compiler and an independent truth-table check arriving at the same result.

Open full-size view ↗
Line chart of bare Correspondence Matrix to CSE-flat evaluation-time ratios from live support four through sixteen, with all confidence intervals below parity, beside an explicit warning that the public wrapper remains slower.
The kernel advantage—and the wrapper boundary

The audit shows where the current computation is promising—and where wrapper overhead still needs improvement.

Open full-size view ↗

Scope & limitations

What this work
does not claim.

The published measurements compare particular implementations, operations and problem sizes. They are not evidence of a general performance advantage over symbolic simplifiers or decision diagrams.

Correctness checks support the implemented cases; they are not a formal proof of every possible implementation or use.

Reproduce a small case

Check the representation before benchmarking it.

Start with the public repository’s setup instructions. In its Python environment, run this example from the repository root. It uses four variables, an explicit row/column partition and a known expected result.

from cm_exprlib import Var, And, Or, Not
from cm_build import compile_expr_to_cm

A, B, C, D = (Var(i) for i in range(4))
expr = Or(And(A, B), And(Not(C), D))
matrix = compile_expr_to_cm(expr, ["x0", "x1"], ["x2", "x3"], {})
expected = [[0, 1, 0, 0], [0, 1, 0, 0],
            [0, 1, 0, 0], [1, 1, 1, 1]]
assert matrix.astype(int).tolist() == expected
print(matrix.astype(int))

To check all sixteen cells independently, enumerate A, B, C and D as 0 or 1 and evaluate (A and B) or ((not C) and D). Match the result to row 2A + B and column 2C + D. Agreement checks this example’s correctness, rather than establishing a general performance advantage.

For a bounded benchmark, run the command below. It writes CSV and HTML reports in the working directory. Record the repository commit, Python and dependency versions, machine, seed, workload and required output when comparing results.

python cm_bench.py --sizes 4 --trials 3 --max-depth 3 --seed 123 --cm-lazy --out-prefix cm_example --html cm_example.html

Compare complete calls as well as inner computation, and retain construction and correctness-check costs. The published audit explains the measured workloads and their limits.

Inspect the evidence

Read it. Run it.
Check the boundary.

Useful when

Your team needs to turn an unconventional algorithmic claim into runnable software, reproducible comparisons and explicit correctness checks.

Explore technical validation →
← All selected workExplore the original method →