Skip to content

Commit 06e3d78

Browse files
committed
fix(p037-rocq): make assumptions audit fail closed
check.sh's Audit.v/ElectionAudit.v checks piped rocq compile's output into grep and swallowed the whole pipeline's exit status with a trailing `|| true`. That masked two real failure modes: rocq compile itself failing (despite `set -o pipefail`), and a future "Axioms:" line, which grep would print and still let the script exit 0 for. Replace both with a check_audit() helper that checks the compile's own exit code explicitly, then requires the exact expected count of "Closed under the global context" lines (10 for Audit.v, 6 for ElectionAudit.v) and zero "Axioms:" lines, failing loudly on any mismatch. Verified via disposable (never committed) hostile mutations: a syntax error injected into Audit.v now makes check.sh exit non-zero instead of silently passing; an axiom-dependent theorem appended to Audit.v is now rejected instead of merely printed. Restoring the pristine files then reproduces the original clean PASS (10/10, 6/6). Also dropped the undocumented `bc` dependency, used only for cosmetic per-file timing that README never declared as a toolchain requirement. No theorem, proof, kernel, or production change. Re-verified: check.sh PASS; 11/11 + 4/4 mutants killed; election_loc_gate.py 111/180; ruff check . passes; diff against rust/, frontend/, ownlang/, formal/p037-kernel/ is empty; Phase-B instrument_identity and B_treatment_head/B_after_evidence are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AN6xHbpovxrmZ4AMjS7WQA
1 parent e4c73f4 commit 06e3d78

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

‎formal/p037-rocq/check.sh‎

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,40 @@ if ! cmp -s "$fresh" theories/RustTables.v; then
2323
fi
2424

2525
for f in Lfp P037 RustTables Correspondence Election; do
26-
t0=$(date +%s.%N)
2726
rocq compile "${W[@]}" -Q theories PlainSpike "theories/$f.v" > /dev/null
28-
printf ' %-18s %.1fs\n' "$f.v" "$(echo "$(date +%s.%N) - $t0" | bc)"
27+
echo " $f.v compiled"
2928
done
29+
30+
# The assumptions audit fails closed: a failed compile, a missing "Closed
31+
# under the global context" line, or any "Axioms:" line are hard failures,
32+
# never just displayed and ignored. The exact expected count is pinned per
33+
# file so a silently dropped or silently added Print Assumptions line is
34+
# also caught, not just an outright axiom.
35+
check_audit() {
36+
local file="$1" want="$2" out closed axioms
37+
out=$(mktemp)
38+
if ! rocq compile "${W[@]}" -Q theories PlainSpike "theories/$file.v" > "$out" 2>&1; then
39+
echo "FAIL: $file.v failed to compile:" >&2
40+
cat "$out" >&2
41+
rm -f "$out"
42+
return 1
43+
fi
44+
cat "$out"
45+
closed=$(grep -c "^Closed under the global context$" "$out" || true)
46+
axioms=$(grep -c "^Axioms:" "$out" || true)
47+
rm -f "$out"
48+
if [ "$axioms" -ne 0 ]; then
49+
echo "FAIL: $file.v reports $axioms axiom-dependent result(s) -- expected none." >&2
50+
return 1
51+
fi
52+
if [ "$closed" -ne "$want" ]; then
53+
echo "FAIL: $file.v reports $closed \"Closed under the global context\" result(s)," \
54+
"expected exactly $want." >&2
55+
return 1
56+
fi
57+
}
58+
3059
echo "--- Audit.v ---"
31-
rocq compile "${W[@]}" -Q theories PlainSpike theories/Audit.v | grep -E "Closed|Axioms|^[A-Za-z_]+ :" || true
60+
check_audit Audit 10
3261
echo "--- ElectionAudit.v ---"
33-
rocq compile "${W[@]}" -Q theories PlainSpike theories/ElectionAudit.v | grep -E "Closed|Axioms|^[A-Za-z_]+ :" || true
62+
check_audit ElectionAudit 6

0 commit comments

Comments
 (0)