Skip to content

docs(proofs): align README, AFFIRMATION and EXPLAINME with the proof ledger; Agda-first convergence plan - #1030

Merged
hyperpolymath merged 3 commits into
claude/eager-wright-zwwbe2-proof-ledgerfrom
claude/eager-wright-zwwbe2-proof-claims
Nov 9, 2026
Merged

hyperpolymath merged 3 commits into
claude/eager-wright-zwwbe2-proof-ledgerfrom
claude/eager-wright-zwwbe2-proof-claims

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

This is the second PR of the proof-ledger stack and is based on #1029; review it after that. It follows the owner's decisions of 2026-11-09: move EXPLAINME to the root with a full refresh, and use constructive reals for the convergence theorems.

EXPLAINME.adoc moves back to the repository root, as README-EXPLAINME requires. Every claim in it was re-checked against the tree.

  • Removed: "Idris2 ABI proofs formally verify recipe correctness"; "Haskell Liquid types"; a proofs/agda/ safety-triangle row for a directory that doesn't exist.
  • Corrected:
    • 5 neural networks is now 8;
    • 7 Zig exports is now 18;
    • Gen.idr is a generator, not a spec;
    • Verdict/Retraction are added.
  • Metrics: volatile figures give way to the mix hypatia.* tasks that compute them.
  • Known gaps: the safety systems are recorded as built but not wired, which I confirmed by grep. README's own overclaims are recorded too: rule-module, lib/, recipe, CLI-command and Mix-task counts, just build-all, guix.scm, and two dead links. Fixing README itself is a follow-up PR.
  • Proof ledger: a new [[proof-ledger]] section cites verification/proof-ledger.jsonl and quotes its census.

README / AFFIRMATION

  • The README proof bullet says what is proved, and that the proofs are about models, not the runtime. It quotes the ledger census.
  • AFFIRMATION drops "blocked only on Mathlib network access" (PROOF-POLICY forbids Mathlib) and its dead .md link.

Derived claims: scripts/proof-ledger.sh claims fails when a census quoted in README, AFFIRMATION or EXPLAINME differs from the ledger's. It runs in CI and has 4 contracts, built from the ledger so they survive count changes.

Convergence handover, rewritten Agda-first:

  • Agda 2.8.0.2 under --safe --without-K --cubical-compatible, over constructive Bishop reals built on agda-stdlib v2.3 (8326c74), with no Mathlib.
  • Milestones M0 to M5 run from the reals through completeness and constructive Banach to PageRank and ESN, with tanh as its own row.
  • The ESN is stated in the induced ∞-norm, which is what echo_state_network.ex actually uses.
  • docs/proofs/needs.adoc becomes a pointer to the ledger; its own list had drifted ("Agda retired", Mathlib).

How has this been verified?

  • Feasibility spike (local): Agda 2.8.0.2 + agda-stdlib v2.3 loads Data.Rational and checks a Bishop-real record under the §2.1 profile, with rc=0.
  • Ledger gates: proof-ledger.sh check / render --check / claims all pass (4 quoted censuses agree). tests/proof-ledger-test.sh: 19 passed, 0 failed. check-proof-status.sh: OK.
  • EXPLAINME spot-checks: I re-verified 42 rule modules, 154 .ex files, 16 Mix tasks, RateLimiter/Safety.Quarantine having no callers, the dispatch_guard.ex novelty lines, and the missing guix.scm.
  • Static checks: shellcheck is clean; the invisible-character scan is clean.

Notes

  • Licence: EXPLAINME keeps CC-BY-SA-4.0, the repo's docs licence. The standard's MPL example reads "or applicable licence".
  • References: .audittraining/ datasets still name docs/EXPLAINME.adoc. They are a frozen training corpus and are left as they are.

Generated by Claude Code

…ledger; Agda-first convergence plan

Second PR of the proof-ledger stack (owner decisions 2026-11-09).

- EXPLAINME.adoc moves back to the repository root, as README-EXPLAINME
  requires. Every claim in it was re-checked against the tree.
  - Removed: "Idris2 proofs verify recipe correctness"; "Haskell Liquid
    types"; a nonexistent proofs/agda/ row.
  - Corrected: 5 networks is now 8; 7 Zig exports is now 18.
  - Volatile metrics give way to the mix tasks that compute them.
  - The safety systems are now described as built but not wired.
  - It gains [[proof-ledger]], which cites the canonical ledger.
  - README's own overclaims are recorded under Known gaps; fixing them is
    a follow-up.
