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
2 changes: 2 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ jobs:
uses: editorconfig-checker/action-editorconfig-checker@v3.0.0
- name: Gate falsifiability canaries (R10)
run: bash scripts/test-gate-falsifiability.sh
- name: Aspect tests (SPDX and banned-construct scans)
run: bash tests/aspect_tests.sh
- name: Workflow and gate regression tests
run: |
bash tests/workflows/review_regressions_test.sh
Expand Down
40 changes: 39 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,44 @@ https://semver.org/spec/v2.0.0.html[Semantic Versioning].

==== Fixed

* *The aspect lane runs, grades stand only on what the policy admits, and four
status claims are narrowed (2026-11-17).*
+
_Aspect lane._ `+just aspect+` was the mint template: it ran nothing and printed
"Aspect tests passed!", and `+test-all+` depends on it. `+tests/aspect_tests.sh+` was
invoked by nothing, so the hardening of it recorded further down this file was to
a script no lane ran. Its Idris2 scan read `+src/interface/Abi/+` only (3 of 16
files) and dropped every hit containing "test". The recipe and the quality
workflow now run the script; the scan reads every Idris2 source through the
comment stripper, adds `+assert_smaller+`, `+unsafePerformIO+`, `+idris_crash+` and
`+postulate+`, and fails when it finds no Idris2 file. Canaries 32–34.
+
_Grade derivation_ (`+scripts/pwg-derive.sh+`). No published grade moves; the
census stays `+PWG-3+` 18, `+ungraded+` 10 of 28. (a) A leg whose current receipt
reports an axiom counts only when each axiom has disposition `+c+`, recorded on
the receipt as `+axiom_dispositions+`; none recorded means inadmissible (§8.4
rule 6, §8.5.1). No disposition is recorded on the live Lean receipts: that is a
trusted-base decision for the owner, and those legs are `+BRIDGE-PENDING+` either
way. (b) The derived axiom list is the union over every witness the grade stands
on, where it was the Agda receipt's alone. (c) Each `+agda+` command in a recorded
invocation must be exactly the three §2.1 flags and one module, where one
canonical command used to vouch for a second with no flags. (d)
`+foundation-diverse+` needs an accepted, `+RECONCILED+`, receipted witness, where
any non-null value used to publish it (§8.3). `+scripts/pwg-check.sh+` rejects a
disposition outside `+c|b|debt+` and one for an axiom the receipt does not report.
Canaries 35–43; each fails against the code before it. The suite stands at
*43/43*.
+
_Status claims._ `+deceptiveDuals+` is a tuple value and is no longer cited as
evidence for "exactly three". `+verdictSound+` is stated over a grade-shaped floor,
as its source says, not over the use-model floor. The tier-2 row names the
ratified iff. The README no longer says `+PROOF-STATUS.adoc+` and `+pwg.json+` "agree
row for row": the gate checks the grade table and census, not the prose rows.
In `+grade-factorisation+`, the README verdict is marked as the pre-ratification
result and lists `+GradeFactorisationR.lean+`, and `+REPORT.adoc+` states the measured
axiom bound (`+propext+` and `+Quot.sound+` over 184 declarations, CI run
43981767344) where it had quoted the audit's allowlist.

* *The comment stripper nests where the languages nest, and `+psiBond+` separation
is stated in general (2026-11-16).* Lean `+/- -/+`, Agda and Idris2 `+{- -}+` and Coq
`+(* *)+` block comments nest; `+tests/lib/strip-proof-comments.awk+` closed on the
Expand All @@ -18,7 +56,7 @@ dangerous-construct scan, and an unterminated nested comment exited `+0+` (a
truncated scan reported as complete). A depth counter per open token fixes both;
C-style `+/* */+` stays flat, and over all 38 tracked sources the output is
unchanged. Canaries 30–31 plant both cases and fail against the old stripper; the
suite stands at *31/31*. Separately, `+psiBond_separates_all_honest+`
suite stood at *31/31* at that point (43/43 after the entry above). Separately, `+psiBond_separates_all_honest+`
(`+GradeFactorisation.lean+`) states that every bond other than `+misbound+` is
separated from it, by `+cases+` over `+Q_ne_unknown+` and `+total_ne_unknown+`, with a
`+#print axioms+` line; its kernel check is the CI `+lean-build+` job.
Expand Down
15 changes: 4 additions & 11 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,11 @@ test-smoke:
e2e: trope-build
bash tests/e2e.sh

