Proving Code Equivalence Across Languages
30 functions compiled to JavaScript and Python. Outputs compared bit-for-bit. Zero divergences across 50,000+ test runs.
30 functions. Compiled to JavaScript and Python. Outputs compared bit-for-bit. Zero divergences.
The Translation Problem
When you transpile code from one language to another, how do you know the output is equivalent to the input? You test it. You run the same inputs through both versions and compare. But how many inputs is enough? A hundred? A thousand? What about the one input you did not test — the one that triggers a rounding difference between JavaScript's IEEE 754 doubles and Python's arbitrary-precision integers?
BRIK-64 takes a fundamentally different approach. Instead of testing equivalence, it proves it. The PCD blueprint is the canonical representation. When compiled to JavaScript and Python, both outputs are derived from the same mathematical specification. The question is not "do they happen to agree?" but "must they agree?"
The Shootout
We compiled 30 PCD programs — ranging from simple arithmetic to deeply nested compositions with conditional branching — to both JavaScript and Python. Each was executed with canonical test inputs derived from the closure domains (boundary values, zero, midpoint, random samples). Every output was compared against the canonical interpreter, the reference implementation that evaluates PCD directly without compilation.
Result: 30/30 functions verified equivalent. Zero divergences across over 50,000 cumulative test runs.
How It Works
The differential testing framework generates random but well-formed PCD programs, compiles them to multiple targets, executes all targets with identical inputs, and compares outputs bit-for-bit. The canonical interpreter serves as the oracle — if any compiled target disagrees with the interpreter, the target has a bug.
The full technical framework — the generator, the canonical interpreter, scaling to 10K+ programs, and CI integration — is documented on Digital Circuitality:
Read the differential semantics framework →
# Run it yourself
git clone https://github.com/brik64/brik64-demos.git
cd brik64-demos
./run_demo.sh demo2-translation-validationSame input. Same output. Every language. Every time. That is what "equivalent" means.