Skip to content

Commit 2ccc37c

Browse files
committed
formal/agda: pin Agda 2.7.0.1, prove usability from --cubical (cubical v0.8)
Agda 2.7.0.1 (the estate pin) replaces Ubuntu's 2.6.3 in the agda-proofs CI job: the official static release binary, SHA-256 pinned and verified before unpack (975b515a…db8a). Both theory modules check unchanged on 2.7.0.1 under --safe --without-K --cubical-compatible with no diagnostic; no proof or statement text changed. The five planted controls still fail the gate. New: formal/agda-cubical/CubicalCompat.agda, a --safe --cubical module in its own library depending on agda/cubical v0.8 (commit 3291fc1d…, the last release supporting 2.7.0.1; v0.9 needs 2.8.0). It imports every module under formal/agda/, re-exports theorems from each, and uses them as Paths via eqToPath (including a funext path for qplus). New recipes check-agda-cubical and check-agda-cubical-controls (5 planted failures, including a source that drops --cubical-compatible, which Agda refuses). Sources stay at --cubical-compatible; README records why and the pins. Still ungraded: no receipt, no Lean leg; the binary's digest is TOFU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4QvDfHidNin3g7itrbLfk
1 parent 464f7c6 commit 2ccc37c

7 files changed

Lines changed: 296 additions & 36 deletions

File tree

‎.github/workflows/coq-proof-gate.yml‎

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,56 @@ jobs:
143143
# Coq job: the recipe fails if `agda` is absent, and every `*.agda` under
144144
# formal/agda/ is checked without being listed.
145145
#
146-
# NOT the estate's pinned Agda. The proof lanes pin Agda 2.7.0.1 (mathesis
147-
# `agda-proof-policy.yml`); this job runs Ubuntu 24.04's `agda-bin`, 2.6.3,
148-
# and asserts that version so a silent package change fails the job. A run
149-
# here is a real check under the canonical flags but is not receipt-grade.
150-
# Provisioning 2.7.0.1 is an open owner decision (formal/agda/README.adoc).
146+
# The estate's pinned Agda, 2.7.0.1 (mathesis `agda-proof-policy.yml`,
147+
# AGDA_VERSION): the official static Linux binary from the agda/agda v2.7.0.1
148+
# release, verified against a SHA-256 pinned here before it is unpacked.
149+
# The usability check from `--cubical` uses agda/cubical v0.8 (the last
150+
# release supporting 2.7.0.1), fetched by commit SHA and asserted.
151+
# A green run is a real check on the pinned version; it is still not a
152+
# receipt (no recorded receipt, no Lean leg — formal/agda/README.adoc).
151153
agda-proofs:
152154
runs-on: ubuntu-24.04
153-
timeout-minutes: 15
155+
timeout-minutes: 20
154156
defaults:
155157
run:
156158
shell: bash
157159
env:
158-
AGDA_CI_VERSION: "2.6.3"
160+
AGDA_CI_VERSION: "2.7.0.1"
161+
AGDA_TARBALL_URL: "https://github.com/agda/agda/releases/download/v2.7.0.1/Agda-v2.7.0.1-linux.tar.xz"
162+
AGDA_TARBALL_SHA256: "975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a"
163+
CUBICAL_REPO: "https://github.com/agda/cubical"
164+
CUBICAL_COMMIT: "3291fc1d8cae1409cc54d4f9cca7366158b573d7" # tag v0.8
159165
steps:
160166
- uses: actions/checkout@v7.0.1
161167