# Run aspect tests (cross-cutting concern validation)
# Run aspect tests (cross-cutting concern validation): SPDX headers and the
# banned-construct scans over every Idris2 and proof source. The recipe used
# to be the mint template: it ran nothing and printed "Aspect tests passed!".
aspect:
@echo "Running aspect tests..."
# TODO: Replace with your aspect test command. Examples:
# bash tests/aspect_tests.sh # Shell-based aspect tests
# cargo test --test aspects # Rust aspect tests
# Aspect tests validate architectural invariants:
# - Thread safety (mutex in FFI modules)
# - ABI/FFI contract (declarations match exports)
# - SPDX compliance (all files have license headers)
# - No dangerous patterns (believe_me, assert_total, etc.)
@echo "Aspect tests passed!"
bash tests/aspect_tests.sh

# Run benchmarks (performance regression detection)
bench:
Expand Down
4 changes: 3 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ The grade-level cancellation boundary (left-cancellative iff ε on the
unquotiented carrier) is proved in Lean; Agda proves finite-fidelity cancellation
and selected non-cancellation counterexamples, not the exhaustive iff.
`docs/status/PROOF-STATUS.adoc` and
`verification/pwg.json` are the per-result record, and they agree row for row.
`verification/pwg.json` are the per-result record. `scripts/pwg-check.sh` checks that the
grade table and census published in the first are the ones derived from the second; the
prose rows of the status file are written by hand and are not checked against the ledger.
Only *L1* and *L4* carry a statement in all three, and of the ten results *eight*
lack one entirely. Lean does not state L2, L5, Honest Generation or Veridicality;
Idris2 does not state L3, L6, conicality or the cancellation boundary; L5 is
Expand Down
8 changes: 4 additions & 4 deletions docs/status/PROOF-STATUS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ toc::[]
| Idris2 `Trope.Soundness.{fateDroppedLtePredicated,fatePredicatedNotLteDropped}`; Agda `TB.Order.{fateDroppedLtePredicated,fatePredicatedNotLteDropped}`.

| Veridicality Derivation
| Exactly three deceptive duals, one per coordinate kind (`Falsified`, `Misbound`, `Conflated`), each the unique deceptive inhabitant of its coordinate.
| Idris2 `Trope.Veridicality.{fateDeceptiveUnique,bondDeceptiveUnique,mergeDeceptiveUnique,deceptiveDuals}`; Agda `TB.Honest.{fateDeceptiveUnique,bondDeceptiveUnique,mergeDeceptiveUnique,deceptiveDuals}`.
| Exactly three deceptive duals, one per coordinate kind (`Falsified`, `Misbound`, `Conflated`), each the unique deceptive inhabitant of its coordinate. The uniqueness of each is a theorem. "Exactly three" is not stated as one proposition: it follows from the three uniqueness lemmas and the construction of `Grade` as their product. `deceptiveDuals` in both provers is a tuple value, states no proposition, and is not cited as evidence.
| Idris2 `Trope.Veridicality.{fateDeceptiveUnique,bondDeceptiveUnique,mergeDeceptiveUnique}`; Agda `TB.Honest.{fateDeceptiveUnique,bondDeceptiveUnique,mergeDeceptiveUnique}`.

| Honest Generation
| The five atoms `attenuate`, `predicate`, `drop`, `sever`, `fuse` with stem:[\varepsilon] generate exactly the honest fragment of each coordinate and never produce a deceptive dual; honesty is closed under stem:[\triangleright].
Expand All @@ -79,7 +79,7 @@ toc::[]

