Repository navigation
formal/agda: pin Agda 2.7.0.1; prove usability from --cubical (agda/cubical v0.8) #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow is managed by gh actions-lock. | |
| # SPDX-License-Identifier: MPL-2.0 | |
| # This workflow is managed by gh actions-lock. | |
| # This workflow is managed by gh actions-lock. | |
| # Coq/Rocq proof gate for the `formal/` mechanised-metatheory track (issue #513). | |
| # | |
| # This gate is deliberately FAIL-CLOSED. It does NOT probe for the prover and | |
| # skip when absent — the container guarantees `coqc` exists, so a missing | |
| # prover is an infrastructure failure, not a silent pass. | |
| # | |
| # `formal/justfile` remains the single source of truth for the proof list and | |
| # its dependency order; this workflow parses that list rather than duplicating | |
| # it, and fails if any `formal/*.v` on disk is not named there. | |
| name: Coq Proof Gate | |
| on: | |
| pull_request: | |
| paths: | |
| - 'formal/**' | |
| - '.github/workflows/coq-proof-gate.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'formal/**' | |
| - '.github/workflows/coq-proof-gate.yml' | |
| workflow_dispatch: | |
| permissions: read-all | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| coq-proofs: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| # The image ships bash 5.2, but GitHub fell back to `sh -e {0}` (dash) on | |
| # the first run, which rejects `set -o pipefail` and the bash-only string | |
| # operations below. Declare the shell explicitly rather than depending on | |
| # the runner's detection. | |
| defaults: | |
| run: | |
| shell: bash | |
| container: | |
| # coqorg/coq:8.20 — pinned by digest. `formal/README.adoc` documents 8.18; | |
| # the corpus was verified to check clean on 8.20.1 (deprecation warnings | |
| # for `app_length` only, no errors). | |
| image: coqorg/coq@sha256:e50d77c4c5a9aa0d76ae1b343d79c5f922da3a75054b79c5dc635895438e4674 | |
| options: --user root | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| # The coqorg images install Coq into an opam switch owned by the `coq` | |
| # user and put it on PATH via an ENTRYPOINT wrapper. GitHub Actions | |
| # overrides the entrypoint for job containers, so that wrapper never | |
| # runs and `coqc` is not on PATH — the switch has to be added by hand. | |
| # Globbed rather than hard-coded so an image bump does not silently | |
| # break the gate; fails loudly if the switch cannot be located. | |
| - name: Put the image's opam switch on PATH | |
| run: | | |
| set -euo pipefail | |
| sw="$(ls -d /home/coq/.opam/*/bin 2>/dev/null | head -1 || true)" | |
| if [ -z "$sw" ] || [ ! -x "$sw/coqc" ]; then | |
| echo "::error::could not locate coqc in the image's opam switch" | |
| exit 1 | |
| fi | |
| echo "$sw" >> "$GITHUB_PATH" | |
| echo "added $sw to PATH" | |
| # The coqorg images install Coq into an opam switch owned by the `coq` | |
| # user and put it on PATH via an ENTRYPOINT wrapper. GitHub Actions | |
| # overrides the entrypoint for job containers, so that wrapper never | |
| # runs and `coqc` is not on PATH — the switch has to be added by hand. | |
| # Globbed rather than hard-coded so an image bump does not silently | |
| # break the gate; fails loudly if the switch cannot be located. | |
| - name: Put the image's opam switch on PATH | |
| run: | | |
| set -euo pipefail | |
| sw="$(ls -d /home/coq/.opam/*/bin 2>/dev/null | head -1 || true)" | |
| if [ -z "$sw" ] || [ ! -x "$sw/coqc" ]; then | |
| echo "::error::could not locate coqc in the image's opam switch" | |
| exit 1 | |
| fi | |
| echo "$sw" >> "$GITHUB_PATH" | |
| echo "added $sw to PATH" | |
| - name: Record prover version | |
| run: coqc --version | |
| - name: Extract the ordered proof list from formal/justfile | |
| id: list | |
| run: | | |
| set -euo pipefail | |
| cd formal | |
| list="$(sed -n '/for f in /,/; do/p' justfile \ | |
| | tr '\n' ' ' \ | |
| | sed 's/.*for f in //; s/; do.*//; s/\\//g' \ | |
| | tr -s ' ')" | |
| if [ -z "${list// /}" ]; then | |
| echo "::error::could not parse the proof list out of formal/justfile" | |
| exit 1 | |
| fi | |
| echo "count=$(printf '%s' "$list" | wc -w)" | |
| echo "list=$list" >> "$GITHUB_OUTPUT" | |
| - name: Guard — every formal/*.v must be wired into the gate | |
| env: | |
| LIST: ${{ steps.list.outputs.list }} | |
| run: | | |
| set -euo pipefail | |
| cd formal | |
| missing=0 | |
| for f in *.v; do | |
| b="${f%.v}" | |
| case " $LIST " in | |
| *" $b "*) ;; | |
| *) echo "::error file=formal/$f::proof file is not listed in formal/justfile — it would never be checked"; missing=1 ;; | |
| esac | |
| done | |
| [ "$missing" -eq 0 ] || exit 1 | |
| echo "all on-disk proofs are wired into the gate" | |
| - name: Type-check every proof and reject any axiom / Admitted | |
| env: | |
| LIST: ${{ steps.list.outputs.list }} | |
| run: | | |
| set -euo pipefail | |
| cd formal | |
| all="" | |
| for f in $LIST; do | |
| echo "== coqc $f.v ==" | |
| o="$(coqc -Q . ASFormal "$f.v")" | |
| printf '%s\n' "$o" | |
| all+="$o"$'\n' | |
| done | |
| # `Print Assumptions` emits "Axioms:" when a theorem depends on an | |
| # axiom or an `Admitted` proof; "Closed under the global context" | |
| # is the clean result. | |
| if printf '%s' "$all" | grep -q "Axioms:"; then | |
| echo "::error::a proof depends on an axiom / Admitted" | |
| exit 1 | |
| fi | |
| echo "OK: all proofs mechanised; no axioms." | |
| # Agda theory sources (formal/agda/, PROOF-POLICY §1). FAIL-CLOSED like the | |
| # Coq job: the recipe fails if `agda` is absent, and every `*.agda` under | |
| # formal/agda/ is checked without being listed. | |
| # | |
| # The estate's pinned Agda, 2.7.0.1 (mathesis `agda-proof-policy.yml`, | |
| # AGDA_VERSION): the official static Linux binary from the agda/agda v2.7.0.1 | |
| # release, verified against a SHA-256 pinned here before it is unpacked. | |
| # The usability check from `--cubical` uses agda/cubical v0.8 (the last | |
| # release supporting 2.7.0.1), fetched by commit SHA and asserted. | |
| # A green run is a real check on the pinned version; it is still not a | |
| # receipt (no recorded receipt, no Lean leg — formal/agda/README.adoc). | |
| agda-proofs: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| AGDA_CI_VERSION: "2.7.0.1" | |
| AGDA_TARBALL_URL: "https://github.com/agda/agda/releases/download/v2.7.0.1/Agda-v2.7.0.1-linux.tar.xz" | |
| AGDA_TARBALL_SHA256: "975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a" | |
| CUBICAL_REPO: "https://github.com/agda/cubical" | |
| CUBICAL_COMMIT: "3291fc1d8cae1409cc54d4f9cca7366158b573d7" # tag v0.8 | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| - name: Install just (Ubuntu package) | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq just | |
| - name: Install Agda 2.7.0.1 (release binary, SHA-256 pinned) | |
| run: | | |
| set -euo pipefail | |
| d="$RUNNER_TEMP/agda-dl"; mkdir -p "$d" | |
| curl -fsSL --proto =https --proto-redir =https --retry 3 -o "$d/agda.tar.xz" "$AGDA_TARBALL_URL" | |
| echo "${AGDA_TARBALL_SHA256} $d/agda.tar.xz" | sha256sum -c - | |
| tar -xJf "$d/agda.tar.xz" -C "$RUNNER_TEMP" | |
| root="$RUNNER_TEMP/Agda-v${AGDA_CI_VERSION}" | |
| echo "$root/bin" >> "$GITHUB_PATH" | |
| # The static binary's built-in data dir is the release builder's | |
| # path; point it at the unpacked primitives. | |
| echo "Agda_datadir=$root/data" >> "$GITHUB_ENV" | |
| - name: Fetch agda/cubical v0.8 (by commit SHA) | |
| run: | | |
| set -euo pipefail | |
| c="$RUNNER_TEMP/cubical" | |
| git init -q "$c" | |
| git -C "$c" fetch -q --depth 1 "$CUBICAL_REPO" "$CUBICAL_COMMIT" | |
| git -C "$c" checkout -q FETCH_HEAD | |
| test "$(git -C "$c" rev-parse HEAD)" = "$CUBICAL_COMMIT" | |
| echo "CUBICAL_DIR=$c" >> "$GITHUB_ENV" | |
| - name: Record and assert the prover version | |
| run: | | |
| set -euo pipefail | |
| agda --version | |
| just --version | |
| agda --version | head -1 | grep -qxF "Agda version ${AGDA_CI_VERSION}" | |
| - name: Check every Agda module under the canonical flags | |
| run: just -f formal/justfile check-agda | |
| - name: Planted controls — each must fail the gate | |
| run: just -f formal/justfile check-agda-controls | |
| - name: Usability from --cubical (agda/cubical v0.8) | |
| run: just -f formal/justfile check-agda-cubical | |
| - name: Planted controls — each must fail the --cubical check | |
| run: just -f formal/justfile check-agda-cubical-controls |