Skip to content

LEC: exit 3 when a difference is found, as a SEC counterexample does - #267

Open
oharboe wants to merge 2 commits into
keplertech:mainfrom
oharboe:lec-exit-status
Open

oharboe wants to merge 2 commits into
keplertech:mainfrom
oharboe:lec-exit-status

Conversation

@oharboe

@oharboe oharboe commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

A combinational LEC that finds a difference exits 0, the same as one that proves the designs equivalent. SEC already reports its verdict in the exit status (0 proved, 3 counterexample). A build rule that runs kepler-formal has to parse the log to tell a broken design from a good one. In bazel-orfs, a rule that trusted the exit status passed a deliberately broken netlist.

This changes a contract the tests pin, so it's up for discussion. Seven places expected exit 0 for a differing pair: the structured in-process run, MiterTests' differing pairs, the tinyrocket examples (tinyrocket against tinyrocket_edited), and the Python primitives test. If exit 0 on a difference is intended, this PR is the place to say so and I'll close it.

  • A difference exits kLecDifferenceExitCode, defined as kSecCounterexampleExitCode (3). This holds on all three LEC paths: whole design, scopes and compact snapshots. Equivalent stays 0.
  • The seven tests now expect 3, and LecResultExitCodesAreStable pins the value.
  • The README gains an "LEC Result Codes" table next to the SEC one.

Tested: bazel test //.... MiterTests and BazelPythonPrimitivesTest pass with the updated expectations, and so does MiterTests' new KeplerCliSubprocessTests.LecExitStatusTellsADifferenceFromEquivalence, which runs the binary on an equivalent and a differing pair.

Correction: an earlier version of this description implied that the KeplerFormalCliTests.cpp changes ran under bazel test. That file is built by CMake only, so those edits keep the CMake suite consistent but were not run. The Bazel-run test above is the one that covers this change.

🤖 Generated with Claude Code

oharboe and others added 2 commits October 6, 2026 09:35
A combinational LEC that finds a difference exited 0, the same as one
that proves the designs equivalent; SEC already reports its verdict in
the exit status (0 proved, 3 counterexample). A script or build rule that
runs kepler-formal could not tell a broken design from a good one without
parsing the log, and one that trusted the exit status passed a
deliberately broken netlist.

A difference now exits kLecDifferenceExitCode, defined as SEC's
counterexample code, from all three LEC paths (whole design, scopes,
compact snapshots); equivalent stays 0. This changes a contract the
tests pinned in seven places (the structured in-process run, MiterTests'
differing pairs, the tinyrocket examples, the Python primitives test);
they now expect 3, and LecResultExitCodesAreStable fixes the value.
The README gains an LEC result-code table beside the SEC one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KeplerFormalCliTests.cpp is built by CMake only, so the tests the first
commit changed there do not run under bazel test. MiterTests does:
LecExitStatusTellsADifferenceFromEquivalence runs the binary on an
equivalent pair (exit 0) and a differing one (exit 3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant