# SPDX-License-Identifier: MPL-2.0 name: Agda proofs # # The Agda leg of every theory theorem here: scripts/check-agda.sh runs the # canonical invocation (standards PROOF-POLICY §2.1), with -Werror, over the # core, the unit tests and the expected rejections. The receipt step records # what a Proof Witness Grade is derived from (PROOF-POLICY §8.2): the source # commit, the Agda version, the installed package's digest and the flags. # # DEVIATION (PROOF-POLICY §6), state: open. # Leg: the Agda leg of every theorem in docs/status/PROOF-STATUS.adoc. # Image: the job runs in debian:trixie-slim pinned by digest (§8.2: isolated, # the receipt names the image). # Tool: Debian trixie agda-bin 2.6.4.3-1+b2, asserted below; apt checks # the .deb against Debian's signed Packages index, and the receipt # step prints that index's SHA256 for the package and the digest of # the installed binary. # Why: this repository has no Guix manifest and no proof container of its # own yet; the hosted runner has no Guix. The digest-pinned Debian # image and the exact, signature-checked package are the pin. # Closes: when a Guix manifest (or the repo's container) provides Agda and # this job installs from it. on: push: branches: [main] pull_request: permissions: contents: read jobs: proofs: name: Core proofs and expected rejections runs-on: ubuntu-latest timeout-minutes: 15 # Pinned by digest (PROOF-POLICY §8.2); re-pin deliberately. container: debian:trixie-slim@sha256:a29215f6a35e51e22adffa17f89e9d2ef06214e64a2bad10d765c46aea49f11f steps: - name: Install the pinned prover run: | apt-get update apt-get install --no-install-recommends -y ca-certificates git agda-bin=2.6.4.3-1+b2 - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: Verify the checked Agda version run: test "$(agda --version)" = 'Agda version 2.6.4.3' - name: Postulate scanner tests run: bash tests/scan_postulates_test.sh - name: Gate stops when find cannot list the import cone 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 env: SOURCE_SHA: ${{ github.sha }} run: | set -eu { echo "## Agda leg receipt" echo "" echo "- source commit: \`$SOURCE_SHA\`" echo "- checker: \`$(agda --version)\`" echo "- image: \`debian:trixie-slim@sha256:a29215f6a35e51e22adffa17f89e9d2ef06214e64a2bad10d765c46aea49f11f\` (isolated, pinned by digest)" echo "- package: \`agda-bin $(dpkg-query -W -f='${Version}' agda-bin)\`, index SHA256 \`$(apt-cache show agda-bin=2.6.4.3-1+b2 | sed -n 's/^SHA256: //p' | head -1)\`" echo "- binary SHA256: \`$(sha256sum "$(command -v agda)" | cut -d' ' -f1)\`" echo "- invocation: \`$(sed -n 's/^flags=(\(.*\))$/\1/p' scripts/check-agda.sh)\`" echo "- import cone: \`src/ResourceAlgebra/All.agda\`, first-party only (\`--no-libraries\`), 0 postulates (\`--safe\`)" echo "- trusted base (prover-supplied postulates, name and binding, checked by the gate): \`$(paste -sd';' _build/check-logs/trusted-base.txt)\`" echo "- input SHA256 (all of \`src/\`, sorted): \`$(find src -name '*.agda' | LC_ALL=C sort | xargs sha256sum | sha256sum | cut -d' ' -f1)\`" } >> "$GITHUB_STEP_SUMMARY" # Lean recheck leg (PROOF-POLICY §2): re-proved by hand, Lean core only. # The qualifying run is `lake build` (§8.2, owner ruling 2026-11-17), in a # container image pinned by digest, which the receipt names (§8.2, owner # ruling 2026-11-16). # DEVIATION (§6), state: open. # Leg: the Lean leg of every theorem in docs/status/PROOF-STATUS.adoc. # Image: ubuntu:24.04 pinned by digest (the same digest as januskey's # recheck job). # Tool: Lean 4.35.0 with Lake, the upstream release archive, checked # against the SHA256 below; the version is asserted against # lean-toolchain, and Lake's version is asserted too. # Why: no Guix manifest or proof container provides Lean here yet. # Closes: when a Guix manifest (or the repo's container) provides Lean. lean-leg: name: Lean recheck leg runs-on: ubuntu-latest timeout-minutes: 15 # ubuntu:24.04, resolved 2026-11-16; re-pin deliberately. Job containers # run as root, so apt needs no sudo. container: ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8 env: LEAN_VERSION: '4.35.0' LEAN_SHA256: '7289597a44543246c9227b8cae501767e095ce17f6d448b95fc4a8dc97268f6d' DEBIAN_FRONTEND: noninteractive defaults: run: shell: bash steps: - name: Install the pinned Lean run: | set -euo pipefail apt-get update apt-get install --no-install-recommends -y ca-certificates curl git zstd curl --proto '=https' --tlsv1.2 --fail --silent --show-error --location \ --output "$RUNNER_TEMP/lean.tar.zst" \ "https://github.com/leanprover/lean4/releases/download/v${LEAN_VERSION}/lean-${LEAN_VERSION}-linux.tar.zst" echo "${LEAN_SHA256} $RUNNER_TEMP/lean.tar.zst" | sha256sum --check --strict mkdir -p /opt/lean tar --zstd -xf "$RUNNER_TEMP/lean.tar.zst" -C /opt/lean rm "$RUNNER_TEMP/lean.tar.zst" echo "/opt/lean/lean-${LEAN_VERSION}-linux/bin" >> "$GITHUB_PATH" - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: Verify the checked Lean and Lake versions run: | set -euo pipefail test "$(cat verification/proofs/lean4/lean-toolchain)" = "leanprover/lean4:v${LEAN_VERSION}" lean --version | grep -F "version ${LEAN_VERSION}," lake --version | grep -F "Lean version ${LEAN_VERSION})" - name: Lean leg run: bash scripts/check-proofs.sh lean4 - name: Leg check fails on a failed build, an axiom or a rewritten manifest run: bash tests/check_lean_leg_test.sh - name: Axioms under lake, and receipt env: SOURCE_SHA: ${{ github.sha }} run: | set -euo pipefail # A counted witness lists its axioms (§8.4). The leg is recorded as # axiom-free, so every printed theorem must say so; the script takes # that census from `lake build`. result="$(bash scripts/check-lean-leg.sh | tee /dev/stderr | tail -1)" src=verification/proofs/lean4 { echo "## Lean leg receipt" echo "" echo "- source commit: \`$SOURCE_SHA\`" echo "- image: \`ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8\` (isolated, pinned by digest)" echo "- checker: \`$(lean --version)\`, \`$(lake --version)\`" echo "- archive SHA256: \`$LEAN_SHA256\`" echo "- invocation: \`lake build\` in a copy of \`$src\` made by \`bash scripts/check-lean-leg.sh\` (core only, no Mathlib, no dependencies)" for f in ResourceAlgebra.lean lakefile.toml lake-manifest.json lean-toolchain; do echo "- input \`$f\` SHA256: \`$(sha256sum "$src/$f" | cut -d' ' -f1)\`" done echo "- script SHA256: \`$(sha256sum scripts/check-lean-leg.sh | cut -d' ' -f1)\`" echo "- axioms: ${result#PASS: Lean leg under lake; }" } >> "$GITHUB_STEP_SUMMARY" - name: Bridge check fails on a broken or axiom-dependent bridge run: bash tests/check_lean_bridge_test.sh # M-2: MaxPlus agrees with tropical-types' Tropical semiring. The bridge # imports one file of hyperpolymath/tropical-types at the commit # scripts/check-lean-bridge.sh pins (PROOF-POLICY §8.5.1, imported # repositories). - name: M-2 bridge to tropical-types, and receipt env: SOURCE_SHA: ${{ github.sha }} run: | set -euo pipefail out="$(bash scripts/check-lean-bridge.sh)" echo "$out" br=verification/bridges/tropical-types { echo "## M-2 bridge receipt" echo "" echo "- source commit: \`$SOURCE_SHA\`" echo "- image: \`ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8\` (isolated, pinned by digest)" echo "- checker: \`$(lean --version)\`, \`$(lake --version)\`" echo "- invocation: \`lake build\` in a work directory made by \`bash scripts/check-lean-bridge.sh\`" sed -n 's/^import: \(.*\) \(.*\) \(.*\) \(.*\)$/- import: `\1` at `\2`, `\3` SHA256 `\4`/p' <<<"$out" sed -n 's/^bridge: \(.*\) \(.*\)$/- bridge: `\1` SHA256 `\2`/p' <<<"$out" for f in "$br/lakefile.toml" "$br/lake-manifest.json" verification/proofs/lean4/lean-toolchain verification/proofs/lean4/ResourceAlgebra.lean scripts/check-lean-bridge.sh; do echo "- input \`$f\` SHA256: \`$(sha256sum "$f" | cut -d' ' -f1)\`" done sed -n 's/^PASS: .*; \(.*\)$/- axioms: \1/p' <<<"$out" } >> "$GITHUB_STEP_SUMMARY" # Rocq recheck leg (PROOF-POLICY §2): re-proved by hand. Dedukti transport # is unavailable for this development (docs/status/PROOF-STATUS.adoc). # DEVIATION (§6), state: open. # Leg: the Rocq leg of every theorem in docs/status/PROOF-STATUS.adoc. # Tool: the upstream rocq/rocq-prover:9.3.0 image (Rocq 9.3.0, stdlib # 9.2.0), pinned by digest; the version is asserted below. # Why: no Guix manifest or proof container provides Rocq here yet. # Closes: when a Guix manifest (or the repo's container) provides Rocq. rocq-leg: name: Rocq recheck leg runs-on: ubuntu-latest timeout-minutes: 20 container: image: rocq/rocq-prover:9.3.0@sha256:97a68f230e785726c3bab4ba17e1d416fdd630de4af4548eb49b08712f29af93 # The image's user cannot write the runner's workspace. Job containers # skip the image's `opam exec` entrypoint, so a step puts its switch on PATH. options: --user root env: OPAMROOT: /home/rocq/.opam defaults: run: shell: bash steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: Put the image's opam switch on PATH run: | set -euo pipefail # The image has one switch; take its bin directory directly rather # than run opam as root on the rocq user's opam root. mapfile -t found < <(ls -d "$OPAMROOT"/*/bin/rocq 2>/dev/null) [ "${#found[@]}" -eq 1 ] || { echo "::error::expected one rocq under $OPAMROOT, found ${#found[@]}"; exit 1; } dirname "${found[0]}" >> "$GITHUB_PATH" - name: Verify the checked Rocq version run: | set -euo pipefail rocq --version | grep -F "version 9.3.0" - name: Rocq leg run: bash scripts/check-proofs.sh coq - name: Assumptions and receipt env: SOURCE_SHA: ${{ github.sha }} run: | set -euo pipefail cd verification/proofs/coq out="$(rocq compile ResourceAlgebra.v 2>&1)" n_print="$(grep -c '^Print Assumptions' ResourceAlgebra.v)" n_closed="$(grep -c 'Closed under the global context' <<<"$out" || true)" # Every printed theorem must rest on no axiom at all (§8.4). if [ "$n_closed" != "$n_print" ]; then echo "::error::only $n_closed of $n_print theorems are closed under the global context"; echo "$out"; exit 1 fi rocqchk -R . "" -norec ResourceAlgebra >/dev/null { echo "## Rocq leg receipt" echo "" echo "- source commit: \`$SOURCE_SHA\`" echo "- checker: \`$(rocq --version | head -1)\`, image \`rocq/rocq-prover:9.3.0@sha256:97a68f23…\`" echo "- invocation: \`rocq compile ResourceAlgebra.v\` in \`verification/proofs/coq\`, then \`rocqchk\`" echo "- input SHA256: \`$(sha256sum ResourceAlgebra.v | cut -d' ' -f1)\`" echo "- assumptions: $n_closed of $n_print printed theorems closed under the global context" } >> "$GITHUB_STEP_SUMMARY" # Declared coverage exemption (see .machine_readable/coverage-exemption.toml). # The live Branch-Floor ruleset carries an 80% code_coverage rule; a prover-only # repository has no runtime code to measure. The exemption is declared in a # file and checked here, so it cannot go stale silently. coverage-exemption: name: Coverage exemption holds runs-on: ubuntu-latest timeout-minutes: 5 steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: Declared exemption is still true run: bash scripts/check-coverage-exemption.sh # Receipt gate (PROOF-POLICY §8.5.1 and §8.5.3). `scripts/proof-receipt.sh # --check` fetches the pinned shared generator, regenerates the proof receipt # (verification/receipts/), refuses any difference from the committed file, # runs the §8.5.3 git checks, checks that each current receipt still describes # the tree, and runs the pinned reader with a negative control. It needs # network access to raw.githubusercontent.com (the pinned standards files) # and github.com (the pinned tropical-types commit). Recording a new run is a # manual step (--run-row, then --write); this job only checks. receipt: name: Proof receipt, derived grades, git checks runs-on: ubuntu-latest timeout-minutes: 10 env: BUN_VERSION: 1.4.4 BUN_SHA256: bf8ccbfb2b0b80159e0f9a6d15c55317add8077534dbc6130a3edb52fccb395c steps: - name: Install the pinned Bun run: | curl --proto '=https' --tlsv1.2 -sSfL -o bun.zip \ "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-x64.zip" echo "${BUN_SHA256} bun.zip" | sha256sum -c - unzip -q bun.zip -d "$RUNNER_TEMP" rm bun.zip echo "$RUNNER_TEMP/bun-linux-x64" >> "$GITHUB_PATH" - name: Checkout (full history; the git checks refuse a shallow clone) uses: actions/checkout@v7.0.1 with: persist-credentials: false fetch-depth: 0 - name: Verify the checked Bun version run: test "$(bun --version)" = "${BUN_VERSION}" - name: Receipt, reader, git checks, freshness run: bash scripts/proof-receipt.sh --check # The in-workflow verdict `Proofs verdict` (NOT the required context: `CI/gate` # of the live Branch-Floor ruleset 25434034 is a commit status published by # ci-gate.yml, the only producer of it). It aggregates every other job in this workflow # with `needs:` and fails # unless ALL of them succeeded: failure, cancellation and skipping all fail, # so it is never a rubber stamp. `if: always()` makes it run (and fail) when # a needed job fails instead of being skipped, which a required check would # report as passing-by-absence. tests/workflows/ci_gate_test.sh fails if a new # job is added here without being added to `needs:`. # Read-only permissions; the one `uses:` is the checkout already pinned in actions.lock. gate: name: Proofs verdict needs: [proofs, lean-leg, rocq-leg, coverage-exemption, receipt] if: ${{ always() }} runs-on: ubuntu-latest timeout-minutes: 5 permissions: contents: read steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - name: All required jobs succeeded env: NEEDS_JSON: ${{ toJSON(needs) }} run: bash scripts/ci-gate.sh