Skip to content

mm0-c: match each .mm0 dummy at most once - #212

Open
zariuq wants to merge 1 commit into
digama0:masterfrom
zariuq:fix/mm0-c-dummy-injectivity
Open

zariuq wants to merge 1 commit into
digama0:masterfrom
zariuq:fix/mm0-c-dummy-injectivity

Conversation

@zariuq

@zariuq zariuq commented Oct 16, 2026

Copy link
Copy Markdown

Issue found by Opus 5.5 and fixed by vim and Codex 6(.1).

check_expr checked a dummy's sort but allowed two distinct UDummy steps to match the same .mm0 variable. A proof file could therefore define f as A. d1 A. d2 d1 = d2, match it against the specification's A. d A. d d = d, and verify ~ f against that specification.

Reject a dummy already matched by an earlier unify-heap entry, skipping saved compound terms. This mirrors the kernel's existing dummy-distinctness check. Alpha-renaming, reordered and unused dummies, and repeated occurrences through URef remain accepted.

Four regression pairs in tests/mm0_mmu cover collapsed dummies, valid renaming/reordering, and saved terms interleaved with dummy matches. Each failing specification has a passing control with identical .mmu input, so compiler rejection cannot make the negative test pass accidentally. The saved-term control also catches a scan that reads a compound term as a variable record.

Validation: 65/65 C-facing MM0/MMU, MM1 and MMB tests pass with GCC. All four new regression cases and the HOL, set, Peano, peano_hex, mm0 and x86 corpora pass with GCC and Clang, including ASan/UBSan builds. The unpatched verifier accepts both new invalid specifications; the patch rejects both and accepts both positive controls. Removing the saved-term tag check makes the new positive control fail.

A broader Clang run has 7 error-reporting crashes on other malformed inputs (58/65 pass); the same crashes occur in the unpatched verifier. The mm0-js and spec-x86 suites were not run.

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