From 8152ee241a1b338d280f30e1108f77ecb1d96067 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 18:14:25 +0000 Subject: [PATCH] proofs: the Agda gate suppresses no warning scripts/check-agda.sh passed -W error -W noUnsupportedIndexedMatch. Since 2026-11-09 the order and the injectivity lemmas are stated so the core raises no UnsupportedIndexedMatch under --cubical-compatible, so the suppression hid nothing; it only let a new indexed match pass unseen. Drop it, so -W error covers every warning (owner decision: restate at source and fail on any warning). tests/check_agda_warning_gate_test.sh reads the gate's flags as proofs.yml does and checks tests/warning/IndexedMatch.agda, whose one clause needs injectivity of suc. The fixture checks without -W error; the gate's flags refuse it. Against the old flags the test fails. proofs.yml runs it. PROOF-STATUS and PROOF-NEEDS describe the new invocation. Receipts already recorded keep the invocation they ran with. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Y6FD63UrriRBHqmhhEca9t --- .github/workflows/proofs.yml | 2 ++ CHANGELOG.adoc | 13 ++++++++ docs/status/PROOF-NEEDS.adoc | 4 +-- docs/status/PROOF-STATUS.adoc | 7 ++-- scripts/check-agda.sh | 6 ++-- tests/check_agda_warning_gate_test.sh | 46 +++++++++++++++++++++++++++ tests/warning/IndexedMatch.agda | 17 ++++++++++ 7 files changed, 89 insertions(+), 6 deletions(-) create mode 100755 tests/check_agda_warning_gate_test.sh create mode 100644 tests/warning/IndexedMatch.agda diff --git a/.github/workflows/proofs.yml b/.github/workflows/proofs.yml index 46c62f7..d7cd683 100644 --- a/.github/workflows/proofs.yml +++ b/.github/workflows/proofs.yml @@ -46,6 +46,8 @@ jobs: run: bash tests/check_agda_find_failure_test.sh - name: Gate stops on a postulate outside the prover's named trusted base run: bash tests/check_agda_trusted_base_test.sh + - name: Gate refuses any Agda warning, UnsupportedIndexedMatch included + run: bash tests/check_agda_warning_gate_test.sh - name: Core proofs and expected rejections run: bash scripts/check-agda.sh - name: Proof receipt diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a2dbf89..242274d 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,5 +1,18 @@ == Changelog +== 2026-11-16 — The Agda gate suppresses no warning + +* `scripts/check-agda.sh` drops `-W noUnsupportedIndexedMatch`. Since + 2026-11-09 the order and the injectivity lemmas are stated so the core + raises no `UnsupportedIndexedMatch` under `--cubical-compatible`, so the + suppression hid nothing. With it gone, `-W error` covers every warning. +* `tests/check_agda_warning_gate_test.sh` with the fixture + `tests/warning/IndexedMatch.agda`: the fixture checks without `-W error`, + and the gate's own flags refuse it. Against the old flags the test fails. + `proofs.yml` runs it. +* `PROOF-STATUS.adoc` and `PROOF-NEEDS.adoc` describe the new invocation. + Receipts already recorded keep the invocation they ran with. + == 2026-11-11 — Proof receipt and grades at f211fc1 * `verification/receipts/resource-algebra-proofs_praxis.deed`: the proof diff --git a/docs/status/PROOF-NEEDS.adoc b/docs/status/PROOF-NEEDS.adoc index 8f20b57..ee4f85b 100644 --- a/docs/status/PROOF-NEEDS.adoc +++ b/docs/status/PROOF-NEEDS.adoc @@ -46,8 +46,8 @@ they were removed with those files on 2026-11-09. | PN-1 | Every theorem in `PROOF-STATUS.adoc` checks in Agda under the canonical invocation `--safe --without-K --cubical-compatible` (policy §2.1), with no -postulates, holes or libraries, under `-W error` (only -`UnsupportedIndexedMatch` is suppressed) and the estate strict flag set. +postulates, holes or libraries, under `-W error` (no warning suppressed) +and the estate strict flag set. | `scripts/check-agda.sh`; CI `proofs.yml` | PN-2 diff --git a/docs/status/PROOF-STATUS.adoc b/docs/status/PROOF-STATUS.adoc index b61abeb..c3db0fe 100644 --- a/docs/status/PROOF-STATUS.adoc +++ b/docs/status/PROOF-STATUS.adoc @@ -33,13 +33,16 @@ dependent type theories (§8.3). * *Invocation.* `scripts/check-agda.sh` runs `agda --safe --without-K --cubical-compatible --no-libraries --ignore-interfaces --double-check --W error -W noUnsupportedIndexedMatch -i src`, and every module also +-W error -i src`, and every module also declares `--exact-split --no-sized-types --no-guardedness` (the estate strict flag set, from main #21) over `src/ResourceAlgebra/All.agda`, the unit tests (`tests/unit/AllTests.agda`) and the nine expected rejections. A rejection must fail at its invalid declaration with the message its `-- EXPECT:` line names. A refusal with any other message fails the gate, and so does any -warning other than `UnsupportedIndexedMatch`. +warning, `UnsupportedIndexedMatch` included. Until 2026-11-16 the gate +suppressed that one warning; the core raised none, and +`tests/check_agda_warning_gate_test.sh` now shows the gate's flags refuse +an indexed match. * *Import cone.* Only `src/ResourceAlgebra/`: no standard library and no other library. There is no `postulate` (refused by `--safe`), no hole and no `TERMINATING` or similar pragma. diff --git a/scripts/check-agda.sh b/scripts/check-agda.sh index 2afe0bf..1220ad5 100755 --- a/scripts/check-agda.sh +++ b/scripts/check-agda.sh @@ -8,10 +8,12 @@ prover="${AGDA:-agda}" "$prover" --version # The canonical theory-proof invocation (standards PROOF-POLICY §2.1, # 2026-11-01) is --safe --without-K --cubical-compatible. -W error makes any -# warning a failure, except UnsupportedIndexedMatch, which is suppressed. +# warning a failure, UnsupportedIndexedMatch included: the order and the +# injectivity lemmas are stated so the cone raises none, and +# tests/check_agda_warning_gate_test.sh shows these flags refuse one. # --no-libraries keeps the import cone first-party (no standard library); # --double-check re-checks every term with the core type checker. -flags=(--safe --without-K --cubical-compatible --no-libraries --ignore-interfaces --double-check -W error -W noUnsupportedIndexedMatch -i src) +flags=(--safe --without-K --cubical-compatible --no-libraries --ignore-interfaces --double-check -W error -i src) # PROOF-POLICY §8.4.6: a comment-aware postulate scan of the import cone # (src/), alongside --safe. scripts/scan-postulates.pl reads each file in # source order (nested block comments, line comments, strings) and fails on diff --git a/tests/check_agda_warning_gate_test.sh b/tests/check_agda_warning_gate_test.sh new file mode 100755 index 0000000..96f3c4b --- /dev/null +++ b/tests/check_agda_warning_gate_test.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +# The Agda gate must fail on any warning, UnsupportedIndexedMatch included: +# the order and the injectivity lemmas were restated so the cone raises +# none, and nothing is suppressed. The test reads the flags from +# scripts/check-agda.sh, as proofs.yml does, and checks +# tests/warning/IndexedMatch.agda, whose one clause needs injectivity of +# suc. Agda 2.6.3 does not print the warning's name when it is an error, so +# the test matches the reason Agda gives, which every version prints. +# Control: without -W error the fixture checks, so the gate's refusal +# comes from the warning alone. Case: with the gate's flags Agda must stop, +# naming UnsupportedIndexedMatch. +set -uo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +export LC_ALL="${LC_ALL:-C.UTF-8}" +prover="${AGDA:-agda}" +command -v "$prover" >/dev/null || { echo "FAIL: no Agda on PATH" >&2; exit 1; } +line=$(sed -n 's/^flags=(\(.*\))$/\1/p' scripts/check-agda.sh) +[[ -n "$line" ]] || { echo "FAIL: no flags=(...) line in scripts/check-agda.sh" >&2; exit 1; } +read -r -a gate <<<"$line" +fixture=tests/warning/IndexedMatch.agda +fail=0 + +# Control: the gate's flags with every -W pair removed. +loose=() +for ((i = 0; i < ${#gate[@]}; i++)); do + if [[ "${gate[i]}" == -W ]]; then ((i++)); continue; fi + loose+=("${gate[i]}") +done +if out=$("$prover" "${loose[@]}" -i tests/warning "$fixture" 2>&1); then + echo "PASS: control: the fixture checks once warnings are not errors" +else + printf 'FAIL: control: the fixture does not check even without -W error\n%s\n' "$(tail -5 <<<"$out")" >&2; fail=1 +fi + +# Case: the gate's own flags. +out=$("$prover" "${gate[@]}" -i tests/warning "$fixture" 2>&1); rc=$? +if [[ $rc -eq 0 ]]; then + echo "FAIL: the gate's flags accepted an indexed match: UnsupportedIndexedMatch is not an error" >&2; fail=1 +elif ! grep -q 'injectivity of the data constructor suc' <<<"$out"; then + printf 'FAIL: Agda stopped for another reason (exit %s)\n%s\n' "$rc" "$(tail -5 <<<"$out")" >&2; fail=1 +else + echo "PASS: the gate's flags refuse an indexed match (exit $rc): UnsupportedIndexedMatch" +fi +exit "$fail" diff --git a/tests/warning/IndexedMatch.agda b/tests/warning/IndexedMatch.agda new file mode 100644 index 0000000..9c265de --- /dev/null +++ b/tests/warning/IndexedMatch.agda @@ -0,0 +1,17 @@ +{-# OPTIONS --safe --without-K --cubical-compatible #-} +-- SPDX-License-Identifier: MPL-2.0 +-- SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +-- +-- Negative control for the Agda gate's warning policy. The clause below +-- matches refl on suc m ≡ suc n, which needs injectivity of suc. Under +-- --cubical-compatible Agda warns (UnsupportedIndexedMatch) that it will +-- not compute along transports. The module is otherwise valid: it checks +-- without -W error. tests/check_agda_warning_gate_test.sh requires the +-- gate's own flags to refuse it. +module IndexedMatch where + +open import Agda.Builtin.Nat using (Nat; suc) +open import Agda.Builtin.Equality using (_≡_; refl) + +suc-injective : ∀ {m n : Nat} → suc m ≡ suc n → m ≡ n +suc-injective refl = refl