Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ jobs:
- uses: leanprover/lean-action@v1.7.0
- name: No sorries
run: "! grep -rn 'sorry' Marches/ Marches.lean"

agda:
# PROOF-POLICY §2.1: the Agda source of truth (proofs/agda), checked cold
# with the checksum-pinned compiler; the import cone scanned for
# postulates; the fixtures under tests/reject-agda refused. The last lines
# of the log are the receipt fields. Local run: scripts/setup-agda.sh,
# then scripts/check-agda.sh.
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: Install the checksum-pinned Agda
run: bash scripts/setup-agda.sh
- name: Agda gate
run: bash scripts/check-agda.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.lake/
/_build/
*.agdai
90 changes: 76 additions & 14 deletions PROOF-STATUS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ marches was written in Lean 4 from 2026-07, before the 2026-10-26 ruling.
By §3 its Lean files keep their value but are *target-only evidence*: they
count as the Lean leg only once an Agda proof of the same statement is
`PROVEN` and the two statements have been compared and the comparison
recorded (`RECONCILED`). Until then every Agda row is `OPEN`.
recorded (`RECONCILED`). The Agda source is in `proofs/agda`, ported group by
group in ROADMAP order. A group with no Agda proof yet stays `OPEN`.

== Grades

Every theorem below is *`ungraded`*: no Agda witness exists, so not even
`PWG-3` applies (§8.2). `foundation_diverse` is false throughout.
The four theorems of the Kernel group are *`PWG-2i`*. The Agda leg is
`PROVEN` under the §2.1 invocation, which is `PWG-3`. The Lean leg is `PROVEN`
with no axioms, and its statements are `RECONCILED` with the Agda ones in
`docs/agda-lean-correspondence.adoc`. Their Rocq leg is `OPEN`, so they still
owe §2's second recheck (§8.4: a grade is not a discharge). Every other theorem
is *`ungraded`*, because no Agda witness exists for it yet. `foundation_diverse`
is false throughout.

Grade census (§8.4), denominator 211 theorems in the `Marches` namespace:
`PWG-1` 0, `PWG-2ii` 0, `PWG-2i` 0, `PWG-3` 0, `ungraded` 211. The 235
`PWG-1` 0, `PWG-2ii` 0, `PWG-2i` 4, `PWG-3` 0, `ungraded` 207. None of the four
rests on an axiom. The 235
definitions in the same namespace are not proof obligations and are not
counted; the axiom census below covers both kinds.

Expand All @@ -39,21 +46,66 @@ counted; the axiom census below covers both kinds.
|Leg |Route |Status token |§2.2 state

|Agda (source)
|—
|`OPEN` (no Agda development yet)
|`source` (`proofs/agda`)
|`PROVEN` for the Kernel group (receipt below); `OPEN` for every other group
|—

|Lean
|`re-proved` (written directly in Lean; no Agda to transport from)
|`PROVEN` or `PROVEN-WITH-AXIOMS`, per group below; target-only evidence (§3)
|not `RECONCILED`: no Agda statement to compare against
|`re-proved` (written by hand in Lean from 2026-07, before the Agda; not
transported)
|`PROVEN` or `PROVEN-WITH-AXIOMS`, per group below
|`RECONCILED` for the Kernel group (`docs/agda-lean-correspondence.adoc`);
for every other group, target-only evidence (§3) with no Agda statement to
compare against

|Rocq
|—
|`OPEN`
|—
|===

== Agda leg receipt

Taken 2026-11-16 at `660e1c61cfdc138452d9a9b4e9bd550cbfebe8fc`, the commit
that added `proofs/agda`, with `scripts/check-agda.sh` (cold: no interface
files are read). Checker: Agda `2.7.0.1`, the release archive accepted at
SHA-256 `975b515a14877ab6bce5bfc641e16c4a3ee52ca5d7f846577dee80aa2145db8a`
(`scripts/setup-agda.sh`). There is no standard library or other Agda
library. The same script runs in CI as the `agda` job of `ci.yml`.

