Skip to content

Milawa: failure of ALL-EQUALP-REMOVAL final check in level 9 due to multiple .proof file versions #2079

Open

Description

@jimwhite

Milawa: a local proof still writes its Proofs/ file, so duplicate proofs of one name overwrite each other and final-checks.sh rejects a valid manifest entry

Copilot + DeepSeek V4.1 Flash description of the issue. It reflects my experience with the final-check.sh error. -- @jimwhite

Summary

thmfiles (which drives Proofs/<level>.events) and the .proof files are
maintained by two different mechanisms: the thmfiles entry is an ACL2 event,
so it is subject to local rollback, while the .proof file is a side effect of
%theorem-check → compact-write-file and is written either way. A local
proof therefore still writes Proofs/<libdir>/thm-<name>.proof, silently
overwriting the proof that the manifest refers to.

Steps to reproduce

cd books/projects/milawa/ACL2
make                    # single-threaded (-j 1); completes successfully
cd ..
./final-checks.sh sbcl sbcl-linux64

Levels base … level8 check. level9 fails at its second event:

10630> VERIFY ALL-EQUALP-REMOVAL
;; Reading from Proofs/level9/thm-all-equalp-removal.proof
;; Checking the proof took 0.01 seconds
Unhandled COMMON-LISP:SIMPLE-ERROR:
  The proof was rejected
...
Error: level9.sbcl-linux64 does not exist.

It is not The proof does not have the right conclusion, so the file proves the
right statement — it is simply not a valid proof at that point in the manifest.

Root cause

ALL-EQUALP-REMOVAL is proved in three level-9 books: theoryp-aux.lisp:39
(global) and eqdatabasep.lisp:49 and add-equality.lisp:209 (both local,
made local by c1b77f4 to avoid a redundancy error).

GENERATE-FILENAME (interface/core.lisp) derives the file name from the libdir
and the event name only, so all three write the same path. The build logs show it:

theoryp-aux.out:402    ;; Proof accepted.  Saving as level9/thm-all-equalp-removal.proof
eqdatabasep.out:344    ;; Proof accepted.  Saving as level9/thm-all-equalp-removal.proof
add-equality.out:15134 ;; Proof accepted.  Saving as level9/thm-all-equalp-removal.proof

local suppresses the thmfiles update but not the file write, so the manifest
entry comes from the one global proof and keeps its position (line 3 of
level9.events, ahead of every DEFINE in that level), while the file content
comes from whichever book finished last (add-equality). Deterministic with
-j 1: this is ordering, not a data race.

The overwriting proof was produced in a world that already had eqdatabasep's
definitions, so it cites their definition axioms — none of which exist yet at the
manifest position of the event:

axiom cited admitted at Proofs/level9.events line
RW.EQSET 1051
RW.EQTRACE-LIST-LOOKUP 1256
RW.EQTRACE-LIST-UPDATE 1311
RW.EQSET-EXTEND 1363
(the event itself) 3

so logic.axiom-okp fails and logic.proofp returns nil.

Same level8.sbcl-linux64, same single event, only the file swapped: the
overwriting proof (337,538 bytes) is rejected; the global proof (330,067 bytes)
is accepted in 0.14 s.

This is the mirror image of #2078, where the thmfiles entry exists but no file
is written. Both need the same invariant: a proof file and its thmfiles entry
must be produced by one and the same event.

Proposed fix (PR to follow)

  1. local should not write a manifest-named proof file — i.e. %theorem-check
    / the %saving path should be inert for events whose registration will be
    rolled back. This is the question already posed in the source ("Should local
    mean not writing the file?").
  2. Make the file name identify the writer (e.g. include the certifying book)
    so two books cannot collide. This also removes the concurrent-writer hazard
    that GENERATE-FILENAME's seed-random$ hack currently papers over.
  3. Check the invariant when serializing, in %save-events-fn: fail with a
    message naming the event if a thmfiles entry references a missing proof
    file. That would have caught Milawa final-check.sh failure for DEFINITION-OF-NOT (Proofs/level4/admit-definition-of-not.proofs) #2078 at build time rather than at
    final-checks.sh time.

Note for the implementation: the event cannot simply be renamed, because
%autoprove NAME takes the rule's statement from an existing ACL2 rule of the
same name (create-rule-from-acl2), and the event cannot be dropped from the
manifest either, since later level-9 proofs (%enable default all-equalp-removal)
and cite it as a theorem appeal.

Interim workaround in use

At the two local duplicates, suppress only the write:

(local
 (ACL2::progn
  (%saving nil)
  (%autoprove all-equalp-removal ...)
  (%saving t)))

Only theoryp-aux then writes the canonical file, and level 9 replays clean
(EXIT=0, 9m10s, no rejected proofs, level9.sbcl-linux64 written). This is a
three-call-site workaround, not a fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions