diff --git a/.github/workflows/hypatia-scan.yml b/.github/workflows/hypatia-scan.yml index 651c6a8..e58b89e 100644 --- a/.github/workflows/hypatia-scan.yml +++ b/.github/workflows/hypatia-scan.yml @@ -22,7 +22,23 @@ permissions: security-events: write jobs: + # The same producer fork-governance.yml runs on PRs. Without it this lane's + # reusable downloads `fleet-report-backs` (its default), finds no such + # artifact, and renders every enrolled fleet row 🟠 indeterminate — on + # every push and scheduled run, permanently. The reusable checks out + # `github.event.pull_request.head.sha || github.sha`, so it serves + # push/schedule unchanged. Same pin as fork-governance.yml. + fleet: + name: Fleet report-backs + uses: hyperpolymath/gitbot-fleet/.github/workflows/fleet-report-back-reusable.yml@8906f47f945d4675d7375eb78898ed0f1c48cc95 + permissions: + contents: read + scan: + # After the fleet job whatever its result: a dead fleet job renders as + # orange fleet rows, never as a missing gate. + needs: [fleet] + if: ${{ !cancelled() }} # Explicit on the calling job (a job-level block replaces, never merges # with, the workflow-level one). The previous pin (cc58c0c…) no longer # exists in standards, so this gate failed at startup with zero jobs — diff --git a/.github/workflows/instant-sync.yml b/.github/workflows/instant-sync.yml index 01efebf..ce15e2a 100644 --- a/.github/workflows/instant-sync.yml +++ b/.github/workflows/instant-sync.yml @@ -18,14 +18,18 @@ jobs: env: HAS_DISPATCH_TOKEN: ${{ secrets.FARM_DISPATCH_TOKEN != '' }} steps: - # This job holds FARM_DISPATCH_TOKEN; monitor its outbound egress - # (Hypatia RE001). Audit mode first: record every endpoint without - # risking the dispatch; tighten to block+allowlist once a main run - # shows the observed set. - - name: Harden runner (egress audit) + # This job holds FARM_DISPATCH_TOKEN, so its egress is CONTAINED, not + # merely audited (Hypatia RE001/RE002: audit mode is telemetry-only and + # never blocks). The only outbound call any step makes is + # repository-dispatch's POST /repos/{repo}/dispatches on api.github.com; + # action tarballs are fetched at job set-up, before this step arms. Same + # shape as the estate's other block-mode instant-sync workflows. + - name: Harden runner (egress block) uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 with: - egress-policy: audit + egress-policy: block + allowed-endpoints: > + api.github.com:443 - name: Trigger Propagation if: env.HAS_DISPATCH_TOKEN == 'true' uses: peter-evans/repository-dispatch@v4.0.1 diff --git a/.github/workflows/proofs.yml b/.github/workflows/proofs.yml index b47f846..fe9cff4 100644 --- a/.github/workflows/proofs.yml +++ b/.github/workflows/proofs.yml @@ -27,6 +27,8 @@ on: paths: - 'verification/proofs/lean4/**' - 'verification/proofs/agda/**' + - 'verification/proofs/rocq/**' + - 'scripts/check-recheck-legs.sh' - 'verification/pwg.json' - 'scripts/pwg-derive.sh' - 'scripts/pwg-check.sh' @@ -207,6 +209,50 @@ jobs: fi echo "PASS: All.agda + Smoke.agda typecheck (${AGDA_FLAGS[*]}; --safe => postulate-free by construction)" + # PROOF-POLICY §2 recheck legs for the ratified-carrier order laws and L4 in + # full (TB.OrderLaws, TB.Monotone): a Rocq leg and a core-only Lean leg. No + # Mathlib, so unlike the lean-build packages below these legs can count + # (PROOF-POLICY §2: "No Mathlib, in Lean or elsewhere"). The gate is + # scripts/check-recheck-legs.sh, which runs the same way locally: pinned + # prover version asserted, compile, an axiom audit that fails on any axiom + # AND on an empty audit domain, then six planted controls that must each be + # caught (Admitted, sorry, a user axiom, an empty domain, and a definition + # drift that only the TB.Bridge tables can see). + # TOOLCHAIN: Ubuntu 24.04's coq package is Coq 8.18.0 (the version mathesis + # pins; the script refuses any other). Lean 4.16.0 (the repo's pin) is the + # GitHub release archive, checked against the SHA-256 observed 2026-11-17. + recheck-legs: + name: "Recheck legs (Rocq 8.18.0, Lean 4.16.0 core): order laws + L4" + runs-on: ubuntu-24.04 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Install Coq 8.18.0 (apt) and Lean 4.16.0 (pinned, checksummed) + shell: bash + env: + LEAN_URL: https://github.com/leanprover/lean4/releases/download/v4.16.0/lean-4.16.0-linux.tar.zst + LEAN_SHA256: cdd31f1064783fff163be53e285722102f16767e65e6fb7f7cb1c232514e0c3a + run: | + set -euo pipefail + sudo apt-get update -q + sudo apt-get install -y -q --no-install-recommends coq zstd + cd "$RUNNER_TEMP" + curl --fail --proto '=https' --proto-redir '=https' --tlsv1.2 -sSL -o lean.tar.zst "$LEAN_URL" + echo "$LEAN_SHA256 lean.tar.zst" | sha256sum -c - + tar --zstd -xf lean.tar.zst + echo "$PWD/lean-4.16.0-linux/bin" >> "$GITHUB_PATH" + - name: Rocq leg (compile + Print Assumptions on every declaration) + shell: bash + run: bash scripts/check-recheck-legs.sh rocq + - name: Lean leg (check + collectAxioms on every declared theorem) + shell: bash + run: bash scripts/check-recheck-legs.sh lean + - name: Planted controls (each must be caught) + shell: bash + run: bash scripts/check-recheck-legs.sh controls + # The Lean developments actually built. `lean-source-honesty` above is a cheap # syntactic guard that runs in seconds on every push; this is the semantic one, # and it is what makes ADR 0003's "grade-algebra ground truth" a measured claim diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 976f692..0267cb4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -8,8 +8,164 @@ https://semver.org/spec/v2.0.0.html[Semantic Versioning]. === [Unreleased] +==== Added + +* *L4 in full and A2 (Fate is a chain) proved, and rechecked in Rocq and +core Lean (2026-11-17).* ++ +The owner ruled to prove, not narrow. `+TB/Monotone.agda+` proves bond and merge +monotonicity and the lifting to the grade composition (one argument at a time, and +both at once as `+▷-mono+`). `+TB/OrderLaws.agda+` proves that `+fateLte+` is +transitive, antisymmetric and total (`+fate-isTotalOrder : IsTotalOrder _≡_ _≤F_+`), +and that `+⊑+` is a decidable preorder. No existing definition changed. ++ +The repository's first Rocq development, `+verification/proofs/rocq/RatifiedOrder.v+` +(Coq 8.18.0, no `+Require+`), and a core-Lean file with no import, +`+verification/proofs/lean4/ratified-order/RatifiedOrder.lean+` (Lean 4.16.0, no +Mathlib), re-prove all of it. `+TB/Bridge.agda+` pins six restated definitions to +the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the +same six literals. A planted one-clause drift that keeps every theorem true is +caught only by the bridge, in both legs. `+scripts/check-recheck-legs.sh+` is the +gate. It asserts the prover version, audits every declaration for axioms, fails +on an empty audit, and runs six planted controls. CI runs it as the new +`+recheck-legs+` job. ++ +Ledger: `+L4-bond-merge+`, `+L4-lifting+`, `+A2-chain+` and `+retention-order+` gain +`+PROVEN+` Agda legs. All seven L4/A2/retention rows gain `+RECONCILED+` Rocq and +Lean legs, with receipts from CI run 44006871652 on `+d5234b1+`. The census moves +from 28 obligations (`+PWG-3+` 18, ungraded 10) to 28 (`+PWG-3+` 15, `+PWG-2ii+` 7, +ungraded 6). The derivation does not reach `+PWG-1+`, because the receipts are not at +the ledger's source commit. The core-Lean leg counts by owner ruling of 2026-11-17, +which ADR 0005 records in its amendment: the 2026-11-09 ruling ("Lean is a +generator, not a leg") covers the Mathlib development only. + ==== Fixed +* *The proof recipes run all four proof developments in their ADR 0005 D4 +roles (2026-11-17, upkeep).* ++ +The ADR 0005 amendment named this as upkeep: the recipes D5 touched still +described three provers. `+build/just/proofs.just+` gains `+proof-check-rocq+`, +`+proof-check-lean-core+` and `+proof-check-recheck-controls+`, which run +`+scripts/check-recheck-legs.sh rocq|lean|controls+`, and `+recheck-legs+`, which +runs all three as the CI job of that name does. A missing or wrong-version prover +fails; it never skips. `+proof-check-all+` and `+verify-all+` now include them, so +both also need `+coqc+` 8.18.0 and `+lean+` 4.16.0. `+proof-status+` lists the four +developments by role, with the PWG census in place of a summary row that +PROOF-STATUS no longer has. ++ +`+proof-check-lean4+` had failed since the core-Lean leg landed (#122), with or +without a toolchain problem. Its orphan guard counted `+lean4/ratified-order/RatifiedOrder.lean+` as a file no lake package +builds. That file is the core-Lean leg, which the recheck gate checks. The guard +now exempts exactly the file the gate names, so a stray file beside it still +fails. `+proof-check-rocq+` has the same guard for `+.v+` files. No proof, ledger +entry or grade changed. + +* *Every PWG witness name now resolves, the ladder's top two rungs are +distinct, and L4 and A2 are graded by their parts (2026-11-16).* ++ +_Witness names._ Nothing read the ledger's `+declarations+`: 13 of 91 distinct +witness names named nothing in the sources — ASCII transliterations +(`+|>+` for `+▷+`, `+|=+` for `+⊑+`, `+beta-+` for `+β-+`, `+-r+` for `+ʳ+`), +kebab-case spellings of camelCase lemmas, `+gmonoid-unit+` for the pair +`+gmonoid-unitL+`/`+gmonoid-unitR+`, and a Lean name in the wrong namespace. L2's +only Agda witness and all three veridicality-derivation witnesses were among them, +on rows published `+PWG-3+`. `+scripts/pwg-names.sh+` inventories the declared +names (through the comment stripper) and `+scripts/pwg-check.sh+` rule 6 resolves +every Agda and Lean witness against it. The 13 are corrected; no grade moved. +Canaries 25–26 fail against the pre-rule-6 gate. Review then found that a +citation with a tab and text appended split into an extra field the resolver +ignored, so the real prefix resolved; each field is now JSON-escaped before +resolution, and canary 29 (which fails against the first version) plants it. ++ +_Ladder._ With both recheck legs counting, the derivation's `+PWG-1+` test +re-checked conjuncts counting already implied, so `+PWG-2ii+` was unreachable and +`+PWG-1+` was granted on `+PWG-2ii+` evidence (measured: receipts recording commit +`+ffff…+` derived `+PWG-1+`). §8.2/§8.5.2 make `+PWG-1+` a question of which commit +the receipts describe; the branch now requires each counted witness's receipt to +record the ledger's source commit. Latent — no obligation has two counting legs. +Canaries 27–28 read the derived grade; 28 fails against the pre-fix derivation. +The suite stands at *29/29*. ++ +_L4 and A2, split (owner ruling 2026-11-16)._ "L4 (monotonicity), in full" and +"Fate is a chain (A2)" derived `+PWG-3+` from Agda legs whose own notes conceded they +covered only part of the statement. L4 is now four obligations — `+L4-fate+` and +`+L4-fidelity+` (`+PWG-3+`), `+L4-bond-merge+` and `+L4-lifting+` (ungraded) — and A2 +two: `+A2-directions+` (`+PWG-3+`) and `+A2-chain+` (ungraded; Lean states only +totality and reflexivity, transitivity is proved in Idris2 off the ladder, and +antisymmetry is cited nowhere, so its Lean leg is `+OPEN+` too). The +census moves from 24 theory obligations (`+PWG-3+` 17, ungraded 7) to 28 +(`+PWG-3+` 18, ungraded 10). The denominator changed because the obligations +did; no evidence changed. ++ +_INTERFACE-REPORT._ It said `+fate-tier-meet-hom-fails+` "would be false under a +commutative model"; the carrier is commutative (`+grade-comm+`) and the theorem +holds on it. It named `+grade-not-comm+` and `+cut-symmetric-fails+` as live (both +replaced), stated the retired clause `+dropped ▷f falsified = dropped+` as +definitional (the ratified clause is `+= falsified+`), and gave +`+GradeBoundary.lean+`'s axiom bound as `+propext+`/`+Quot.sound+` only, where the +file's own footer names three. All corrected; prose only. + +* *Two prose claims narrowed to what the provers actually state (2026-11-16).* +Both were raised in review on #114 and merged unaddressed. ++ +`+README.adoc+` said `+psiBond+` "separates honest from deceptive bonds". The Lean +file states one pair: `+psiBond_separates_honest_deceptive+` is +`+psiBond Bond.severed ≠ psiBond Bond.misbound+`, by `+total ≠ unknown+`. The +general claim is believed and is a single `+cases+` away — `+psiBond intact+` and +`+psiBond withheld+` are both `+Q 0+`, and `+Q_ne_unknown+` is already in the same +file — but it is *not* a theorem today, so the README no longer asserts it. It is +not added here because no Lean toolchain was available to check it, and an +unverified theorem in a proof file is the thing these gates exist to stop. ++ +`+INTERFACE-REPORT.adoc+`'s F4 checklist said "the deceptive tier is +forward-closed (L5)". The checklist refutes that two bullets above: the fate +*tier* is not closed under `+▷+` on the right, and `+fate-tier-meet-hom-fails+` is +the witness — `+dropped ▷f atten unknown+` reduces to `+dropped+`, which is +`+honestLossy+`, although `+atten unknown+` is tier-deceptive. What Agda proves is +`+deceptive-absorbs-▷+`: the grade-level *predicate*, closed in its *left* +argument. Both qualifications now appear, with the distinction `+TB/Tier.agda+` +already drew in a comment ("does not launder the GRADE-level deceptive +predicate") lifted into the report. + +* *A receipt that records FAILURE no longer supports a grade (2026-11-16).* +`+scripts/pwg-derive.sh+` read a receipt's `+state+` but never its `+result+`. +Measured against `+main+` `+0dceab6+`: flipping this repository's Agda receipt to +`+"result": "fail"+` while leaving `+"state": "current"+` left the derived census +*byte-identical* — 17 `+PWG-3+` grades still published on a receipt recording the +checker *rejecting* the development — and `+scripts/pwg-check.sh+` exited `+0+`. +A grade may not outlive the run that earned it; a regressed run is §8.2 evidence +of the opposite. `+usable_receipt+` and `+pwg3_receipt+` now both require +`+result == "pass"+`, and rule 3 constrains `+result+` to the closed vocabulary +`+pass|fail+` so an unrecognised value is an error rather than a silent +non-pass. With the fix the same planted receipt collapses the census to +`+PWG-3+` 0, `+ungraded+` 24. Canaries 20 and 21 plant exactly these two cases +and were confirmed to FAIL against the pre-fix scripts. Canary 22 plants a +`+result+` of `+"pass\n"+`: jq's `+$+` anchor matches before a final newline, so +the rule-3 check admitted it. Rule 3 now compares `+result+` by exact equality. ++ +The same defect sat in the seven sibling anchors: the commit check in rule 3 +and in both derivation predicates, and the `+state+`, token, §2.2-state and route +vocabularies. Measured: a 40-hex commit followed by a newline passed the *whole* +gate, derivation included, so a malformed provenance field could carry a grade. +All seven are now anchored with `+\A…\z+`. Canaries 23 and 24 plant a trailing newline on a +commit and on a token; both FAIL against the pre-fix scripts and PASS against +the fix. The suite is now *24/24*. ++ +Two things this change did *not* do are worth recording, because each was tried +and rejected on evidence. The ShellCheck `+SC1112+` warning on `+pwg-derive.sh+` +could not be fixed the obvious way: that comment sits inside the single-quoted +`+jq+` program, so replacing the Unicode right-quote with a plain apostrophe +*terminated the string* and broke the script — caught immediately by the suite's +own live-ledger canary. The comment is reworded to contain no apostrophe at all, +and the block now carries a warning saying why. And `+SC2030+`/`+SC2031+` were +not silenced: the meta-canary shadowed `+PASS+`/`+FAIL+` inside a command +substitution to discard the probe's deliberate failure, which tainted *ten* +later reads of the real counters. It now reads the probe's verdict line instead, +so the warnings go away by construction rather than by suppression. +`+shellcheck 0.11.0 --severity=style+` — the version and severity CI pins — is +clean over every tracked `+*.sh+`, with no disable added. + * *A comment marker inside a string literal is no longer read as a comment (2026-11-09).* `+tests/lib/strip-proof-comments.awk+` tracked block comments with no notion of string literals, so `+def m : String := "/-"+` opened a block @@ -65,7 +221,8 @@ count is now part of the claim. + Added canary 19, the *meta-canary*: it breaks one canary's own `+jq+` program and asserts the suite reports FAILURE. It fails against the pre-fix harness, which -is what makes it evidence rather than decoration. The suite is *19/19*, and all +is what makes it evidence rather than decoration. The suite stands at *24/24* +once the receipt-result canaries recorded below are counted, and all four breakages — a corrupted transform, a no-op fixture, a dropped group, and a suite that cannot see its own breakage — were each confirmed to fail it. @@ -102,7 +259,8 @@ Wired: `+just pwg+` (census and per-obligation grades), `+just pwg-render+` job in `+proofs.yml+` that needs no prover because the kernels already ran. + Falsified, not assumed: `+scripts/test-gate-falsifiability.sh+` gains seven PWG -canaries plus a control, and the suite now runs 18/18. Two are load-bearing — +canaries plus a control, taking the suite to 18 cases at that point (it stands at +*24/24* after the later entries in this same block). Two are load-bearing — removing the import cone collapses all 17 `+PWG-3+` to `+ungraded+` (census `+ungraded+` 24), and flipping one Lean leg to `+RECONCILED+` lifts that obligation to `+PWG-2i+` — so they fire only if the published table really is @@ -113,11 +271,17 @@ receipts, the derivation returns `+PWG-1+`. * *Proof Witness Grades recorded, and the proof records reconciled with the sources (2026-11-09).* `+docs/status/PROOF-STATUS.adoc+` gains the §8.5 PWG record -that `+PROOF-POLICY.adoc+` §8 (owner ruling 2026-11-04) requires, with both theory -groups derived as `+ungraded+` — Theorem B for want of a §2.1-conformant *receipt* -(its flags in force already are §2.1), the Lean-witnessed results for want of an -Agda *source* — plus the §1.1 import-cone record and a census in the form §8.4 -rule 7 allows. Four published rows narrowed to what the provers actually state: L3 +that `+PROOF-POLICY.adoc+` §8 (owner ruling 2026-11-04) requires, plus the §1.1 +import-cone record and a census in the form §8.4 rule 7 allows. *As first +drafted this entry read "both theory groups derived as `+ungraded+`"; that +reading was superseded within this same block* by the evidence ledger below, +which records the §2.1-conformant Agda receipt the first reading treated as +missing, and so derives `+PWG-3+` for 17 of the 24 theory obligations and +`+ungraded+` for 7 — on three §8.1 grounds: no §2.1-conformant receipt, no +Agda source at all, or an incomplete Agda leg. The last applies to +`+retention-order+` and `+tier2-membership+`: their Agda token is `+OPEN+` +despite a current, passing Agda receipt, as the ledger and breakdown above record. +The published census is the derived one, and `+scripts/pwg-check.sh+` fails on any drift between them. Four published rows narrowed to what the provers actually state: L3 (two-sidedness is stated only for `+Falsified+` in Agda), L4 (Agda covers fate and fidelity; Lean covers fate; bond, merge and the grade-level lifting have an Idris2 leg only, which §8.1 excludes from the ladder), Target 3 (`+_↝_+` has two diff --git a/README.adoc b/README.adoc index b05686d..8ccc8e1 100644 --- a/README.adoc +++ b/README.adoc @@ -74,9 +74,16 @@ rejects them at validation, naming the offending coordinate. The alternative | `verification/proofs/lean4/grade-boundary/` | The grade-algebra ground truth (Lean 4 + Mathlib): the three-tier honest/deceptive cancellation boundary. No `sorryAx` and no user axiom; the kernel reports `propext` and `Quot.sound`, and `Classical.choice` in three theorems. | `verification/proofs/lean4/grade-factorisation/` | The tropical factorisation probe (Lean 4 + Mathlib): imports the carrier and decides whether the grade admits a commutative cost-quotient. Verdict *(B) factors but veridicality-blind* on the *pre-ratification* carrier; re-run on the ratified carrier it becomes *(B′) sighted on the fate axis* — `piR` separates honest `Dropped` from deceptive `Falsified`, and reads the four fate slots -only; `psiBond` separates honest from deceptive bonds -(`GradeFactorisation.lean`). A precondition only; does not address recursion (CO-1). +only; on the bond axis `psiBond` is proved to separate the honest `severed` from +the deceptive `misbound` (`psiBond_separates_honest_deceptive`, via +`total ≠ unknown`, in `GradeFactorisation.lean`). That is the *one pair* the file +states; the general "separates every honest bond from every deceptive one" is +believed and is a single `cases` away — `psiBond intact = psiBond withheld = Q 0` +and `Q_ne_unknown` is already in the file — but it is not currently a theorem, +so it is not claimed here. A precondition only; does not address recursion (CO-1). | `verification/proofs/agda/theorem-b/` | Theorem B — the deferred calculus metatheory (Agda `--safe --without-K --cubical-compatible`, the PROOF-POLICY §2.1 invocation; zero postulates): intrinsic graded calculus, value-substitution, subject reduction (β/let; `fix` open), Honest Generation. +| `verification/proofs/rocq/` | A PROOF-POLICY §2 recheck leg (Coq 8.18.0, no `Require`): the ratified-carrier order laws and L4 in full (`TB.OrderLaws`, `TB.Monotone`), restated from the Agda with a definition bridge. Gate: `just proof-check-rocq`. +| `verification/proofs/lean4/ratified-order/` | The other §2 recheck leg (core Lean 4.16.0, no `import`, no Mathlib): the same theorems. Gate: `just proof-check-lean-core`. ADR 0005 D4, as amended 2026-11-17, gives each of the four proof developments its role: Agda the normative kernel, Rocq and core Lean the recheck legs, Lean with Mathlib a generator, Idris2 the reference. | `verification/proofs/INTEGRATION-REPORT.adoc` | How the three streams reconcile: the unified R-id ↔ Lean ↔ Agda ↔ status table, the convergence (central open problem), and the divergence adjudication. | `docs/CONTRIBUTING-A-FRONTEND.adoc` | How a new front-end targets the IR (the portability contract). | `docs/status/PROOF-STATUS.adoc` | What is proved vs. stubbed-and-named vs. deferred. @@ -109,7 +116,8 @@ just check # schema validation + Idris2 typecheck + conformance suite just trope-conformance # just the IR→verdict conformance corpus idris2 --typecheck verification/proofs/idris2/trope.ipkg # the verified core src/idris2/build/exec/tropecheck tests/conformance/fixtures/duck-collapse.ir.json -just verify-all # grade-algebra ground truth (Lean) + Theorem B (Agda), both green + honesty gate +just verify-all # Lean + Mathlib, Theorem B (Agda), the Rocq + core-Lean recheck legs, honesty gate, PWG record +just recheck-legs # just the two §2 recheck legs (Coq 8.18.0, core Lean 4.16.0) + their planted controls just build-lean # both Lean harnesses (grade-boundary + grade-factorisation) + axiom audits just build-agda # just the Agda Theorem B metatheory (--safe --without-K) ---- @@ -157,16 +165,23 @@ unquotiented carrier) is proved in Lean; Agda proves finite-fidelity cancellatio 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. -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; +Only *L1* and *L4* carry a statement in all three of Agda, Lean with Mathlib and +Idris2, and of the ten results *eight* lack one entirely. Lean with Mathlib does +not state L2, L5, Honest Generation or Veridicality; Idris2 does not state L3, L6, conicality or the cancellation boundary; L5 is Agda-only. Where Idris2 does restate a result, PROOF-POLICY §8.1 keeps it off the Proof Witness Grade ladder as an engineering restatement — the ledger records it under `reference`, never as a leg, so it can neither raise nor lower a grade. -And *L4 in full* is proved by none of the three: Agda covers the fate coordinate -and the fidelity dimension, Lean covers fate, and bond and merge have an Idris2 -restatement only. Idris2 establishes coordinate-level monotonicity only; the -lifting for `gradeCompose` is not mechanised in Idris2. The atom +*L4 in full* and *A2* (Fate is a chain) are proved in Agda since 2026-11-17. +`TB.Monotone` adds the bond and merge coordinates and the lifting to +`gradeCompose`, and `TB.OrderLaws` adds transitivity, antisymmetry and totality. +Both are rechecked in Rocq (`verification/proofs/rocq/`) and in core Lean with no +Mathlib (`verification/proofs/lean4/ratified-order/`). The ledger grades L4 as +four obligations and A2 as two (owner ruling 2026-11-16). All six, and the +retention order (a decidable preorder), derive `PWG-2ii`. The core-Lean leg counts +by owner ruling of 2026-11-17, which ADR 0005 records in its amendment: Lean with +Mathlib stays a generator, never a leg. Completeness of the chain, which spec §7 also uses, is proved in +no prover. The atom factorisation (O1's carrier half, proved on the ratified `GradeR` in `EffectAtomsRatified.lean`; O1-coord stays open) and the tropical factorisations — pre-ratification `GradeFactorisation.lean` veridicality-blind, ratified diff --git a/build/just/proofs.just b/build/just/proofs.just index e1905fb..0ad8bce 100644 --- a/build/just/proofs.just +++ b/build/just/proofs.just @@ -4,16 +4,17 @@ # FORMAL VERIFICATION (PROOFS) # # Imported by ../../Justfile via `import? "build/just/proofs.just"`. -# Recipes here check formal proofs across Idris2, Lean4 and Agda, plus +# Recipes here check the four proof developments in the roles ADR 0005 D4 +# gives them (as amended 2026-11-17): Agda is the normative kernel; Rocq and +# core Lean (no Mathlib) are the PROOF-POLICY §2 recheck legs; Lean + Mathlib +# is a generator, never a leg; Idris2 is the executable reference. They also # scan for dangerous/unsafe constructs and report status. Run via # `just proof-check-all` for the full sweep. -# Check all formal proofs (Idris2 + Lean4 + Agda) -proof-check-all: proof-check-idris2 proof-check-lean4 proof-check-agda proof-scan-dangerous +# Check all formal proofs (Agda kernel, Rocq + core-Lean recheck legs, Lean + Mathlib generator, Idris2 reference) +proof-check-all: proof-check-idris2 proof-check-lean4 proof-check-agda recheck-legs proof-scan-dangerous @echo "=== All proof checks complete ===" -# Check Idris2 proofs by PACKAGE (the verified core + the ABI seam) -# # This recipe used to `find` every .idr under verification/ and run # `idris2 --check` on each from the repo root — where module names do not # resolve, template files that belong to no package fail spuriously, and a @@ -22,6 +23,8 @@ proof-check-all: proof-check-idris2 proof-check-lean4 proof-check-agda proof-sca # check that means something: it is what CI runs, with %default total # enforced by the modules themselves. A missing toolchain is a FAIL here: # a gate that passes when it did not run is worse than no gate. +# +# Check the Idris2 executable reference by PACKAGE (the verified core + the ABI seam; off the PWG ladder) proof-check-idris2: #!/usr/bin/env bash set -euo pipefail @@ -46,15 +49,17 @@ proof-check-idris2: fi echo "PASS: trope.ipkg + abi.ipkg typecheck; no orphan .idr files" -# Check Lean4 proofs by PACKAGE (lake build at CI strictness) -# # Was: `lean ` per file from the root (imports unresolvable, so # permanently red) plus SKIP-on-missing-toolchain. Now the same build CI -# runs: both lake packages with warnings as errors. +# runs: both lake packages with warnings as errors. These are the GENERATOR +# (ADR 0005 D4 as amended), never a §2 leg; the core-Lean recheck leg is +# proof-check-lean-core. +# +# Check the Lean + Mathlib generator packages by PACKAGE (lake build --wfail; a generator, never a §2 leg) proof-check-lean4: #!/usr/bin/env bash set -euo pipefail - echo "=== Checking Lean4 proofs (lake build --wfail, both packages) ===" + echo "=== Checking Lean + Mathlib generator (lake build --wfail, both packages) ===" if ! command -v lake &>/dev/null; then echo "FAIL: lake not installed (Lean v4.16.0, see lean-toolchain files) — refusing to report a skip as a pass" exit 1 @@ -62,20 +67,25 @@ proof-check-lean4: ( cd verification/proofs/lean4/grade-boundary && lake build --wfail ) ( cd verification/proofs/lean4/grade-factorisation && lake build --wfail ) # Orphan guard: every .lean in the tree must be a lean_lib of one of - # the two lakefiles (a file no package builds is never kernel-checked). + # the two lakefiles, or be THE core-Lean leg that + # scripts/check-recheck-legs.sh gates (proof-check-lean-core). A file + # neither builds is never kernel-checked. + leg="$(sed -n 's/^LEAN_FILE="\(.*\)"$/\1/p' scripts/check-recheck-legs.sh)" + [ -n "$leg" ] || { echo "FAIL: no LEAN_FILE in scripts/check-recheck-legs.sh — cannot tell the core-Lean leg from an orphan"; exit 1; } orphans="" for f in $(find verification/proofs/lean4 -name '*.lean' -not -path '*/.lake/*' | sort); do + [ "$f" = "$leg" ] && continue base="$(basename "$f" .lean)" grep -qhE '^name = "'"$base"'"' verification/proofs/lean4/*/lakefile.toml \ || orphans="$orphans $f" done if [ -n "$orphans" ]; then - echo "FAIL: Lean files belonging to no lake package (never built):$orphans" + echo "FAIL: Lean files belonging to no lake package and not the core-Lean leg (never checked):$orphans" exit 1 fi - echo "PASS: both Lean packages build (--wfail); no orphan .lean files" + echo "PASS: both Lean + Mathlib packages build (--wfail); no orphan .lean files (core-Lean leg: $leg)" -# Check Agda proofs (same entry point and flags as build-agda / CI) +# Check the Agda normative kernel (same entry point and flags as build-agda / CI) proof-check-agda: #!/usr/bin/env bash set -euo pipefail @@ -90,10 +100,48 @@ proof-check-agda: && agda "${AGDA_FLAGS[@]}" Smoke.agda ) echo "PASS: Theorem B typechecks (${AGDA_FLAGS[*]})" -# (No proof-check-coq: the tree carries no Coq — T5 of PR #102 removed the -# never-instantiated template, and a recipe whose find matches nothing and -# whose missing toolchain exits 0 is, in ADR 0005's words, "a gate that -# cannot fail". If Coq ever lands for real, add the recipe with the proof.) +# --------------------------------------------------------------------------- +# PROOF-POLICY §2 recheck legs: Rocq and core Lean (ADR 0005 D4/D5, as +# amended 2026-11-17). T5 of PR #102 removed a never-instantiated Coq +# template and its silently-skipping recipe, "a gate that cannot fail", and +# said a Coq recipe should come back only with a real proof. The Rocq +# development that landed on 2026-11-17 is that proof, an instantiated leg, +# and the recipes below check it. The gate is +# scripts/check-recheck-legs.sh, the same script the proofs.yml +# `recheck-legs` job runs. It asserts the pinned prover version (Coq 8.18.0, +# Lean 4.16.0), and a missing prover FAILS (it never skips). It also fails +# on any axiom and on an empty audit domain. +# --------------------------------------------------------------------------- + +# Rocq recheck leg: compile, then `Print Assumptions` on every Theorem and Lemma +proof-check-rocq: + #!/usr/bin/env bash + set -euo pipefail + # Orphan guard: the script gates ONE Rocq file. Any other .v in the proof + # tree would be a development no gate checks. + leg="$(sed -n 's/^ROCQ_FILE="\(.*\)"$/\1/p' scripts/check-recheck-legs.sh)" + [ -n "$leg" ] || { echo "FAIL: no ROCQ_FILE in scripts/check-recheck-legs.sh"; exit 1; } + orphans="" + for f in $(find verification/proofs -name '*.v' -not -path '*/_build/*' | sort); do + [ "$f" = "$leg" ] || orphans="$orphans $f" + done + if [ -n "$orphans" ]; then + echo "FAIL: Rocq files no gate checks (only $leg is gated):$orphans" + exit 1 + fi + bash scripts/check-recheck-legs.sh rocq + +# Core-Lean recheck leg (no Mathlib): check, then collectAxioms on every declared theorem +proof-check-lean-core: + @bash scripts/check-recheck-legs.sh lean + +# Planted controls: Admitted, sorry, a user axiom, an empty domain and a definition drift must each be caught +proof-check-recheck-controls: + @bash scripts/check-recheck-legs.sh controls + +# Both §2 recheck legs plus their planted controls (mirrors the proofs.yml recheck-legs job) +recheck-legs: proof-check-rocq proof-check-lean-core proof-check-recheck-controls + @echo "PASS: recheck-legs — Rocq and core-Lean legs green, every planted control caught" # Scan for dangerous patterns in proof files (believe_me, sorry, Admitted, etc.) # COMMENT-AWARE: strips line (-- //) and block ({- -}, /- -/, (* *)) comments before @@ -125,34 +173,36 @@ proof-scan-dangerous: fi echo "PASS: No dangerous patterns found in proofs (comments excluded)" -# Show proof status summary +# Show proof status summary: the four developments by ADR 0005 D4 role, then the PWG census proof-status: #!/usr/bin/env bash - echo "=== Proof Status ===" + set -uo pipefail + # Source files only: never count a .lake/ or _build/ tree (vendored Mathlib). + n() { find "$@" -not -path '*/.lake/*' -not -path '*/_build/*' 2>/dev/null | wc -l; } + L=verification/proofs/lean4 + echo "=== Proof Status (roles: ADR 0005 D4, as amended 2026-11-17) ===" echo "" - echo "Idris2: $(find verification/proofs/idris2 -name '*.idr' 2>/dev/null | wc -l) files" - echo "Lean4: $(find verification/proofs/lean4 -name '*.lean' 2>/dev/null | wc -l) files" - echo "Agda: $(find verification/proofs/agda -name '*.agda' 2>/dev/null | wc -l) files" + # The role goes last: printf pads by bytes, and "§" is two of them. + printf '%-13s %5s %-27s %s\n' \ + "Development" "Files" "Gate" "Role" \ + "Agda" "$(n verification/proofs/agda -name '*.agda')" "just proof-check-agda" "normative kernel" \ + "Rocq" "$(n verification/proofs/rocq -name '*.v')" "just proof-check-rocq" "§2 recheck leg" \ + "Lean (core)" "$(n "$L/ratified-order" -name '*.lean')" "just proof-check-lean-core" "§2 recheck leg, no Mathlib" \ + "Lean+Mathlib" "$(n "$L/grade-boundary" "$L/grade-factorisation" -name '*.lean')" "just proof-check-lean4" "generator, never a leg" \ + "Idris2" "$(n verification/proofs/idris2 -name '*.idr')" "just proof-check-idris2" "executable reference, off the PWG ladder" echo "" - # PROOF-STATUS may live at root, docs/status/ (post-#20), .md or .adoc (post-#23) - for candidate in docs/status/PROOF-STATUS.adoc docs/status/PROOF-STATUS.md PROOF-STATUS.adoc PROOF-STATUS.md; do - if [ -f "$candidate" ]; then - grep -E "^\| \*\*Total\*\*|^\| \*Total\*" "$candidate" 2>/dev/null || echo "(No summary row in $candidate)" - exit 0 - fi - done - echo "(No PROOF-STATUS file found at root or docs/status/)" + echo "Proof Witness Grades are derived from verification/pwg.json (PROOF-POLICY §8.4 rule 2):" + bash scripts/pwg-derive.sh --census # --------------------------------------------------------------------------- # Theorem-B integration targets (the grade-algebra ground truth + its Agda # metatheory). These supersede the naïve per-file `proof-check-{lean4,agda}` # for the two pinned developments, which need lake+Mathlib (Lean) and # `--without-K` over an `All.agda` entry point (Agda) rather than a bare -# per-file check. +# per-file check. verify-all, the merge gate, also runs the §2 recheck legs +# (recheck-legs, above), so all four proof developments gate a merge. # --------------------------------------------------------------------------- -# Build BOTH Lean packages and axiom-audit every `#print axioms` receipt. -# # The old "audit" re-ran `lake build | grep ... || true` on a warm tree: # lake re-emits nothing for up-to-date modules, grep found nothing, and the # step passed having audited zero theorems. Now each source is re-elaborated @@ -161,6 +211,8 @@ proof-status: # Classical.choice, Quot.sound} — with a non-vacuity floor (the corpus # carries 70+ receipts today; the audit fails below 50 rather than passing # on an empty grep). +# +# Build BOTH Lean + Mathlib generator packages and axiom-audit every `#print axioms` receipt. build-lean: #!/usr/bin/env bash set -euo pipefail @@ -218,8 +270,8 @@ build-agda: # (Agda postulate-freedom is enforced by --safe in build-agda; a word-grep would # false-positive on the honest 'sorry-free' / 'No postulate' comments — do NOT use one.) # -# Build both formal developments + run the Lean source honesty gate (the merge gate). -verify-all: build-lean build-agda +# The merge gate: Lean + Mathlib generator, Agda kernel, Rocq + core-Lean recheck legs and controls, Lean honesty gate, PWG record. +verify-all: build-lean build-agda recheck-legs #!/usr/bin/env bash set -euo pipefail echo "=== verify-all: Lean source honesty gate ===" @@ -238,7 +290,7 @@ verify-all: build-lean build-agda done echo "=== verify-all: Proof Witness Grade record ===" bash scripts/pwg-check.sh - echo "PASS: verify-all — Lean green, no sorryAx and no user axiom; Agda strict-flags green; PWG record derived and in step." + echo "PASS: verify-all — Lean + Mathlib green, no sorryAx and no user axiom; Agda strict-flags green; Rocq and core-Lean recheck legs green with every planted control caught; PWG record derived and in step." # Derive every Proof Witness Grade from verification/pwg.json and show the census. # The ledger holds EVIDENCE only; PROOF-POLICY §8.4 rule 2 says the grade is diff --git a/docs/decisions/0005-v0.2-consolidation-o5-and-prover-roles.adoc b/docs/decisions/0005-v0.2-consolidation-o5-and-prover-roles.adoc index 7099f3f..ab95857 100644 --- a/docs/decisions/0005-v0.2-consolidation-o5-and-prover-roles.adoc +++ b/docs/decisions/0005-v0.2-consolidation-o5-and-prover-roles.adoc @@ -118,3 +118,85 @@ decided by this ADR. * *Leave O5 as the workbench proposal* — rejected: an obligation cited by the checker's firewalls must live in the checker's spec, not in a proposal downstream cannot cite as normative. + +== Amendment, 2026-11-17: D4 and D5, the §2 recheck legs + +*Status of this amendment:* owner rulings of 2026-11-09 and 2026-11-17, recorded +here. The ADR as a whole stays *Proposed* until the owner accepts it. + +*Why.* D4 made "Lean 4 + Mathlib" this repository's provenance prover. PROOF-POLICY +§2 (standards `3-practice/PROOF-POLICY.adoc`) defines no such role. It requires +every Agda theory proof to be rechecked in Rocq and in Lean, with no Mathlib: "a +proof that needs a large external library to compile is a dependency, not a proof +the estate owns". Two owner rulings close that gap. + +* *2026-11-09, Lean as a generator.* The Mathlib development (the + `grade-boundary` and `grade-factorisation` packages) keeps Mathlib and keeps its + purpose: finding and stress-testing theorems, which are then restated in core + Agda. It is never a §2 leg. The ledger records each of its legs as + `route: re-proved, state: BRIDGE-PENDING`, which does not count (§2.2, §8.2). +* *2026-11-17, rechecked in Rocq and Lean.* Theory goes in Agda and is rechecked + in Rocq and Lean, with no Mathlib. Asked whether the 2026-11-09 ruling also + covers a Lean leg that imports nothing, the owner ruled that it does not. Such a + leg is a §2 recheck leg, and it counts when its correspondence is `RECONCILED`. + +*D4, as amended (prover roles).* + +[cols="1,3"] +|=== +| Prover | Role + +| Agda +| The normative kernel, unchanged: Theorem B and every theory obligation, under the +§2.1 invocation `agda --safe --without-K --cubical-compatible`. + +| Rocq +| A §2 recheck leg, route `re-proved`: `verification/proofs/rocq/`, with no +`Require` beyond the prelude. Gate: `scripts/check-recheck-legs.sh rocq`. + +| Lean, core +| A §2 recheck leg, route `re-proved`: `verification/proofs/lean4/ratified-order/`, +with no import (no Mathlib). Gate: `scripts/check-recheck-legs.sh lean`. Lean is +an independent kernel of the same dependent-type family as Agda and Rocq, so +§8.3's `+foundation-diverse+` tag is not earned by it. + +| Lean + Mathlib +| A generator, never a leg (2026-11-09): `verification/proofs/lean4/grade-boundary/` +and `grade-factorisation/`. Its results become gradeable only once restated in +core Agda. Its rows stay `BRIDGE-PENDING`. + +| Idris2 +| The executable reference, unchanged. PROOF-POLICY §8.1 keeps it off the PWG +ladder, so the ledger records it under `reference`, never as a leg. + +| Rust +| The fast core, unchanged. It is validated against the reference over the +conformance corpus and proves nothing. +|=== + +*D5, as amended.* D5 removed three mint templates, among them +`verification/proofs/coq/TypeSafety.v`, because they were never instantiated and +the Coq recipe skipped silently. That reasoning stands. The Rocq development added +on 2026-11-17 is different in kind. It is an instantiated recheck leg. Its gate +asserts the Coq version, fails on a missing prover, fails on any axiom and on an +empty audit, and runs planted controls in CI. The repository therefore has four +proof developments (Agda, Rocq, Lean, Idris2) plus the Rust fast core. "Three +provers" in D5 and its consequences is superseded by this table. + +*Consequences of the amendment.* + +* `docs/status/PROOF-STATUS.adoc` no longer marks the core-Lean legs as awaiting + the owner. The paragraph there on the 2026-11-09 ruling points here instead of + to an amendment "tracked separately". +* The seven rows whose Rocq and core-Lean legs count (`L4-fate`, `L4-fidelity`, + `L4-bond-merge`, `L4-lifting`, `A2-directions`, `A2-chain`, `retention-order`) + keep their derived `PWG-2ii`. No grade moves because of this amendment: it records + the ruling the ledger already followed. +* A new theory result reaches `PWG-2ii` only by the same route: an Agda source, + then a Rocq leg and a core-Lean leg, each with a recorded §2.2 correspondence + and a receipt. A Mathlib Lean proof of it is welcome as a generator, and it + counts for nothing on the ladder. +* Not changed by this amendment: `just proof-status` and the other recipes D5 + touched still describe the developments they ran on 2026-10-27. Bringing them in + line with this table is upkeep (doctrine 16), and it is tracked as such rather + than done here. diff --git a/docs/status/PROOF-STATUS.adoc b/docs/status/PROOF-STATUS.adoc index d2508bc..8c1c804 100644 --- a/docs/status/PROOF-STATUS.adoc +++ b/docs/status/PROOF-STATUS.adoc @@ -36,8 +36,8 @@ toc::[] | Agda `TB.Grade.{falsified-absorbL,falsified-absorbR,misbound-absorbL,conflated-absorbL,unknown-absorbL,total-absorb-Q}`, `TB.Tier.deceptive-absorbs-▷`; Lean `FateA.falsified_two_sided_zero`, `GradeR.gBotR_two_sided_zero`. | L4 (monotonicity), in full -| stem:[\triangleright] is monotone in both arguments w.r.t. stem:[\sqsubseteq] on every coordinate of the ratified carrier. Coverage differs by prover: the Agda covers the fate coordinate (`fateL4Mono{R,L}`) and the fidelity dimension (`dplusMono{R,L}`) only; the bond and merge coordinates have an Idris2 restatement only. Idris2 establishes coordinate-level monotonicity only; the grade-level lifting for `gradeCompose` that spec §7's Knaster–Tarski argument invokes is not mechanised in Idris2. Per PROOF-POLICY §8.1 Idris2 is an engineering prover and is not on the PWG ladder, so bond, merge and the grade-level lifting currently have no gradeable theory leg. -| Idris2 `Trope.Soundness.{fateL4MonoR,fateL4MonoL}`, `Trope.Order.{bondComposeMono,mergeComposeMono}`; Agda `TB.Order.{fateL4MonoR,fateL4MonoL}`; Lean `FateA.{comp_mono_right,comp_mono_left}` (fate coordinate only; `FateA.le` is defined on `Fate` alone and the Lean tree carries no `Bond`, `Merge` or `GradeR` order). +| stem:[\triangleright] is monotone in both arguments w.r.t. stem:[\sqsubseteq] on every coordinate of the ratified carrier, and the grade composition is too. *Proved in full in Agda since 2026-11-17* (owner ruling: prove, not narrow): fate (`TB.Order.fateL4Mono{R,L}`), fidelity (`TB.Order.dplusMono{R,L}`), bond and merge (`TB.Monotone.{bondL4Mono,mergeL4Mono}{R,L}`), and the grade-level lifting for `gradeCompose` that spec §7 invokes (`TB.Monotone.gradeL4Mono{R,L}`, and `TB.Monotone.▷-mono` for both arguments at once). Each part is rechecked in Rocq and in core Lean (see *Recheck legs of the order laws and L4* below). The PWG ledger grades L4 as four obligations, `L4-fate`, `L4-fidelity`, `L4-bond-merge` and `L4-lifting` (owner ruling 2026-11-16); L4 in full is their conjunction. Spec §7 also uses that each coordinate is a *complete* chain; completeness is not part of L4 or A2 and is proved in no prover. +| Agda `TB.Order.{fateL4MonoR,fateL4MonoL,dplusMonoR,dplusMonoL}`, `TB.Monotone.{bondL4MonoR,bondL4MonoL,mergeL4MonoR,mergeL4MonoL,gradeL4MonoR,gradeL4MonoL,▷-mono}`; Rocq (`verification/proofs/rocq/RatifiedOrder.v`) and core Lean (`TropeRatified.*`, `verification/proofs/lean4/ratified-order/`) the same names (`▷-mono` is `gcomp_mono`); Idris2 `Trope.Soundness.{fateL4MonoR,fateL4MonoL}`, `Trope.Order.{bondComposeMono,mergeComposeMono}` (reference, §8.1); Mathlib Lean `FateA.{comp_mono_right,comp_mono_left}` (fate only, `BRIDGE-PENDING`). | L5 (deception infectiousness) | Once a coordinate is at its deceptive bottom no composition restores an honest value; applying any further effect to a deceptive term keeps it deceptive. A corollary of L3. @@ -48,12 +48,12 @@ toc::[] | Lean `GradeR.instCommMonoid`, `FateA.comp_comm`; Agda `TB.Grade.grade-comm`. | Retention order is a decidable preorder -| stem:[\sqsubseteq] is decidable, reflexive and transitive on grades. -| Idris2 `Trope.Laws.decGradeLte`, `Trope.Coords.{fateLteRefl,bondLteRefl,mergeLteRefl}`, `Trope.Fidelity.dLteRefl`, `Trope.Order.{fateLteTrans,bondLteTrans,mergeLteTrans,dLteTrans}`, `Trope.Soundness.gradeLteTrans`. +| stem:[\sqsubseteq] is decidable, reflexive and transitive on grades. Proved in Agda since 2026-11-17, and rechecked in Rocq and core Lean. +| Agda `TB.Order.⊑-refl`, `TB.OrderLaws.{⊑-trans,⊑-dec,⊑-isPreorder}`; Rocq and core Lean `gle_refl`, `gle_trans`, `gle_dec`; Idris2 (reference) `Trope.Laws.decGradeLte`, `Trope.Coords.{fateLteRefl,bondLteRefl,mergeLteRefl}`, `Trope.Fidelity.dLteRefl`, `Trope.Order.{fateLteTrans,bondLteTrans,mergeLteTrans,dLteTrans}`, `Trope.Soundness.gradeLteTrans`. | Fate is a chain (A2) -| `Dropped ⊑ Predicated` and `Predicated ⋢ Dropped`; the v0.1 antichain is dissolved in the stated direction only. -| Idris2 `Trope.Soundness.{fateDroppedLtePredicated,fatePredicatedNotLteDropped}`; Agda `TB.Order.{fateDroppedLtePredicated,fatePredicatedNotLteDropped}`. +| `Fate` is a chain: stem:[\sqsubseteq] on `Fate` is reflexive, transitive, antisymmetric and total, ordered Falsified ⊏ Dropped ⊏ Predicated ⊏ Atten(unknown) ⊏ Atten(total) ⊏ … ⊏ Atten(Q 0) ⊏ Present. In particular `Dropped ⊑ Predicated` and `Predicated ⋢ Dropped`, which dissolve the v0.1 antichain. Proved in Agda since 2026-11-17 as `fate-isTotalOrder : IsTotalOrder _≡_ _≤F_` (owner ruling: prove, not narrow); the fidelity order is a chain as well. The PWG ledger grades the two directional facts (`A2-directions`) and the chain (`A2-chain`) separately (owner ruling 2026-11-16). Completeness of the chain is not claimed here and is proved in no prover. +| Agda `TB.OrderLaws.{fate-isTotalOrder,fateLte-trans,fateLte-antisym,fateLte-total,dLte-isTotalOrder}`, `TB.Order.{fateLte-refl,fateDroppedLtePredicated,fatePredicatedNotLteDropped}`; Rocq and core Lean `fate_isTotalOrder`, `fateLte_{refl,trans,antisym,total}` and the two directional facts; Idris2 (reference) `Trope.Soundness.{fateDroppedLtePredicated,fatePredicatedNotLteDropped}`, `Trope.Order.fateLteTrans`; Mathlib Lean `FateA.{le_total,le_refl}` (`BRIDGE-PENDING`). | Veridicality Derivation | Exactly three deceptive duals, one per coordinate kind (`Falsified`, `Misbound`, `Conflated`), each the unique deceptive inhabitant of its coordinate. @@ -181,10 +181,25 @@ leg, so they can neither raise nor lower a grade. | 0 of 2 | re-proved · `PROVEN` · `AGDA-VERIFIED` · unavailable · `OPEN` · `NOT-INVENTORIED` · re-proved · `PROVEN-WITH-AXIOMS` · `BRIDGE-PENDING` -| L4 (monotonicity), in full -| `3` -| 0 of 2 -| re-proved · `PROVEN` · `AGDA-VERIFIED` · unavailable · `OPEN` · `NOT-INVENTORIED` · re-proved · `PROVEN-WITH-AXIOMS` · `BRIDGE-PENDING` +| L4 (monotonicity): fate coordinate +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` + +| L4 (monotonicity): fidelity dimension +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` + +| L4 (monotonicity): bond and merge coordinates +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` + +| L4 (monotonicity): grade-level lifting for gradeCompose +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` | L5 (deception infectiousness) | `3` @@ -197,14 +212,19 @@ leg, so they can neither raise nor lower a grade. | re-proved · `PROVEN` · `AGDA-VERIFIED` · unavailable · `OPEN` · `NOT-INVENTORIED` · re-proved · `PROVEN-WITH-AXIOMS` · `BRIDGE-PENDING` | Retention order is a decidable preorder -| `ungraded` -| 0 of 2 -| re-proved · `OPEN` · `AGDA-PENDING` · unavailable · `OPEN` · `NOT-INVENTORIED` · unavailable · `OPEN` · `NOT-INVENTORIED` +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` + +| A2 directional facts: Dropped below Predicated, not conversely +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` | Fate is a chain (A2) -| `3` -| 0 of 2 -| re-proved · `PROVEN` · `AGDA-VERIFIED` · unavailable · `OPEN` · `NOT-INVENTORIED` · re-proved · `PROVEN-WITH-AXIOMS` · `BRIDGE-PENDING` +| `2ii` +| 2 of 2 +| re-proved · `PROVEN` · `AGDA-VERIFIED` · re-proved · `PROVEN` · `RECONCILED` · re-proved · `PROVEN` · `RECONCILED` | Veridicality Derivation | `3` @@ -293,28 +313,79 @@ leg, so they can neither raise nor lower a grade. |=== // PWG-TABLE:END -*Census* (PROOF-POLICY §8.4 rule 7, never a percentage): of 24 theory obligations in this repository, `PWG-3` 17, `PWG-2i` 0, `PWG-2ii` 0, `PWG-1` 0, `ungraded` 7. No obligation here carries `+foundation-diverse` (§8.3). - -Read the census as the policy intends: seventeen obligations have a kernel-checked -Agda witness with a complete §8.2 receipt at the current commit, and *none* has a -counting recheck leg. `PWG-3` is not a discharge (§8.4 rule 1) — every one of the -seventeen still owes both its §2 legs. The seven `ungraded` rows split three ways, -and the distinction is the useful part. *Two* are Lean-only with no Agda source at -all: the O1 atom factorisation and the tropical (B′) sighting. *Three* are -Idris2-only, where an engineering restatement is not a leg (§8.1). *Two* have a -real but incomplete Agda leg, so the Agda token is `OPEN`: the retention order -proves reflexivity but neither transitivity nor decidability, and tier-2 membership -proves six of the non-cancellativity witnesses (`TB.Tier`, fate and bond) plus the -positive `Q-cancelʳ`, but not the exhaustive characterisation — there is no Agda -counterpart of `grade_leftCancel_iff`, and no Agda witness on the merge coordinate. -§8.1 makes all three causes `ungraded` alike; only the second is about engineering -provers. A missing Agda source and a partial one are different debts, and the -ledger records which one each row carries rather than flattening both to -"Lean-only". - -Nothing can reach `PWG-2i`, `PWG-2ii` or `PWG-1` from where this tree stands: no -Rocq development exists in this repository at all, so the ladder has a missing -rung that is independent of any Agda work. +*Census* (PROOF-POLICY §8.4 rule 7, never a percentage): of 28 theory obligations in this repository, `PWG-3` 15, `PWG-2i` 0, `PWG-2ii` 7, `PWG-1` 0, `ungraded` 6. No obligation here carries `+foundation-diverse` (§8.3). + +Read the census as the policy intends. *Seven* obligations are at `PWG-2ii`: +the four parts of L4, both parts of A2, and the retention order. Each has a +kernel-checked Agda witness and two counting recheck legs, a Rocq leg and a +core-Lean leg (`verification/proofs/rocq/RatifiedOrder.v`, +`verification/proofs/lean4/ratified-order/RatifiedOrder.lean`, both +`RECONCILED`; see *Recheck legs of the order laws and L4*). None of them is +`PWG-1`: their receipts are from CI run 44006871652 on `d5234b1`, not from the +ledger's source commit, and the derivation (§8.2, §8.5.2) does not carry a grade +across commits. *Fifteen* obligations are at `PWG-3`: a kernel-checked Agda +witness with a complete §8.2 receipt and no counting recheck leg. `PWG-3` is not a +discharge (§8.4 rule 1); each of the fifteen still owes both its §2 legs. + +The six `ungraded` rows split three ways. *Two* are Lean-only with no Agda source +at all: the O1 atom factorisation and the tropical (B′) sighting. *Three* are +Idris2-only, where an engineering restatement is not a leg (§8.1): HC-4 +coherence, exact grade soundness and T-Sub soundness. *One* has a real but +incomplete Agda leg, so its Agda token is `OPEN`: tier-2 membership proves six of +the non-cancellativity witnesses (`TB.Tier`, fate and bond) plus the positive +`Q-cancelʳ`, but not the exhaustive characterisation. There is no Agda +counterpart of `grade_leftCancel_iff`, and no Agda witness on the merge +coordinate. §8.1 makes all three causes `ungraded` alike; only the Idris2-only +group is about engineering provers. A missing Agda source and a partial one are +different debts, and the ledger records which one each row carries rather than +flattening both to "Lean-only". + +Until 2026-11-17 nothing here could reach `PWG-2i` or above, because no Rocq +development existed. The recheck legs above are the first, and they cover only +the seven rows named. The other fifteen `PWG-3` rows have no Rocq or counting +Lean leg yet. + +[[recheck-legs]] +=== Recheck legs of the order laws and L4 (§2, §2.2) + +*Owner rulings.* On 2026-11-17 the owner ruled that L4 and A2 are proved as +their titles state, and that theory "goes in Agda, rechecked in Rocq and Lean", +with no Mathlib. The 2026-11-09 ruling below ("Lean is a generator, not a leg") +was given about the Mathlib development, for the Mathlib reason. The Lean leg here +is a separate file with no import at all. It is recorded `RECONCILED` and it +counts. Asked on 2026-11-17, the owner confirmed that reading. The 2026-11-09 +ruling covers the Mathlib development only, and a core-Lean leg is a §2 recheck +leg. ADR 0005 records both rulings in its amendment of 2026-11-17. + +[cols="1,3"] +|=== +| Item | Record + +| Source (Agda) +| `TB.Order`, `TB.OrderLaws`, `TB.Monotone` (`verification/proofs/agda/theorem-b/`), and `TB.Bridge` for the definitions. + +| Rocq leg +| `verification/proofs/rocq/RatifiedOrder.v`, route `re-proved`. Coq 8.18.0, no `Require` (prelude only). Gate: `bash scripts/check-recheck-legs.sh rocq`. Receipt `rocq-ratified-order-d5234b1`, CI run 44006871652: `Print Assumptions` closed under the global context for 49 of 49 declarations. + +| Lean leg +| `verification/proofs/lean4/ratified-order/RatifiedOrder.lean`, route `re-proved`. Lean 4.16.0 core: no import, no Mathlib, no `simp`, `omega` or `decide`. Gate: `bash scripts/check-recheck-legs.sh lean`. Receipt `lean-ratified-order-d5234b1`, CI run 44006871652: no axiom for 49 of 49 declared theorems, nor for any definition they use. + +| Why re-proved, not transported +| The Agda→Dedukti→Rocq/Lean transport of §2 is not wired in this repository, and no released Lambdapi Lean exporter exists (PROOF-POLICY §2, item 2). + +| Statement correspondence +a| Compared by reading, item by item, and checked mechanically for the definitions: + +* *Definitions.* Each leg restates `Δ`, `Fate`, `Bond`, `Merge`, `Grade`, `_⊕d_`, `_▷f_`, `_▷b_`, `_▷m_`, `_▷_`, `lteb`, `dLte`, `fateLte`, `bondLte`, `mergeLte` and `gradeLte` with the same constructors and the same clauses. `TB.Bridge` states the values of `fateLte`, `_▷f_`, `bondLte`, `_▷b_`, `mergeLte` and `_▷m_` on a fixed sample, as six numeral lists. Each leg proves the *same six literals* about its own restatement by computation (`bridge_*`). Bond (16 pairs) and Merge (9 pairs) are covered exhaustively; Fate is covered on 9 points (81 pairs), including Δ addition. A planted one-clause drift (`withheld ▷b intact` set to `intact`) leaves every theorem provable and is caught only by `bridge_bcomp`, in both legs. That is a CI control. +* *Theorems.* Each leg states every theorem above with the same hypotheses and conclusion as the Agda. `⊑` is `gle g h := gradeLte g h = true` (Agda: `gradeLte g h ≡ true`). `IsTotalOrder _≡_ _≤F_` is stated as its four laws (`fate_isTotalOrder`). `⊑-dec : Dec (g ⊑ h)` is `gle_dec` (Rocq `{gle g h} + {~ gle g h}`, Lean `Decidable (gle g h)`), and in Lean also the theorem `gle_decides`. +* *Encoding only.* Agda `ℕ`/`Bool`/`_∧_`/`_≡_`/`_⊎_` are `nat`/`bool`/`andb`/`eq`/`or` (Rocq) and `Nat`/`Bool`/`&&`/`=`/`Or` (Lean). Conjunctions are parenthesised right-nested, because Agda's `_∧_` is right-associative while Rocq's `&&` and Lean's `&&` are left-associative. Infix operators become named functions, and hyphens become underscores. + +| Residual assumptions +| None in any leg: the Agda is `--safe` with no postulate in its cone (receipt `agda-d5234b1`), and each recheck leg reports no axiom. + +| Planted controls (CI) +| `bash scripts/check-recheck-legs.sh controls`: a Rocq `Admitted`, a Lean `sorry`, a Lean user axiom, an empty Lean audit domain, and the definition drift in each leg. Each must be caught, and in run 44006871652 all 6 were. +|=== === Import cone (§1.1) @@ -352,16 +423,19 @@ Owner ruling 2026-11-09: **Lean is a generator, not a leg.** The Lean developmen keeps Mathlib and keeps its purpose — finding and stress-testing theorems — and its results are then restated in core Agda, which is what becomes gradeable. The Mathlib cone therefore never enters the trusted base, and no Lean row here is or -will be a §2 recheck leg. The ledger records every Lean leg as -`route: re-proved, state: BRIDGE-PENDING`, which does not count (§2.2, §8.2). The +will be a §2 recheck leg. The ledger records every Lean leg of the Mathlib +development as `route: re-proved, state: BRIDGE-PENDING`, which does not count +(§2.2, §8.2). (The core-Lean legs added on 2026-11-17 for the seven order and L4 +rows import nothing, Mathlib included, and are recorded `RECONCILED`. The owner +ruled on 2026-11-17 that this ruling does not cover them: see <> +and ADR 0005, amendment of 2026-11-17.) The two Lean-only obligations — the O1 atom factorisation and the tropical (B′) sighting — stay `ungraded` until an Agda statement of them exists at all; tier-2 membership has its Agda witnesses already and stays `ungraded` only until the exhaustive step joins them. The census at the head of this section is the authoritative split. -The amendment to ADR 0005 D4 implementing this is tracked separately; until it -lands, the ADR and the policy disagree on paper and this paragraph is the -operative reading. +ADR 0005 records this ruling, and the 2026-11-17 one, in its amendment of +2026-11-17 (D4 and D5, the §2 recheck legs). One measurable cost of the dependency, worth keeping in view: `Trope.nine_families` is proved by `rfl` yet reports `[propext, Classical.choice, Quot.sound]`, reaching diff --git a/scripts/check-recheck-legs.sh b/scripts/check-recheck-legs.sh new file mode 100755 index 0000000..bf1f14e --- /dev/null +++ b/scripts/check-recheck-legs.sh @@ -0,0 +1,178 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) +# +# check-recheck-legs.sh rocq|lean|controls +# +# The gate for the PROOF-POLICY §2 recheck legs of the ratified-carrier order +# laws and L4 (verification/proofs/rocq/RatifiedOrder.v and +# verification/proofs/lean4/ratified-order/RatifiedOrder.lean). The same +# script runs locally and in CI (.github/workflows/proofs.yml), so a green +# local run and a green CI run mean the same thing. +# +# rocq coqc must be the pinned version; the file must compile; and +# `Print Assumptions` must report "Closed under the global +# context" for EVERY Theorem and Lemma the file declares. +# lean lean must be the pinned version; the file must check with no +# error and no warning (a `sorry` only warns); and EVERY theorem +# the source declares must depend on no axiom at all +# (Lean.collectAxioms, the function behind #print axioms). +# controls plants a defect in a scratch copy of each leg and requires the +# gate above to FAIL on it: an Admitted proof, a sorry, a user +# axiom, and a one-clause drift in a restated definition (caught +# by the bridge theorems). A gate that has never been seen to +# fail is not a gate. +# +# Fails closed: a missing or wrong-version prover is a FAIL, never a skip, and +# an axiom audit that inspects zero declarations is a FAIL, not a vacuous pass +# (the defect found in hyperpolymath/mathesis THY-1's Lean leg, 2026-11-16). +# +# Exit: 0 = pass; 1 = fail; 2 = misuse. + +set -euo pipefail + +MODE="${1:-}" +cd "$(dirname "${BASH_SOURCE[0]}")/.." +ROCQ_FILE="verification/proofs/rocq/RatifiedOrder.v" +LEAN_FILE="verification/proofs/lean4/ratified-order/RatifiedOrder.lean" +ROCQ_VERSION="${ROCQ_VERSION:-8.18.0}" +LEAN_VERSION="${LEAN_VERSION:-4.16.0}" + +fail() { echo "FAIL: $*" >&2; exit 1; } + +need_rocq() { + command -v coqc >/dev/null 2>&1 || fail "coqc not on PATH (a missing prover fails this gate; it never skips)" + coqc --version | grep -qF "version ${ROCQ_VERSION}" || + fail "coqc is not version ${ROCQ_VERSION}: $(coqc --version | head -1)" +} + +need_lean() { + command -v lean >/dev/null 2>&1 || fail "lean not on PATH (a missing prover fails this gate; it never skips)" + lean --version | grep -qF "version ${LEAN_VERSION}" || + fail "lean is not version ${LEAN_VERSION}: $(lean --version | head -1)" +} + +# rocq_audit FILE -> prints the receipt line; returns 1 on any defect. +rocq_audit() { + local src="$1" dir base names expect got out rc + dir="$(mktemp -d)"; base="AuditRatifiedOrder" + names="$(sed -n -E "s/^[[:space:]]*(Theorem|Lemma)[[:space:]]+([A-Za-z_][A-Za-z0-9_']*).*/\2/p" "$src")" + expect="$(grep -c . <<<"$names" || true)" + if [ "$expect" -eq 0 ]; then echo "rocq audit: no Theorem or Lemma declared (empty domain)"; rm -rf "$dir"; return 1; fi + { cat "$src"; echo; while IFS= read -r n; do echo "Print Assumptions $n."; done <<<"$names"; } >"$dir/$base.v" + set +e; out="$(cd "$dir" && coqc "$base.v" 2>&1)"; rc=$?; set -e + rm -rf "$dir" + got="$(grep -c '^Closed under the global context' <<<"$out" || true)" + if [ "$rc" -ne 0 ] || [ "$got" -ne "$expect" ]; then + echo "rocq audit: $got of $expect declaration(s) closed under the global context (coqc exit $rc)" + grep -v '^Closed under the global context' <<<"$out" | head -20 + return 1 + fi + echo "Print Assumptions: closed under the global context for $expect of $expect declaration(s)" +} + +# lean_check FILE -> prints the receipt line; returns 1 on any defect. +lean_check() { + local src="$1" dir out rc declared audited + set +e; out="$(lean "$src" 2>&1)"; rc=$?; set -e + if [ "$rc" -ne 0 ] || grep -qE '(^|: )(error|warning)' <<<"$out"; then + echo "lean: the file does not check cleanly (exit $rc)"; grep -E 'error|warning' <<<"$out" | head -20; return 1 + fi + dir="$(mktemp -d)" + { echo "import Lean"; cat "$src"; cat <<'LEAN' + +open Lean Elab Command in +#eval show CommandElabM Unit from do + let env ← getEnv + let mut n := 0 + for (name, ci) in env.constants.map₂.toList do + -- Only what the source declares: theorems, and defs that carry a + -- declaration range (the lemmas Lean generates have none). + let isThm := match ci with | .thmInfo _ => true | _ => false + let isDef := match ci with | .defnInfo _ => true | _ => false + unless isThm || isDef do continue + if (← liftCoreM (findDeclarationRanges? name)).isNone then continue + if isThm then n := n + 1 + let axs ← liftCoreM (Lean.collectAxioms name) + unless axs.isEmpty do + logInfo m!"GATE-AXIOMS {name}: {axs.toList}" + logInfo m!"GATE-AUDIT-DONE {n}" +LEAN + } >"$dir/Audit.lean" + set +e; out="$(lean "$dir/Audit.lean" 2>&1)"; rc=$?; set -e + rm -rf "$dir" + declared="$(grep -cE '^[[:space:]]*theorem[[:space:]]' "$src" || true)" + audited="$(sed -n 's/.*GATE-AUDIT-DONE \([0-9]*\).*/\1/p' <<<"$out")" + if [ "$rc" -ne 0 ] || [ -z "$audited" ] || grep -q 'GATE-AXIOMS' <<<"$out"; then + echo "lean audit: a declaration depends on an axiom, or the audit did not run (exit $rc)" + grep -E 'GATE-|error' <<<"$out" | head -20; return 1 + fi + if [ "$audited" -eq 0 ] || [ "$audited" -ne "$declared" ]; then + echo "lean audit: audited $audited theorem(s), the source declares $declared (an empty or partial domain fails)"; return 1 + fi + echo "axioms: none for $audited of $declared declared theorem(s), and none for any def they use" +} + +case "$MODE" in + rocq) + need_rocq + echo "=== Rocq recheck leg: $ROCQ_FILE ($(coqc --version | head -1)) ===" + dir="$(mktemp -d)"; cp "$ROCQ_FILE" "$dir/" + ( cd "$dir" && coqc "$(basename "$ROCQ_FILE")" ) || { rm -rf "$dir"; fail "coqc rejects $ROCQ_FILE"; } + rm -rf "$dir" + rocq_audit "$ROCQ_FILE" || fail "Rocq axiom audit" + echo "sha256 $(sha256sum "$ROCQ_FILE" | cut -d' ' -f1) $ROCQ_FILE" + echo "PASS: Rocq recheck leg" + ;; + lean) + need_lean + echo "=== Lean recheck leg: $LEAN_FILE ($(lean --version | head -1)) ===" + lean_check "$LEAN_FILE" || fail "Lean check or axiom audit" + echo "sha256 $(sha256sum "$LEAN_FILE" | cut -d' ' -f1) $LEAN_FILE" + echo "PASS: Lean recheck leg" + ;; + controls) + need_rocq; need_lean + t="$(mktemp -d)"; trap 'rm -rf "$t"' EXIT + bad=0 + expect_fail() { # $1 label, $2 command... + local label="$1"; shift + if "$@" >"$t/log" 2>&1; then echo "CONTROL NOT CAUGHT: $label"; cat "$t/log"; bad=1 + else echo "caught: $label -- $(grep -m1 -E . "$t/log")"; fi + } + # Rocq: an Admitted proof compiles; the audit must still refuse it. + sed '0,/^Proof\. intros \[\]; reflexivity\. Qed\./s//Proof. Admitted./' "$ROCQ_FILE" >"$t/A.v" + grep -q 'Admitted\.' "$t/A.v" || fail "control setup: no Admitted planted" + expect_fail "Rocq Admitted proof" rocq_audit "$t/A.v" + # Rocq: a one-clause drift in a restated definition. withheld ▷b intact + # = intact keeps every restated theorem TRUE (▷b stays monotone), so only + # the bridge can see it; the failure must be at bridge_bcomp. + sed 's/^ | withheld, intact => withheld$/ | withheld, intact => intact/' "$ROCQ_FILE" >"$t/D.v" + cmp -s "$ROCQ_FILE" "$t/D.v" && fail "control setup: no Rocq drift planted" + bl="$(grep -n '^Theorem bridge_bcomp' "$t/D.v" | cut -d: -f1)" + el="$( (cd "$t" && coqc D.v 2>&1 || true) | sed -n 's/^File .*, line \([0-9]*\),.*/\1/p' | head -1)" + if [ -n "$el" ] && [ "$el" -ge "$bl" ] && [ "$el" -le "$((bl + 1))" ]; then + echo "caught: Rocq definition drift (bcomp), caught by the bridge -- first error at line $el (bridge_bcomp)" + else echo "CONTROL NOT CAUGHT (or not by the bridge): Rocq definition drift, first error line '${el}'"; bad=1; fi + # Lean: a sorry only warns; the gate must refuse it. + { cat "$LEAN_FILE"; printf '\ntheorem planted_sorry : 1 = 2 := sorry\n'; } >"$t/S.lean" + expect_fail "Lean sorry" lean_check "$t/S.lean" + # Lean: a user axiom compiles without warning; the audit must refuse it. + { cat "$LEAN_FILE"; printf '\naxiom planted_ax : False\ntheorem planted_use : 1 = 2 := planted_ax.elim\n'; } >"$t/X.lean" + expect_fail "Lean user axiom" lean_check "$t/X.lean" + # Lean: the same drift; the only error must be at bridge_bcomp. + sed 's/^ | withheld, intact => withheld$/ | withheld, intact => intact/' "$LEAN_FILE" >"$t/D.lean" + cmp -s "$LEAN_FILE" "$t/D.lean" && fail "control setup: no Lean drift planted" + bl="$(grep -n '^theorem bridge_bcomp' "$t/D.lean" | cut -d: -f1)" + errs="$(lean "$t/D.lean" 2>&1 | grep -E ': error' || true)" + if [ -n "$errs" ] && ! grep -vq "D.lean:$bl:" <<<"$errs"; then + echo "caught: Lean definition drift (bcomp), caught by the bridge -- only error at line $bl (bridge_bcomp)" + else echo "CONTROL NOT CAUGHT (or not by the bridge): Lean definition drift"; echo "$errs"; bad=1; fi + # Lean: an audit over an empty domain must fail, not pass vacuously. + printf 'def onlyADef : Nat := 1\n' >"$t/E.lean" + expect_fail "Lean empty audit domain" lean_check "$t/E.lean" + [ "$bad" -eq 0 ] || fail "a planted defect was not caught" + echo "PASS: every planted defect was caught (6 controls)" + ;; + *) echo "usage: $(basename "$0") rocq|lean|controls" >&2; exit 2 ;; +esac diff --git a/scripts/pwg-check.sh b/scripts/pwg-check.sh index b33b977..51cab5d 100755 --- a/scripts/pwg-check.sh +++ b/scripts/pwg-check.sh @@ -16,7 +16,9 @@ # fields 8.2 requires, including a full 40-character commit; # 4. every section 5 token and every 2.2 state comes from its closed vocabulary; # 5. the table and census published in docs/status/PROOF-STATUS.adoc are -# byte-identical to what scripts/pwg-derive.sh produces. +# byte-identical to what scripts/pwg-derive.sh produces; +# 6. every agda and lean witness name the ledger cites resolves to a +# declaration in the sources (scripts/pwg-names.sh). # # Fails loudly and says which rule broke. Usage: pwg-check.sh [REPO_ROOT] set -uo pipefail @@ -74,14 +76,14 @@ missing=$(jq -r ' badr=$(jq -r ' .receipts | to_entries[] | .key as $k | .value as $v - | [ (if ($v.commit // "" | test("^[0-9a-f]{40}$")) then empty else "\($k): commit is not a full 40-char sha" end), + | [ (if ($v.commit // "" | test("\\A[0-9a-f]{40}\\z")) then empty else "\($k): commit is not a full 40-char sha" end), (if ($v.checker // "" | length) > 0 then empty else "\($k): no checker" end), (if ($v.checker_version // "" | length) > 0 then empty else "\($k): no checker_version (8.2)" end), (if ($v.invocation // "" | length) > 0 then empty else "\($k): no invocation (8.2)" end), (if ($v.inputs_digest // "" | length) > 0 then empty else "\($k): no inputs_digest (8.2)" end), - (if ($v.result // "" | length) > 0 then empty else "\($k): no result (8.2)" end), + (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("^(current|superseded|regressed)$")) then empty else "\($k): state must be current|superseded|regressed (8.4 rule 5)" 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) ] | .[]' "$LEDGER") \ || die "rule 3 (receipt completeness) could not be evaluated over this ledger: malformed theorem/leg/receipt shape" @@ -93,7 +95,7 @@ badr=$(jq -r ' badtok=$(jq -r ' [ .theorems[] as $t | ($t.legs | to_entries[]) - | select((.value.token // "") | test("^(PROVEN|PROVEN-WITH-AXIOMS|TESTED|ASSUMED|OPEN)$") | not) + | select((.value.token // "") | test("\\A(PROVEN|PROVEN-WITH-AXIOMS|TESTED|ASSUMED|OPEN)\\z") | not) | "\($t.id)/\(.key): token \(.value.token)" ] | .[]' "$LEDGER") \ || die "rule 4 (section 5 tokens) could not be evaluated over this ledger: malformed theorem/leg/receipt shape" @@ -102,7 +104,7 @@ badtok=$(jq -r ' badstate=$(jq -r ' [ .theorems[] as $t | ($t.legs | to_entries[]) - | select((.value.state // "") | test("^(AGDA-PENDING|AGDA-VERIFIED|COQ-CHECKED|LEAN-CHECKED|BRIDGE-PENDING|RECONCILED|COUNTEREXAMPLE|QUARANTINED|NOT-INVENTORIED)$") | not) + | select((.value.state // "") | test("\\A(AGDA-PENDING|AGDA-VERIFIED|COQ-CHECKED|LEAN-CHECKED|BRIDGE-PENDING|RECONCILED|COUNTEREXAMPLE|QUARANTINED|NOT-INVENTORIED)\\z") | not) | "\($t.id)/\(.key): state \(.value.state)" ] | .[]' "$LEDGER") \ || die "rule 4 (2.2 states) could not be evaluated over this ledger: malformed theorem/leg/receipt shape" @@ -111,7 +113,7 @@ badstate=$(jq -r ' badroute=$(jq -r ' [ .theorems[] as $t | ($t.legs | to_entries[]) - | select((.value.route // "") | test("^(transported|re-proved|waived|unavailable)$") | not) + | select((.value.route // "") | test("\\A(transported|re-proved|waived|unavailable)\\z") | not) | "\($t.id)/\(.key): route \(.value.route)" ] | .[]' "$LEDGER") \ || die "rule 4 (8.5 routes) could not be evaluated over this ledger: malformed theorem/leg/receipt shape" @@ -138,8 +140,55 @@ else fi fi +# --- 6. every cited witness names a declaration that exists ---------------- +# Measured 2026-11-16 against main 0dceab6: 13 of the ledger's 91 distinct +# witness names resolved to nothing in the sources -- ASCII transliterations +# (`|>` for `▷`, `beta-` for `β-`), a kebab-case spelling of a camelCase name, a +# lemma split in two (`gmonoid-unit` vs `gmonoid-unitL`/`-unitR`), a wrong Lean +# namespace -- including L2's ONLY Agda witness, on a row published PWG-3. The +# grade was derived from tokens and receipts; nothing checked that the token's +# witness existed. scripts/pwg-names.sh inventories the declared names; this rule +# resolves every agda and lean leg's `declarations` against it. Agda names must +# match exactly (a module name is also a valid citation); a Lean name may omit a +# leading namespace prefix, so it resolves if some declaration equals it or ends +# with `.`. Name resolution, not proof: the receipt still carries that. +NAMES="$ROOT/scripts/pwg-names.sh" +if [ ! -f "$NAMES" ]; then + die "scripts/pwg-names.sh is missing -- rule 6 (witness names resolve) cannot be checked" +elif ! inventory=$(bash "$NAMES" "$ROOT" 2>&1); then + die "rule 6 could not build the declaration inventory:"$'\n'"$inventory" +else + dangling=$(jq -r ' + .theorems[] as $t + | ($t.legs | to_entries[]) | select(.key == "agda" or .key == "lean") + | .key as $l | (.value.declarations // [])[] + # Lossless: each field is JSON-escaped (quotes dropped), so a tab or + # newline inside a citation stays INSIDE its field as a visible \t / \n + # and the name then matches nothing. Interpolating raw let a citation + # with "\tjunk" appended split into an extra field the resolver ignored, + # and the original name resolved. Ordinary names, Unicode included, + # come through @json unchanged. + | [$l, $t.id, .] | map(@json | .[1:-1]) | join("\t")' "$LEDGER" \ + | INV="$inventory" awk -F'\t' ' + BEGIN { + n = split(ENVIRON["INV"], rows, "\n") + for (i = 1; i <= n; i++) { split(rows[i], f, "\t"); have[f[1] "\t" f[2]] = 1; if (f[1] == "lean") lean[++ln] = f[2] } + } + NF != 3 { print "malformed citation record: " $0; next } + { + ok = (($1 "\t" $3) in have) + if (!ok && $1 == "lean") + for (i = 1; i <= ln && !ok; i++) { + L = lean[i]; m = length($3) + if (length(L) > m && substr(L, length(L) - m) == "." $3) ok = 1 + } + if (!ok) print $2 "/" $1 ": " $3 + }') || die "rule 6 (witness names resolve) could not be evaluated over this ledger" + [ -n "$dangling" ] && die "witness name(s) that resolve to no declaration in the sources:"$'\n'"$dangling" +fi + if [ "$fail" -eq 0 ]; then n=$(jq -e '.theorems | length' "$LEDGER") || die "the ledger has no .theorems array" - echo "PASS: PWG ledger well-formed, no asserted grades, $n obligation(s) derived, published table and census match" + echo "PASS: PWG ledger well-formed, no asserted grades, every witness name resolves, $n obligation(s) derived, published table and census match" fi exit "$fail" diff --git a/scripts/pwg-derive.sh b/scripts/pwg-derive.sh index 02360ad..20c50bc 100755 --- a/scripts/pwg-derive.sh +++ b/scripts/pwg-derive.sh @@ -40,14 +40,29 @@ command -v jq >/dev/null || { echo "pwg-derive: jq is required" >&2; exit 2; } # --------------------------------------------------------------------------- # shellcheck disable=SC2016 # single quotes are REQUIRED: $a/$c/$l/$t/$R below are # jq variables, and the shell must not expand them. +# +# CONSEQUENCE, and it has bitten twice: NO APOSTROPHE MAY APPEAR ANYWHERE INSIDE +# THIS BLOCK, comments included. One closes the string, and what follows is read +# as shell. Write "the receipt of the leg", never "the leg's receipt". The first +# occurrence here was a Unicode right-quote, which survived only because it is +# not an ASCII apostrophe; "fixing" SC1112 by swapping in a plain one broke the +# script. Reword instead. DERIVE=' # A section 5 token that means the kernel accepted it. def accepted: . == "PROVEN" or . == "PROVEN-WITH-AXIOMS"; - # A receipt is usable when it is the current one and names a full 40-char commit - # (8.2 PWG-1: "the source repository and its full 40-character commit"). + # A receipt is usable when it is the current one, RECORDS A PASS, and names a + # full 40-char commit (8.2 PWG-1: "the source repository and its full + # 40-character commit"). + # + # The result check is load-bearing, not decorative. Measured 2026-11-16 against + # main 0dceab6: flipping the Agda receipt of this ledger to "result": "fail" while + # leaving "state": "current" left the census byte-identical -- 17 PWG-3 grades + # published on a receipt that records the checker REJECTING the development -- + # and scripts/pwg-check.sh exited 0. A grade may not outlive the run that + # earned it; a regressed run is 8.2 evidence of the opposite. def usable_receipt($rs): $rs - | map(select(.state == "current" and (.commit | test("^[0-9a-f]{40}$")))) + | map(select(.state == "current" and .result == "pass" and (.commit | test("\\A[0-9a-f]{40}\\z")))) | length > 0; # 8.2 PWG-3 additionally requires the receipt to record the checker version, @@ -55,7 +70,8 @@ DERIVE=' def pwg3_receipt($rs): $rs | map(select( .state == "current" - and (.commit | test("^[0-9a-f]{40}$")) + and .result == "pass" + and (.commit | test("\\A[0-9a-f]{40}\\z")) and (.checker_version // "" | length > 0) and (.stdlib_pin // "" | length > 0) and (.import_cone // "" | length > 0) @@ -69,14 +85,23 @@ DERIVE=' # PROVEN-WITH-AXIOMS and its 2.2 correspondence state is RECONCILED." And: # a waived leg, an unavailable leg and any BRIDGE-PENDING leg do not count. # Also require at least one current receipt with a full 40-character commit, - # resolving the leg’s receipt IDs through the supplied receipt map. + # resolving the receipt IDs of the leg through the supplied receipt map. def counts($leg; $receipts): ($leg.token | accepted) and $leg.state == "RECONCILED" and ($leg.route != "waived" and $leg.route != "unavailable") and usable_receipt([$leg.receipts[] | $receipts[.]]); - .receipts as $R + # 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 + # ledger records no echoes, so a receipt from any other commit does not + # describe it -- the conservative reading, and it still counts toward 3/2i/2ii.) + def describes($rs; $src): $rs + | map(select(.state == "current" and .result == "pass" and .commit == $src)) + | length > 0; + + .commit as $src + | .receipts as $R | .theorems | map( . as $t @@ -94,9 +119,13 @@ DERIVE=' elif $legs == 0 then "3" elif $legs == 1 then "2i" else - (if (usable_receipt($ar) - and usable_receipt([$c.receipts[] | $R[.]]) - and usable_receipt([$l.receipts[] | $R[.]])) + # Both legs count, so every conjunct of usable_receipt already holds + # for all three witnesses: testing it here (as this branch once did) + # made "2ii" unreachable and granted PWG-1 on PWG-2ii evidence. The + # rung above 2ii is about WHICH COMMIT the receipts describe. + (if (describes($ar; $src) + and describes([$c.receipts[] | $R[.]]; $src) + and describes([$l.receipts[] | $R[.]]; $src)) then "1" else "2ii" end) end ) as $grade diff --git a/scripts/pwg-names.sh b/scripts/pwg-names.sh new file mode 100755 index 0000000..80f925a --- /dev/null +++ b/scripts/pwg-names.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) +# +# Inventory of the declarations the PWG ledger may cite as witnesses. +# +# Emits one line per exported declaration, `\t`, +# read from the sources with comments stripped (tests/lib/strip-proof-comments.awk, +# which fails loudly on an unterminated comment or string). scripts/pwg-check.sh +# rule 6 resolves every `declarations` entry in verification/pwg.json against this +# list, so a witness that names nothing — a transliterated or renamed identifier — +# is a gate failure, not a silent row. +# +# This is a NAME inventory, not a kernel. It establishes that the cited name is +# declared where the ledger says; that the declaration proves the stated +# obligation is the receipt's business (PROOF-POLICY 8.2), not this script's. +# +# agda : top-level (column-0) signatures in verification/proofs/agda/theorem-b/TB/, +# qualified by the file's module (TB.). `a b : T` declares both. +# Declarations inside a `private` block are not exported and are not +# listed. Constructors and record fields are not listed. +# lean : theorem/lemma/def/abbrev/instance/structure/inductive/class/axiom/opaque +# declarations under verification/proofs/lean4/ (no .lake), qualified by +# the enclosing `namespace` stack. `section`/`end` are tracked so an +# `end` closes the right scope. +# +# Usage: pwg-names.sh [REPO_ROOT] +set -euo pipefail +ROOT="${1:-$(cd "$(dirname "$0")/.." && pwd)}" +STRIP="$ROOT/tests/lib/strip-proof-comments.awk" +[ -f "$STRIP" ] || { echo "pwg-names: comment stripper missing at tests/lib/strip-proof-comments.awk" >&2; exit 2; } + +AGDA_DIR="$ROOT/verification/proofs/agda/theorem-b/TB" +LEAN_DIR="$ROOT/verification/proofs/lean4" +[ -d "$AGDA_DIR" ] || { echo "pwg-names: no Agda sources at $AGDA_DIR" >&2; exit 2; } +[ -d "$LEAN_DIR" ] || { echo "pwg-names: no Lean sources at $LEAN_DIR" >&2; exit 2; } + +n=0 +while IFS= read -r -d '' f; do + mod="TB.$(basename "$f" .agda)" + awk -f "$STRIP" "$f" | awk -v mod="$mod" ' + BEGIN { print "agda\t" mod } + # A column-0 line ends a private block or a data block; an indented line + # continues it. + /^[^ \t]/ { priv = 0; indata = 0 } + /^private[ \t]*$/ { priv = 1; next } + priv { next } + # Constructors of a top-level `data … where` are exported as TB... + /^data[ \t].*[ \t]where[ \t]*$/ { indata = 1; next } + indata && /^[ \t]+[^ \t]/ { + if (!match($0, / :( |$)/)) next + head = substr($0, 1, RSTART - 1); sub(/^[ \t]+/, "", head) + k = split(head, toks, /[ \t]+/) + for (j = 1; j <= k; j++) if (toks[j] != "") print "agda\t" mod "." toks[j] + next + } + /^[^ \t]/ { + # `name : T` or a signature continued on the next line (`name :`). + if (!match($0, / :( |$)/)) next + colon = RSTART + head = substr($0, 1, colon - 1) + k = split(head, toks, /[ \t]+/) + if (toks[1] ~ /^(data|record|module|open|import|infix|infixl|infixr|pattern|syntax|postulate|abstract|mutual|instance|variable|field|constructor)$/) next + for (j = 1; j <= k; j++) if (toks[j] != "") print "agda\t" mod "." toks[j] + }' + n=$((n + 1)) +done < <(find "$AGDA_DIR" -name '*.agda' -print0 | sort -z) +[ "$n" -gt 0 ] || { echo "pwg-names: found no .agda files -- an empty inventory would resolve nothing" >&2; exit 1; } + +n=0 +while IFS= read -r -d '' f; do + awk -f "$STRIP" "$f" | awk ' + function joined( s, i) { s = ""; for (i = 1; i <= depth; i++) if (ns[i] != "") s = s ns[i] "."; return s } + { + line = $0 + sub(/^[ \t]+/, "", line) + if (match(line, /^namespace[ \t]+[^ \t]+/)) { + name = line; sub(/^namespace[ \t]+/, "", name); sub(/[ \t].*$/, "", name) + c = split(name, parts, ".") + for (i = 1; i <= c; i++) { depth++; ns[depth] = parts[i]; kind[depth] = (i == 1 ? "ns" : "nsc") } + next + } + if (line ~ /^(noncomputable[ \t]+)?section([ \t]|$)/) { depth++; ns[depth] = ""; kind[depth] = "sec"; next } + if (line ~ /^end([ \t]|$)/) { + # `end A.B` closes the components A and B; a bare `end` or `end S` closes one scope. + name = line; sub(/^end[ \t]*/, "", name); sub(/[ \t].*$/, "", name) + c = (name == "") ? 1 : split(name, parts, ".") + if (depth > 0 && kind[depth] == "sec") c = 1 + for (i = 1; i <= c && depth > 0; i++) depth-- + next + } + # strip attributes and modifiers + while (match(line, /^@\[[^]]*\][ \t]*/)) line = substr(line, RLENGTH + 1) + while (match(line, /^(private|protected|noncomputable|unsafe|partial|nonrec|scoped|local)[ \t]+/)) { + if (line ~ /^private[ \t]/) priv = 1 + line = substr(line, RLENGTH + 1) + } + if (match(line, /^(theorem|lemma|def|abbrev|instance|structure|inductive|class|axiom|opaque)[ \t]+[^ \t:({[]+/)) { + name = substr(line, 1, RLENGTH); sub(/^[a-z]+[ \t]+/, "", name) + if (!priv) print "lean\t" joined() name + } + priv = 0 + }' + n=$((n + 1)) +done < <(find "$LEAN_DIR" -name '*.lean' -not -path '*/.lake/*' -print0 | sort -z) +[ "$n" -gt 0 ] || { echo "pwg-names: found no .lean files -- an empty inventory would resolve nothing" >&2; exit 1; } diff --git a/scripts/test-gate-falsifiability.sh b/scripts/test-gate-falsifiability.sh index 2fe424c..3218ad4 100755 --- a/scripts/test-gate-falsifiability.sh +++ b/scripts/test-gate-falsifiability.sh @@ -156,6 +156,15 @@ pwg_case() { cp "$ROOT/scripts/pwg-derive.sh" "$d/scripts/" 2>/dev/null || { rm -rf "$d"; bad "$label (no pwg-derive.sh to copy)"; return; } cp "$ROOT/scripts/pwg-check.sh" "$d/scripts/" 2>/dev/null || { rm -rf "$d"; bad "$label (no pwg-check.sh to copy)"; return; } cp "$ROOT/docs/status/PROOF-STATUS.adoc" "$d/docs/status/" 2>/dev/null || { rm -rf "$d"; bad "$label (no PROOF-STATUS.adoc to copy — rule 5 would be untested)"; return; } + # Rule 6 resolves witness names against the real sources: carry the inventory + # script, the comment stripper it reads through, and the Agda/Lean sources. + cp "$ROOT/scripts/pwg-names.sh" "$d/scripts/" 2>/dev/null || { rm -rf "$d"; bad "$label (no pwg-names.sh to copy — rule 6 would be untested)"; return; } + mkdir -p "$d/tests/lib" "$d/verification/proofs/agda/theorem-b" + if ! { cp "$ROOT/tests/lib/strip-proof-comments.awk" "$d/tests/lib/" \ + && cp -r "$ROOT/verification/proofs/agda/theorem-b/TB" "$d/verification/proofs/agda/theorem-b/" \ + && (cd "$ROOT/verification/proofs" && find lean4 -name '*.lean' -not -path '*/.lake/*' -print0 | xargs -0 cp --parents -t "$d/verification/proofs/"); }; then + rm -rf "$d"; bad "$label (could not copy the sources rule 6 resolves against)"; return + fi if [ "$jqprog" = "IDENTITY" ]; then cp "$ROOT/verification/pwg.json" "$d/verification/pwg.json" elif [ "$jqprog" = "PRETTY" ]; then @@ -225,6 +234,85 @@ pwg_canaries() { pwg_case reject "flipping a Lean leg to RECONCILED changes the grade and is rejected" \ '(.theorems[] | select(.id == "L1") | .legs.lean.state) |= "RECONCILED"' \ "not the derived one" + # R11. A grade may not outlive the run that earned it. Measured against main + # 0dceab6 these two PASSED the gate: the derivation read .state but never + # .result, so a receipt recording the checker REJECTING the development still + # carried 17 PWG-3 grades, and an unrecognised result was not a pass but was + # not an error either. Both canaries FAIL against the pre-fix scripts. + # "fail" is a LEGITIMATE recorded value, so rule 3 admits it; the rejection + # must come from the grades themselves collapsing. Measured 2026-11-16: with + # the Agda receipt at result=fail the census goes PWG-3 17 -> 0 and ungraded + # 7 -> 24, so the published table is no longer the derived one. Against the + # pre-fix scripts the census was byte-identical and this canary did not fire. + pwg_case reject "a receipt that records result=fail cannot support a grade" \ + '.receipts["agda-c0eb4f1"].result = "fail"' \ + "not the derived one" + pwg_case reject "a receipt result outside the closed vocabulary is rejected" \ + '.receipts["agda-c0eb4f1"].result = "probably-fine"' \ + "result must be pass|fail" + # `$` in a regex can match before a final newline. Require the vocabulary + # diagnostic so rejection for derived-table drift cannot mask this defect. + pwg_case reject "a receipt result with a trailing newline is rejected" \ + '.receipts["agda-c0eb4f1"].result = "pass\n"' \ + "result must be pass[|]fail" + # The same defect in the seven sibling anchors: jq's $ accepts a final + # newline, so a 40-hex commit + "\n" and a token + "\n" were admitted. The + # anchors are now \\A...\\z. Both canaries FAIL against the pre-fix scripts. + pwg_case reject "a receipt commit with a trailing newline is rejected" \ + '.receipts["agda-c0eb4f1"].commit += "\n"' \ + "not a full 40-char sha" + pwg_case reject "a section 5 token with a trailing newline is rejected" \ + '.theorems[0].legs.agda.token += "\n"' \ + "section 5 closed vocabulary" + # R12. A witness must name something. Measured against main 0dceab6: 13 of 91 + # distinct witness names resolved to no declaration (L2's only Agda witness + # among them) and the gate passed, because nothing read `declarations`. Both + # canaries FAIL against the pre-rule-6 gate. The first plants the exact ASCII + # transliteration that was live on main; the second a Lean name whose + # namespace exists but holds no such declaration. + pwg_case reject "an Agda witness spelled in ASCII (|> for ▷) does not resolve" \ + '(.theorems[] | select(.id == "L3") | .legs.agda.declarations) |= map(sub("▷"; "|>"))' \ + "resolve to no declaration" + pwg_case reject "a Lean witness in the wrong namespace does not resolve" \ + '(.theorems[] | select(.id == "L1") | .legs.lean.declarations) = ["Trope.Bond.comp_assoc"]' \ + "resolve to no declaration" + # A real name with a tab and text appended. The first rule-6 version split + # the citation on the tab and resolved the real prefix, ignoring the rest; + # this canary FAILS against it. Review on #119. + pwg_case reject "a witness with a tab-joined suffix does not resolve" \ + '(.theorems[] | select(.id == "L1") | .legs.agda.declarations) |= map(. + "\tjunk")' \ + "resolve to no declaration" +} + +# --- the top of the ladder: PWG-2ii and PWG-1 are different rungs ---------- +# The table-drift gate cannot tell 1 from 2ii (either way the published row stops +# matching), so these canaries read the DERIVED grade directly. Both legs of L1 +# are made to count; the only variable is the commit the receipts record. +# Measured 2026-11-16: against the pre-fix derivation a receipt commit of all +# f's derived PWG-1 -- "2ii" was unreachable, because the branch tested only +# conjuncts that counting had already implied. The 2ii canary FAILS against it. +derive_case() { + local want="$1" label="$2" commit="$3" d got + d=$(scratch) + if ! jq -cS --arg c "$commit" ' + .receipts["rocq-canary"] = (.receipts["lean-boundary-c0eb4f1"] + {commit: $c}) + | .receipts["lean-boundary-c0eb4f1"].commit = $c + | (.theorems[] | select(.id == "L1") | .legs) |= + (.lean.state = "RECONCILED" + | .rocq = {declarations: [], receipts: ["rocq-canary"], route: "re-proved", state: "RECONCILED", token: "PROVEN"})' \ + "$ROOT/verification/pwg.json" > "$d/pwg.json" 2>/dev/null; then + rm -rf "$d"; bad "$label (the canary's OWN jq transform failed)"; return + fi + got=$(bash "$ROOT/scripts/pwg-derive.sh" --ledger "$d/pwg.json" --json 2>/dev/null | jq -r '.[] | select(.id == "L1") | .pwg') + rm -rf "$d" + if [ "$got" = "$want" ]; then ok "$label"; else bad "$label (derived PWG-$got, expected PWG-$want)"; fi +} +ladder_canaries() { + local src + src=$(jq -r '.commit' "$ROOT/verification/pwg.json") + derive_case 1 "both legs counting, receipts on the source commit, derive PWG-1 (control)" "$src" + derive_case 2ii "both legs counting, receipts on another commit, derive PWG-2ii, not PWG-1" \ + "$(printf '%040d' 0 | tr 0 f)" } # --- META (R10 applied to R10): the suite must detect breakage in ITS OWN fixtures. @@ -234,10 +322,17 @@ pwg_canaries() { # reports FAILURE. Measured: this canary FAILS against the pre-fix harness. meta_canary() { local out - out=$( PASS=0; FAIL=0 - pwg_case reject "meta-probe (expected to be reported as FAILING)" '.theorems[0].pwg = ' >/dev/null 2>&1 - printf 'FAILCOUNT=%s' "$FAIL" ) - if printf '%s' "$out" | grep -q 'FAILCOUNT=1'; then + # Isolation by subshell is the POINT: the meta-probe is MEANT to fail, and its + # failure must not reach the suite tally. Read its VERDICT LINE rather than a + # counter. An earlier version shadowed PASS/FAIL inside the substitution to + # discard them; that worked, but ShellCheck then marked every later read of + # those names SC2031 across the whole tally block, and silencing ten warnings + # on the real counters to keep one deliberate shadow is a bad trade -- it + # blinds the check where it would do genuine work. Nothing is assigned here + # that the outer shell reads, so the warnings go away by construction instead + # of by suppression. + out=$( pwg_case reject "meta-probe (expected to be reported as FAILING)" '.theorems[0].pwg = ' 2>&1 ) + if printf '%s\n' "$out" | grep -q '^FAIL '; then ok "a canary whose own jq program is broken is reported as FAILURE (meta-canary)" else bad "a BROKEN canary still reported PASS — the suite cannot detect its own breakage" @@ -246,12 +341,12 @@ meta_canary() { wellknown_canaries; valid_canary; live_canary c_weak_crypto; c_plaintext_http; c_secret -pwg_canaries +pwg_canaries; ladder_canaries meta_canary echo # A canary group that silently stops running used to report "10/10" and exit 0. # The count is part of the claim. -EXPECTED_CASES=19 +EXPECTED_CASES=29 if [ "$((PASS+FAIL))" -ne "$EXPECTED_CASES" ]; then echo "gate falsifiability canaries: $((PASS+FAIL)) cases ran, $EXPECTED_CASES expected — a canary group did not run" exit 1 diff --git a/verification/proofs/README.adoc b/verification/proofs/README.adoc index 6816e3d..fe3e145 100644 --- a/verification/proofs/README.adoc +++ b/verification/proofs/README.adoc @@ -2,7 +2,20 @@ // Copyright (c) Jonathan D.A. Jewell = Formal Verification Proofs -This directory contains formal proofs organised by proof assistant. +This directory contains formal proofs organised by proof assistant. There are four +proof developments, each in the role ADR 0005 D4 gives it (as amended 2026-11-17, +`docs/decisions/0005-v0.2-consolidation-o5-and-prover-roles.adoc`): + +[cols="1,3"] +|=== +| Development | Role + +| Agda | The normative kernel: Theorem B and every theory obligation. +| Rocq | A PROOF-POLICY §2 recheck leg, with no `Require`. +| Lean, core | A §2 recheck leg, with no `import` (no Mathlib). +| Lean + Mathlib | A generator, never a leg. Its results become gradeable only once restated in core Agda. +| Idris2 | The executable reference. PROOF-POLICY §8.1 keeps it off the PWG ladder. +|=== == Directory Structure @@ -11,33 +24,43 @@ This directory contains formal proofs organised by proof assistant. proofs/ ├── INTEGRATION-REPORT.adoc # Theorem B reconciliation: unified R-id↔Lean↔Agda↔status │ # table, the central open problem, divergence adjudication -├── idris2/ # the verified core (package trope, trope.ipkg) +├── idris2/ # the executable reference's verified core (package trope, trope.ipkg) │ └── Trope/ # %default total; the grade algebra + laws (see PROOF-STATUS) -├── lean4/ # Lean4 proofs (algebra, lattices) -│ ├── grade-boundary/ # grade-algebra GROUND TRUTH: the honest/deceptive cancellation -│ │ # boundary (Lean 4 + Mathlib; sorry-free; no user axiom) -│ └── grade-factorisation/ # tropical factorisation probe: imports the carrier; verdict (B) -│ # factors but veridicality-blind (precondition only; not CO-1) -└── agda/ # Agda proofs (induction, metatheory) - └── theorem-b/ # Theorem B: calculus metatheory over the grade algebra - # (--safe --without-K --cubical-compatible --exact-split; zero postulates) +├── lean4/ +│ ├── grade-boundary/ # generator (Lean 4 + Mathlib): the honest/deceptive cancellation +│ │ # boundary, ADR 0003's ground truth (sorry-free; no user axiom) +│ ├── grade-factorisation/ # generator (Lean 4 + Mathlib): tropical factorisation probe; imports +│ │ # the carrier; verdict (B) factors but veridicality-blind +│ │ # (precondition only; not CO-1) +│ └── ratified-order/ # §2 recheck leg (core Lean 4.16.0, no import): order laws + L4 +├── rocq/ # §2 recheck leg (Coq 8.18.0, no Require): order laws + L4 +│ └── RatifiedOrder.v +└── agda/ # the normative kernel (--safe --without-K --cubical-compatible --exact-split) + └── theorem-b/ # Theorem B: calculus metatheory over the grade algebra; zero postulates ---- == Verification Commands [source,bash] ---- -just proof-check-all # Run all proof checkers (package builds + dangerous-pattern scan) -just proof-check-idris2 # Idris2 only -just proof-check-lean4 # Lean4 only -just proof-check-agda # Agda only +just proof-check-all # Run all proof checkers (package builds, both recheck legs + controls, dangerous-pattern scan) +just proof-check-agda # Agda only (the normative kernel) +just proof-check-rocq # Rocq recheck leg only +just proof-check-lean-core # core-Lean recheck leg only +just proof-check-recheck-controls # the planted defects each recheck-leg gate must catch +just recheck-legs # the three above (mirrors the proofs.yml recheck-legs job) +just proof-check-lean4 # Lean + Mathlib generator only +just proof-check-idris2 # Idris2 only (the reference) +just proof-status # the four developments by role, then the PWG census # The two pinned developments need a real build (lake+Mathlib / an All.agda entry), # not a bare per-file check — proof-check-{idris2,lean4,agda} now do exactly that # (the ABI seam's abi.ipkg, at the repo root over src/interface/Abi, is checked -# by proof-check-idris2 too). The fuller merges-gate equivalents: -just verify-all # grade-boundary + grade-factorisation (Lean) + Theorem B (Agda): build + honesty gate -just build-lean # both Lean harnesses (grade-boundary + grade-factorisation) + axiom audits +# by proof-check-idris2 too). The recheck legs run scripts/check-recheck-legs.sh, +# which fails on a missing or wrong-version prover; it never skips. +# The fuller merges-gate equivalents: +just verify-all # Lean + Mathlib + Theorem B (Agda) + both recheck legs: build + honesty gate + PWG record +just build-lean # both Lean + Mathlib harnesses (grade-boundary + grade-factorisation) + axiom audits just build-agda # Agda Theorem B (--safe --without-K --cubical-compatible --exact-split -W error) # the probe also has its own subproject harness: ( cd lean4/grade-factorisation && just falsify ) # sorry-free, axiom-clean, falsifier witnesses live @@ -64,13 +87,16 @@ is a pre-filter. CI enforcement is the provers themselves, at full strictness warnings as errors, leanchecker re-checking the compiled Lean environment, an axiom allowlist audit over every Lean module, Agda under `--safe --without-K --cubical-compatible --exact-split --warning=error`, Idris2 package typechecks -under `%default total`, plus the comment-aware source gates in the same -workflows. +under `%default total`, the two recheck legs under +`scripts/check-recheck-legs.sh` (Rocq `Print Assumptions` and core-Lean +`collectAxioms` on every declared theorem, with no axiom allowed, and six planted +controls that must each be caught), plus the comment-aware source gates in the +same workflows. == Adding New Proofs -1. Choose the appropriate prover (see `../../docs/status/PROOF-NEEDS.adoc`) -2. Create the `.idr`/`.lean`/`.agda` file in the right directory +1. Choose the appropriate prover by its role above (and see `../../docs/status/PROOF-NEEDS.adoc`) +2. Create the `.agda`/`.v`/`.lean`/`.idr` file in the right directory 3. Ensure `%default total` (Idris2) or equivalent 4. Run the verification command 5. Update `../../docs/status/PROOF-STATUS.adoc` diff --git a/verification/proofs/agda/theorem-b/All.agda b/verification/proofs/agda/theorem-b/All.agda index de0e4fa..83510db 100644 --- a/verification/proofs/agda/theorem-b/All.agda +++ b/verification/proofs/agda/theorem-b/All.agda @@ -8,6 +8,9 @@ module All where open import TB.Grade open import TB.Order +open import TB.OrderLaws +open import TB.Monotone +open import TB.Bridge open import TB.Tier open import TB.Syntax open import TB.Substitution diff --git a/verification/proofs/agda/theorem-b/INTERFACE-REPORT.adoc b/verification/proofs/agda/theorem-b/INTERFACE-REPORT.adoc index 8ba8317..38b4d07 100644 --- a/verification/proofs/agda/theorem-b/INTERFACE-REPORT.adoc +++ b/verification/proofs/agda/theorem-b/INTERFACE-REPORT.adoc @@ -63,7 +63,8 @@ modality; `EchoIndexed.agda` — indexed functoriality; these are the It sits ON TOP of the *FROZEN INTERFACE* — the grade algebra established in Lean 4 (`verification/proofs/lean4/grade-boundary/GradeBoundary.lean`, sorry-free, axioms -`propext`/`Quot.sound` only). The four established facts are re-established in Agda +at most Lean/Mathlib's standard axioms `propext`, `Classical.choice` and +`Quot.sound`, as that file's own axiom-audit footer states). The four established facts are re-established in Agda here as the foundation (`TB.Grade`), then the calculus metatheory is built over them. [IMPORTANT] @@ -95,7 +96,7 @@ deceptive (`falsified`/`misbound`/`conflated`/`unknown`, left zeros ⇒ L5 irrev Fences respected: spec is v0.2, ratified carrier R-2026-07-07 (O1 seven-effects completeness OUT OF SCOPE, untouched); "CF" (cancellative+conical ⇒ special-Frobenius) NOT assumed — it is -refuted-as-universal by both F2 and L5. +refuted-as-universal by L5 (and, on the pre-ratification carrier only, by F2). == Module → fact → status map (the merge key) @@ -130,10 +131,21 @@ refuted-as-universal by both F2 and L5. == Per-target verdict -=== Target 1 — encode the grade as a NON-COMMUTATIVE graded structure (intrinsic) — *PROVED* +=== Target 1 — encode the grade as a graded structure (intrinsic) — *PROVED* + +[NOTE] +==== +As first set, this target read "NON-COMMUTATIVE". On the ratified carrier +(R-2026-07-07) the product is commutative (`grade-comm`) and +`dropped ▷f falsified = falsified` (`TB/Grade.agda`, the `_▷f_` clause marked +(A1)). The sentences below that present F2 or a non-commutative ▷ as current +describe the pre-ratification carrier and are kept as the record of it; the +rest of the paragraph (the intrinsic calculus) is current. +==== `TB.Grade` ports the carrier (Δ, Fate, Bond, Merge, Grade) and ▷ clause-for-clause -from the Lean, with first-argument-match so F2 holds *definitionally* +from the Lean, with first-argument-match so F2 held *definitionally* on the +pre-ratification carrier (`dropped ▷f falsified = dropped ≠ falsified = falsified ▷f dropped`). F1/F2/F3 and the F4 absorbing lemmas are re-established. `TB.Syntax` is the *intrinsic* calculus `Γ ⊢ A ! g` (a derivation is a well-typed-and-well-graded term): variables carry ε; @@ -257,7 +269,7 @@ above records.) lemmas, `deceptiveDuals = (falsified, misbound, conflated)`) and Generation (`Move`, `moveFate/Bond/Merge`, `movesHonest*`, `genFate/genBond/genMerge`) from the Idris ground truth. The new content is the *calculus metatheorem*: honesty is closed -under the non-commutative ▷ (`honest-closed-▷`, via per-coordinate +under ▷ (`honest-closed-▷`, via per-coordinate `fate/bond/merge-honest`), and every writable effect atom is honest (`ε/atten/drop/sever/predicate-atom-honest`). Therefore a term built from the writable effects can NEVER produce a deceptive grade @@ -276,12 +288,29 @@ realised dynamically: the deceptive states are unreachable by construction. * F2 (non-commutativity) is *mandatory* and live: `grade-not-comm` is a pinned theorem; ▷ is a bare non-commutative function; no commutative bundle is instantiated for `Grade`/`Fate`; the substitution refutation - (`cut-symmetric-fails`) and the tier finding (`fate-tier-meet-hom-fails`) both - DEPEND on F2 and would be false under a commutative model. + (`cut-symmetric-fails`) depended on F2. [CORRECTED 2026-11-16] None of + `grade-not-comm` and `cut-symmetric-fails` exists any more (they are + replaced by `grade-comm` and `cut-grade-comm`). The tier finding + `fate-tier-meet-hom-fails` is *not* among the F2-dependent results: it is + proved on the ratified, COMMUTATIVE carrier with a new witness + (`dropped ▷f atten unknown = dropped`; collapse discards the fidelity + coordinate), so it holds under a commutative model. * F4 (three-tier boundary) is preserved as a *structure* subject reduction respects: - the cancellative core is closed and cancels; the deceptive tier is forward-closed - (L5); the honest-but-lossy middle is shown non-cancellative by witnesses; and the + the cancellative core is closed and cancels; the GRADE-LEVEL deceptive predicate + is closed under `▷` in its LEFT argument (`deceptive-absorbs-▷`, total — L5); + the honest-but-lossy middle is shown non-cancellative by witnesses; and the one place a clean homomorphism would over-claim is exhibited as a refuted finding. + *Both qualifications on that second clause are load-bearing, and an earlier + draft of this line carried neither.* It read "the deceptive tier is + forward-closed", which this very checklist refutes two bullets up: the fate + TIER is not closed under `▷` on the RIGHT, and `fate-tier-meet-hom-fails` is + the witness — `dropped ▷f atten unknown` reduces to `dropped`, which is + `honestLossy`, although `atten unknown` is tier-deceptive, because collapse + discards the fidelity coordinate the deceptive `unknown` was living in. What + is forward-closed is the grade-level *predicate* from the left, which is a + different statement and the one Agda proves. `TB/Tier.agda` records the + distinction explicitly: the collapse "does not launder the GRADE-level + deceptive predicate". No statement was silently restricted to make it go through; every scoping choice (presence-coarseness, `fuse` omission, `fix` NOT-REACHED) is stated explicitly. diff --git a/verification/proofs/agda/theorem-b/Smoke.agda b/verification/proofs/agda/theorem-b/Smoke.agda index edde93c..0a27476 100644 --- a/verification/proofs/agda/theorem-b/Smoke.agda +++ b/verification/proofs/agda/theorem-b/Smoke.agda @@ -25,6 +25,18 @@ open import TB.Order using ; dplusMonoR ; dplusMonoL -- fidelity monotonicity ; fateL4MonoR ; fateL4MonoL ) -- L4, both arguments +-- A2-chain + retention-order: Fate is a chain (a total order), and ⊑ is a +-- decidable preorder on grades. +open import TB.OrderLaws using + ( fateLte-trans ; fateLte-antisym ; fateLte-total ; fate-isTotalOrder -- A2: chain + ; dLte-isTotalOrder -- fidelity chain + ; ⊑-trans ; ⊑-dec ; ⊑-isPreorder ) -- decidable preorder + +-- L4 in full: bond and merge coordinates, and the grade-level lifting. +open import TB.Monotone using + ( bondL4MonoR ; bondL4MonoL ; mergeL4MonoR ; mergeL4MonoL -- L4-bond-merge + ; gradeL4MonoR ; gradeL4MonoL ; ▷-mono ) -- L4-lifting + -- F4 — the three-tier boundary, dynamically (closure, NOT homomorphism). open import TB.Tier using ( Tier ; tierOf ; _⊓ᵗ_ diff --git a/verification/proofs/agda/theorem-b/TB/Bridge.agda b/verification/proofs/agda/theorem-b/TB/Bridge.agda new file mode 100644 index 0000000..750ede2 --- /dev/null +++ b/verification/proofs/agda/theorem-b/TB/Bridge.agda @@ -0,0 +1,126 @@ +{-# OPTIONS --safe --without-K --cubical-compatible --exact-split #-} +-- SPDX-FileCopyrightText: © 2026 Jonathan D.A. Jewell (hyperpolymath) +-- SPDX-License-Identifier: MPL-2.0 +-- +-- Theorem B — the definition bridge for the Rocq and Lean recheck legs of the +-- ratified-carrier order laws and L4 (PROOF-POLICY §2.2). +-- +-- A re-proved leg restates the Agda definitions by hand, and a restated +-- definition can drift from its source while every theorem about it still +-- proves. This module pins the values of the six definitions the legs restate +-- (fateLte, _▷f_, bondLte, _▷b_, mergeLte, _▷m_) on a fixed sample, as lists +-- of numerals. verification/proofs/rocq/RatifiedOrder.v and +-- verification/proofs/lean4/ratified-order/RatifiedOrder.lean state the SAME +-- six literals about their own restatements and prove them by computation. +-- If any one restatement disagrees with the Agda at any sample point, that +-- prover's kernel rejects its bridge theorem. +-- +-- Coverage: Bond (4 × 4) and Merge (3 × 3) are covered exhaustively. Fate is +-- covered on nine points, top to bottom: present, atten (Q 0), atten (Q 2), +-- atten (Q 5), atten total, atten unknown, predicated, dropped, falsified +-- (81 pairs); the Atten pairs exercise Δ addition (Q 2 ⊕d Q 5 = Q 7). +-- The fateLte table is lower-triangular in that order: the chain, visibly. +-- +-- Codes: Fate present 0, atten (Q n) 10 + n, atten total 1, atten unknown 2, +-- predicated 3, dropped 4, falsified 5; Bond intact 0, withheld 1, severed 2, +-- misbound 3; Merge single 0, fused 1, conflated 2; a Boolean is 1 or 0. + +module TB.Bridge where + +open import Data.Bool.Base using (Bool; true; false) +open import Data.List.Base using (List; []; _∷_; map; concatMap) +open import Data.Nat.Base using (ℕ; _+_) +open import Relation.Binary.PropositionalEquality using (_≡_; refl) + +open import TB.Grade +open import TB.Order + +b2n : Bool → ℕ +b2n true = 1 +b2n false = 0 + +fcode : Fate → ℕ +fcode present = 0 +fcode (atten (Q n)) = 10 + n +fcode (atten total) = 1 +fcode (atten unknown) = 2 +fcode predicated = 3 +fcode dropped = 4 +fcode falsified = 5 + +bcode : Bond → ℕ +bcode intact = 0 +bcode withheld = 1 +bcode severed = 2 +bcode misbound = 3 + +mcode : Merge → ℕ +mcode single = 0 +mcode fused = 1 +mcode conflated = 2 + +sampleF : List Fate +sampleF = present ∷ atten (Q 0) ∷ atten (Q 2) ∷ atten (Q 5) ∷ atten total + ∷ atten unknown ∷ predicated ∷ dropped ∷ falsified ∷ [] + +sampleB : List Bond +sampleB = intact ∷ withheld ∷ severed ∷ misbound ∷ [] + +sampleM : List Merge +sampleM = single ∷ fused ∷ conflated ∷ [] + +-- Every ordered pair of the sample, row by row: tbl f [x₁ … xₙ] = +-- f x₁ x₁ … f x₁ xₙ, f x₂ x₁ … +tbl : {A : Set} → (A → A → ℕ) → List A → List ℕ +tbl f xs = concatMap (λ x → map (f x) xs) xs + +fateLteTable-literal : List ℕ +fateLteTable-literal = + 1 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ + 0 ∷ 1 ∷ 1 ∷ 1 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 0 ∷ 0 ∷ 0 ∷ + 0 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 0 ∷ 0 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ + 0 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ + 1 ∷ 1 ∷ 1 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ [] + +fcompTable-literal : List ℕ +fcompTable-literal = + 0 ∷ 10 ∷ 12 ∷ 15 ∷ 1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ 10 ∷ 10 ∷ 12 ∷ 15 ∷ 1 ∷ 2 ∷ + 3 ∷ 4 ∷ 5 ∷ 12 ∷ 12 ∷ 14 ∷ 17 ∷ 1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ 15 ∷ 15 ∷ 17 ∷ + 20 ∷ 1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ 2 ∷ + 2 ∷ 2 ∷ 2 ∷ 2 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ 3 ∷ 3 ∷ 3 ∷ 3 ∷ 3 ∷ 3 ∷ 3 ∷ 4 ∷ 5 ∷ + 4 ∷ 4 ∷ 4 ∷ 4 ∷ 4 ∷ 4 ∷ 4 ∷ 4 ∷ 5 ∷ 5 ∷ 5 ∷ 5 ∷ 5 ∷ 5 ∷ 5 ∷ 5 ∷ 5 ∷ + 5 ∷ [] + +bondLteTable-literal : List ℕ +bondLteTable-literal = + 1 ∷ 0 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ [] + +bcompTable-literal : List ℕ +bcompTable-literal = + 0 ∷ 1 ∷ 2 ∷ 3 ∷ 1 ∷ 1 ∷ 2 ∷ 3 ∷ 2 ∷ 2 ∷ 2 ∷ 3 ∷ 3 ∷ 3 ∷ 3 ∷ 3 ∷ [] + +mergeLteTable-literal : List ℕ +mergeLteTable-literal = + 1 ∷ 0 ∷ 0 ∷ 1 ∷ 1 ∷ 0 ∷ 1 ∷ 1 ∷ 1 ∷ [] + +mcompTable-literal : List ℕ +mcompTable-literal = + 0 ∷ 1 ∷ 2 ∷ 1 ∷ 1 ∷ 2 ∷ 2 ∷ 2 ∷ 2 ∷ [] + +bridge-fateLte : tbl (λ x y → b2n (fateLte x y)) sampleF ≡ fateLteTable-literal +bridge-fateLte = refl + +bridge-fcomp : tbl (λ x y → fcode (x ▷f y)) sampleF ≡ fcompTable-literal +bridge-fcomp = refl + +bridge-bondLte : tbl (λ x y → b2n (bondLte x y)) sampleB ≡ bondLteTable-literal +bridge-bondLte = refl + +bridge-bcomp : tbl (λ x y → bcode (x ▷b y)) sampleB ≡ bcompTable-literal +bridge-bcomp = refl + +bridge-mergeLte : tbl (λ x y → b2n (mergeLte x y)) sampleM ≡ mergeLteTable-literal +bridge-mergeLte = refl + +bridge-mcomp : tbl (λ x y → mcode (x ▷m y)) sampleM ≡ mcompTable-literal +bridge-mcomp = refl diff --git a/verification/proofs/agda/theorem-b/TB/Monotone.agda b/verification/proofs/agda/theorem-b/TB/Monotone.agda new file mode 100644 index 0000000..15b228d --- /dev/null +++ b/verification/proofs/agda/theorem-b/TB/Monotone.agda @@ -0,0 +1,109 @@ +{-# OPTIONS --safe --without-K --cubical-compatible --exact-split #-} +-- SPDX-FileCopyrightText: © 2026 Jonathan D.A. Jewell (hyperpolymath) +-- SPDX-License-Identifier: MPL-2.0 +-- +-- Theorem B — L4 (monotonicity) IN FULL on the RATIFIED carrier +-- (R-2026-07-07 (A1)/(A2), ADR 0004): ▷ is monotone in each argument with +-- respect to ⊑ on every coordinate, and the grade composition ▷ is too. +-- +-- L4-fate TB.Order.fateL4Mono{R,L} (already in TB.Order) +-- L4-fidelity TB.Order.dplusMono{R,L} (already in TB.Order) +-- L4-bond-merge bondL4Mono{R,L}, mergeL4Mono{R,L} (this module) +-- L4-lifting gradeL4Mono{R,L}, ▷-mono (this module) +-- +-- The left-argument forms follow from the right-argument forms by the +-- coordinate's commutativity (L6: ▷b-comm, ▷m-comm, grade-comm), so each +-- coordinate needs one case analysis, not two. ▷-mono, monotonicity in both +-- arguments at once, is the form the T-Fix-Decl argument (spec §7) applies at +-- a composition site; it composes the two one-sided lemmas through ⊑-trans. + +module TB.Monotone where + +open import Data.Bool.Base using (true) +open import Data.Product.Base using (_×_; _,_) +open import Relation.Binary.PropositionalEquality using (_≡_; refl; subst₂) + +open import TB.Grade +open import TB.Order +open import TB.OrderLaws using (∧⁶-elim; ∧⁶-intro; ⊑-trans) + +-------------------------------------------------------------------------------- +-- L4-bond-merge. Bond: Misbound ⊏ Severed ⊏ Withheld ⊏ Intact. +-------------------------------------------------------------------------------- + +bondL4MonoR : ∀ h x y → bondLte x y ≡ true → bondLte (h ▷b x) (h ▷b y) ≡ true +bondL4MonoR intact x y p = p +bondL4MonoR misbound x y _ = refl +bondL4MonoR withheld misbound y _ = refl +bondL4MonoR withheld intact intact _ = refl +bondL4MonoR withheld intact withheld () +bondL4MonoR withheld intact severed () +bondL4MonoR withheld intact misbound () +bondL4MonoR withheld withheld intact _ = refl +bondL4MonoR withheld withheld withheld _ = refl +bondL4MonoR withheld withheld severed () +bondL4MonoR withheld withheld misbound () +bondL4MonoR withheld severed intact _ = refl +bondL4MonoR withheld severed withheld _ = refl +bondL4MonoR withheld severed severed _ = refl +bondL4MonoR withheld severed misbound () +bondL4MonoR severed misbound y _ = refl +bondL4MonoR severed intact intact _ = refl +bondL4MonoR severed intact withheld () +bondL4MonoR severed intact severed () +bondL4MonoR severed intact misbound () +bondL4MonoR severed withheld intact _ = refl +bondL4MonoR severed withheld withheld _ = refl +bondL4MonoR severed withheld severed () +bondL4MonoR severed withheld misbound () +bondL4MonoR severed severed intact _ = refl +bondL4MonoR severed severed withheld _ = refl +bondL4MonoR severed severed severed _ = refl +bondL4MonoR severed severed misbound () + +bondL4MonoL : ∀ x y h → bondLte x y ≡ true → bondLte (x ▷b h) (y ▷b h) ≡ true +bondL4MonoL x y h p = + subst₂ (λ u v → bondLte u v ≡ true) (▷b-comm h x) (▷b-comm h y) (bondL4MonoR h x y p) + +-- Merge: Conflated ⊏ Fused ⊏ Single. + +mergeL4MonoR : ∀ h x y → mergeLte x y ≡ true → mergeLte (h ▷m x) (h ▷m y) ≡ true +mergeL4MonoR single x y p = p +mergeL4MonoR conflated x y _ = refl +mergeL4MonoR fused conflated y _ = refl +mergeL4MonoR fused single single _ = refl +mergeL4MonoR fused single fused () +mergeL4MonoR fused single conflated () +mergeL4MonoR fused fused single _ = refl +mergeL4MonoR fused fused fused _ = refl +mergeL4MonoR fused fused conflated () + +mergeL4MonoL : ∀ x y h → mergeLte x y ≡ true → mergeLte (x ▷m h) (y ▷m h) ≡ true +mergeL4MonoL x y h p = + subst₂ (λ u v → mergeLte u v ≡ true) (▷m-comm h x) (▷m-comm h y) (mergeL4MonoR h x y p) + +-------------------------------------------------------------------------------- +-- L4-lifting. The grade composition ▷ (gradeCompose) is ⊑-monotone: the six +-- coordinate lemmas, applied componentwise. +-------------------------------------------------------------------------------- + +gradeL4MonoR : ∀ k g h → g ⊑ h → (k ▷ g) ⊑ (k ▷ h) +gradeL4MonoR (mkGrade q b c r bo m) (mkGrade q₁ b₁ c₁ r₁ bo₁ m₁) (mkGrade q₂ b₂ c₂ r₂ bo₂ m₂) p + with ∧⁶-elim _ _ _ _ _ _ p +... | pq , pb , pc , pr , pbo , pm = + ∧⁶-intro _ _ _ _ _ _ + (fateL4MonoR q q₁ q₂ pq) + (fateL4MonoR b b₁ b₂ pb) + (fateL4MonoR c c₁ c₂ pc) + (fateL4MonoR r r₁ r₂ pr) + (bondL4MonoR bo bo₁ bo₂ pbo) + (mergeL4MonoR m m₁ m₂ pm) + +gradeL4MonoL : ∀ g h k → g ⊑ h → (g ▷ k) ⊑ (h ▷ k) +gradeL4MonoL g h k p = + subst₂ _⊑_ (grade-comm k g) (grade-comm k h) (gradeL4MonoR k g h p) + +-- Both arguments at once: g₁ ⊑ g₂ and h₁ ⊑ h₂ give g₁ ▷ h₁ ⊑ g₂ ▷ h₂. +▷-mono : ∀ g₁ g₂ h₁ h₂ → g₁ ⊑ g₂ → h₁ ⊑ h₂ → (g₁ ▷ h₁) ⊑ (g₂ ▷ h₂) +▷-mono g₁ g₂ h₁ h₂ p q = + ⊑-trans (g₁ ▷ h₁) (g₂ ▷ h₁) (g₂ ▷ h₂) (gradeL4MonoL g₁ g₂ h₁ p) (gradeL4MonoR g₂ h₁ h₂ q) diff --git a/verification/proofs/agda/theorem-b/TB/OrderLaws.agda b/verification/proofs/agda/theorem-b/TB/OrderLaws.agda new file mode 100644 index 0000000..97bd430 --- /dev/null +++ b/verification/proofs/agda/theorem-b/TB/OrderLaws.agda @@ -0,0 +1,346 @@ +{-# OPTIONS --safe --without-K --cubical-compatible --exact-split #-} +-- SPDX-FileCopyrightText: © 2026 Jonathan D.A. Jewell (hyperpolymath) +-- SPDX-License-Identifier: MPL-2.0 +-- +-- Theorem B — the order laws of the retention order ⊑ (TB.Order) on the +-- RATIFIED carrier (R-2026-07-07 (A2), ADR 0004). +-- +-- A2-chain Fate is a CHAIN: fateLte is reflexive, transitive, +-- antisymmetric and total — a total order in the sense of +-- the standard library (fate-isTotalOrder). The fidelity +-- order dLte, which fateLte uses on the Atten segment, is a +-- chain as well (dLte-isTotalOrder). +-- retention-order ⊑ on grades is a decidable preorder: reflexive (TB.Order +-- ⊑-refl), transitive (⊑-trans), decidable (⊑-dec). +-- +-- TB.Order proves reflexivity only; transitivity, antisymmetry and totality +-- were stated in no ladder prover before this module (pwg.json A2-chain, +-- retention-order). Everything here is by structural case analysis on the +-- Boolean orders exactly as TB.Order defines them; no definition is changed. + +module TB.OrderLaws where + +open import Data.Bool.Base using (Bool; true; false; _∧_) +open import Data.Bool.Properties using () renaming (_≟_ to _≟ᵇ_) +open import Data.Nat.Base using (ℕ; zero; suc) +open import Data.Product.Base using (_×_; _,_) +open import Data.Sum.Base using (_⊎_; inj₁; inj₂) +open import Relation.Binary.Structures using (IsPreorder; IsPartialOrder; IsTotalOrder) +open import Relation.Binary.PropositionalEquality + using (_≡_; refl; cong; subst; isEquivalence) +open import Relation.Nullary.Decidable using (Dec) + +open import TB.Grade +open import TB.Order + +-------------------------------------------------------------------------------- +-- ℕ: the structural Boolean ≤ (lteb) is a total order. +-------------------------------------------------------------------------------- + +lteb-trans : ∀ a b c → lteb a b ≡ true → lteb b c ≡ true → lteb a c ≡ true +lteb-trans zero b c _ _ = refl +lteb-trans (suc a) zero c () _ +lteb-trans (suc a) (suc b) zero _ () +lteb-trans (suc a) (suc b) (suc c) p q = lteb-trans a b c p q + +lteb-antisym : ∀ a b → lteb a b ≡ true → lteb b a ≡ true → a ≡ b +lteb-antisym zero zero _ _ = refl +lteb-antisym zero (suc b) _ () +lteb-antisym (suc a) zero () _ +lteb-antisym (suc a) (suc b) p q = cong suc (lteb-antisym a b p q) + +lteb-total : ∀ a b → lteb a b ≡ true ⊎ lteb b a ≡ true +lteb-total zero b = inj₁ refl +lteb-total (suc a) zero = inj₂ refl +lteb-total (suc a) (suc b) = lteb-total a b + +-------------------------------------------------------------------------------- +-- Δ: the fidelity order (unknown ⊏ total ⊏ … ⊏ Q 1 ⊏ Q 0) is a total order. +-------------------------------------------------------------------------------- + +dLte-trans : ∀ a b c → dLte a b ≡ true → dLte b c ≡ true → dLte a c ≡ true +dLte-trans unknown b c _ _ = refl +dLte-trans (Q x) (Q y) (Q z) p q = lteb-trans z y x q p +dLte-trans (Q x) (Q y) total _ () +dLte-trans (Q x) (Q y) unknown _ () +dLte-trans (Q x) total c () _ +dLte-trans (Q x) unknown c () _ +dLte-trans total (Q y) (Q z) _ _ = refl +dLte-trans total (Q y) total _ _ = refl +dLte-trans total (Q y) unknown _ () +dLte-trans total total (Q z) _ _ = refl +dLte-trans total total total _ _ = refl +dLte-trans total total unknown _ () +dLte-trans total unknown c () _ + +dLte-antisym : ∀ a b → dLte a b ≡ true → dLte b a ≡ true → a ≡ b +dLte-antisym unknown unknown _ _ = refl +dLte-antisym unknown (Q y) _ () +dLte-antisym unknown total _ () +dLte-antisym (Q x) (Q y) p q = cong Q (lteb-antisym x y q p) +dLte-antisym (Q x) total () _ +dLte-antisym (Q x) unknown () _ +dLte-antisym total (Q y) _ () +dLte-antisym total total _ _ = refl +dLte-antisym total unknown () _ + +dLte-total : ∀ a b → dLte a b ≡ true ⊎ dLte b a ≡ true +dLte-total unknown b = inj₁ refl +dLte-total (Q x) (Q y) = lteb-total y x +dLte-total (Q x) total = inj₂ refl +dLte-total (Q x) unknown = inj₂ refl +dLte-total total (Q y) = inj₁ refl +dLte-total total total = inj₁ refl +dLte-total total unknown = inj₂ refl + +-------------------------------------------------------------------------------- +-- A2-chain. Fate: Falsified ⊏ Dropped ⊏ Predicated ⊏ Atten(unknown) ⊏ +-- Atten(total) ⊏ … ⊏ Atten(Q 0) ⊏ Present is a total order. +-------------------------------------------------------------------------------- + +fateLte-trans : ∀ x y z → fateLte x y ≡ true → fateLte y z ≡ true → fateLte x z ≡ true +fateLte-trans falsified y z _ _ = refl +-- x = dropped: only z = falsified is open, and it forces y = falsified. +fateLte-trans dropped y present _ _ = refl +fateLte-trans dropped y (atten _) _ _ = refl +fateLte-trans dropped y predicated _ _ = refl +fateLte-trans dropped y dropped _ _ = refl +fateLte-trans dropped present falsified _ () +fateLte-trans dropped (atten _) falsified _ () +fateLte-trans dropped predicated falsified _ () +fateLte-trans dropped dropped falsified _ () +fateLte-trans dropped falsified falsified () _ +-- x = predicated: z ∈ {dropped, falsified} is refuted by y. +fateLte-trans predicated y present _ _ = refl +fateLte-trans predicated y (atten _) _ _ = refl +fateLte-trans predicated y predicated _ _ = refl +fateLte-trans predicated present dropped _ () +fateLte-trans predicated (atten _) dropped _ () +fateLte-trans predicated predicated dropped _ () +fateLte-trans predicated dropped dropped () _ +fateLte-trans predicated falsified dropped () _ +fateLte-trans predicated present falsified _ () +fateLte-trans predicated (atten _) falsified _ () +fateLte-trans predicated predicated falsified _ () +fateLte-trans predicated dropped falsified () _ +fateLte-trans predicated falsified falsified () _ +-- x = atten a: the Atten segment is the fidelity chain. +fateLte-trans (atten a) y present _ _ = refl +fateLte-trans (atten a) present (atten c) _ () +fateLte-trans (atten a) (atten b) (atten c) p q = dLte-trans a b c p q +fateLte-trans (atten a) predicated (atten c) () _ +fateLte-trans (atten a) dropped (atten c) () _ +fateLte-trans (atten a) falsified (atten c) () _ +fateLte-trans (atten a) present predicated _ () +fateLte-trans (atten a) (atten b) predicated _ () +fateLte-trans (atten a) predicated predicated () _ +fateLte-trans (atten a) dropped predicated () _ +fateLte-trans (atten a) falsified predicated () _ +fateLte-trans (atten a) present dropped _ () +fateLte-trans (atten a) (atten b) dropped _ () +fateLte-trans (atten a) predicated dropped () _ +fateLte-trans (atten a) dropped dropped () _ +fateLte-trans (atten a) falsified dropped () _ +fateLte-trans (atten a) present falsified _ () +fateLte-trans (atten a) (atten b) falsified _ () +fateLte-trans (atten a) predicated falsified () _ +fateLte-trans (atten a) dropped falsified () _ +fateLte-trans (atten a) falsified falsified () _ +-- x = present: present is the top, so y = present and z = present. +fateLte-trans present y present _ _ = refl +fateLte-trans present present (atten _) _ () +fateLte-trans present present predicated _ () +fateLte-trans present present dropped _ () +fateLte-trans present present falsified _ () +fateLte-trans present (atten _) (atten _) () _ +fateLte-trans present (atten _) predicated () _ +fateLte-trans present (atten _) dropped () _ +fateLte-trans present (atten _) falsified () _ +fateLte-trans present predicated (atten _) () _ +fateLte-trans present predicated predicated () _ +fateLte-trans present predicated dropped () _ +fateLte-trans present predicated falsified () _ +fateLte-trans present dropped (atten _) () _ +fateLte-trans present dropped predicated () _ +fateLte-trans present dropped dropped () _ +fateLte-trans present dropped falsified () _ +fateLte-trans present falsified (atten _) () _ +fateLte-trans present falsified predicated () _ +fateLte-trans present falsified dropped () _ +fateLte-trans present falsified falsified () _ + +fateLte-antisym : ∀ x y → fateLte x y ≡ true → fateLte y x ≡ true → x ≡ y +fateLte-antisym present present _ _ = refl +fateLte-antisym present (atten _) () _ +fateLte-antisym present predicated () _ +fateLte-antisym present dropped () _ +fateLte-antisym present falsified () _ +fateLte-antisym (atten a) present _ () +fateLte-antisym (atten a) (atten b) p q = cong atten (dLte-antisym a b p q) +fateLte-antisym (atten a) predicated () _ +fateLte-antisym (atten a) dropped () _ +fateLte-antisym (atten a) falsified () _ +fateLte-antisym predicated present _ () +fateLte-antisym predicated (atten _) _ () +fateLte-antisym predicated predicated _ _ = refl +fateLte-antisym predicated dropped () _ +fateLte-antisym predicated falsified () _ +fateLte-antisym dropped present _ () +fateLte-antisym dropped (atten _) _ () +fateLte-antisym dropped predicated _ () +fateLte-antisym dropped dropped _ _ = refl +fateLte-antisym dropped falsified () _ +fateLte-antisym falsified present _ () +fateLte-antisym falsified (atten _) _ () +fateLte-antisym falsified predicated _ () +fateLte-antisym falsified dropped _ () +fateLte-antisym falsified falsified _ _ = refl + +fateLte-total : ∀ x y → fateLte x y ≡ true ⊎ fateLte y x ≡ true +fateLte-total falsified y = inj₁ refl +fateLte-total present present = inj₁ refl +fateLte-total present (atten _) = inj₂ refl +fateLte-total present predicated = inj₂ refl +fateLte-total present dropped = inj₂ refl +fateLte-total present falsified = inj₂ refl +fateLte-total (atten a) present = inj₁ refl +fateLte-total (atten a) (atten b) = dLte-total a b +fateLte-total (atten a) predicated = inj₂ refl +fateLte-total (atten a) dropped = inj₂ refl +fateLte-total (atten a) falsified = inj₂ refl +fateLte-total predicated present = inj₁ refl +fateLte-total predicated (atten _) = inj₁ refl +fateLte-total predicated predicated = inj₁ refl +fateLte-total predicated dropped = inj₂ refl +fateLte-total predicated falsified = inj₂ refl +fateLte-total dropped present = inj₁ refl +fateLte-total dropped (atten _) = inj₁ refl +fateLte-total dropped predicated = inj₁ refl +fateLte-total dropped dropped = inj₁ refl +fateLte-total dropped falsified = inj₂ refl + +-- The relations as Set-valued orders, for the standard-library structures. +infix 4 _≤Δ_ _≤F_ +_≤Δ_ : Δ → Δ → Set +a ≤Δ b = dLte a b ≡ true + +_≤F_ : Fate → Fate → Set +x ≤F y = fateLte x y ≡ true + +dLte-isTotalOrder : IsTotalOrder _≡_ _≤Δ_ +dLte-isTotalOrder = record + { isPartialOrder = record + { isPreorder = record + { isEquivalence = isEquivalence + ; reflexive = λ {a} {b} eq → subst (λ b′ → dLte a b′ ≡ true) eq (dLte-refl a) + ; trans = λ {a} {b} {c} → dLte-trans a b c + } + ; antisym = λ {a} {b} → dLte-antisym a b + } + ; total = dLte-total + } + +-- A2-chain, as one statement: Fate is a chain (a total order). +fate-isTotalOrder : IsTotalOrder _≡_ _≤F_ +fate-isTotalOrder = record + { isPartialOrder = record + { isPreorder = record + { isEquivalence = isEquivalence + ; reflexive = λ {x} {y} eq → subst (λ y′ → fateLte x y′ ≡ true) eq (fateLte-refl x) + ; trans = λ {x} {y} {z} → fateLte-trans x y z + } + ; antisym = λ {x} {y} → fateLte-antisym x y + } + ; total = fateLte-total + } + +-------------------------------------------------------------------------------- +-- Bond and merge: chains too (Misbound ⊏ Severed ⊏ Withheld ⊏ Intact; +-- Conflated ⊏ Fused ⊏ Single). Transitivity is what ⊑-trans needs. +-------------------------------------------------------------------------------- + +bondLte-trans : ∀ x y z → bondLte x y ≡ true → bondLte y z ≡ true → bondLte x z ≡ true +bondLte-trans misbound y z _ _ = refl +bondLte-trans severed y intact _ _ = refl +bondLte-trans severed y withheld _ _ = refl +bondLte-trans severed y severed _ _ = refl +bondLte-trans severed intact misbound _ () +bondLte-trans severed withheld misbound _ () +bondLte-trans severed severed misbound _ () +bondLte-trans severed misbound misbound () _ +bondLte-trans withheld y intact _ _ = refl +bondLte-trans withheld y withheld _ _ = refl +bondLte-trans withheld intact severed _ () +bondLte-trans withheld withheld severed _ () +bondLte-trans withheld severed severed () _ +bondLte-trans withheld misbound severed () _ +bondLte-trans withheld intact misbound _ () +bondLte-trans withheld withheld misbound _ () +bondLte-trans withheld severed misbound () _ +bondLte-trans withheld misbound misbound () _ +bondLte-trans intact y intact _ _ = refl +bondLte-trans intact intact withheld _ () +bondLte-trans intact intact severed _ () +bondLte-trans intact intact misbound _ () +bondLte-trans intact withheld z () _ +bondLte-trans intact severed z () _ +bondLte-trans intact misbound z () _ + +mergeLte-trans : ∀ x y z → mergeLte x y ≡ true → mergeLte y z ≡ true → mergeLte x z ≡ true +mergeLte-trans conflated y z _ _ = refl +mergeLte-trans fused y single _ _ = refl +mergeLte-trans fused y fused _ _ = refl +mergeLte-trans fused single conflated _ () +mergeLte-trans fused fused conflated _ () +mergeLte-trans fused conflated conflated () _ +mergeLte-trans single y single _ _ = refl +mergeLte-trans single single fused _ () +mergeLte-trans single single conflated _ () +mergeLte-trans single fused z () _ +mergeLte-trans single conflated z () _ + +-------------------------------------------------------------------------------- +-- retention-order. ⊑ is the componentwise product of the six coordinate +-- orders; a Boolean conjunction of six tests, taken apart and put back. +-------------------------------------------------------------------------------- + +∧⁶-elim : ∀ a b c d e f → (a ∧ b ∧ c ∧ d ∧ e ∧ f) ≡ true → + a ≡ true × b ≡ true × c ≡ true × d ≡ true × e ≡ true × f ≡ true +∧⁶-elim true true true true true f p = refl , refl , refl , refl , refl , p +∧⁶-elim true true true true false f () +∧⁶-elim true true true false e f () +∧⁶-elim true true false d e f () +∧⁶-elim true false c d e f () +∧⁶-elim false b c d e f () + +∧⁶-intro : ∀ a b c d e f → a ≡ true → b ≡ true → c ≡ true → d ≡ true → + e ≡ true → f ≡ true → (a ∧ b ∧ c ∧ d ∧ e ∧ f) ≡ true +∧⁶-intro true true true true true f _ _ _ _ _ pf = pf +∧⁶-intro true true true true false f _ _ _ _ () _ +∧⁶-intro true true true false e f _ _ _ () _ _ +∧⁶-intro true true false d e f _ _ () _ _ _ +∧⁶-intro true false c d e f _ () _ _ _ _ +∧⁶-intro false b c d e f () _ _ _ _ _ + +⊑-trans : ∀ g h k → g ⊑ h → h ⊑ k → g ⊑ k +⊑-trans (mkGrade q₁ b₁ c₁ r₁ bo₁ m₁) (mkGrade q₂ b₂ c₂ r₂ bo₂ m₂) (mkGrade q₃ b₃ c₃ r₃ bo₃ m₃) p p′ + with ∧⁶-elim _ _ _ _ _ _ p | ∧⁶-elim _ _ _ _ _ _ p′ +... | pq , pb , pc , pr , pbo , pm | pq′ , pb′ , pc′ , pr′ , pbo′ , pm′ = + ∧⁶-intro _ _ _ _ _ _ + (fateLte-trans q₁ q₂ q₃ pq pq′) + (fateLte-trans b₁ b₂ b₃ pb pb′) + (fateLte-trans c₁ c₂ c₃ pc pc′) + (fateLte-trans r₁ r₂ r₃ pr pr′) + (bondLte-trans bo₁ bo₂ bo₃ pbo pbo′) + (mergeLte-trans m₁ m₂ m₃ pm pm′) + +-- ⊑ is decided by its own Boolean: gradeLte g h is computed, then compared. +⊑-dec : ∀ g h → Dec (g ⊑ h) +⊑-dec g h = gradeLte g h ≟ᵇ true + +⊑-isPreorder : IsPreorder _≡_ _⊑_ +⊑-isPreorder = record + { isEquivalence = isEquivalence + ; reflexive = λ {g} {h} eq → subst (λ h′ → g ⊑ h′) eq (⊑-refl g) + ; trans = λ {g} {h} {k} → ⊑-trans g h k + } diff --git a/verification/proofs/lean4/ratified-order/RatifiedOrder.lean b/verification/proofs/lean4/ratified-order/RatifiedOrder.lean new file mode 100644 index 0000000..731edd3 --- /dev/null +++ b/verification/proofs/lean4/ratified-order/RatifiedOrder.lean @@ -0,0 +1,567 @@ +/- +SPDX-FileCopyrightText: © 2026 Jonathan D.A. Jewell (hyperpolymath) +SPDX-License-Identifier: MPL-2.0 + +Lean recheck leg, route re-proved, for the ratified-carrier order laws and +L4 (monotonicity) in full. Source of truth: the Agda modules +verification/proofs/agda/theorem-b/TB/{Grade,Order,OrderLaws,Monotone}.agda. + +Only Lean core is used: no `import`, no Mathlib (PROOF-POLICY §2). Unlike the +grade-boundary and grade-factorisation packages, which import Mathlib and stay +BRIDGE-PENDING, this file is meant to count as a recheck leg. + +Every Agda definition used is restated with the same constructors and clauses, +and every theorem with the same hypotheses and conclusion; each is proved +again by hand. No `simp`, `omega`, `decide` or `ac_rfl`: proofs are `cases`, +`rfl`, `rw`, `nomatch` and term application, so that no theorem depends on an axiom +(`#print axioms` at the foot of this file; CI audits every theorem). + +Encoding differences, all of them notation: +- Agda's ℕ, Bool, _∧_ and _≡_ are Nat, Bool, `&&` and `=`. Lean's `&&` is + left-associative and Agda's `_∧_` right-associative, so every conjunction + below is parenthesised right-nested, as in the Agda. +- Agda's `_⊎_` is `Or`: both disjuncts are propositions here. +- Agda's infix operators are named functions: `_⊕d_` is `dplus`, `_▷f_` + `fcomp`, `_▷b_` `bcomp`, `_▷m_` `mcomp`, `_▷_` `gcomp`, `_⊑_` `gle`. + Hyphens become underscores. +- `IsTotalOrder` is unfolded into its four laws (reflexive, transitive, + antisymmetric, total), which is what the standard-library record carries. +-/ + +namespace TropeRatified + +/-! ## The carrier (TB.Grade) -/ + +inductive Delta where + | Q (n : Nat) + | total + | unknown + +open Delta + +def dplus : Delta → Delta → Delta + | unknown, _ => unknown + | total, unknown => unknown + | total, total => total + | total, Q _ => total + | Q _, unknown => unknown + | Q _, total => total + | Q a, Q b => Q (a + b) + +inductive Fate where + | present + | atten (d : Delta) + | predicated + | dropped + | falsified + +open Fate + +def fcomp : Fate → Fate → Fate + | falsified, _ => falsified + | dropped, falsified => falsified + | dropped, present => dropped + | dropped, atten _ => dropped + | dropped, predicated => dropped + | dropped, dropped => dropped + | present, f => f + | atten _, falsified => falsified + | atten _, dropped => dropped + | atten d, present => atten d + | atten d, atten e => atten (dplus d e) + | atten _, predicated => predicated + | predicated, falsified => falsified + | predicated, dropped => dropped + | predicated, present => predicated + | predicated, atten _ => predicated + | predicated, predicated => predicated + +inductive Bond where + | intact + | withheld + | severed + | misbound + +open Bond + +def bcomp : Bond → Bond → Bond + | intact, b => b + | withheld, intact => withheld + | withheld, withheld => withheld + | withheld, severed => severed + | withheld, misbound => misbound + | severed, intact => severed + | severed, withheld => severed + | severed, severed => severed + | severed, misbound => misbound + | misbound, _ => misbound + +inductive Merge where + | single + | fused + | conflated + +open Merge + +def mcomp : Merge → Merge → Merge + | single, m => m + | fused, single => fused + | fused, fused => fused + | fused, conflated => conflated + | conflated, _ => conflated + +structure Grade where + mkGrade :: + fQuality : Fate + fBearer : Fate + fContext : Fate + fRecord : Fate + gBond : Bond + gMerge : Merge + +def gcomp (g h : Grade) : Grade := + ⟨fcomp g.fQuality h.fQuality, fcomp g.fBearer h.fBearer, + fcomp g.fContext h.fContext, fcomp g.fRecord h.fRecord, + bcomp g.gBond h.gBond, mcomp g.gMerge h.gMerge⟩ + +/-! ## The retention order (TB.Order) -/ + +def lteb : Nat → Nat → Bool + | 0, _ => true + | _ + 1, 0 => false + | m + 1, n + 1 => lteb m n + +def dLte : Delta → Delta → Bool + | unknown, _ => true + | Q a, Q b => lteb b a + | Q _, total => false + | Q _, unknown => false + | total, Q _ => true + | total, total => true + | total, unknown => false + +def fateLte : Fate → Fate → Bool + | falsified, _ => true + | present, present => true + | present, atten _ => false + | present, predicated => false + | present, dropped => false + | present, falsified => false + | atten _, present => true + | atten a, atten b => dLte a b + | atten _, predicated => false + | atten _, dropped => false + | atten _, falsified => false + | predicated, present => true + | predicated, atten _ => true + | predicated, predicated => true + | predicated, dropped => false + | predicated, falsified => false + | dropped, present => true + | dropped, atten _ => true + | dropped, predicated => true + | dropped, dropped => true + | dropped, falsified => false + +def bondLte : Bond → Bond → Bool + | intact, intact => true + | intact, withheld => false + | intact, severed => false + | intact, misbound => false + | withheld, intact => true + | withheld, withheld => true + | withheld, severed => false + | withheld, misbound => false + | severed, intact => true + | severed, withheld => true + | severed, severed => true + | severed, misbound => false + | misbound, _ => true + +def mergeLte : Merge → Merge → Bool + | single, single => true + | single, fused => false + | single, conflated => false + | fused, single => true + | fused, fused => true + | fused, conflated => false + | conflated, _ => true + +def gradeLte (g h : Grade) : Bool := + fateLte g.fQuality h.fQuality && (fateLte g.fBearer h.fBearer && + (fateLte g.fContext h.fContext && (fateLte g.fRecord h.fRecord && + (bondLte g.gBond h.gBond && mergeLte g.gMerge h.gMerge)))) + +def gle (g h : Grade) : Prop := gradeLte g h = true + +/-! ## Reflexivity (TB.Order) -/ + +theorem lteb_refl : ∀ n, lteb n n = true + | 0 => rfl + | n + 1 => lteb_refl n + +theorem dLte_refl : ∀ d, dLte d d = true + | Q n => lteb_refl n + | total => rfl + | unknown => rfl + +theorem fateLte_refl : ∀ f, fateLte f f = true + | present => rfl + | atten d => dLte_refl d + | predicated => rfl + | dropped => rfl + | falsified => rfl + +theorem bondLte_refl : ∀ b, bondLte b b = true := by + intro b; cases b <;> rfl + +theorem mergeLte_refl : ∀ m, mergeLte m m = true := by + intro m; cases m <;> rfl + +/-! ## Six-way conjunctions, taken apart and put back -/ + +theorem and6_elim : ∀ a b c d e f : Bool, + (a && (b && (c && (d && (e && f))))) = true → + a = true ∧ b = true ∧ c = true ∧ d = true ∧ e = true ∧ f = true + | true, true, true, true, true, _, p => ⟨rfl, rfl, rfl, rfl, rfl, p⟩ + | true, true, true, true, false, _, p => nomatch p + | true, true, true, false, _, _, p => nomatch p + | true, true, false, _, _, _, p => nomatch p + | true, false, _, _, _, _, p => nomatch p + | false, _, _, _, _, _, p => nomatch p + +theorem and6_intro : ∀ a b c d e f : Bool, + a = true → b = true → c = true → d = true → e = true → f = true → + (a && (b && (c && (d && (e && f))))) = true + | _, _, _, _, _, _, rfl, rfl, rfl, rfl, rfl, rfl => rfl + +theorem gle_refl (g : Grade) : gle g g := + and6_intro _ _ _ _ _ _ (fateLte_refl _) (fateLte_refl _) (fateLte_refl _) + (fateLte_refl _) (bondLte_refl _) (mergeLte_refl _) + +/-! ## A2-directions (TB.Order) -/ + +theorem fateDroppedLtePredicated : fateLte dropped predicated = true := rfl + +theorem fatePredicatedNotLteDropped : fateLte predicated dropped = false := rfl + +/-! ## Order laws (TB.OrderLaws): lteb, dLte and fateLte are chains -/ + +theorem lteb_trans : ∀ a b c, lteb a b = true → lteb b c = true → lteb a c = true + | 0, _, _, _, _ => rfl + | _ + 1, 0, _, p, _ => nomatch p + | _ + 1, _ + 1, 0, _, q => nomatch q + | a + 1, b + 1, c + 1, p, q => lteb_trans a b c p q + +theorem lteb_antisym : ∀ a b, lteb a b = true → lteb b a = true → a = b + | 0, 0, _, _ => rfl + | 0, _ + 1, _, q => nomatch q + | _ + 1, 0, p, _ => nomatch p + | a + 1, b + 1, p, q => congrArg (· + 1) (lteb_antisym a b p q) + +theorem lteb_total : ∀ a b, lteb a b = true ∨ lteb b a = true + | 0, _ => Or.inl rfl + | _ + 1, 0 => Or.inr rfl + | a + 1, b + 1 => lteb_total a b + +theorem dLte_trans : ∀ a b c, dLte a b = true → dLte b c = true → dLte a c = true := by + intro a b c p q + cases a <;> cases b <;> cases c <;> + first | rfl | (cases p; done) | (cases q; done) + | exact lteb_trans _ _ _ q p + +theorem dLte_antisym : ∀ a b, dLte a b = true → dLte b a = true → a = b := by + intro a b p q + cases a <;> cases b <;> + first | rfl | (cases p; done) | (cases q; done) + | exact congrArg Delta.Q (lteb_antisym _ _ q p) + +theorem dLte_total : ∀ a b, dLte a b = true ∨ dLte b a = true := by + intro a b + cases a <;> cases b <;> + first | exact Or.inl rfl | exact Or.inr rfl | exact lteb_total _ _ + +theorem fateLte_trans : ∀ x y z, + fateLte x y = true → fateLte y z = true → fateLte x z = true := by + intro x y z p q + cases x <;> cases y <;> cases z <;> + first | rfl | (cases p; done) | (cases q; done) + | exact dLte_trans _ _ _ p q + +theorem fateLte_antisym : ∀ x y, + fateLte x y = true → fateLte y x = true → x = y := by + intro x y p q + cases x <;> cases y <;> + first | rfl | (cases p; done) | (cases q; done) + | exact congrArg Fate.atten (dLte_antisym _ _ p q) + +theorem fateLte_total : ∀ x y, fateLte x y = true ∨ fateLte y x = true := by + intro x y + cases x <;> cases y <;> + first | exact Or.inl rfl | exact Or.inr rfl | exact dLte_total _ _ + +/-- A2-chain as one statement: the four laws of a total order. -/ +theorem fate_isTotalOrder : + (∀ x, fateLte x x = true) ∧ + (∀ x y z, fateLte x y = true → fateLte y z = true → fateLte x z = true) ∧ + (∀ x y, fateLte x y = true → fateLte y x = true → x = y) ∧ + (∀ x y, fateLte x y = true ∨ fateLte y x = true) := + ⟨fateLte_refl, fateLte_trans, fateLte_antisym, fateLte_total⟩ + +theorem dLte_isTotalOrder : + (∀ a, dLte a a = true) ∧ + (∀ a b c, dLte a b = true → dLte b c = true → dLte a c = true) ∧ + (∀ a b, dLte a b = true → dLte b a = true → a = b) ∧ + (∀ a b, dLte a b = true ∨ dLte b a = true) := + ⟨dLte_refl, dLte_trans, dLte_antisym, dLte_total⟩ + +theorem bondLte_trans : ∀ x y z, + bondLte x y = true → bondLte y z = true → bondLte x z = true := by + intro x y z p q + cases x <;> cases y <;> cases z <;> + first | rfl | (cases p; done) | (cases q; done) + +theorem mergeLte_trans : ∀ x y z, + mergeLte x y = true → mergeLte y z = true → mergeLte x z = true := by + intro x y z p q + cases x <;> cases y <;> cases z <;> + first | rfl | (cases p; done) | (cases q; done) + +/-! ## retention-order (TB.OrderLaws): ⊑ is a decidable preorder -/ + +theorem gle_trans : ∀ g h k, gle g h → gle h k → gle g k := by + intro g h k p q + have ⟨pq, pb, pc, pr, pbo, pm⟩ := and6_elim _ _ _ _ _ _ p + have ⟨qq, qb, qc, qr, qbo, qm⟩ := and6_elim _ _ _ _ _ _ q + exact and6_intro _ _ _ _ _ _ + (fateLte_trans _ _ _ pq qq) (fateLte_trans _ _ _ pb qb) + (fateLte_trans _ _ _ pc qc) (fateLte_trans _ _ _ pr qr) + (bondLte_trans _ _ _ pbo qbo) (mergeLte_trans _ _ _ pm qm) + +/-- ⊑ is decided by its own Boolean (Agda `⊑-dec`). -/ +def gle_dec (g h : Grade) : Decidable (gle g h) := + match hb : gradeLte g h with + | true => isTrue hb + | false => isFalse (fun p => nomatch hb.symm.trans p) + +/-- The decision procedure is sound and complete for ⊑, as a theorem the +axiom audit inspects. -/ +theorem gle_decides (g h : Grade) : gle g h ∨ ¬ gle g h := + match hb : gradeLte g h with + | true => Or.inl hb + | false => Or.inr (fun p => nomatch hb.symm.trans p) + +/-! ## L4-fidelity (TB.Order): dplus is monotone in each argument -/ + +theorem lteb_suc_right : ∀ a b, lteb a b = true → lteb a (b + 1) = true + | 0, _, _ => rfl + | _ + 1, 0, p => nomatch p + | a + 1, b + 1, p => lteb_suc_right a b p + +theorem lteb_self_plus : ∀ m n, lteb m (m + n) = true + | 0, n => by rw [Nat.zero_add]; rfl + | m + 1, n => by rw [Nat.succ_add]; exact lteb_self_plus m n + +theorem lteb_plus_left : ∀ m n, lteb n (m + n) = true + | 0, n => by rw [Nat.zero_add]; exact lteb_refl n + | m + 1, n => by rw [Nat.succ_add]; exact lteb_suc_right n (m + n) (lteb_plus_left m n) + +theorem lteb_plus_monoL : ∀ c a b, lteb a b = true → lteb (c + a) (c + b) = true + | 0, a, b, p => by rw [Nat.zero_add, Nat.zero_add]; exact p + | c + 1, a, b, p => by rw [Nat.succ_add, Nat.succ_add]; exact lteb_plus_monoL c a b p + +theorem lteb_plus_monoR : ∀ a b c, lteb a b = true → lteb (a + c) (b + c) = true + | 0, b, c, _ => by rw [Nat.zero_add]; exact lteb_plus_left b c + | _ + 1, 0, _, p => nomatch p + | a + 1, b + 1, c, p => by + rw [Nat.succ_add, Nat.succ_add]; exact lteb_plus_monoR a b c p + +theorem dplusMonoR : ∀ c a b, dLte a b = true → dLte (dplus c a) (dplus c b) = true := by + intro c a b p + cases c <;> cases a <;> cases b <;> + first | rfl | (cases p; done) | exact lteb_plus_monoL _ _ _ p + +theorem dplusMonoL : ∀ a b c, dLte a b = true → dLte (dplus a c) (dplus b c) = true := by + intro a b c p + cases a <;> cases b <;> cases c <;> + first | rfl | (cases p; done) | exact lteb_plus_monoR _ _ _ p + +theorem dplusRetLteR : ∀ d a, dLte (dplus d a) d = true := by + intro d a + cases d <;> cases a <;> first | rfl | exact lteb_self_plus _ _ + +theorem dplusRetLteL : ∀ a e, dLte (dplus a e) e = true := by + intro a e + cases a <;> cases e <;> first | rfl | exact lteb_plus_left _ _ + +/-! ## L4-fate (TB.Order) -/ + +theorem fateL4MonoR : ∀ h x y, + fateLte x y = true → fateLte (fcomp h x) (fcomp h y) = true := by + intro h x y p + cases h <;> cases x <;> cases y <;> + first | rfl | exact p | (cases p; done) | exact dLte_refl _ + | exact dplusRetLteR _ _ | exact dplusMonoR _ _ _ p + +theorem fateL4MonoL : ∀ x y h, + fateLte x y = true → fateLte (fcomp x h) (fcomp y h) = true := by + intro x y h p + cases x <;> cases y <;> cases h <;> + first | rfl | exact p | (cases p; done) | exact dLte_refl _ + | exact dplusRetLteL _ _ | exact dplusMonoL _ _ _ p + +/-! ## L4-bond-merge (TB.Monotone) -/ + +theorem bondL4MonoR : ∀ h x y, + bondLte x y = true → bondLte (bcomp h x) (bcomp h y) = true := by + intro h x y p + cases h <;> cases x <;> cases y <;> first | rfl | (cases p; done) + +theorem bondL4MonoL : ∀ x y h, + bondLte x y = true → bondLte (bcomp x h) (bcomp y h) = true := by + intro x y h p + cases x <;> cases y <;> cases h <;> first | rfl | (cases p; done) + +theorem mergeL4MonoR : ∀ h x y, + mergeLte x y = true → mergeLte (mcomp h x) (mcomp h y) = true := by + intro h x y p + cases h <;> cases x <;> cases y <;> first | rfl | (cases p; done) + +theorem mergeL4MonoL : ∀ x y h, + mergeLte x y = true → mergeLte (mcomp x h) (mcomp y h) = true := by + intro x y h p + cases x <;> cases y <;> cases h <;> first | rfl | (cases p; done) + +/-! ## L4-lifting (TB.Monotone): gcomp is ⊑-monotone -/ + +theorem gradeL4MonoR : ∀ k g h, gle g h → gle (gcomp k g) (gcomp k h) := by + intro k g h p + have ⟨pq, pb, pc, pr, pbo, pm⟩ := and6_elim _ _ _ _ _ _ p + exact and6_intro _ _ _ _ _ _ + (fateL4MonoR _ _ _ pq) (fateL4MonoR _ _ _ pb) + (fateL4MonoR _ _ _ pc) (fateL4MonoR _ _ _ pr) + (bondL4MonoR _ _ _ pbo) (mergeL4MonoR _ _ _ pm) + +theorem gradeL4MonoL : ∀ g h k, gle g h → gle (gcomp g k) (gcomp h k) := by + intro g h k p + have ⟨pq, pb, pc, pr, pbo, pm⟩ := and6_elim _ _ _ _ _ _ p + exact and6_intro _ _ _ _ _ _ + (fateL4MonoL _ _ _ pq) (fateL4MonoL _ _ _ pb) + (fateL4MonoL _ _ _ pc) (fateL4MonoL _ _ _ pr) + (bondL4MonoL _ _ _ pbo) (mergeL4MonoL _ _ _ pm) + +/-- Both arguments at once (Agda `▷-mono`). -/ +theorem gcomp_mono : ∀ g₁ g₂ h₁ h₂, + gle g₁ g₂ → gle h₁ h₂ → gle (gcomp g₁ h₁) (gcomp g₂ h₂) := + fun g₁ g₂ h₁ h₂ p q => + gle_trans _ _ _ (gradeL4MonoL g₁ g₂ h₁ p) (gradeL4MonoR g₂ h₁ h₂ q) + +/-! ## Definition bridge (TB.Bridge) + +The same six literals as the Agda and the Rocq: if this file's restatement of +any of the six definitions disagrees with the Agda at a sample point, the +matching bridge theorem fails. Bond and Merge are covered exhaustively; Fate +on nine points, top to bottom. Codes as in TB/Bridge.agda. -/ + +def b2n : Bool → Nat + | true => 1 + | false => 0 + +def fcode : Fate → Nat + | present => 0 + | atten (Q n) => 10 + n + | atten total => 1 + | atten unknown => 2 + | predicated => 3 + | dropped => 4 + | falsified => 5 + +def bcode : Bond → Nat + | intact => 0 + | withheld => 1 + | severed => 2 + | misbound => 3 + +def mcode : Merge → Nat + | single => 0 + | fused => 1 + | conflated => 2 + +def sampleF : List Fate := + [present, atten (Q 0), atten (Q 2), atten (Q 5), atten total, + atten unknown, predicated, dropped, falsified] + +def sampleB : List Bond := [intact, withheld, severed, misbound] + +def sampleM : List Merge := [single, fused, conflated] + +def lmap {α β : Type} (f : α → β) : List α → List β + | [] => [] + | x :: t => f x :: lmap f t + +def lappend {α : Type} : List α → List α → List α + | [], ys => ys + | x :: t, ys => x :: lappend t ys + +def lconcatMap {α β : Type} (f : α → List β) : List α → List β + | [] => [] + | x :: t => lappend (f x) (lconcatMap f t) + +def tbl {α : Type} (f : α → α → Nat) (xs : List α) : List Nat := + lconcatMap (fun x => lmap (f x) xs) xs + +def fateLteTable_literal : List Nat := + [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, + 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1] + +def fcompTable_literal : List Nat := + [0, 10, 12, 15, 1, 2, 3, 4, 5, 10, 10, 12, 15, 1, 2, 3, 4, 5, 12, 12, + 14, 17, 1, 2, 3, 4, 5, 15, 15, 17, 20, 1, 2, 3, 4, 5, 1, 1, 1, 1, 1, + 2, 3, 4, 5, 2, 2, 2, 2, 2, 2, 3, 4, 5, 3, 3, 3, 3, 3, 3, 3, 4, 5, 4, + 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5] + +def bondLteTable_literal : List Nat := + [1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1] + +def bcompTable_literal : List Nat := + [0, 1, 2, 3, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3] + +def mergeLteTable_literal : List Nat := + [1, 0, 0, 1, 1, 0, 1, 1, 1] + +def mcompTable_literal : List Nat := + [0, 1, 2, 1, 1, 2, 2, 2, 2] + +theorem bridge_fateLte : tbl (fun x y => b2n (fateLte x y)) sampleF = fateLteTable_literal := rfl + +theorem bridge_fcomp : tbl (fun x y => fcode (fcomp x y)) sampleF = fcompTable_literal := rfl + +theorem bridge_bondLte : tbl (fun x y => b2n (bondLte x y)) sampleB = bondLteTable_literal := rfl + +theorem bridge_bcomp : tbl (fun x y => bcode (bcomp x y)) sampleB = bcompTable_literal := rfl + +theorem bridge_mergeLte : tbl (fun x y => b2n (mergeLte x y)) sampleM = mergeLteTable_literal := rfl + +theorem bridge_mcomp : tbl (fun x y => mcode (mcomp x y)) sampleM = mcompTable_literal := rfl + +end TropeRatified + +/-! ## Axiom report (the CI audit re-derives this for every theorem) -/ + +#print axioms TropeRatified.fate_isTotalOrder +#print axioms TropeRatified.gle_trans +#print axioms TropeRatified.gle_decides +#print axioms TropeRatified.fateL4MonoR +#print axioms TropeRatified.fateL4MonoL +#print axioms TropeRatified.dplusMonoR +#print axioms TropeRatified.dplusMonoL +#print axioms TropeRatified.bondL4MonoR +#print axioms TropeRatified.bondL4MonoL +#print axioms TropeRatified.mergeL4MonoR +#print axioms TropeRatified.mergeL4MonoL +#print axioms TropeRatified.gradeL4MonoR +#print axioms TropeRatified.gradeL4MonoL +#print axioms TropeRatified.gcomp_mono +#print axioms TropeRatified.bridge_fcomp diff --git a/verification/proofs/lean4/ratified-order/lean-toolchain b/verification/proofs/lean4/ratified-order/lean-toolchain new file mode 100644 index 0000000..2586f88 --- /dev/null +++ b/verification/proofs/lean4/ratified-order/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.16.0 diff --git a/verification/proofs/rocq/RatifiedOrder.v b/verification/proofs/rocq/RatifiedOrder.v new file mode 100644 index 0000000..9ba2744 --- /dev/null +++ b/verification/proofs/rocq/RatifiedOrder.v @@ -0,0 +1,592 @@ +(* SPDX-FileCopyrightText: © 2026 Jonathan D.A. Jewell (hyperpolymath) + SPDX-License-Identifier: MPL-2.0 + + Rocq recheck leg, route re-proved, for the ratified-carrier order laws and + L4 (monotonicity) in full. Source of truth: the Agda modules + verification/proofs/agda/theorem-b/TB/{Grade,Order,OrderLaws,Monotone}.agda. + + This file restates every Agda definition it uses with the same + constructors and clauses, and states every theorem with the same + hypotheses and conclusion; then proves each again by hand. It imports + nothing: no standard-library module, no axiom. docs/status/PROOF-STATUS.adoc + records the statement correspondence (PROOF-POLICY 2.2). + + Encoding differences, all of them notation: + - Agda's ℕ is nat; Agda's Bool, true, false, _∧_ are bool, true, false, + andb. Agda's _∧_ is infixr, so every conjunction below is written + right-nested with explicit parentheses. + - Agda's _≡_ is eq; Agda's _⊎_ is sumbool-free `or`, since both disjuncts + are propositions here. + - Agda's infix operators are named functions: _⊕d_ is dplus, _▷f_ fcomp, + _▷b_ bcomp, _▷m_ mcomp, _▷_ gcomp, _⊑_ gle. Hyphens become underscores. + - IsTotalOrder is unfolded into its four laws (refl, trans, antisym, + total), which is what the standard-library record carries. *) + +(* ------------------------------------------------------------------ *) +(* The carrier (TB.Grade). *) +(* ------------------------------------------------------------------ *) + +Inductive Delta : Set := Q (n : nat) | total | unknown. + +Definition dplus (a b : Delta) : Delta := + match a, b with + | unknown, _ => unknown + | total, unknown => unknown + | total, total => total + | total, Q _ => total + | Q _, unknown => unknown + | Q _, total => total + | Q x, Q y => Q (x + y) + end. + +Inductive Fate : Set := present | atten (d : Delta) | predicated | dropped | falsified. + +Definition fcomp (f g : Fate) : Fate := + match f, g with + | falsified, _ => falsified + | dropped, falsified => falsified + | dropped, present => dropped + | dropped, atten _ => dropped + | dropped, predicated => dropped + | dropped, dropped => dropped + | present, h => h + | atten _, falsified => falsified + | atten _, dropped => dropped + | atten d, present => atten d + | atten d, atten e => atten (dplus d e) + | atten _, predicated => predicated + | predicated, falsified => falsified + | predicated, dropped => dropped + | predicated, present => predicated + | predicated, atten _ => predicated + | predicated, predicated => predicated + end. + +Inductive Bond : Set := intact | withheld | severed | misbound. + +Definition bcomp (a b : Bond) : Bond := + match a, b with + | intact, c => c + | withheld, intact => withheld + | withheld, withheld => withheld + | withheld, severed => severed + | withheld, misbound => misbound + | severed, intact => severed + | severed, withheld => severed + | severed, severed => severed + | severed, misbound => misbound + | misbound, _ => misbound + end. + +Inductive Merge : Set := single | fused | conflated. + +Definition mcomp (a b : Merge) : Merge := + match a, b with + | single, m => m + | fused, single => fused + | fused, fused => fused + | fused, conflated => conflated + | conflated, _ => conflated + end. + +Record Grade : Set := mkGrade + { fQuality : Fate; fBearer : Fate; fContext : Fate; fRecord : Fate; + gBond : Bond; gMerge : Merge }. + +Definition gcomp (g h : Grade) : Grade := + mkGrade (fcomp (fQuality g) (fQuality h)) (fcomp (fBearer g) (fBearer h)) + (fcomp (fContext g) (fContext h)) (fcomp (fRecord g) (fRecord h)) + (bcomp (gBond g) (gBond h)) (mcomp (gMerge g) (gMerge h)). + +(* ------------------------------------------------------------------ *) +(* The retention order (TB.Order). *) +(* ------------------------------------------------------------------ *) + +Fixpoint lteb (m n : nat) : bool := + match m, n with + | O, _ => true + | S _, O => false + | S a, S b => lteb a b + end. + +Definition dLte (a b : Delta) : bool := + match a, b with + | unknown, _ => true + | Q x, Q y => lteb y x + | Q _, total => false + | Q _, unknown => false + | total, Q _ => true + | total, total => true + | total, unknown => false + end. + +Definition fateLte (f g : Fate) : bool := + match f, g with + | falsified, _ => true + | present, present => true + | present, atten _ => false + | present, predicated => false + | present, dropped => false + | present, falsified => false + | atten _, present => true + | atten a, atten b => dLte a b + | atten _, predicated => false + | atten _, dropped => false + | atten _, falsified => false + | predicated, present => true + | predicated, atten _ => true + | predicated, predicated => true + | predicated, dropped => false + | predicated, falsified => false + | dropped, present => true + | dropped, atten _ => true + | dropped, predicated => true + | dropped, dropped => true + | dropped, falsified => false + end. + +Definition bondLte (a b : Bond) : bool := + match a, b with + | intact, intact => true + | intact, withheld => false + | intact, severed => false + | intact, misbound => false + | withheld, intact => true + | withheld, withheld => true + | withheld, severed => false + | withheld, misbound => false + | severed, intact => true + | severed, withheld => true + | severed, severed => true + | severed, misbound => false + | misbound, _ => true + end. + +Definition mergeLte (a b : Merge) : bool := + match a, b with + | single, single => true + | single, fused => false + | single, conflated => false + | fused, single => true + | fused, fused => true + | fused, conflated => false + | conflated, _ => true + end. + +Definition gradeLte (g h : Grade) : bool := + andb (fateLte (fQuality g) (fQuality h)) + (andb (fateLte (fBearer g) (fBearer h)) + (andb (fateLte (fContext g) (fContext h)) + (andb (fateLte (fRecord g) (fRecord h)) + (andb (bondLte (gBond g) (gBond h)) + (mergeLte (gMerge g) (gMerge h)))))). + +Definition gle (g h : Grade) : Prop := gradeLte g h = true. + +(* ------------------------------------------------------------------ *) +(* Reflexivity (TB.Order). *) +(* ------------------------------------------------------------------ *) + +Lemma lteb_refl : forall n, lteb n n = true. +Proof. induction n as [|n IH]; simpl; [reflexivity | exact IH]. Qed. + +Lemma dLte_refl : forall d, dLte d d = true. +Proof. intros [n| |]; simpl; [apply lteb_refl | reflexivity | reflexivity]. Qed. + +Lemma fateLte_refl : forall f, fateLte f f = true. +Proof. intros [|d| | |]; simpl; try reflexivity; apply dLte_refl. Qed. + +Lemma bondLte_refl : forall b, bondLte b b = true. +Proof. intros []; reflexivity. Qed. + +Lemma mergeLte_refl : forall m, mergeLte m m = true. +Proof. intros []; reflexivity. Qed. + +Lemma gle_refl : forall g, gle g g. +Proof. + intros [q b c r bo m]; unfold gle, gradeLte; simpl. + rewrite fateLte_refl, fateLte_refl, fateLte_refl, fateLte_refl, + bondLte_refl, mergeLte_refl; reflexivity. +Qed. + +(* ------------------------------------------------------------------ *) +(* A2-directions (TB.Order). *) +(* ------------------------------------------------------------------ *) + +Theorem fateDroppedLtePredicated : fateLte dropped predicated = true. +Proof. reflexivity. Qed. + +Theorem fatePredicatedNotLteDropped : fateLte predicated dropped = false. +Proof. reflexivity. Qed. + +(* ------------------------------------------------------------------ *) +(* Order laws (TB.OrderLaws): lteb, dLte and fateLte are chains. *) +(* ------------------------------------------------------------------ *) + +Lemma lteb_trans : forall a b c, lteb a b = true -> lteb b c = true -> lteb a c = true. +Proof. + induction a as [|a IH]; intros [|b] [|c] p q; simpl in *; + try reflexivity; try discriminate. + exact (IH b c p q). +Qed. + +Lemma lteb_antisym : forall a b, lteb a b = true -> lteb b a = true -> a = b. +Proof. + induction a as [|a IH]; intros [|b] p q; simpl in *; + try reflexivity; try discriminate. + rewrite (IH b p q); reflexivity. +Qed. + +Lemma lteb_total : forall a b, lteb a b = true \/ lteb b a = true. +Proof. + induction a as [|a IH]; intros [|b]; simpl; + try (left; reflexivity); try (right; reflexivity). + exact (IH b). +Qed. + +Lemma dLte_trans : forall a b c, dLte a b = true -> dLte b c = true -> dLte a c = true. +Proof. + intros [x| |] [y| |] [z| |] p q; simpl in *; + try reflexivity; try discriminate. + exact (lteb_trans z y x q p). +Qed. + +Lemma dLte_antisym : forall a b, dLte a b = true -> dLte b a = true -> a = b. +Proof. + intros [x| |] [y| |] p q; simpl in *; + try reflexivity; try discriminate. + rewrite (lteb_antisym x y q p); reflexivity. +Qed. + +Lemma dLte_total : forall a b, dLte a b = true \/ dLte b a = true. +Proof. + intros [x| |] [y| |]; simpl; + try (left; reflexivity); try (right; reflexivity). + exact (lteb_total y x). +Qed. + +Theorem fateLte_trans : forall x y z, + fateLte x y = true -> fateLte y z = true -> fateLte x z = true. +Proof. + intros [|a| | |] [|b| | |] [|c| | |] p q; simpl in *; + try reflexivity; try discriminate. + exact (dLte_trans a b c p q). +Qed. + +Theorem fateLte_antisym : forall x y, + fateLte x y = true -> fateLte y x = true -> x = y. +Proof. + intros [|a| | |] [|b| | |] p q; simpl in *; + try reflexivity; try discriminate. + rewrite (dLte_antisym a b p q); reflexivity. +Qed. + +Theorem fateLte_total : forall x y, fateLte x y = true \/ fateLte y x = true. +Proof. + intros [|a| | |] [|b| | |]; simpl; + try (left; reflexivity); try (right; reflexivity). + exact (dLte_total a b). +Qed. + +(* A2-chain as one statement: the four laws of a total order. *) +Theorem fate_isTotalOrder : + (forall x, fateLte x x = true) /\ + (forall x y z, fateLte x y = true -> fateLte y z = true -> fateLte x z = true) /\ + (forall x y, fateLte x y = true -> fateLte y x = true -> x = y) /\ + (forall x y, fateLte x y = true \/ fateLte y x = true). +Proof. + exact (conj fateLte_refl (conj fateLte_trans (conj fateLte_antisym fateLte_total))). +Qed. + +Theorem dLte_isTotalOrder : + (forall a, dLte a a = true) /\ + (forall a b c, dLte a b = true -> dLte b c = true -> dLte a c = true) /\ + (forall a b, dLte a b = true -> dLte b a = true -> a = b) /\ + (forall a b, dLte a b = true \/ dLte b a = true). +Proof. + exact (conj dLte_refl (conj dLte_trans (conj dLte_antisym dLte_total))). +Qed. + +Lemma bondLte_trans : forall x y z, + bondLte x y = true -> bondLte y z = true -> bondLte x z = true. +Proof. intros [] [] [] p q; simpl in *; try reflexivity; try discriminate. Qed. + +Lemma mergeLte_trans : forall x y z, + mergeLte x y = true -> mergeLte y z = true -> mergeLte x z = true. +Proof. intros [] [] [] p q; simpl in *; try reflexivity; try discriminate. Qed. + +(* ------------------------------------------------------------------ *) +(* retention-order (TB.OrderLaws): ⊑ is a decidable preorder. *) +(* ------------------------------------------------------------------ *) + +Lemma andb_true6 : forall a b c d e f, + andb a (andb b (andb c (andb d (andb e f)))) = true -> + a = true /\ b = true /\ c = true /\ d = true /\ e = true /\ f = true. +Proof. + intros [] [] [] [] [] [] p; simpl in p; try discriminate; + repeat split; reflexivity. +Qed. + +Lemma andb_intro6 : forall a b c d e f, + a = true -> b = true -> c = true -> d = true -> e = true -> f = true -> + andb a (andb b (andb c (andb d (andb e f)))) = true. +Proof. + intros a b c d e f pa pb pc pd pe pf. + rewrite pa, pb, pc, pd, pe, pf; reflexivity. +Qed. + +Theorem gle_trans : forall g h k, gle g h -> gle h k -> gle g k. +Proof. + intros [q1 b1 c1 r1 bo1 m1] [q2 b2 c2 r2 bo2 m2] [q3 b3 c3 r3 bo3 m3] p p'; + unfold gle, gradeLte in *; simpl in *. + destruct (andb_true6 _ _ _ _ _ _ p) as [pq [pb [pc [pr [pbo pm]]]]]. + destruct (andb_true6 _ _ _ _ _ _ p') as [pq' [pb' [pc' [pr' [pbo' pm']]]]]. + apply andb_intro6. + - exact (fateLte_trans _ _ _ pq pq'). + - exact (fateLte_trans _ _ _ pb pb'). + - exact (fateLte_trans _ _ _ pc pc'). + - exact (fateLte_trans _ _ _ pr pr'). + - exact (bondLte_trans _ _ _ pbo pbo'). + - exact (mergeLte_trans _ _ _ pm pm'). +Qed. + +Theorem gle_dec : forall g h, {gle g h} + {~ gle g h}. +Proof. + intros g h; unfold gle; destruct (gradeLte g h). + - left; reflexivity. + - right; discriminate. +Defined. + +(* ------------------------------------------------------------------ *) +(* L4-fidelity (TB.Order): dplus is monotone in each argument. *) +(* ------------------------------------------------------------------ *) + +Lemma lteb_suc_right : forall a b, lteb a b = true -> lteb a (S b) = true. +Proof. + induction a as [|a IH]; intros [|b] p; simpl in *; + try reflexivity; try discriminate. + exact (IH b p). +Qed. + +Lemma lteb_self_plus : forall m n, lteb m (m + n) = true. +Proof. induction m as [|m IH]; intros n; simpl; [reflexivity | apply IH]. Qed. + +Lemma lteb_plus_left : forall m n, lteb n (m + n) = true. +Proof. + induction m as [|m IH]; intros n; simpl. + - apply lteb_refl. + - apply lteb_suc_right, IH. +Qed. + +Lemma lteb_plus_monoL : forall c a b, lteb a b = true -> lteb (c + a) (c + b) = true. +Proof. induction c as [|c IH]; intros a b p; simpl; [exact p | exact (IH a b p)]. Qed. + +Lemma lteb_plus_monoR : forall a b c, lteb a b = true -> lteb (a + c) (b + c) = true. +Proof. + induction a as [|a IH]; intros [|b] c p; simpl in *; try discriminate. + - apply lteb_refl. + - exact (lteb_plus_left (S b) c). + - exact (IH b c p). +Qed. + +Theorem dplusMonoR : forall c a b, dLte a b = true -> dLte (dplus c a) (dplus c b) = true. +Proof. + intros [m| |] [x| |] [y| |] p; simpl in *; try reflexivity; try discriminate. + exact (lteb_plus_monoL m y x p). +Qed. + +Theorem dplusMonoL : forall a b c, dLte a b = true -> dLte (dplus a c) (dplus b c) = true. +Proof. + intros [x| |] [y| |] [n| |] p; simpl in *; try reflexivity; try discriminate. + exact (lteb_plus_monoR y x n p). +Qed. + +Lemma dplusRetLteR : forall d a, dLte (dplus d a) d = true. +Proof. + intros [m| |] [n| |]; simpl; try reflexivity. + apply lteb_self_plus. +Qed. + +Lemma dplusRetLteL : forall a e, dLte (dplus a e) e = true. +Proof. + intros [m| |] [n| |]; simpl; try reflexivity. + apply lteb_plus_left. +Qed. + +(* ------------------------------------------------------------------ *) +(* L4-fate (TB.Order). *) +(* ------------------------------------------------------------------ *) + +Theorem fateL4MonoR : forall h x y, + fateLte x y = true -> fateLte (fcomp h x) (fcomp h y) = true. +Proof. + intros [|d| | |] [|a| | |] [|b| | |] p; simpl in *; + first [ reflexivity | discriminate | exact p | apply dLte_refl + | apply dplusRetLteR | exact (dplusMonoR d a b p) ]. +Qed. + +Theorem fateL4MonoL : forall x y h, + fateLte x y = true -> fateLte (fcomp x h) (fcomp y h) = true. +Proof. + intros [|a| | |] [|b| | |] [|e| | |] p; simpl in *; + first [ reflexivity | discriminate | exact p | apply dLte_refl + | apply dplusRetLteL | exact (dplusMonoL a b e p) ]. +Qed. + +(* ------------------------------------------------------------------ *) +(* L4-bond-merge (TB.Monotone). *) +(* ------------------------------------------------------------------ *) + +Theorem bondL4MonoR : forall h x y, + bondLte x y = true -> bondLte (bcomp h x) (bcomp h y) = true. +Proof. intros [] [] [] p; simpl in *; try reflexivity; try discriminate. Qed. + +Theorem bondL4MonoL : forall x y h, + bondLte x y = true -> bondLte (bcomp x h) (bcomp y h) = true. +Proof. intros [] [] [] p; simpl in *; try reflexivity; try discriminate. Qed. + +Theorem mergeL4MonoR : forall h x y, + mergeLte x y = true -> mergeLte (mcomp h x) (mcomp h y) = true. +Proof. intros [] [] [] p; simpl in *; try reflexivity; try discriminate. Qed. + +Theorem mergeL4MonoL : forall x y h, + mergeLte x y = true -> mergeLte (mcomp x h) (mcomp y h) = true. +Proof. intros [] [] [] p; simpl in *; try reflexivity; try discriminate. Qed. + +(* ------------------------------------------------------------------ *) +(* L4-lifting (TB.Monotone): gcomp is ⊑-monotone. *) +(* ------------------------------------------------------------------ *) + +Theorem gradeL4MonoR : forall k g h, gle g h -> gle (gcomp k g) (gcomp k h). +Proof. + intros [q b c r bo m] [q1 b1 c1 r1 bo1 m1] [q2 b2 c2 r2 bo2 m2] p; + unfold gle, gradeLte, gcomp in *; simpl in *. + destruct (andb_true6 _ _ _ _ _ _ p) as [pq [pb [pc [pr [pbo pm]]]]]. + apply andb_intro6. + - exact (fateL4MonoR q _ _ pq). + - exact (fateL4MonoR b _ _ pb). + - exact (fateL4MonoR c _ _ pc). + - exact (fateL4MonoR r _ _ pr). + - exact (bondL4MonoR bo _ _ pbo). + - exact (mergeL4MonoR m _ _ pm). +Qed. + +Theorem gradeL4MonoL : forall g h k, gle g h -> gle (gcomp g k) (gcomp h k). +Proof. + intros [q1 b1 c1 r1 bo1 m1] [q2 b2 c2 r2 bo2 m2] [q b c r bo m] p; + unfold gle, gradeLte, gcomp in *; simpl in *. + destruct (andb_true6 _ _ _ _ _ _ p) as [pq [pb [pc [pr [pbo pm]]]]]. + apply andb_intro6. + - exact (fateL4MonoL _ _ q pq). + - exact (fateL4MonoL _ _ b pb). + - exact (fateL4MonoL _ _ c pc). + - exact (fateL4MonoL _ _ r pr). + - exact (bondL4MonoL _ _ bo pbo). + - exact (mergeL4MonoL _ _ m pm). +Qed. + +Theorem gcomp_mono : forall g1 g2 h1 h2, + gle g1 g2 -> gle h1 h2 -> gle (gcomp g1 h1) (gcomp g2 h2). +Proof. + intros g1 g2 h1 h2 p q. + exact (gle_trans _ _ _ (gradeL4MonoL g1 g2 h1 p) (gradeL4MonoR g2 h1 h2 q)). +Qed. + +(* ------------------------------------------------------------------ *) +(* Definition bridge (TB.Bridge). The same six literals as the Agda *) +(* and the Lean: if this file's restatement of any of the six *) +(* definitions disagrees with the Agda at a sample point, the matching *) +(* bridge theorem fails. Bond and Merge are covered exhaustively; Fate *) +(* on nine points, top to bottom. Codes as in TB/Bridge.agda. *) +(* ------------------------------------------------------------------ *) + +Local Open Scope list_scope. + +Definition b2n (b : bool) : nat := match b with true => 1 | false => 0 end. + +Definition fcode (f : Fate) : nat := + match f with + | present => 0 + | atten (Q n) => 10 + n + | atten total => 1 + | atten unknown => 2 + | predicated => 3 + | dropped => 4 + | falsified => 5 + end. + +Definition bcode (b : Bond) : nat := + match b with intact => 0 | withheld => 1 | severed => 2 | misbound => 3 end. + +Definition mcode (m : Merge) : nat := + match m with single => 0 | fused => 1 | conflated => 2 end. + +Definition sampleF : list Fate := + present :: atten (Q 0) :: atten (Q 2) :: atten (Q 5) :: atten total + :: atten unknown :: predicated :: dropped :: falsified :: nil. + +Definition sampleB : list Bond := intact :: withheld :: severed :: misbound :: nil. + +Definition sampleM : list Merge := single :: fused :: conflated :: nil. + +Fixpoint lmap {A B : Type} (f : A -> B) (xs : list A) : list B := + match xs with nil => nil | x :: t => f x :: lmap f t end. + +Fixpoint lappend {A : Type} (xs ys : list A) : list A := + match xs with nil => ys | x :: t => x :: lappend t ys end. + +Fixpoint lconcatMap {A B : Type} (f : A -> list B) (xs : list A) : list B := + match xs with nil => nil | x :: t => lappend (f x) (lconcatMap f t) end. + +Definition tbl {A : Type} (f : A -> A -> nat) (xs : list A) : list nat := + lconcatMap (fun x => lmap (f x) xs) xs. + +Definition fateLteTable_literal : list nat := + 1 :: 0 :: 0 :: 0 :: 0 :: 0 :: 0 :: 0 :: 0 :: 1 :: 1 :: 0 :: 0 :: + 0 :: 0 :: 0 :: 0 :: 0 :: 1 :: 1 :: 1 :: 0 :: 0 :: 0 :: 0 :: 0 :: + 0 :: 1 :: 1 :: 1 :: 1 :: 0 :: 0 :: 0 :: 0 :: 0 :: 1 :: 1 :: 1 :: + 1 :: 1 :: 0 :: 0 :: 0 :: 0 :: 1 :: 1 :: 1 :: 1 :: 1 :: 1 :: 0 :: + 0 :: 0 :: 1 :: 1 :: 1 :: 1 :: 1 :: 1 :: 1 :: 0 :: 0 :: 1 :: 1 :: + 1 :: 1 :: 1 :: 1 :: 1 :: 1 :: 0 :: 1 :: 1 :: 1 :: 1 :: 1 :: 1 :: + 1 :: 1 :: 1 :: nil. + +Definition fcompTable_literal : list nat := + 0 :: 10 :: 12 :: 15 :: 1 :: 2 :: 3 :: 4 :: 5 :: 10 :: 10 :: 12 :: + 15 :: 1 :: 2 :: 3 :: 4 :: 5 :: 12 :: 12 :: 14 :: 17 :: 1 :: 2 :: + 3 :: 4 :: 5 :: 15 :: 15 :: 17 :: 20 :: 1 :: 2 :: 3 :: 4 :: 5 :: + 1 :: 1 :: 1 :: 1 :: 1 :: 2 :: 3 :: 4 :: 5 :: 2 :: 2 :: 2 :: 2 :: + 2 :: 2 :: 3 :: 4 :: 5 :: 3 :: 3 :: 3 :: 3 :: 3 :: 3 :: 3 :: 4 :: + 5 :: 4 :: 4 :: 4 :: 4 :: 4 :: 4 :: 4 :: 4 :: 5 :: 5 :: 5 :: 5 :: + 5 :: 5 :: 5 :: 5 :: 5 :: 5 :: nil. + +Definition bondLteTable_literal : list nat := + 1 :: 0 :: 0 :: 0 :: 1 :: 1 :: 0 :: 0 :: 1 :: 1 :: 1 :: 0 :: 1 :: + 1 :: 1 :: 1 :: nil. + +Definition bcompTable_literal : list nat := + 0 :: 1 :: 2 :: 3 :: 1 :: 1 :: 2 :: 3 :: 2 :: 2 :: 2 :: 3 :: 3 :: + 3 :: 3 :: 3 :: nil. + +Definition mergeLteTable_literal : list nat := + 1 :: 0 :: 0 :: 1 :: 1 :: 0 :: 1 :: 1 :: 1 :: nil. + +Definition mcompTable_literal : list nat := + 0 :: 1 :: 2 :: 1 :: 1 :: 2 :: 2 :: 2 :: 2 :: nil. + +Theorem bridge_fateLte : tbl (fun x y => b2n (fateLte x y)) sampleF = fateLteTable_literal. +Proof. reflexivity. Qed. + +Theorem bridge_fcomp : tbl (fun x y => fcode (fcomp x y)) sampleF = fcompTable_literal. +Proof. reflexivity. Qed. + +Theorem bridge_bondLte : tbl (fun x y => b2n (bondLte x y)) sampleB = bondLteTable_literal. +Proof. reflexivity. Qed. + +Theorem bridge_bcomp : tbl (fun x y => bcode (bcomp x y)) sampleB = bcompTable_literal. +Proof. reflexivity. Qed. + +Theorem bridge_mergeLte : tbl (fun x y => b2n (mergeLte x y)) sampleM = mergeLteTable_literal. +Proof. reflexivity. Qed. + +Theorem bridge_mcomp : tbl (fun x y => mcode (mcomp x y)) sampleM = mcompTable_literal. +Proof. reflexivity. Qed. diff --git a/verification/pwg.json b/verification/pwg.json index 2ca1fc8..6af3d7d 100644 --- a/verification/pwg.json +++ b/verification/pwg.json @@ -1 +1 @@ -{"commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","note":"Evidence ledger. The pwg field of each theorem is DERIVED from the legs and receipts below by scripts/pwg-derive.sh, never written by hand; scripts/pwg-check.sh re-derives and fails on drift (PROOF-POLICY 8.4 rule 2). Idris2 appears as a reference, not a leg: 8.1 excludes engineering provers from the ladder.","policy":{"commit":"9bdf864cc7f2c8e24b4df84bf00d04158eee3ad5","path":"3-practice/PROOF-POLICY.adoc","repo":"metadatastician/standards","section":"8"},"receipts":{"agda-c0eb4f1":{"axioms":[],"checker":"agda","checker_version":"2.7.0.1","commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/42623339243","import_cone":"root modules All.agda and Smoke.agda; all seven TB.* modules reachable from All.agda; postulate count 0 (--safe refuses postulate; independently scanned with hyperpolymath/mathesis scripts/census/proof-holes.sh over verification/proofs/agda at this commit, which emitted no record of any class)","inputs_digest":"git-tree verification/proofs/agda = 8d3370e7da58023b9bfa0802e710860105ace73a","invocation":"agda --safe --without-K --cubical-compatible All.agda ; agda --safe --without-K --cubical-compatible Smoke.agda","observed":"PASS: All.agda + Smoke.agda typecheck (--safe --without-K --cubical-compatible; --safe => postulate-free by construction)","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"agda-stdlib v2.0 sha256:14eecb83d62495f701e1eb03ffba59a2f767491f728a8ab8c8bb9243331399d8"},"lean-boundary-c0eb4f1":{"axioms":["propext","Quot.sound","Classical.choice"],"checker":"lean","checker_version":"4.16.0 (lake, leanchecker)","commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/42623339243","import_cone":"every module of grade-boundary sits in the import Mathlib cone via GradeBoundary.lean:3","inputs_digest":"git-tree verification/proofs/lean4 = 5f32026d26810845d94d42b5a1281da3c2a06146","invocation":"lake build --wfail ; leanchecker ; axiom audit against the allowlist {propext, Classical.choice, Quot.sound}","observed":"job 'Lean grade-boundary: lake build + sorry-free environment' success; 'Trope.GradeR.atom_factorization' depends on axioms: [propext]; 'Trope.nine_families' depends on axioms: [propext, Classical.choice, Quot.sound]","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"mathlib4 rev v4.16.0 (lakefile.toml) -- see the Mathlib note: PROOF-POLICY 2 forbids this dependency for a recheck leg"},"lean-factorisation-c0eb4f1":{"axioms":["propext","Quot.sound","Classical.choice"],"checker":"lean","checker_version":"4.16.0 (lake, leanchecker)","commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/42623339243","import_cone":"grade-factorisation requires gradeBoundary, so the import Mathlib cone covers it","inputs_digest":"git-tree verification/proofs/lean4 = 5f32026d26810845d94d42b5a1281da3c2a06146","invocation":"lake build --wfail ; leanchecker ; axiom audit against the allowlist {propext, Classical.choice, Quot.sound}","observed":"job 'Lean grade-factorisation: lake build + sorry-free environment' success","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"mathlib4 rev v4.16.0, transitively via the gradeBoundary path dependency"}},"repo":"hyperpolymath/trope-checker","schema_version":"1.0.0","theorems":[{"foundation_diverse_witness":null,"id":"L1","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.gmonoid-assoc"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.comp_assoc"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":["Trope.Laws.gradeAssoc","Trope.Coords.fateAssoc","Trope.Coords.bondAssoc","Trope.Coords.mergeAssoc","Trope.Fidelity.dplusAssoc"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L1 (associativity)"},{"foundation_diverse_witness":null,"id":"L2","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.gmonoid-unit"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":["Trope.Grade.gradeUnitL","Trope.Grade.gradeUnitR","Trope.Coords.fateUnitL","Trope.Fidelity.dplusZeroR"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L2 (unit)"},{"foundation_diverse_witness":null,"id":"L3","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.falsified-absorbL","TB.Grade.falsified-absorbR","TB.Grade.misbound-absorbL","TB.Grade.conflated-absorbL","TB.Grade.unknown-absorbL","TB.Grade.total-absorb-Q","TB.Tier.deceptive-absorbs-|>"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.falsified_two_sided_zero","GradeR.gBotR_two_sided_zero"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Agda states both sides only for Falsified. For Misbound, Conflated and Unknown the left form is stated; the right follows in one step from the coordinate's commutativity but is not itself a lemma.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"L3 (bottom absorption)"},{"foundation_diverse_witness":null,"id":"L4","kind":"theory","legs":{"agda":{"declarations":["TB.Order.fateL4MonoR","TB.Order.fateL4MonoL","TB.Order.dplusMonoR","TB.Order.dplusMonoL"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.comp_mono_right","FateA.comp_mono_left"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Coverage differs by prover. Agda covers the fate coordinate and the fidelity dimension; Lean covers fate only (FateA.le is defined on Fate alone). Bond and merge have an Idris2 restatement only, which 8.1 excludes from the ladder. Idris2 establishes coordinate-level monotonicity only; the grade-level lifting for gradeCompose that spec section 7's Knaster-Tarski argument invokes is not mechanised in Idris2. Bond, merge and the grade-level lifting have no gradeable theory leg.","reference":{"idris2":{"declarations":["Trope.Soundness.fateL4MonoR","Trope.Soundness.fateL4MonoL","Trope.Order.bondComposeMono","Trope.Order.mergeComposeMono"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L4 (monotonicity), in full"},{"foundation_diverse_witness":null,"id":"L5","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.deceptive-absorbs-|>","TB.Reduction.attenuate-stays-deceptive","TB.Reduction.project-stays-deceptive"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"L5 (deception infectiousness)"},{"foundation_diverse_witness":null,"id":"L6","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.grade-comm"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["GradeR.instCommMonoid","FateA.comp_comm"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"L6 ratification is still subject to the open owner ruling tracked on trope-checker issue 106.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"L6 (commutativity)"},{"foundation_diverse_witness":null,"id":"retention-order","kind":"theory","legs":{"agda":{"declarations":["TB.Order.|=-refl"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Agda proves reflexivity only. Transitivity and decidability exist in the Idris2 reference, which 8.1 excludes from the ladder, so the preorder claim has no complete theory leg. The Agda leg is OPEN, not PROVEN, for this obligation.","reference":{"idris2":{"declarations":["Trope.Laws.decGradeLte","Trope.Soundness.gradeLteTrans","Trope.Coords.fateLteRefl","Trope.Coords.bondLteRefl","Trope.Coords.mergeLteRefl","Trope.Fidelity.dLteRefl"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Retention order is a decidable preorder"},{"foundation_diverse_witness":null,"id":"A2-chain","kind":"theory","legs":{"agda":{"declarations":["TB.Order.fateDroppedLtePredicated","TB.Order.fatePredicatedNotLteDropped"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.le_total","FateA.le_refl"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"What is proved is the two directional facts of A2. Totality is stated in Lean (FateA.le_total); transitivity and antisymmetry are not mechanised in any prover, so 'chain' is stronger than the mechanised content.","reference":{"idris2":{"declarations":["Trope.Soundness.fateDroppedLtePredicated","Trope.Soundness.fatePredicatedNotLteDropped"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Fate is a chain (A2)"},{"foundation_diverse_witness":null,"id":"veridicality-derivation","kind":"theory","legs":{"agda":{"declarations":["TB.Honest.fate-deceptive-unique","TB.Honest.bond-deceptive-unique","TB.Honest.merge-deceptive-unique"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The 'exactly three' half rests on the three uniqueness lemmas plus the construction of Grade; Trope.Veridicality.deceptiveDuals is a tuple value and states no proposition, so it is not cited as evidence here.","reference":{"idris2":{"declarations":["Trope.Veridicality.fateDeceptiveUnique","Trope.Veridicality.bondDeceptiveUnique","Trope.Veridicality.mergeDeceptiveUnique"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Veridicality Derivation"},{"foundation_diverse_witness":null,"id":"honest-generation","kind":"theory","legs":{"agda":{"declarations":["TB.Honest.genFate","TB.Honest.genBond","TB.Honest.genMerge","TB.Honest.honest-closed-|>"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":["Trope.Generation.genFate","Trope.Generation.genBond","Trope.Generation.genMerge"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Honest Generation"},{"foundation_diverse_witness":null,"id":"hc4-coherence","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Idris2 only. No Agda source, so ungraded under 8.1 however sound the Idris2 proof is.","reference":{"idris2":{"declarations":["Trope.Veridicality.epsilonHonest","Trope.Grade.epsilonCoherent"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"The unit is non-deceptive and HC-4-coherent"},{"foundation_diverse_witness":null,"id":"C1","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.grade-conical"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["GradeR.conical","FateA.conical"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"C1 (conicality)"},{"foundation_diverse_witness":null,"id":"C2","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.Q-cancel-r","TB.Tier.core-closed-|>"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["GradeR.gradeR_leftCancel_iff","GradeR.gradeR_not_leftCancel","GradeR.gDroppedR_not_cancel","FateA.atten_cancel_on_normalForms"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The normal-form half is proved on the fate coordinate only (FateA.atten_cancel_on_normalForms); there is no grade-level normal-form cancellation theorem. Amendment (A3) is not modelled in the Agda, whose carrier is the unnormalised one.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"C2 (the cancellation boundary)"},{"foundation_diverse_witness":null,"id":"tier2-membership","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.unknown-not-cancel","TB.Tier.total-honest-not-cancel","TB.Tier.falsified-not-cancel","TB.Tier.dropped-honest-not-cancel","TB.Tier.predicated-honest-not-cancel","TB.Tier.severed-honest-not-cancel","TB.Tier.Q-cancelʳ"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":["Bond.withheld_honest_not_cancel","Merge.fused_honest_not_cancel","Fate.atten_not_cancel","Grade.grade_leftCancel_iff","GradeR.gradeR_leftCancel_iff","FateA.leftCancelWitness"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Agda states six of the non-cancellativity witnesses (fate and bond) plus the positive right-cancellation Q-cancelʳ, so the Agda leg is NOT unavailable. It is OPEN because the exhaustive characterisation is not stated in Agda: there is no Agda counterpart of grade_leftCancel_iff, and no Agda witness on the merge coordinate. Lean carries the exhaustive iff. Grade.grade_leftCancel_iff is over the historical pre-ratification carrier; the ratified restatement is GradeR.gradeR_leftCancel_iff. Ungraded because the Agda token is OPEN (§8.1), not for want of an Agda source.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Tier-2 membership, exhaustive"},{"foundation_diverse_witness":null,"id":"C3","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.fate-tier-meet-hom-fails"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.dropped_still_not_cancel","Delta.fidelity_total_honest_not_cancel"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The ratified witness is dropped |>f atten unknown against the tier meet. The pre-ratification witness dropped |>f falsified = dropped was reversed by amendment (A1) and is retained as history only.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"C3 (partition; tier closure is not a homomorphism)"},{"foundation_diverse_witness":null,"id":"O1-carrier","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":["Trope.GradeR.atom_factorization","Trope.nine_families","Trope.family_realized","Trope.families_disjoint","Trope.fateFamily_none_iff"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Lean only, so ungraded under 8.1. Mechanised: the factorisation into six slot projections, and separately the nine-label classification over the coordinate value types. NOT mechanised: the link between them. No theorem maps a grade's slot projections to AtomFamily, and the emb*_one lemmas that would begin that bridge are stated but used by nothing, so 'drawn from the nine families' and 'exhaustive' are argued in a docstring rather than stated.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"O1-carrier (atom factorisation)"},{"foundation_diverse_witness":null,"id":"tropical-Bprime","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":["piR_hom","piR_one","piRHom","piR_nontrivial","piR_surjective","piR_sighted","phiR_sighted","phiId_not_hom","sighted_forces_squash","squash_top","squash_ne_unknown","squash_add"],"receipts":["lean-factorisation-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Lean only, so ungraded under 8.1. sighted_forces_squash concludes f (atten Delta.unknown) /= Delta.unknown: a sighted homomorphism must send atten Unknown AWAY from the deceptive top, not onto it.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Tropical factorisation, (B-prime) sighted"},{"foundation_diverse_witness":null,"id":"theorem-b-t1","kind":"theory","legs":{"agda":{"declarations":["TB.Syntax","TB.Grade","TB.Tier"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 1 - intrinsic graded calculus"},{"foundation_diverse_witness":null,"id":"theorem-b-t2","kind":"theory","legs":{"agda":{"declarations":["TB.Substitution.cut-preserves-grade","TB.Substitution.cut-grade-comm"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The v0.1 sharpness refutation (cut-orientation-matters, cut-symmetric-fails) was retired by amendment (A1) and is replaced by cut-grade-comm: the cut is reorderable.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 2 - grade-exact substitution"},{"foundation_diverse_witness":null,"id":"theorem-b-t3","kind":"theory","legs":{"agda":{"declarations":["TB.Reduction.beta-app","TB.Reduction.beta-let","TB.Reduction.let-redex-grade","TB.Reduction.let-tier-preserved","TB.Reduction.seq-stays-core"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Narrow and intrinsic. The step relation has exactly two constructors, each requiring the substituted argument at grade epsilon, with no congruence rule and no step for any effect former. Preservation holds by construction because the relation is indexed at the same type and grade on both sides, not by induction. There is no progress theorem. The fix case is open (CO-1).","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 3 - subject reduction, beta/let core"},{"foundation_diverse_witness":null,"id":"theorem-b-t4","kind":"theory","legs":{"agda":{"declarations":["TB.Honest"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 4 - Honest Generation and Veridicality"},{"foundation_diverse_witness":null,"id":"grade-soundness-exact","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Idris2 only, so ungraded under 8.1.","reference":{"idris2":{"declarations":["Trope.Soundness.soundFromExact"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Grade soundness, exact lowering"},{"foundation_diverse_witness":null,"id":"tsub-soundness","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Idris2 only, so ungraded under 8.1.","reference":{"idris2":{"declarations":["Trope.Soundness.subSound"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"T-Sub soundness"},{"foundation_diverse_witness":null,"id":"verdict-soundness","kind":"engineering","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Classified engineering: the statement is about the shipped checker's verdict function over its own types, so 8.1 puts it off the ladder entirely and it carries section 5 tokens only. Note that verdictSound is typed over Grade while the shipped checker's floor is a different type decided by a different predicate, and no lemma connects them.","reference":{"idris2":{"declarations":["Trope.Soundness.verdictSound"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Verdict soundness (corollary)"},{"foundation_diverse_witness":null,"id":"grade-soundness-core","kind":"theory","legs":{"agda":{"declarations":["TB.Reduction","TB.Substitution.cut-preserves-grade"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Inherits Target 3's fragment: the beta/let core only, with the fix case open (CO-1).","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Grade soundness, beta/let core"}]} +{"commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","note":"Evidence ledger. The pwg field of each theorem is DERIVED from the legs and receipts below by scripts/pwg-derive.sh, never written by hand; scripts/pwg-check.sh re-derives and fails on drift (PROOF-POLICY 8.4 rule 2). Idris2 appears as a reference, not a leg: 8.1 excludes engineering provers from the ladder.","policy":{"commit":"9bdf864cc7f2c8e24b4df84bf00d04158eee3ad5","path":"3-practice/PROOF-POLICY.adoc","repo":"metadatastician/standards","section":"8"},"receipts":{"agda-c0eb4f1":{"axioms":[],"checker":"agda","checker_version":"2.7.0.1","commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/42623339243","import_cone":"root modules All.agda and Smoke.agda; all seven TB.* modules reachable from All.agda; postulate count 0 (--safe refuses postulate; independently scanned with hyperpolymath/mathesis scripts/census/proof-holes.sh over verification/proofs/agda at this commit, which emitted no record of any class)","inputs_digest":"git-tree verification/proofs/agda = 8d3370e7da58023b9bfa0802e710860105ace73a","invocation":"agda --safe --without-K --cubical-compatible All.agda ; agda --safe --without-K --cubical-compatible Smoke.agda","observed":"PASS: All.agda + Smoke.agda typecheck (--safe --without-K --cubical-compatible; --safe => postulate-free by construction)","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"agda-stdlib v2.0 sha256:14eecb83d62495f701e1eb03ffba59a2f767491f728a8ab8c8bb9243331399d8"},"agda-d5234b1":{"axioms":[],"checker":"agda","checker_version":"2.7.0.1","commit":"d5234b15e56829a81ceec44e6cf14713357096ef","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/44006871652/job/133784244586","import_cone":"root modules All.agda and Smoke.agda; 145 modules in the cone (agda --dependency-graph), 12 first-party: All, Smoke and the ten TB.* modules, TB.OrderLaws, TB.Monotone and TB.Bridge among them; postulate count 0 (--safe refuses postulate; independently scanned with hyperpolymath/mathesis scripts/scan-postulates.sh over the 12 first-party files, which reported 12 files, 0 postulate(s))","inputs_digest":"git-tree verification/proofs/agda = 3b19a6787cd678e93ea0c6be49a6e60634ff6978","invocation":"agda --safe --without-K --cubical-compatible All.agda ; agda --safe --without-K --cubical-compatible Smoke.agda","observed":"PASS: All.agda + Smoke.agda typecheck (--safe --without-K --cubical-compatible; --safe => postulate-free by construction)","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"agda-stdlib v2.0 sha256:14eecb83d62495f701e1eb03ffba59a2f767491f728a8ab8c8bb9243331399d8"},"lean-boundary-c0eb4f1":{"axioms":["propext","Quot.sound","Classical.choice"],"checker":"lean","checker_version":"4.16.0 (lake, leanchecker)","commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/42623339243","import_cone":"every module of grade-boundary sits in the import Mathlib cone via GradeBoundary.lean:3","inputs_digest":"git-tree verification/proofs/lean4 = 5f32026d26810845d94d42b5a1281da3c2a06146","invocation":"lake build --wfail ; leanchecker ; axiom audit against the allowlist {propext, Classical.choice, Quot.sound}","observed":"job 'Lean grade-boundary: lake build + sorry-free environment' success; 'Trope.GradeR.atom_factorization' depends on axioms: [propext]; 'Trope.nine_families' depends on axioms: [propext, Classical.choice, Quot.sound]","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"mathlib4 rev v4.16.0 (lakefile.toml) -- see the Mathlib note: PROOF-POLICY 2 forbids this dependency for a recheck leg"},"lean-factorisation-c0eb4f1":{"axioms":["propext","Quot.sound","Classical.choice"],"checker":"lean","checker_version":"4.16.0 (lake, leanchecker)","commit":"c0eb4f1a1a50aabfab23b94fd74b53cef267f653","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/42623339243","import_cone":"grade-factorisation requires gradeBoundary, so the import Mathlib cone covers it","inputs_digest":"git-tree verification/proofs/lean4 = 5f32026d26810845d94d42b5a1281da3c2a06146","invocation":"lake build --wfail ; leanchecker ; axiom audit against the allowlist {propext, Classical.choice, Quot.sound}","observed":"job 'Lean grade-factorisation: lake build + sorry-free environment' success","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"mathlib4 rev v4.16.0, transitively via the gradeBoundary path dependency"},"lean-ratified-order-d5234b1":{"axioms":[],"checker":"lean","checker_version":"4.16.0 (commit 128a1e6b0a82; GitHub release archive, sha256 cdd31f1064783fff163be53e285722102f16767e65e6fb7f7cb1c232514e0c3a)","commit":"d5234b15e56829a81ceec44e6cf14713357096ef","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/44006871652/job/133784244634","import_cone":"verification/proofs/lean4/ratified-order/RatifiedOrder.lean alone: no import (Lean core only, no Mathlib)","inputs_digest":"git-tree verification/proofs/lean4/ratified-order = 2d69c2f34f4c98834f21ed6413f85b375b024e7b; RatifiedOrder.lean sha256 74c33f1310227243155da52d4afee603f58cff7b8df9942accf6b8dd80f554c5","invocation":"bash scripts/check-recheck-legs.sh lean (lean RatifiedOrder.lean with no error or warning, then Lean.collectAxioms on every declared theorem and def); bash scripts/check-recheck-legs.sh controls","observed":"axioms: none for 49 of 49 declared theorem(s), and none for any def they use; PASS: Lean recheck leg; controls: every planted defect was caught (6 controls)","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"Lean core only (no lakefile, no Mathlib)"},"rocq-ratified-order-d5234b1":{"axioms":[],"checker":"coqc","checker_version":"8.18.0 (Ubuntu 24.04 coq package; scripts/check-recheck-legs.sh refuses any other version)","commit":"d5234b15e56829a81ceec44e6cf14713357096ef","evidence":"https://github.com/hyperpolymath/trope-checker/actions/runs/44006871652/job/133784244634","import_cone":"verification/proofs/rocq/RatifiedOrder.v alone: it requires no library module (Coq prelude only)","inputs_digest":"git-tree verification/proofs/rocq = 2f808c303b5707bf40a54a7eb5c64cd4b774c511; RatifiedOrder.v sha256 89085ae49cb52894fbb16175cc86f2dc3da29333ef8699becf850c0b5ec1583e","invocation":"bash scripts/check-recheck-legs.sh rocq (coqc RatifiedOrder.v, then Print Assumptions on every Theorem and Lemma); bash scripts/check-recheck-legs.sh controls","observed":"Print Assumptions: closed under the global context for 49 of 49 declaration(s); PASS: Rocq recheck leg; controls: every planted defect was caught (6 controls)","repo":"hyperpolymath/trope-checker","result":"pass","state":"current","stdlib_pin":"none: no Require"}},"repo":"hyperpolymath/trope-checker","schema_version":"1.0.0","theorems":[{"foundation_diverse_witness":null,"id":"L1","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.gmonoid-assoc"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.comp_assoc"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":["Trope.Laws.gradeAssoc","Trope.Coords.fateAssoc","Trope.Coords.bondAssoc","Trope.Coords.mergeAssoc","Trope.Fidelity.dplusAssoc"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L1 (associativity)"},{"foundation_diverse_witness":null,"id":"L2","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.gmonoid-unitL","TB.Grade.gmonoid-unitR"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":["Trope.Grade.gradeUnitL","Trope.Grade.gradeUnitR","Trope.Coords.fateUnitL","Trope.Fidelity.dplusZeroR"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L2 (unit)"},{"foundation_diverse_witness":null,"id":"L3","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.falsified-absorbL","TB.Grade.falsified-absorbR","TB.Grade.misbound-absorbL","TB.Grade.conflated-absorbL","TB.Grade.unknown-absorbL","TB.Grade.total-absorb-Q","TB.Tier.deceptive-absorbs-▷"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.falsified_two_sided_zero","GradeR.gBotR_two_sided_zero"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Agda states both sides only for Falsified. For Misbound, Conflated and Unknown the left form is stated; the right follows in one step from the coordinate's commutativity but is not itself a lemma.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"L3 (bottom absorption)"},{"foundation_diverse_witness":null,"id":"L4-fate","kind":"theory","legs":{"agda":{"declarations":["TB.Order.fateL4MonoR","TB.Order.fateL4MonoL"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.fateL4MonoR","TropeRatified.fateL4MonoL"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["fateL4MonoR","fateL4MonoL"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"One of four parts of L4 (owner ruling 2026-11-16: split rather than grade the whole on partial coverage). The others are L4-fidelity, L4-bond-merge and L4-lifting; L4 in full is their conjunction, and since 2026-11-17 all four hold. The Rocq and Lean legs are the Mathlib-free recheck of verification/proofs/rocq and verification/proofs/lean4/ratified-order; the Mathlib package lemmas FateA.comp_mono_right/left remain, BRIDGE-PENDING, and are not this leg. Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{"idris2":{"declarations":["Trope.Soundness.fateL4MonoR","Trope.Soundness.fateL4MonoL"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L4 (monotonicity): fate coordinate"},{"foundation_diverse_witness":null,"id":"L4-fidelity","kind":"theory","legs":{"agda":{"declarations":["TB.Order.dplusMonoR","TB.Order.dplusMonoL"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.dplusMonoR","TropeRatified.dplusMonoL"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["dplusMonoR","dplusMonoL"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"One of four parts of L4. Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{},"title":"L4 (monotonicity): fidelity dimension"},{"foundation_diverse_witness":null,"id":"L4-bond-merge","kind":"theory","legs":{"agda":{"declarations":["TB.Monotone.bondL4MonoR","TB.Monotone.bondL4MonoL","TB.Monotone.mergeL4MonoR","TB.Monotone.mergeL4MonoL"],"receipts":["agda-d5234b1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.bondL4MonoR","TropeRatified.bondL4MonoL","TropeRatified.mergeL4MonoR","TropeRatified.mergeL4MonoL"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["bondL4MonoR","bondL4MonoL","mergeL4MonoR","mergeL4MonoL"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"One of four parts of L4. Proved in Agda 2026-11-17 (TB.Monotone; the left forms follow from the right forms by bond and merge commutativity). The Idris2 restatement remains a reference only (8.1). Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{"idris2":{"declarations":["Trope.Order.bondComposeMono","Trope.Order.mergeComposeMono"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"L4 (monotonicity): bond and merge coordinates"},{"foundation_diverse_witness":null,"id":"L4-lifting","kind":"theory","legs":{"agda":{"declarations":["TB.Monotone.gradeL4MonoR","TB.Monotone.gradeL4MonoL","TB.Monotone.▷-mono"],"receipts":["agda-d5234b1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.gradeL4MonoR","TropeRatified.gradeL4MonoL","TropeRatified.gcomp_mono"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["gradeL4MonoR","gradeL4MonoL","gcomp_mono"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"One of four parts of L4: the lifting from coordinate-level monotonicity to gradeCompose that spec section 7 (Knaster-Tarski) invokes. Proved in Agda 2026-11-17 (TB.Monotone): each argument separately, and both at once (▷-mono, through ⊑-trans). Spec section 7 also needs each coordinate to be a COMPLETE chain; completeness is not part of this obligation and is proved in no prover. Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{},"title":"L4 (monotonicity): grade-level lifting for gradeCompose"},{"foundation_diverse_witness":null,"id":"L5","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.deceptive-absorbs-▷","TB.Reduction.attenuate-stays-deceptive","TB.Reduction.project-stays-deceptive"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"L5 (deception infectiousness)"},{"foundation_diverse_witness":null,"id":"L6","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.grade-comm"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["GradeR.instCommMonoid","FateA.comp_comm"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"L6 ratification is still subject to the open owner ruling tracked on trope-checker issue 106.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"L6 (commutativity)"},{"foundation_diverse_witness":null,"id":"retention-order","kind":"theory","legs":{"agda":{"declarations":["TB.Order.⊑-refl","TB.OrderLaws.⊑-trans","TB.OrderLaws.⊑-dec","TB.OrderLaws.⊑-isPreorder"],"receipts":["agda-d5234b1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.gle_refl","TropeRatified.gle_trans","TropeRatified.gle_dec","TropeRatified.gle_decides"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["gle_refl","gle_trans","gle_dec"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"Proved in Agda 2026-11-17: reflexivity (TB.Order), transitivity and decidability (TB.OrderLaws), packaged as ⊑-isPreorder. Before that the Agda proved reflexivity only and the leg was OPEN. Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{"idris2":{"declarations":["Trope.Laws.decGradeLte","Trope.Soundness.gradeLteTrans","Trope.Coords.fateLteRefl","Trope.Coords.bondLteRefl","Trope.Coords.mergeLteRefl","Trope.Fidelity.dLteRefl"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Retention order is a decidable preorder"},{"foundation_diverse_witness":null,"id":"A2-directions","kind":"theory","legs":{"agda":{"declarations":["TB.Order.fateDroppedLtePredicated","TB.Order.fatePredicatedNotLteDropped"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.fateDroppedLtePredicated","TropeRatified.fatePredicatedNotLteDropped"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["fateDroppedLtePredicated","fatePredicatedNotLteDropped"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"One of two parts of A2 (owner ruling 2026-11-16: split). The two directional facts only; that Fate is a chain is A2-chain. Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{"idris2":{"declarations":["Trope.Soundness.fateDroppedLtePredicated","Trope.Soundness.fatePredicatedNotLteDropped"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"A2 directional facts: Dropped below Predicated, not conversely"},{"foundation_diverse_witness":null,"id":"A2-chain","kind":"theory","legs":{"agda":{"declarations":["TB.OrderLaws.fate-isTotalOrder","TB.OrderLaws.fateLte-trans","TB.OrderLaws.fateLte-antisym","TB.OrderLaws.fateLte-total","TB.Order.fateLte-refl"],"receipts":["agda-d5234b1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["TropeRatified.fate_isTotalOrder","TropeRatified.fateLte_trans","TropeRatified.fateLte_antisym","TropeRatified.fateLte_total","TropeRatified.fateLte_refl"],"receipts":["lean-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"},"rocq":{"declarations":["fate_isTotalOrder","fateLte_trans","fateLte_antisym","fateLte_total","fateLte_refl"],"receipts":["rocq-ratified-order-d5234b1"],"route":"re-proved","state":"RECONCILED","token":"PROVEN"}},"notes":"A chain is a total order: reflexive, transitive, antisymmetric and total. Proved in Agda 2026-11-17 as fate-isTotalOrder : IsTotalOrder _≡_ _≤F_ (standard library), with the fidelity order a chain as well (dLte-isTotalOrder). The Mathlib package lemmas FateA.le_total and FateA.le_refl remain, BRIDGE-PENDING, and are not this leg. Completeness of the chain is not part of this obligation and is proved in no prover. The directional facts are A2-directions. Both recheck legs restate the carrier clause for clause, as checked by manual correspondence review (PROOF-STATUS, statement correspondence). Separately, TB.Bridge pins the six restated definitions to the Agda on a fixed sample (exhaustive for Bond and Merge), and each leg proves the same six tables; a disagreement at a sampled point makes a corresponding bridge theorem fail.","reference":{"idris2":{"declarations":["Trope.Order.fateLteTrans"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Fate is a chain (A2)"},{"foundation_diverse_witness":null,"id":"veridicality-derivation","kind":"theory","legs":{"agda":{"declarations":["TB.Honest.fateDeceptiveUnique","TB.Honest.bondDeceptiveUnique","TB.Honest.mergeDeceptiveUnique"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The 'exactly three' half rests on the three uniqueness lemmas plus the construction of Grade; Trope.Veridicality.deceptiveDuals is a tuple value and states no proposition, so it is not cited as evidence here.","reference":{"idris2":{"declarations":["Trope.Veridicality.fateDeceptiveUnique","Trope.Veridicality.bondDeceptiveUnique","Trope.Veridicality.mergeDeceptiveUnique"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Veridicality Derivation"},{"foundation_diverse_witness":null,"id":"honest-generation","kind":"theory","legs":{"agda":{"declarations":["TB.Honest.genFate","TB.Honest.genBond","TB.Honest.genMerge","TB.Honest.honest-closed-▷"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":["Trope.Generation.genFate","Trope.Generation.genBond","Trope.Generation.genMerge"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Honest Generation"},{"foundation_diverse_witness":null,"id":"hc4-coherence","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Idris2 only. No Agda source, so ungraded under 8.1 however sound the Idris2 proof is.","reference":{"idris2":{"declarations":["Trope.Veridicality.epsilonHonest","Trope.Grade.epsilonCoherent"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"The unit is non-deceptive and HC-4-coherent"},{"foundation_diverse_witness":null,"id":"C1","kind":"theory","legs":{"agda":{"declarations":["TB.Grade.grade-conical"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["GradeR.conical","FateA.conical"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"C1 (conicality)"},{"foundation_diverse_witness":null,"id":"C2","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.Q-cancelʳ","TB.Tier.core-closed-▷"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["GradeR.gradeR_leftCancel_iff","GradeR.gradeR_not_leftCancel","GradeR.gDroppedR_not_cancel","FateA.atten_cancel_on_normalForms"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The normal-form half is proved on the fate coordinate only (FateA.atten_cancel_on_normalForms); there is no grade-level normal-form cancellation theorem. Amendment (A3) is not modelled in the Agda, whose carrier is the unnormalised one.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"C2 (the cancellation boundary)"},{"foundation_diverse_witness":null,"id":"tier2-membership","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.unknown-not-cancel","TB.Tier.total-honest-not-cancel","TB.Tier.falsified-not-cancel","TB.Tier.dropped-honest-not-cancel","TB.Tier.predicated-honest-not-cancel","TB.Tier.severed-honest-not-cancel","TB.Tier.Q-cancelʳ"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":["Bond.withheld_honest_not_cancel","Merge.fused_honest_not_cancel","Fate.atten_not_cancel","Grade.grade_leftCancel_iff","GradeR.gradeR_leftCancel_iff","FateA.leftCancelWitness"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Agda states six of the non-cancellativity witnesses (fate and bond) plus the positive right-cancellation Q-cancelʳ, so the Agda leg is NOT unavailable. It is OPEN because the exhaustive characterisation is not stated in Agda: there is no Agda counterpart of grade_leftCancel_iff, and no Agda witness on the merge coordinate. Lean carries the exhaustive iff. Grade.grade_leftCancel_iff is over the historical pre-ratification carrier; the ratified restatement is GradeR.gradeR_leftCancel_iff. Ungraded because the Agda token is OPEN (§8.1), not for want of an Agda source.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Tier-2 membership, exhaustive"},{"foundation_diverse_witness":null,"id":"C3","kind":"theory","legs":{"agda":{"declarations":["TB.Tier.fate-tier-meet-hom-fails"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":["FateA.dropped_still_not_cancel","Trope.Grade.fidelity_total_honest_not_cancel"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The ratified witness is dropped |>f atten unknown against the tier meet. The pre-ratification witness dropped |>f falsified = dropped was reversed by amendment (A1) and is retained as history only.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"C3 (partition; tier closure is not a homomorphism)"},{"foundation_diverse_witness":null,"id":"O1-carrier","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":["Trope.GradeR.atom_factorization","Trope.nine_families","Trope.family_realized","Trope.families_disjoint","Trope.fateFamily_none_iff"],"receipts":["lean-boundary-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Lean only, so ungraded under 8.1. Mechanised: the factorisation into six slot projections, and separately the nine-label classification over the coordinate value types. NOT mechanised: the link between them. No theorem maps a grade's slot projections to AtomFamily, and the emb*_one lemmas that would begin that bridge are stated but used by nothing, so 'drawn from the nine families' and 'exhaustive' are argued in a docstring rather than stated.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"O1-carrier (atom factorisation)"},{"foundation_diverse_witness":null,"id":"tropical-Bprime","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":["piR_hom","piR_one","piRHom","piR_nontrivial","piR_surjective","piR_sighted","phiR_sighted","phiId_not_hom","sighted_forces_squash","squash_top","squash_ne_unknown","squash_add"],"receipts":["lean-factorisation-c0eb4f1"],"route":"re-proved","state":"BRIDGE-PENDING","token":"PROVEN-WITH-AXIOMS"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Lean only, so ungraded under 8.1. sighted_forces_squash concludes f (atten Delta.unknown) /= Delta.unknown: a sighted homomorphism must send atten Unknown AWAY from the deceptive top, not onto it.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Tropical factorisation, (B-prime) sighted"},{"foundation_diverse_witness":null,"id":"theorem-b-t1","kind":"theory","legs":{"agda":{"declarations":["TB.Syntax","TB.Grade","TB.Tier"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 1 - intrinsic graded calculus"},{"foundation_diverse_witness":null,"id":"theorem-b-t2","kind":"theory","legs":{"agda":{"declarations":["TB.Substitution.cut-preserves-grade","TB.Substitution.cut-grade-comm"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"The v0.1 sharpness refutation (cut-orientation-matters, cut-symmetric-fails) was retired by amendment (A1) and is replaced by cut-grade-comm: the cut is reorderable.","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 2 - grade-exact substitution"},{"foundation_diverse_witness":null,"id":"theorem-b-t3","kind":"theory","legs":{"agda":{"declarations":["TB.Reduction.β-app","TB.Reduction.β-let","TB.Reduction.let-redex-grade","TB.Reduction.let-tier-preserved","TB.Reduction.seq-stays-core"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Narrow and intrinsic. The step relation has exactly two constructors, each requiring the substituted argument at grade epsilon, with no congruence rule and no step for any effect former. Preservation holds by construction because the relation is indexed at the same type and grade on both sides, not by induction. There is no progress theorem. The fix case is open (CO-1).","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 3 - subject reduction, beta/let core"},{"foundation_diverse_witness":null,"id":"theorem-b-t4","kind":"theory","legs":{"agda":{"declarations":["TB.Honest"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Theorem B Target 4 - Honest Generation and Veridicality"},{"foundation_diverse_witness":null,"id":"grade-soundness-exact","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Idris2 only, so ungraded under 8.1.","reference":{"idris2":{"declarations":["Trope.Soundness.soundFromExact"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Grade soundness, exact lowering"},{"foundation_diverse_witness":null,"id":"tsub-soundness","kind":"theory","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Idris2 only, so ungraded under 8.1.","reference":{"idris2":{"declarations":["Trope.Soundness.subSound"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"T-Sub soundness"},{"foundation_diverse_witness":null,"id":"verdict-soundness","kind":"engineering","legs":{"agda":{"declarations":[],"receipts":[],"route":"unavailable","state":"AGDA-PENDING","token":"OPEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Classified engineering: the statement is about the shipped checker's verdict function over its own types, so 8.1 puts it off the ladder entirely and it carries section 5 tokens only. Note that verdictSound is typed over Grade while the shipped checker's floor is a different type decided by a different predicate, and no lemma connects them.","reference":{"idris2":{"declarations":["Trope.Soundness.verdictSound"],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"PROVEN"}},"title":"Verdict soundness (corollary)"},{"foundation_diverse_witness":null,"id":"grade-soundness-core","kind":"theory","legs":{"agda":{"declarations":["TB.Reduction","TB.Substitution.cut-preserves-grade"],"receipts":["agda-c0eb4f1"],"route":"re-proved","state":"AGDA-VERIFIED","token":"PROVEN"},"lean":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"},"rocq":{"declarations":[],"receipts":[],"route":"unavailable","state":"NOT-INVENTORIED","token":"OPEN"}},"notes":"Inherits Target 3's fragment: the beta/let core only, with the fix case open (CO-1).","reference":{"idris2":{"declarations":[],"state":"not-a-leg (PROOF-POLICY 8.1 excludes engineering provers from the PWG ladder)","token":"OPEN"}},"title":"Grade soundness, beta/let core"}]}