----
$ agda --safe --without-K --cubical-compatible --no-libraries --ignore-interfaces -i proofs/agda proofs/agda/All.agda
import cone: Agda.Builtin.Equality Agda.Builtin.List Agda.Primitive All Marches.Basic Marches.Kernel Marches.Prelude
postulate scan: 4 files, 0 postulate(s)
prover-supplied: Agda.Primitive postulates exactly Level _⊔_ lsuc lzero, each bound by its BUILTIN pragma; no other postulate
[PASS] postulate scan: cone clean, both controls behave
[PASS] refused as expected: a postulate, by the command-line --safe
[PASS] refused as expected: tests/reject-agda/FreewheelReturns.agda (should be empty)
[PASS] refused as expected: tests/reject-agda/UsesK.agda (because K has been disabled)
inputs-manifest:
6d72ba84f01be6ee0f1eb968c24211ef4ff6a2f9b709b5ac68f841362595c917 proofs/agda/All.agda
6d11fd6646fe9c4e974f2ad86a0c273f071f4a4502dead8535b31a7a2e57ce96 proofs/agda/Marches/Basic.agda
19980896daff2a787ef2b91f584e7d3568d80316f6bc31c2454de7b609bb663b proofs/agda/Marches/Kernel.agda
ecfec1a4105f5f6cf36272fa278774ebfb6c88e11f9bf3c662d7326f0ab3039c proofs/agda/Marches/Prelude.agda
inputs-sha256: 4f589dfe6d2719a058dd182b52cf7cccfeb4817c542831df6a9b963348821567
[check-agda] OK
----

The digest is the §8.5.1 one. The policy's shell line
(`printf '%s\n' PATH… | LC_ALL=C sort | xargs -d '\n' sha256sum -- | sha256sum`)
gives the same value. Axioms: none. The trusted base is the four
`Agda.Primitive` primitives named above.

*Scope of this receipt.* It is a local run at the commit named. CI runs the
same gate on every commit and prints the same fields, but no job yet
records them. The machine-readable proof receipt of §8.5.1
(`verification/receipts/*_praxis.deed`, read by `deed_lint.js`) is `OPEN`.
Until it exists, the grades here are derived by hand from these records,
and none of them is `PWG-1`. A squash merge will replace `660e1c6` on `main`. The receipt still describes
the merge commit while the four input files are unchanged there: an echo
(§8.5.2) with an `inputs-sha256` witness, to be written into the
machine-readable receipt when it exists.

== Lean leg receipt

Taken 2026-11-09 on `main` at `abe636aaba3f36eebee7f40b0707ef6bb090715e`,
Expand Down Expand Up @@ -96,6 +148,15 @@ A CI job that emits a full §8.2 receipt per commit is `OPEN` (see the
plan below). When the Lean inputs change, this receipt is superseded and
must be retaken.

The Kernel group's Lean leg was re-checked on 2026-11-16 at `660e1c6`, whose
`Marches/` tree is the same `7ef83e4` as above. Lean `v4.35.0` (release
archive accepted at SHA-256
`7289597a44543246c9227b8cae501767e095ce17f6d448b95fc4a8dc97268f6d`):
`lake build` completed (19 jobs), there is no `sorry`, the BadGadget `#eval`
prints the same orbit, and `#print axioms` reports "does not depend on any
axioms" for `strict_implies_inflationary`, `run_le`, `run_worsens` and
`no_return`.

== Theorem groups

`PROVEN` here means the Lean kernel accepted the term with no axioms.
Expand All @@ -112,9 +173,10 @@ are not headline theorems and no row below depends on them.
|Group (module) |Headline theorems |Lean leg |Agda

|Kernel: single-region loop-freedom (`Kernel`, `Basic`)
|`run_worsens`, `no_return`, `strict_implies_inflationary`
|`PROVEN`
|`OPEN`
|`run_worsens`, `no_return`, `strict_implies_inflationary`, `run_le`
|`PROVEN`, `RECONCILED`
|`PROVEN` (`run-worsens`, `no-return`, `strict-implies-inflationary`,
`run-le`): `PWG-2i`

|Two-region composition (`Compose`)
|`trace_worsens`, `wt_cycles_are_empty`, `no_back_cross`, `no_a_label_in_B`
Expand Down Expand Up @@ -191,7 +253,7 @@ import, checked by `lake build`, but it inherits the same `OPEN` Agda status.
== Plan: closing the Agda gap

Owner decision 2026-11-09: record the gap here now; the Agda port is the
next body of work.
next body of work. Progress: Kernel group done 2026-11-16 (steps 1 and 2).

. *Agda source.* Port the groups above to Agda in this repository
(`--safe --without-K`, no postulates, the §2.1 canonical invocation), group
Expand All @@ -213,7 +275,7 @@ recording the fields §8.2 lists (checker and version, invocation, input
digest, result, axioms, full commit): `PWG-1`. For the Lean leg this is a
CI job around `lake build` and the axiom census; it is `OPEN`.

Until step 1 lands for a group, nothing in this repository may be called
Until step 1 lands for a group, nothing in that group may be called
graded. `PROVEN` and `PROVEN-WITH-AXIOMS` in `README.adoc` mean "accepted by
the Lean kernel", without or with the named axioms, not "discharged under
the estate policy".
8 changes: 5 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ graded machinery (see `ROADMAP.adoc`).
`PROVEN` in this table means the Lean kernel accepted the proof and it uses
no axioms. `PROVEN-WITH-AXIOMS` means the kernel accepted it and it rests on
the Lean built-in axioms named in the row. Under the estate proof policy
marches is theory, so Agda is the source of truth and no theorem here is
graded yet. `PROOF-STATUS.adoc` records each witness leg, the axiom census,
the scope of the Lean receipt, and the plan for the Agda port.
marches is theory, so Agda is the source of truth (`proofs/agda`). The port
goes group by group. So far only the Kernel group is graded: its four
theorems are `PWG-2i` (Agda `PROVEN`, Lean leg reconciled, Rocq leg `OPEN`).
Every other theorem is ungraded. `PROOF-STATUS.adoc` records each witness
leg, the receipts, the axiom census and the plan for the rest of the port.

[cols="3,1,2"]
|===
Expand Down
17 changes: 17 additions & 0 deletions ROADMAP.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ it `PWG-2ii`.
Gate per group: the Agda check passes under the canonical invocation and
the statement comparison is written down. Takes precedence over rung 4.

[cols="3,3,1",options="header"]
|===
|Group |Artefact |Status

|Kernel (`Basic`, `Kernel`)
|`proofs/agda/Marches/` (`Prelude`, `Basic`, `Kernel`); `scripts/check-agda.sh` in
CI; `docs/agda-lean-correspondence.adoc`
|met 2026-11-16 (`PWG-2i`)

|Two-region composition (`Compose`)
|—
|next
|===

After all groups: the machine-readable proof receipt
(`verification/receipts/*_praxis.deed`, PROOF-POLICY §8.5.1).

== Rung 4 — attestation (A2ML bridge)

* Announcements as attested claims: RPKI attests origin; this layer
Expand Down
30 changes: 30 additions & 0 deletions STATE.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
= STATE — cross-session log

== 2026-11-16 — Agda source, Kernel group (Agda-source session)

* `proofs/agda` holds the Agda source for the Kernel group: `PathAlgebra`,
`StrictlyInflationary`, `Inflationary`, `run`, `strict-implies-inflationary`,
`run-le`, `run-worsens` and `no-return`. A small local `Prelude` replaces
the standard library, so the import cone is four files here plus
`Agda.Primitive`, `Agda.Builtin.Equality` and `Agda.Builtin.List`. This
matches the Lean side (core only, no Mathlib), and later groups will prove
the lemmas they need by hand, as the Lean side does.
* `scripts/check-agda.sh` checks `proofs/agda/All.agda` cold under the §2.1
invocation. It scans the import cone with januskey's reference postulate
scanner, ported verbatim (`b503488`): no postulate here, and in the
prover's modules only `Agda.Primitive`'s four level primitives. It
requires refusals: a `--safe` control, `FreewheelReturns` (strictness is
load-bearing, as with F2) and `UsesK` (`--without-K` is in force on the
command line). It then prints the receipt fields and the §8.5.1 inputs
digest. `scripts/setup-agda.sh` installs Agda 2.7.0.1 at echo-types'
checksum. A new `agda` job in `ci.yml` runs both.
* Receipt at `660e1c6`: PASS, inputs digest `4f589df…`, which the policy's
shell line reproduces. Lean leg re-checked at the same commit with v4.35.0
(archive checksum OK): `lake build` 19 jobs, no `sorry`, the orbit
unchanged, and no axioms for the four theorems.
* `docs/agda-lean-correspondence.adoc` is the §2.2 comparison, made by
reading, with residuals: Agda `Set` against Lean `Prop`, equality without
K, and two trusted kernels. The Kernel group is `RECONCILED`, so its four
theorems are `PWG-2i`. The census is now `PWG-2i` 4 and `ungraded` 207 of
211.
* Open: the Rocq leg; the machine-readable receipt (§8.5.1); the next
group, `Compose`.

== 2026-11-16 — estate audit repointed after the suite rename (not a rung)

* `hyperpolymath/cicd-suite` was renamed to
Expand Down
141 changes: 141 additions & 0 deletions docs/agda-lean-correspondence.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= Agda–Lean statement correspondence
:revdate: 2026-11-16

The record that `hyperpolymath/standards` `3-practice/PROOF-POLICY.adoc` §2.2
asks for, group by group. It covers each theorem whose Agda source is in
`proofs/agda` and whose Lean leg is in `Marches/`. For each pair it gives the
exact propositions, their assumptions, their type and universe discipline and
how they were compared. Revisions, checkers, invocations and results are in
`PROOF-STATUS.adoc`. A successful check in each prover does not on its own
show that both proved the same proposition. This page is that separate
argument.

*Method.* The comparison was made by reading. Definitions were compared field
by field and theorems binder by binder, against the Lean files at the commit
named in `PROOF-STATUS.adoc`. No mechanical bridge links the two: there is no
Dedukti round trip, and the Lean leg was not transported. Lean's names are in
snake case and Agda's in kebab case, because an underscore in an Agda name
marks a mixfix argument.

*Route of the Lean leg:* `re-proved`. The Lean development was written by hand
from 2026-07, before the Agda source existed. It was not transported from the
Agda proof.

== Kernel group (`Basic`, `Kernel`)

State: `RECONCILED`, 2026-11-16, with the residual assumptions listed below.

=== Definitions

[cols="2,2,3",options="header"]
|===
|Agda (`proofs/agda/Marches/`) |Lean (`Marches/`) |Comparison

|`Basic.PathAlgebra : Set₁`, a record with fields `Carrier Label : Set`,
`better : Carrier → Carrier → Set`, `ext : Label → Carrier → Carrier`,
`trans : ∀ {a b c} → better a b → better b c → better a c`,
`irrefl : ∀ a → ¬ better a a`
|`Basic.PathAlgebra`, a structure with fields `Carrier Label : Type`,
`better : Carrier → Carrier → Prop`, `ext`, `trans`, `irrefl` of the same
shapes
|Same fields in the same order, with the same arities and the same
implicit and explicit binders. Carriers sit at the lowest universe in both
(`Set` = `Set₀`, `Type` = `Type 0`), so the record is in `Set₁` and the
structure in `Type 1`. *Difference:* `better` is `Set`-valued in Agda and
`Prop`-valued in Lean (residual R1).

|`Basic.StrictlyInflationary A`
|`Marches.StrictlyInflationary A`
|Both are `∀ l a, better A a (ext A l a)`.

|`Basic.Inflationary A`
|`Marches.Inflationary A`
|Both are `∀ l a, ¬ better A (ext A l a) a`.

|`Basic.run A`
|`Marches.run A`
|The same two equations: `run A [] a = a` and
`run A (l ∷ ls) a = run A ls (ext A l a)`. The word is read left to right.
Agda uses `Agda.Builtin.List` and Lean uses core `List`.

|`Prelude.¬_`, `Prelude.⊥`
|`Not`, `False`
|`¬ P = P → ⊥`, where `⊥` is a data type with no constructors. Lean's
`¬ P` is `P → False`. They are the same.

|`Prelude._⊎_`
|`Or`
|A sum with two injections. In Agda it is a type, so it is proof-relevant;
Lean's `Or` is a `Prop`. Only `run-le` uses it (residual R1).

|`_≡_` (`Agda.Builtin.Equality`)
|`Eq`
|The identity type. Agda uses it without K (§2.1) and these proofs use
only `subst` and `sym`, which J gives. Lean's `Eq` is a `Prop`
(residual R2).
|===

=== Theorems

[cols="2,2,3",options="header"]
|===
|Agda |Lean |Proposition (both), in the binder order of both

|`Basic.strict-implies-inflationary`
|`Marches.strict_implies_inflationary`
|`∀ (A : PathAlgebra), StrictlyInflationary A → Inflationary A`

|`Kernel.run-le`
|`Marches.run_le`
|`∀ A, StrictlyInflationary A → ∀ ls a,
better A a (run A ls a) ∨ run A ls a = a`

|`Kernel.run-worsens`
|`Marches.run_worsens`
|`∀ A, StrictlyInflationary A → ∀ l ls a, better A a (run A (l :: ls) a)`

|`Kernel.no-return`
|`Marches.no_return`
|`∀ A, StrictlyInflationary A → ∀ l ls a, ¬ (run A (l :: ls) a = a)`. Lean
writes `≠`, which unfolds to `a = b → False`.
|===

The hypotheses are the same in both: one path algebra and its strictness.
Neither side adds an assumption, a typeclass or a section variable. Lean
reports no axioms for any of the four theorems (`#print axioms`), and the Agda
gate finds no postulate in the import cone outside the prover's own level
primitives.

=== Residual assumptions

R1. *Propositions as types.* Agda's `better` and `_⊎_` are `Set`-valued and
proof-relevant. Lean's are `Prop`-valued and proof-irrelevant. A Lean path
algebra gives an Agda one when each proposition is read as a type, and read
at that algebra each Agda statement is the Lean statement. So the Agda
statements quantify over at least the Lean algebras. No statement here
compares two proofs of `better`, or quantifies over `Prop`, so the
difference cannot change the truth of a statement. This is an argument made
by reading. It is not a checked bridge.

R2. *Equality.* Lean's `Eq` has proof irrelevance by definition. Agda is run
without K, so its `_≡_` does not. The statements use equality only in
`run-le` (as a disjunct) and in `no-return` (under a negation), and never
compare two equality proofs, so K is not needed to state them. The Agda
proofs use only J. Neither side needs the other's equality principles.

R3. *Kernels.* The legs are independent kernel results: Agda 2.7.0.1 checked
the Agda source and Lean 4.35.0 checked the Lean source. Each prover's own
kernel is trusted. Agda's trusted base in this cone is `Agda.Primitive`'s
`Level`, `lzero`, `lsuc` and `_⊔_`, each bound by its `BUILTIN` pragma.

=== Negative controls

`tests/reject-agda/FreewheelReturns.agda` gives the free-wheeling algebra:
one signature, extension the identity, no preference. It claims `no-return`
for that algebra, and the gate requires Agda to refuse it. So the strictness
hypothesis of `no-return` is load-bearing, as falsifier F2 is on the Lean side
(`Marches/Freewheel.lean`). `tests/reject-agda/UsesK.agda` has no `OPTIONS`
pragma and proves K. Its refusal shows that the gate's own command line runs
with `--without-K`.
8 changes: 8 additions & 0 deletions proofs/agda/All.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# OPTIONS --safe --without-K --cubical-compatible #-}
-- The graded root: every module whose theorems PROOF-STATUS.adoc grades.
-- Checked by scripts/check-agda.sh under the canonical invocation.
module All where

import Marches.Prelude
import Marches.Basic
import Marches.Kernel
Loading
Loading