| Tier-2 membership, exhaustive
| In the unquotiented model, every honest-but-lossy element is individually witnessed non-cancellative (finite attenuation regains cancellation on A3 normal forms), `Withheld` and `Fused` included; the per-element witnesses feed the iff.
| Lean `TierTwoComplete.lean`: `Bond.withheld_honest_not_cancel`, `Merge.fused_honest_not_cancel`, `Fate.atten_not_cancel`, the `*.leftCancelWitness` family, `Grade.grade_leftCancel_iff`. Agda states six of the per-element witnesses and the positive right-cancellation, all in `TB.Tier`: `unknown-not-cancel`, `total-honest-not-cancel`, `falsified-not-cancel`, `dropped-honest-not-cancel`, `predicated-honest-not-cancel`, `severed-honest-not-cancel`, `Q-cancelʳ`. What Agda does *not* state is the exhaustive step: there is no Agda counterpart of `grade_leftCancel_iff`, and no Agda witness on the merge coordinate, which is why the ledger's Agda token for this row is `OPEN` rather than the row being Lean-only.
| Lean `TierTwoComplete.lean`: `Bond.withheld_honest_not_cancel`, `Merge.fused_honest_not_cancel`, `Fate.atten_not_cancel`, the `*.leftCancelWitness` family (`FateA.leftCancelWitness` on the ratified fate), and the exhaustive iff, `GradeR.gradeR_leftCancel_iff` on the ratified carrier (`Grade.grade_leftCancel_iff` is the same statement over the historical pre-ratification carrier, kept as history). Agda states six of the per-element witnesses and the positive right-cancellation, all in `TB.Tier`: `unknown-not-cancel`, `total-honest-not-cancel`, `falsified-not-cancel`, `dropped-honest-not-cancel`, `predicated-honest-not-cancel`, `severed-honest-not-cancel`, `Q-cancelʳ`. What Agda does *not* state is the exhaustive step: there is no Agda counterpart of `grade_leftCancel_iff`, and no Agda witness on the merge coordinate, which is why the ledger's Agda token for this row is `OPEN` rather than the row being Lean-only.

| C3 (partition; tier closure is not a homomorphism)
| `Dropped`, `Total`, `Severed`, `Predicated`, `Withheld`, `Fused` are honest non-cancellative elements; `Falsified`, `Misbound`, `Conflated`, `Unknown` are the deceptive ones. `tierOf (g ▷ h) = tierOf g ⊓ tierOf h` is false on fate; tier preservation is closure.
Expand Down Expand Up @@ -124,7 +124,7 @@ toc::[]
| Idris2 `Trope.Soundness.subSound`.

| Verdict soundness (corollary)
| stem:[\mathrm{floor}(U) \sqsubseteq g \wedge g \sqsubseteq \rho \Rightarrow \mathrm{floor}(U) \sqsubseteq \rho].
| stem:[f \sqsubseteq g \wedge g \sqsubseteq \rho \Rightarrow f \sqsubseteq \rho] for a *grade-shaped* floor stem:[f], which is how the source states it. It is not a statement about the use-model floor stem:[\mathrm{floor}(U)]: the shipped checker's floor is a partial per-coordinate demand, a different type decided by a different predicate, and no lemma connects the two (see _Modelling notes_).
| Idris2 `Trope.Soundness.verdictSound`.