162-
- name: Install Agda and just (Ubuntu packages)
168+
- name: Install just (Ubuntu package)
163169
run: |
164170
set -euo pipefail
165171
sudo apt-get update -qq
166-
sudo apt-get install -y -qq agda-bin just
172+
sudo apt-get install -y -qq just
173+
174+
- name: Install Agda 2.7.0.1 (release binary, SHA-256 pinned)
175+
run: |
176+
set -euo pipefail
177+
d="$RUNNER_TEMP/agda-dl"; mkdir -p "$d"
178+
curl -fsSL --retry 3 -o "$d/agda.tar.xz" "$AGDA_TARBALL_URL"
179+
echo "${AGDA_TARBALL_SHA256} $d/agda.tar.xz" | sha256sum -c -
180+
tar -xJf "$d/agda.tar.xz" -C "$RUNNER_TEMP"
181+
root="$RUNNER_TEMP/Agda-v${AGDA_CI_VERSION}"
182+
echo "$root/bin" >> "$GITHUB_PATH"
183+
# The static binary's built-in data dir is the release builder's
184+
# path; point it at the unpacked primitives.
185+
echo "Agda_datadir=$root/data" >> "$GITHUB_ENV"
186+
187+
- name: Fetch agda/cubical v0.8 (by commit SHA)
188+
run: |
189+
set -euo pipefail
190+
c="$RUNNER_TEMP/cubical"
191+
git init -q "$c"
192+
git -C "$c" fetch -q --depth 1 "$CUBICAL_REPO" "$CUBICAL_COMMIT"
193+
git -C "$c" checkout -q FETCH_HEAD
194+
test "$(git -C "$c" rev-parse HEAD)" = "$CUBICAL_COMMIT"
195+
echo "CUBICAL_DIR=$c" >> "$GITHUB_ENV"
167196
168197
- name: Record and assert the prover version
169198
run: |
@@ -177,3 +206,9 @@ jobs:
177206