- README's proof bullet now describes what is proved, over models not the
  runtime, and quotes the ledger census. AFFIRMATION drops "blocked only on
  Mathlib network access" (PROOF-POLICY forbids Mathlib) and fixes a dead
  .md link.
- scripts/proof-ledger.sh claims: every census README, AFFIRMATION or
  EXPLAINME quotes must equal the ledger's computed census. It runs in CI,
  with 4 contracts built from the ledger itself.
- The neural-convergence handover is rewritten: Agda first (2.8.0.2,
  --safe --without-K --cubical-compatible) over constructive Bishop reals
  built on agda-stdlib v2.3 (8326c74), milestones M0-M5, no Mathlib. The
  stdlib feasibility was spiked locally under the profile. The ESN is
  framed in the induced infinity-norm the runtime actually uses.
- docs/proofs/needs.adoc becomes a pointer to the ledger; its own list had
  drifted ("Agda retired", Mathlib).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYR5bf5FBLS7cXQK72aVNM
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f1e02c25-ac6a-4997-9814-97cb9ecc4bca
Commits

Reviewing files that changed from the base of the PR and between b2b23e5 and fd96af7.

Files selected for processing: 11

  • .github/workflows/verify-proofs.yml
  • AFFIRMATION.adoc
  • CHANGELOG.adoc
  • EXPLAINME.adoc
  • README.adoc
  • docs/EXPLAINME.adoc
  • docs/README.adoc
  • docs/proofs/HANDOVER-neural-convergence.adoc
  • docs/proofs/needs.adoc
  • scripts/proof-ledger.sh
  • tests/proof-ledger-test.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ger-wright-zwwbe2-proof-claims