| Grade soundness, β/let core
Expand Down
8 changes: 7 additions & 1 deletion scripts/pwg-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ badr=$(jq -r '
(if ($v.result == "pass" or $v.result == "fail") then empty else "\($k): result must be pass|fail (8.2 -- the derivation reads it; an unrecognised value must not be treated as a pass)" end),
(if ($v.evidence // "" | length) > 0 then empty else "\($k): no evidence pointer" end),
(if ($v.state // "" | test("\\A(current|superseded|regressed)\\z")) then empty else "\($k): state must be current|superseded|regressed (8.4 rule 5)" end),
(if ($v | has("axioms")) then empty else "\($k): no axioms list (8.4 rule 6 — axioms travel with the grade)" end) ]
(if ($v | has("axioms")) then empty else "\($k): no axioms list (8.4 rule 6 — axioms travel with the grade)" end),
(($v.axiom_dispositions // {}) | to_entries[]
| select((.value | IN("c", "b", "debt")) | not)
| "\($k): disposition of \(.key) must be c|b|debt (8.5.1)"),
(($v.axiom_dispositions // {}) | keys[] as $n
| select((($v.axioms // []) | index($n)) == null)
| "\($k): disposition recorded for \($n), which the receipt does not report as an axiom") ]
| .[]' "$LEDGER") \
|| die "rule 3 (receipt completeness) could not be evaluated over this ledger: malformed theorem/leg/receipt shape"
[ -n "$badr" ] && die "incomplete receipt(s):"$'\n'"$badr"
Expand Down
52 changes: 45 additions & 7 deletions scripts/pwg-derive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ DERIVE='
| map(select(.state == "current" and .result == "pass" and (.commit | test("\\A[0-9a-f]{40}\\z"))))
| length > 0;

# 2.1: every Agda entrypoint in the recorded invocation is the canonical one.
# The invocation may join several commands with ";". Each command that runs
# agda must be exactly: agda, the three flags as whole words, and one module.
# The earlier test searched the whole string for the three flag substrings,
# so one canonical command vouched for a second command that carried none of
# them, and any further option rode along unseen. Measured 2026-11-17: with
# the second entrypoint reduced to "agda Smoke.agda" the census did not move.
def canonical_agda:
[ split(";")[] | [splits("[[:space:]]+")] | map(select(length > 0)) | select(length > 0 and .[0] == "agda") ]
| length > 0
and all(.[];
(.[1:] | map(select(startswith("-"))) | sort) == ["--cubical-compatible", "--safe", "--without-K"]
and (.[1:] | map(select(startswith("-") | not)) | length) == 1);

# 8.4 rule 6 and 8.5.1: a witness whose current receipt reports an axiom
# without disposition c does not count. Dispositions are recorded on the
# receipt as axiom_dispositions {name: c|b|debt}; an axiom with none recorded
# is not admissible (fail closed). A receipt reporting no axiom is admissible.
def axioms_admissible($rs): $rs
| map(select(.state == "current"))
| all(.[]; . as $r | all(($r.axioms // [])[]; ($r.axiom_dispositions // {})[.] == "c"));

# 8.2 PWG-3 additionally requires the receipt to record the checker version,
# the standard-library pin, the flags actually in force, and the import cone (1.1).
def pwg3_receipt($rs): $rs
Expand All @@ -75,9 +97,7 @@ DERIVE='
and (.checker_version // "" | length > 0)
and (.stdlib_pin // "" | length > 0)
and (.import_cone // "" | length > 0)
and (.invocation // "" | test("--safe"))
and (.invocation // "" | test("--without-K"))
and (.invocation // "" | test("--cubical-compatible"))
and (.invocation // "" | canonical_agda)
))
| length > 0;

Expand All @@ -90,7 +110,20 @@ DERIVE='
($leg.token | accepted)
and $leg.state == "RECONCILED"
and ($leg.route != "waived" and $leg.route != "unavailable")
and usable_receipt([$leg.receipts[] | $receipts[.]]);
and usable_receipt([$leg.receipts[] | $receipts[.]])
and axioms_admissible([$leg.receipts[] | $receipts[.]]);

# 8.3: the tag needs a kernel-checked witness whose statement correspondence
# is recorded as in 2.2. A witness is {token, state, receipts}; it earns the
# tag on the same terms a leg counts. The earlier test was "the field is not
# null", so any value at all -- a note, a plan -- published the tag.
def diverse($w; $receipts):
($w | type) == "object"
and (($w.token // "") | accepted)
and $w.state == "RECONCILED"
and (($w.receipts // []) | length > 0)
and usable_receipt([$w.receipts[] | $receipts[.]])
and axioms_admissible([$w.receipts[] | $receipts[.]]);

# 8.2 PWG-1 / 8.5.2: a receipt DESCRIBES the source commit when its commit is
# the source commit of the ledger. (8.5.2 also admits an echo chain to it; this
Expand All @@ -109,7 +142,7 @@ DERIVE='
| ($t.legs.rocq) as $c
| ($t.legs.lean) as $l
| ([$a.receipts[] | $R[.]]) as $ar
| (($a.token | accepted) and $a.state == "AGDA-VERIFIED" and pwg3_receipt($ar)) as $agda_ok
| (($a.token | accepted) and $a.state == "AGDA-VERIFIED" and pwg3_receipt($ar) and axioms_admissible($ar)) as $agda_ok
| (if counts($c; $R) then 1 else 0 end) as $nc
| (if counts($l; $R) then 1 else 0 end) as $nl
| ($nc + $nl) as $legs
Expand All @@ -135,10 +168,15 @@ DERIVE='
kind: $t.kind,
pwg: $grade,
# 8.3: a non-DTT witness is a TAG beside the grade, never a leg.
foundation_diverse: (($t.foundation_diverse_witness // null) != null),
foundation_diverse: diverse($t.foundation_diverse_witness // null; $R),
counting_legs: $legs,
agda_receipt_complete: $agda_ok,
axioms: ([ $ar[]? | .axioms[]? ] | unique),
# 8.4 rule 6: the axioms of EVERY witness the grade stands on, not of the
# Agda leg alone. A counting Rocq or Lean leg used to contribute its
# count and none of its axioms.
axioms: ([ ($ar[]? | .axioms[]?),
(if counts($c; $R) then ($c.receipts[] | $R[.] | .axioms[]?) else empty end),
(if counts($l; $R) then ($l.receipts[] | $R[.] | .axioms[]?) else empty end) ] | unique),
legs: {
agda: {route: $a.route, token: $a.token, state: $a.state, counts: (counts($a; $R))},
rocq: {route: $c.route, token: $c.token, state: $c.state, counts: (counts($c; $R))},
Expand Down
Loading
Loading