178207
- name: Planted controls — each must fail the gate
179208
run: just -f formal/justfile check-agda-controls
209+
210+
- name: Usability from --cubical (agda/cubical v0.8)
211+
run: just -f formal/justfile check-agda-cubical
212+
213+
- name: Planted controls — each must fail the --cubical check
214+
run: just -f formal/justfile check-agda-cubical-controls

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,5 @@ tools/vendor/
126126
/affinescript-router/e2e/node_modules/
127127
/tests/codegen-bun/collision/*.log
128128
/tests/codegen-bun/collision/*.bun.js
129+
# Agda >= 2.7 interface cache next to an .agda-lib
130+
formal/agda-cubical/_build/
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{-# OPTIONS --safe --cubical #-}
2+
-- SPDX-License-Identifier: MPL-2.0
3+
-- SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell (hyperpolymath)
4+
--
5+
-- CubicalCompat.agda
6+
-- ══════════════════
7+
-- Usability witness: the `formal/agda/` theory sources, which are checked
8+
-- under the estate's canonical `--safe --without-K --cubical-compatible`,
9+
-- import cleanly into a FULL `--cubical` development built on the agda/cubical
10+
-- library (v0.8, the last release supporting Agda 2.7.0.1), and their
11+
-- theorems are usable there as cubical paths.
12+
--
13+
-- This module proves nothing new about AffineScript. It is a compatibility
14+
-- fixture: if either source loses `--cubical-compatible`, or starts using a
15+
-- construct `--cubical` rejects, this module stops checking.
16+
--
17+
-- Checked by `just -f formal/justfile check-agda-cubical`.
18+
19+
module CubicalCompat where
20+
21+
open import Cubical.Foundations.Prelude using (Type; Path)
22+
open import Cubical.Data.Equality.Conversion using (eqToPath; pathToEq)
23+
open import Agda.Builtin.Maybe using (Maybe; nothing)
24+
import Agda.Builtin.Equality as Eq
25+
26+
import QttSemiring as Q
27+
import BorrowProvenance as B
28+
29+
-- Re-exported unchanged, in their inductive-equality (`Agda.Builtin`) form.
30+
open Q public using (qplus-comm; qof-plus)
31+
open B public using (safety; stuck-rejected; K1-rejected-by-theorem)
32+
33+
-- QttSemiring, as a cubical path …
34+
qplus-comm-path : ∀ p q → Path Q.quant (Q.qplus p q) (Q.qplus q p)
35+
qplus-comm-path p q = eqToPath (Q.qplus-comm p q)
36+
37+
-- … and as a path between FUNCTIONS. Function extensionality is not
38+
-- available under `--without-K` alone; in cubical Agda it is a lambda over
39+
-- the interval. This is the use a `--cubical` client gets that the source
40+
-- cannot state itself.
41+
qplus-flip-path : Path (Q.quant → Q.quant → Q.quant) Q.qplus (λ p q → Q.qplus q p)
42+
qplus-flip-path i p q = qplus-comm-path p q i
43+
44+
-- The round trip lands back on the original theorem (inductive equality).
45+
qplus-comm-roundtrip : ∀ p q → Q.qplus p q Eq.≡ Q.qplus q p
46+
qplus-comm-roundtrip p q = pathToEq (qplus-comm-path p q)
47+
48+
-- BorrowProvenance: the K-1 (#554) verdict obtained from the rejection
49+
-- theorem, as a cubical path.
50+
K1-rejected-path : Path (Maybe B.CState) (B.chk B.initC B.K1) nothing
51+
K1-rejected-path = eqToPath B.K1-rejected-by-theorem
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- SPDX-License-Identifier: MPL-2.0
2+
-- SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell (hyperpolymath)
3+
name: affinescript-cubical-compat
4+
include: . ../agda
5+
depend: cubical-0.8

‎formal/agda/BORROW-PROVENANCE-EXPERIMENT.adoc‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,11 @@ implemented refuted on three programs.* One result of each kind.
387387
[#controls]
388388
== What was run
389389

390-
All under Agda 2.6.3 (Ubuntu 24.04 `agda-bin`). The pinned 2.7.0.1 was not
391-
available, so these are checks and not receipt-grade runs.
390+
All under Agda 2.6.3 (Ubuntu 24.04 `agda-bin`); the two gate runs below were
391+
repeated unchanged on the pinned Agda 2.7.0.1 (release binary) on 2026-12-01
392+
with the same result, and the module also imports into a `--safe --cubical`
393+
module (`formal/agda-cubical/`, see `README.adoc`). The nine mutations were
394+
run on 2.6.3 only. No receipt exists, so none of this is receipt-grade.
392395

393396
* `just -f formal/justfile check-agda`: 2 modules, exit 0, no warning.
394397
* `just -f formal/justfile check-agda-controls`: all 5 planted controls fail

‎formal/agda/README.adoc‎

Lines changed: 108 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ file, checked from this directory.
2222
| `QttSemiring.agda`
2323
| The QTT quantity semiring `{0, 1, ω}`: 21 statements, the same as
2424
`formal/QttSemiring.v` (obligation P-4)
25-
| Checks clean under the canonical flags on Agda 2.6.3. *Not yet checked on
26-
the pinned Agda 2.7.0.1.* No Lean leg. No receipt. So still `ungraded`.
25+
| Checks clean under the canonical flags on the pinned Agda 2.7.0.1 (and on
26+
2.6.3); imports into a `--safe --cubical` module. No Lean leg. No receipt.
27+
So still `ungraded`.
2728

2829
| `BorrowProvenance.agda`
2930
| *Experiment* (#553, ADR-028 option G): on a toy reference calculus, the
3031
checker's tracked loan set contains the provenance fibre for every program
3132
in the second-class cut D; exclusivity and rejection for D+R4
32-
| Checks clean under the canonical flags on Agda 2.6.3. A toy model, not
33+
| Checks clean under the canonical flags on the pinned Agda 2.7.0.1 (and on
34+
2.6.3); imports into a `--safe --cubical` module. A toy model, not
3335
`lib/borrow.ml`. No Rocq or Lean leg, no receipt: `ungraded`. Record:
3436
`BORROW-PROVENANCE-EXPERIMENT.adoc`.
3537
|===
@@ -40,16 +42,73 @@ file, checked from this directory.
4042
----
4143
just -f formal/justfile check-agda # the gate
4244
just -f formal/justfile check-agda-controls # five planted failures; each must fail the gate
45+
# usability from full --cubical; needs an agda/cubical checkout at v0.8:
46+
CUBICAL_DIR=/path/to/cubical just -f formal/justfile check-agda-cubical
47+
CUBICAL_DIR=/path/to/cubical just -f formal/justfile check-agda-cubical-controls
4348
----
4449

4550
The gate fails when `agda` is missing, when a module lacks the canonical
4651
pragma, contains `postulate`, exits non-zero, or prints anything but
4752
`Checking` lines (so a warning fails). Every `*.agda` under this directory is
4853
checked; nothing is listed by hand.
4954

50-
CI runs both recipes in the `agda-proofs` job of
51-
`.github/workflows/coq-proof-gate.yml`, on Ubuntu 24.04's `agda-bin` package
52-
(Agda 2.6.3).
55+
CI runs all four recipes in the `agda-proofs` job of
56+
`.github/workflows/coq-proof-gate.yml`, on the pinned toolchain below.
57+
58+
=== Pinned toolchain
59+
60+
[cols="2,5",options="header"]
61+
|===
62+
| Component | Pin
63+
64+
| Agda
65+
| 2.7.0.1, the official static Linux binary
66+
`Agda-v2.7.0.1-linux.tar.xz` from the agda/agda `v2.7.0.1` release
67+
(tag object `f24f2aaf…`, commit `a6fc20c27ae953149b53a8997ba4a1c8b17d628a`).
68+
SHA-256 `975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a`;
69+
CI verifies it before unpacking. The binary's built-in data directory is
70+
the release builder's path, so `Agda_datadir` must point at the unpacked
71+
`data/`.
72+
73+
| agda/cubical
74+
| `v0.8`, commit `3291fc1d8cae1409cc54d4f9cca7366158b573d7` (library name
75+
`cubical-0.8`). Its README's compatibility table pairs v0.8 with Agda
76+
2.6.4.1 and 2.7.0.1; v0.9 (the latest tag, `b150186d…`) and `master`
77+
require Agda 2.8.0, so v0.8 is the latest release usable with the pin.
78+
CI fetches it by commit SHA and asserts `HEAD`. Used only by the
79+
`--cubical` usability check; the theory sources import no library.
80+
|===
81+
82+
=== Usability from `--cubical`
83+
84+
`formal/agda-cubical/CubicalCompat.agda` is a `--safe --cubical` module, in
85+
its own library (`affinescript-cubical-compat`, `depend: cubical-0.8`), that
86+
imports every module under this directory. It re-exports one or more theorems
87+
of each unchanged, then uses them as cubical paths through the library's
88+
`eqToPath` / `pathToEq`:
89+
90+
* `qplus-comm-path` — `QttSemiring.qplus-comm` as a `Path`;
91+
* `qplus-flip-path` — a `Path` between the *functions* `qplus` and its flip:
92+
function extensionality, which `--without-K` alone does not give;
93+
* `qplus-comm-roundtrip` — back to the inductive `_≡_`;
94+
* `K1-rejected-path` — `BorrowProvenance.K1-rejected-by-theorem` (the #554
95+
verdict from the rejection theorem) as a `Path`.
96+
97+
`check-agda-cubical` fails if any module under this directory is not imported
98+
by the fixture, so a new theory module must join it. Its controls show the
99+
check is load-bearing: a source whose pragma drops `--cubical-compatible`
100+
(keeping `--safe --without-K`) is refused by Agda with "Importing module
101+
QttSemiring not using the --cubical-compatible flag from a module which
102+
does", and a source with K available is refused for `--without-K` as well.
103+
104+
Decision: the sources stay at the canonical `--cubical-compatible`; nothing
105+
was ported to full `--cubical`. `--cubical-compatible` is what makes a module
106+
importable from cubical developments, so usability is proved by the import
107+
rather than bought by changing the lane. Porting would move the modules out
108+
of the PROOF-POLICY theory lane, add a library to their import cone, and cut
109+
the Rocq and Lean legs for any statement using a cubical primitive (see the
110+
comparison under "Extrapolation" below). A cubical client gets paths and
111+
funext over these theorems for free, as the fixture shows.
53112

54113
== What is and is not established
55114

@@ -67,17 +126,37 @@ Established, by runs in this session (2026-12-01, container Ubuntu 24.04):
67126
definitions. A mutated table entry made the Agda check fail.
68127
* The gate fails on each of five planted controls.
69128

129+
Established on the pinned Agda 2.7.0.1 (a later session, 2026-12-01, same
130+
container image; toolchain pinned as in the table above):
131+
132+
* Both modules, unchanged, check with exit 0 and *no* output other than
133+
`Checking` lines under `agda --safe --without-K --cubical-compatible`
134+
(`check-agda`). No repair was needed; no statement or proof text changed.
135+
Neither draws `UnsupportedIndexedMatch` on 2.7.0.1.
136+
* `check-agda-controls`: all five planted controls still fail the gate on
137+
2.7.0.1; the `indexed` control fails for the intended reason (2.7.0.1
138+
prints `-W[no]UnsupportedIndexedMatch` and exits 0, and the gate rejects
139+
the output).
140+
* `check-agda-cubical`: `CubicalCompat.agda` checks against agda/cubical
141+
v0.8 with exit 0 and no diagnostic, loading both sources;
142+
`check-agda-cubical-controls`: all five controls fail it.
143+
* All four recipes were replayed from a fresh download and a fresh cubical
144+
fetch, exactly as the CI job runs them.
145+
70146
Not established:
71147

72-
* *The pinned Agda 2.7.0.1.* It could not be installed in the session. The
73-
official release binary was downloaded (SHA-256
74-
`975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a`, taken
75-
from the download itself and not checked against an independent record),
76-
but the session's permission policy refused to run it. A build from Hackage
77-
failed because `cabal-install` 3.8.1 (Ubuntu) no longer verifies Hackage's
78-
root keys; building around that check was refused too, correctly. So the
79-
result above is a real check on a different Agda version, and it is *not*
80-
receipt-grade.
148+
* *An independent record of the Agda binary's digest.* The SHA-256 above was
149+
computed from the download (twice, identical) and is pinned in CI from
150+
then on (trust on first use). It was not compared with a digest published
151+
by the Agda project: the release page and API were not reachable from the
152+
session. Anyone with access can confirm it against the release asset's
153+
`digest` field on GitHub. (An earlier session's attempt to build 2.7.0.1
154+
from Hackage failed on `cabal-install` 3.8.1's root-key check; this
155+
session used the release binary instead.)
156+
* *The nine `BorrowProvenance` mutations* were run on 2.6.3 only, not
157+
repeated on 2.7.0.1 (they are not scripted).
158+
* *CI on the pin.* The job was replayed locally; its first GitHub Actions
159+
run is on the PR that introduced it.
81160
* *A Lean leg.* Lean 4.15.0 and 4.13.0 were downloaded and their SHA-256
82161
digests match the ones `docs/COMPLETION-PLAN.adoc` §5.0 records
83162
(`af71a256…`, `44ceeac7…`), but running them was refused in this session.
@@ -324,8 +403,10 @@ What drives the uncertainty, largest first:
324403
. *The prelude.* No stdlib means ℕ and list lemmas are re-proved. `lia` is
325404
used only 4 times across the seven files, so this is bounded, but
326405
`QttDynamic`'s one `lia` closes 27 cases at once.
327-
. *The pinned version.* Nothing here has run on Agda 2.7.0.1. Unification and
328-
warning behaviour changed between 2.6.3 and 2.7; the files may need edits.
406+
. *The pinned version.* The two committed modules needed no edit on Agda
407+
2.7.0.1. The probe files above were measured on 2.6.3 only; unification and
408+
warning behaviour changed between 2.6.3 and 2.7, so further files may still
409+
need edits.
329410
. *The other two legs.* Each Agda source also needs its statement comparison
330411
with the Rocq leg and a new Lean leg (no Mathlib). The Lean leg was not
331412
measured at all.
@@ -404,9 +485,11 @@ and the cross-prover comparison.
404485
| Measured (Agda 2.6.3): the committed module checks unchanged with its pragma
405486
replaced by `--safe --cubical`, because it uses only the inductive `_≡_`.
406487
`--cubical` does not remove F1: the direct indexed match draws the same
407-
`UnsupportedIndexedMatch` warning under `--safe --cubical`. Not measured:
408-
restating the laws over `Path`, which is what a cubical development would
409-
actually use, and which needs the two equalities bridged.
488+
`UnsupportedIndexedMatch` warning under `--safe --cubical`. Measured on
489+
Agda 2.7.0.1 with agda/cubical v0.8: the bridge works without restating
490+
anything — `CubicalCompat.agda` turns the `_≡_` theorems into `Path`s with
491+
the library's `eqToPath`, including a funext path. Not measured: proofs
492+
written natively over `Path`.
410493

411494
| Other legs
412495
| Rocq and Lean state the same thing.
@@ -475,10 +558,11 @@ admission record and any shared grade signature are estate-level items.
475558

476559
== Open decisions for the owner
477560

478-
. How to provision the pinned Agda 2.7.0.1 for this repository's CI: the
479-
mathesis route (Guix time-machine with its `build/channels.scm`), or the
480-
checksum-pinned official release binary. Until then the CI job runs
481-
Agda 2.6.3 and says so.
561+
. _Decided 2026-12-01:_ provisioning of the pinned Agda 2.7.0.1. The owner
562+
asked for 2.7.0.1 plus the latest compatible agda/cubical; CI now uses the
563+
checksum-pinned official release binary. The mathesis route (Guix
564+
time-machine with its `build/channels.scm`) remains the alternative if the
565+
estate wants one provisioning path for every lane.
482566
. Whether `UnsupportedIndexedMatch` fails the gate (as here) or passes (as in
483567
mathesis's `check-proofs.sh`).
484568
. Whether to port the remaining theory files as they stand, or first repair

0 commit comments

Comments
 (0)