# Conflicts:
#	tests/proof-ledger-test.sh
@hyperpolymath
hyperpolymath added this pull request to stack #1038 November 9, 2026 15:41
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 9, 2026 15:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T16:24:33.571566Z fd96af7 New commits
🔒 Security Review ❌ Failed 2026-11-09T16:14:36.009460Z
We couldn’t complete this review. Comment @codex security review to try again.
fd96af7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a483e99e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/proof-ledger.sh Outdated
Comment on lines +182 to +183
[ -f "$doc" ] || continue
found=$(tr '\n' ' ' < "$doc" | tr -s ' ' | grep -oE '[0-9]+ proven of [0-9]+(; [0-9]+ proven-with-postulates, [0-9]+ tested-only, [0-9]+ argued, [0-9]+ open\.?)?' || true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail when a required claim document or census is absent

The new proof-status workflow invokes claims with the default document list, but missing files are silently skipped and there is no assertion that each file contributed a census. Consequently, deleting or renaming EXPLAINME.adoc, or merely removing/reformatting all census text in any designated document, still exits successfully—even PROOF_CLAIM_DOCS=/nonexistent reports that zero censuses agree. Require every configured document to exist and yield the expected census before this CI gate passes.

Useful? React with 👍 / 👎.

Comment on lines +97 to +99
* The runtime uses IEEE floats. The theorems are about reals; the link from
them to `+lib/neural/*.ex+` is the `+models-runtime-refinement+` row, and
`+test/neural_test.exs+` is that row's evidence, which is `+tested-only+`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not describe the open refinement row as tested-only

At this commit, the canonical models-runtime-refinement ledger row has status open, file -, and no evidence names; test/neural_test.exs belongs to no such row. Calling that test this row's evidence and labeling the row tested-only directly contradicts the ledger this documentation tells implementers to follow, and can make the outstanding model-to-runtime correspondence work appear complete.

Useful? React with 👍 / 👎.

Comment thread EXPLAINME.adoc Outdated
Comment on lines +187 to +188
`/api/*` needs a bearer token only when `HYPATIA_API_BEARER_TOKEN` is set;
otherwise it is loopback-only.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the unauthenticated non-local override

When HYPATIA_API_BEARER_TOKEN is unset but HYPATIA_API_ALLOW_NONLOCAL=true, Hypatia.Web.ApiRouter.legacy_loopback_only/2 explicitly permits non-loopback requests without a token. Therefore the API is not always loopback-only in the stated “otherwise” case; omitting this exception can lead operators to expose operational endpoints while believing the documented IP restriction still applies.

Useful? React with 👍 / 👎.

Comment on lines +69 to +73
M3 — PageRank (`+PageRank.agda+`)::
`+G(x) = α·P·x + (1 - α)·v+` with `+P+` column-stochastic (non-negative
rational entries, columns summing to 1) and a rational `+0 ≤ α < 1+`.
`+G+` is an ℓ¹ contraction with modulus `+α+`, because a column-stochastic
`+P+` gives `+‖P x‖₁ ≤ ‖x‖₁+`. Then M2. *Ledger:* `+pagerank-convergence+`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Model the transition matrix the runtime actually constructs

For repeated successful outcomes between the same identities, build_edges/1 emits parallel edges, while iterate_trust/4 adds every duplicate to out_weight_sum but uses Enum.find to include only one matching edge in each target's numerator. The resulting runtime transition matrix can therefore be sub-stochastic rather than column-stochastic, so the proposed M3 theorem's exact-column-sum premise excludes a normal runtime input and cannot establish the stated obligation for graph_of_trust.ex; either model the sub-stochastic case or deduplicate the runtime edges.

Useful? React with 👍 / 👎.

Merges b2b23e5 (computed grades, PROOF-POLICY pin, check hardening). The
one conflict is in scripts/proof-ledger.sh, where both branches added a
function: claims() here and markers_ok() there. Both are kept.

It also fixes Codex's four findings on 3a483e9:
- `claims`: a claim document that does not exist, or quotes no census, now
  fails. It was skipped silently, so a renamed EXPLAINME passed. Two new
  contracts; 40/40 pass.
- HANDOVER M3 is stated for a column-sub-stochastic P (each column sums to
  at most 1). ||Px||_1 <= ||x||_1 still holds, so the contraction argument
  is unchanged, and it covers the matrices the runtime builds:
  - dangling nodes give zero columns;
  - iterate_trust/4 sums parallel edges into the out-weight but takes one
    of them into each target, so repeated outcomes leak mass.
  The leak is named as a runtime defect to fix in the runtime.
- HANDOVER: models-runtime-refinement is open and names no evidence;
  test/neural_test.exs is a candidate, not that row's recorded evidence.
- EXPLAINME: /api needs a bearer token when HYPATIA_API_BEARER_TOKEN is set
  and not empty. Otherwise only loopback clients are answered, unless
  HYPATIA_API_ALLOW_NONLOCAL=true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYR5bf5FBLS7cXQK72aVNM
@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd96af78ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

∞-norm, *not* the spectral radius: the runtime has scaled by the induced
∞-norm (`+@reservoir_norm+` = 0.95) since 2026-10, and `+test/neural_test.exs+`
checks both that bound and the convergence of two initial states.
*Ledger:* `+esn-echo-state+` becomes `+proven+` at PWG-3.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the ESN ledger row open through M5

If the milestones land independently as prescribed, M4 proves only a theorem parameterized by an activation already known to be 1-Lipschitz and bounded, while M5 explicitly defers proving those premises for the runtime's :math.tanh activation. Marking esn-echo-state proven after M4 would therefore overstate the current unconditional ledger obligation; either keep the row open until M5 lands or change the obligation to record the activation premises and track the runtime instantiation separately.

Useful? React with 👍 / 👎.

Comment thread EXPLAINME.adoc
Comment on lines +242 to +243
Safety systems are built but not wired. `Safety.RateLimiter` and
`Safety.Quarantine` have no caller in `lib/`. `BatchRollback.rollback/2` is

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Qualify Quarantine as absent only from dispatch paths

In the inspected tree, lib/hypatia/web/api_router.ex:90-92 and lib/hypatia/web/graphql.ex:191-193 call the Quarantine GenServer, so the new claim that it has no caller in lib/ is false. It is still not consulted by scan or dispatch enforcement, which is the actual gap; state that narrower condition so maintainers do not overlook the existing API and GraphQL integration.

Useful? React with 👍 / 👎.

Comment thread EXPLAINME.adoc
[cols="1,2", options="header"]
|===
| README row | Tree
| `lib/`: 133 | 154 `.ex` files (`+ls lib/**/*.ex \| wc -l+`), 180 `defmodule`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a recursive command for the module count

With Bash's default globstar setting disabled, the shown ls lib/**/*.ex | wc -l command expands only files exactly one directory below lib/ and reports 101 here, not the stated 154; it omits both top-level files and deeper subdirectories. Because this section says its counts are reproducible with the commands shown, use find lib -name '*.ex' (or explicitly enable globstar) so future audits do not derive a false module count.

Useful? React with 👍 / 👎.

@hyperpolymath
hyperpolymath merged commit 5d911b6 into main Nov 9, 2026
99 checks passed
@hyperpolymath
hyperpolymath deleted the claude/eager-wright-zwwbe2-proof-claims branch November 9, 2026 20:59
hyperpolymath added a commit that referenced this pull request Nov 9, 2026
…dger rows now proven (#1031)

## Summary

This is the third PR of the proof-ledger stack, based on #1030 (which is
based on #1029).

The owner decided on 2026-11-09 to **re-home the Lean engineering proofs
to Idris2 now** (PROOF-POLICY §3), rather than record Lean's kernel
axioms as necessary.

- **New Idris2 files:** `verification/proofs/idris2/` gains
`RateLimiting`, `BayesianUpdate`, `ParserTotality`, `PageRankInvariants`
and `ESNSpectralScaling`.
- They port the Lean files theorem for theorem, with names in camelCase.
- Every file is under `%default total`, with no `believe_me`,
`assert_total` or holes.
- The existing per-file `idris2 --check` loop picks them up; no new CI
is needed.
- **Why the axioms go away:** four of the Lean files rested on
`propext`, or on `propext` + `Quot.sound` (from `Lean.collectAxioms`,
see #1029). Idris2 has neither.
- **Ledger rows renamed:**

  | Old id | New id |
  |---|---|
  | `lean-rate-limiting` | `rate-limiting` |
  | `lean-bayesian-update` | `bayesian-update` |
  | `lean-parser-totality` | `parser-totality` |
  | `lean-pagerank-preconditions` | `pagerank-preconditions` |
  | `lean-esn-preconditions` | `esn-preconditions` |

All five are **`proven`**. **Census: 22 proven of 42; 0
proven-with-postulates, 11 tested-only, 2 argued, 7 open.**
- **Lean project removed:** `verification/proofs/lean4/` is deleted. The
`lake build` job becomes **`Lean hole re-check (HYP-01 control)`**: the
pinned Lean stays for the verdict fixture only. The job is not a
required check (rules on `main` require `abi-codegen-drift`, `zig build
test`, `Escript packaging soundness`, `scan / gitleaks`).
- **Claims updated:** README, AFFIRMATION, EXPLAINME, PROOF-STATUS and
`needs.adoc` describe the move. The `claims` gate from #1030 caught all
four stale census quotes first, so the derived-claims check works end to
end.
- **Contract fix:** the ledger contracts now refuse a mutant whose
target row is missing. I hit this in practice: the old axiom contracts
targeted the renamed `lean-*` ids, so they would have mutated nothing
and still passed.

## How has this been verified?

Local receipt, Idris2 **0.7.0** built from source with Chez Scheme (the
same version CI pins):

| Check | Result |
|---|---|
| `idris2 --check` on all 12 `verification/proofs/idris2/*.idr` | 12/12
ok |
| `idris2 --build src/abi/hypatia-abi.ipkg`,
`verify/hypatia-verify.ipkg` | exit 0, exit 0 |
| `scripts/check-verdicts.sh` | PASS: 2 positive controls, 5 expected
rejections |
| `scripts/check-trusted-base.sh` | OK |
| `proof-ledger.sh check` / `render --check` / `claims` | valid /
current / 4 censuses agree |
| `tests/proof-ledger-test.sh` | 19 passed, 0 failed; a planted missing
target makes it fail |
| `actionlint` | only the pre-existing SC2005 note `main` has |

## Notes

- **Not a recheck leg:** this re-homes engineering statements. It is not
a recheck leg of any theory theorem. The convergence theorems remain
`open` (Agda-first plan in #1030).
- **Removed files:** the removed Lean files' statements are the Idris2
files' statements. Git history keeps the Lean versions.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01CYR5bf5FBLS7cXQK72aVNM)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants