Skip to content

feat(formal): F-1 preservation + grow K-1 (let/vars) + state P-2/P-3/F-3/F-4 - #621

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/lucid-cray-4a22dp
Jun 21, 2026
Merged

feat(formal): F-1 preservation + grow K-1 (let/vars) + state P-2/P-3/F-3/F-4#621
hyperpolymath merged 1 commit into
mainfrom
claude/lucid-cray-4a22dp

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Continues the formal/ Wave-0 programme in the order you gave — 3 → 1 → 2 (F-1, then grow K-1, then state the siblings). All Coq/Rocq 8.18, all axiom-free (Print Assumptions"Closed under the global context"); no Admitted.

3 — F-1 (F1_TransformerPreservation.v, mechanized)

The real same-cube theorem, composing on K-1: models a face surface fexp + parser sugar, the transform elaborate : fexp → sexp (ADR-010's T_F), and the face's own semantics feval. Proves the transform preserves meaning —

Theorem f1_transform_preserves_eval : forall f, feval f = seval (elaborate f).

— then chains K-1's k1_preservation_holds for end-to-end codegen preservation (f1_codegen_preservation), plus a cross-face same-cube corollary (faces landing on the same canonical AST emit identical code). The observational trailing-statement/tail split stays in invariant-path/proofs/SameCube.agda (F-2).

1 — grow K-1 (K1Let_CodegenPreservation.v, mechanized)

Re-proves codegen preservation for a richer fragment: de Bruijn variables, let, and an environment. The target machine gains a locals register, and compilation balances IBind/IUnbind so locals scope correctly. (if/structured control is the next increment — it needs a target control construct + a termination measure.)

2 — state the siblings (Siblings_Stated.v, statements only)

P-2 (progress + preservation), P-3 (borrow soundness + the explicit "reject #554" obligation), F-3 (pragma locality + alias-table functionality), F-4 (error-vocabulary faithfulness as a class/referent simulation). Each is a Definition ..._statement : Prop over Section Variables, discharged at End into closed, universally-quantified props — the Coq analogue of solo-core's statement-only skeleton. Nothing is claimed proven, and there are no axioms/Parameters.

Wiring & docs

  • justfile check compiles all four in dependency order (F-1 Requires K-1) and asserts no axioms; _CoqProject + README.adoc updated.
  • .hypatia-ignore extends the Coq-.v-is-not-V-lang carve-out to the three new files.
  • PROOF-NEEDS.adoc: F-1 absent → partial, F-3/F-4 absent → stated, formal/ file list + Wave-0 row refreshed.

Check

just -f formal/justfile check

Verified locally: 4 closure reports, zero axioms.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KPG9mEQXFyA3k7NWAzMNMr


Generated by Claude Code

… state P-2/P-3/F-3/F-4

Continues the formal/ Wave-0 programme (docs/PROOF-NEEDS.adoc), in the order
F-1 → grow-K-1 → state-siblings. All Coq/Rocq 8.18, all axiom-free
(`Print Assumptions`: "Closed under the global context"); no Admitted.

F-1 — F1_TransformerPreservation.v (mechanized, composes on K-1):
  Models a face surface `fexp` + sugar, the transform `elaborate : fexp -> sexp`
  (ADR-010's T_F), and the face's own semantics `feval`. Proves the transform
  preserves meaning (feval f = seval (elaborate f)), then chains K-1's
  k1_preservation_holds to get end-to-end codegen preservation, plus the
  cross-face same-cube corollary (faces landing on the same canonical AST emit
  identical code). The observational split is F-2 (SameCube.agda).

K-1 grown — K1Let_CodegenPreservation.v (mechanized):
  Re-proves codegen preservation for a richer fragment adding de Bruijn
  variables, `let`, and an environment; the target machine gains a locals
  register with IBind/IUnbind balancing. (`if`/structured control is the next
  increment — needs a target control construct + termination measure.)

Siblings stated — Siblings_Stated.v (statements only, nothing proven):
  P-2 (progress + preservation), P-3 (borrow soundness + the explicit
  "reject #554" obligation), F-3 (pragma locality + alias-table functionality),
  F-4 (error-vocabulary faithfulness as a class/referent simulation). Each is a
  `Definition ..._statement : Prop` over section Variables, discharged at End
  into closed universally-quantified props — the Coq analogue of solo-core's
  statement-only Idris2 skeleton.

Track wiring: justfile `check` now compiles all four in dependency order
(F-1 Requires K-1) and asserts no axioms; _CoqProject + README updated.
.hypatia-ignore extends the Coq-not-V-lang carve-out to the three new .v files.
PROOF-NEEDS.adoc: F-1 absent→partial, F-3/F-4 absent→stated, formal/ file list
+ Wave-0 row refreshed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPG9mEQXFyA3k7NWAzMNMr
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 41 issues detected

Severity Count
🔴 Critical 2
🟠 High 23
🟡 Medium 16

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in instant-sync.yml",
    "type": "secret_action_without_presence_gate",
    "file": "instant-sync.yml",
    "action": "peter-evans/repository-dispatch",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Shell execution -- validate input before passing to shell (1 occurrences, CWE-78)",
    "type": "js_exec_sync",
    "file": "/home/runner/work/affinescript/affinescript/packages/affinescript-cli/mod.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "Shell execution -- validate input before passing to shell (2 occurrences, CWE-78)",
    "type": "js_exec_sync",
    "file": "/home/runner/work/affinescript/affinescript/packages/affine-vscode/mod.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "Shell execution -- validate input before passing to shell (1 occurrences, CWE-78)",
    "type": "js_exec_sync",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-vite/src/affine-plugin-improved.js",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "expect() in hot path (32 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/affinescript/affinescript/affinescriptiser/src/codegen/wasm_gen.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "expect() in hot path (29 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/affinescript/affinescript/affinescriptiser/src/codegen/affine_gen.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (2 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/affinescript/affinescript/runtime/src/panic.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (1 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/affinescript/affinescript/runtime/src/alloc.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (3 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/affinescript/affinescript/runtime/src/ffi.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath marked this pull request as ready for review June 21, 2026 12:07
@hyperpolymath
hyperpolymath merged commit bfa312b into main Jun 21, 2026
16 checks passed
@hyperpolymath
hyperpolymath deleted the claude/lucid-cray-4a22dp branch June 21, 2026 12:08
hyperpolymath added a commit that referenced this pull request Sep 8, 2026
…vert a stale merge's silent ledger regression (#744)

The `build` job has been red on `main` since **2026-06-28**. Three
separable causes, one commit each.

## 1. The red itself (`3d25fb6`)

`3661d98` removed the DOC-04 status banner from `README.adoc`, which
`tools/check-doc-truthing.sh` requires. Restored, plus three references
to `SOUNDNESS-LEDGER.adoc` — a file that does not exist — repointed at
`docs/SOUNDNESS.adoc`.

## 2. Why nothing else reported (`5c0366a`)

GitHub Actions skips every later step in a job once one fails. The
doc-truthing failure therefore disarmed the soundness-ledger gate, the
capability-anchor gate and the formatting check for ten weeks. They
reported `skipped`, not `failure` — **worse than red, because `skipped`
reads as absence of news rather than as a gate that never ran.**

`if: ${{ !cancelled() }}` on all four makes each report its own verdict.

## 3. What the disarmed gate was hiding (`f3a70ae`)

With the gates re-armed, the soundness-ledger gate failed on three of
its five properties. The cause is not a soundness regression:

`152d959` (2026-08-18) merged `origin/claude/capability-test-anchors`, a
branch whose copy of `docs/SOUNDNESS.adoc` predated three fixes already
on the main line. **It raised a real conflict, and the conflict was
resolved by deleting main's side.** Replaying the merge shows this
directly:

```console
$ git merge-tree --write-tree 808e859 fb27a7f
CONFLICT (content): Merge conflict in docs/SOUNDNESS.adoc     # exit 1, two hunks
```

Git's own auto-merge output still contained both of main's fixes next to
the conflict markers. Diffing that replayed tree against what was
committed gives **60 deletions, 0 insertions** — the six marker lines
plus 54 lines of main's side, nothing added: the signature of a pure
"take theirs" resolution. Against its first parent the merge is 27
insertions / 51 deletions with **no new content**, reverting all three:

1. The #555 row was re-pointed at `test_resume_nontail_known_shallow`, a
name that was only ever *planned* (in the 2026-06-17 handoff) and has
never existed in the tree. The pin that does exist,
`test_resume_nontail_xfail` (`test/xfail/test_xfail_pins.ml:56`), covers
the same fixture and the same behaviour and is what the seal hashes.
2. The **Pinned-residual discipline** section was deleted — the section
naming the `XPASS` hand-off as the one place the anti-drift machinery
relies on a human.
3. Two claims regressed to being false: #624 restated as "flagged but
not yet fenced" although `f020a6f` fenced it, and the mechanisation
paragraph rolled back to "#620/#621", dropping P-2, P-3, F-3 and F-4.

This commit restores the file to `808e859`, the main-line parent of that
merge. Nothing has touched it since, so no later work is lost.

### The seal was never wrong — and was NOT resealed

Property 3 fails with a message offering `--reseal (if intentional)`.
Taking that offer would have hashed a test that does not exist: the
computed digest was `e3b0c442…` — the SHA-256 of the empty string.
**`tools/soundness-anchors.sha256` is unchanged.** The ledger was the
side that drifted, and it is the side that was fixed.

## Verification

All three gates run locally from a clean tree:

```
check-doc-truthing      OK  exit 0
check-soundness-ledger  OK  exit 0   all 5 properties (anchors + back-links + content-bound + stamp-fresh + pins live)
check-capability-anchors OK exit 0
```

Property 5 exercises the xfail harness, so its pass is a live
confirmation that `test_resume_nontail_xfail` still fails-as-expected —
the #555 hole is still pinned, not silently closed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <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.

1 participant