Skip to content

feat(rung-3): a region crossing is a cut; K-4 laws over TropicalNat - #37

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/new-session-up7579
Oct 14, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
claude/new-session-up7579

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Stack 2/3 for MRC-01 (rung 3). Stack 1/3, the toolchain move to v4.34.0, merged as #36. Next: …-docs (correspondence table, falsifier, STATE/ROADMAP), stacked on this branch.

Marches/Cut.lean (new)

A cut of the region DAG is a set of regions closed under predecessors: every region that can cross into the cut is in it. This is classical downward closure. It is not choreographic-types' party-indexed Consistent, which is a merge condition at choices; the next PR in the stack records that as a falsifier finding.

Theorem Says
Cut.edge_crosses_past In an acyclic graph every edge r → r' leaves the principal cut ↓r.
Cut.path_back_crosses_no_cut Negative: an edge on a cycle crosses no cut. Acyclic is load-bearing.
DiscSys.trace_cross_crosses_cut Every crossing in a well-typed composite trace crosses a cut that holds the trace's start and not its end.
DiscSys.trace_mem_back, trace_inside A trace that ends in a cut was inside it all along, and fired every label inside it.
DiscSys.no_reentry A trace that leaves a cut never re-enters it. This is no_back_cross lifted from one interface to every cut.
DiscSys.composeCut Prefix-closure: compose restricted to a cut prefix is a Discipline.
composeCut_trace_embed / composeCut_trace_reflect Its traces are exactly the composite's traces that end in the prefix: the frontier's future is irrelevant to the prefix.
trace_cross_crosses_cut, trace_stays_in_B The same results for the two-region Interface of Compose.lean, read as the 2-node DAG Reassembly.boolUp.
CutExhibit.* A concrete twoTropical trace that instantiates the theorems, plus a negative control on a self-loop.

Marches/Tropical.lean: the grade at the crossing

TropicalGrade reads TropicalNat as a (min,+) grade: alt = min, seq = +, one = 0.

  • K-4 laws: seq_unitl (𝟙 ⊗ x = x) and alt_idem (x ⊕ x = x).
  • S-3 inside marches: better_reverses_altLe. better runs with cost, while the ⊕-induced order runs against it, as in resource-algebra's Loss and opposite to its MaxPlus. altLe_one puts 𝟙 at the top, as Loss's fin 0. s3_witness uses the same numbers as resource-algebra's S-3 (2 ≼ 1).
  • The Agda side is not imported or re-declared. altLe is marches' own order, and the doc comment says so.

Evidence (local, Lean v4.34.0)

$ rm -rf .lake && lake build
Build completed successfully (15 jobs).
$ grep -rnw sorry Marches/ Marches.lean ; echo $?
1
$ lake env lean Marches/BadGadget.lean
[(false, false), (true, true), (false, false), (true, true)]

#print axioms over all 45 declarations added in Cut.lean and TropicalGrade: every one reports does not depend on any axioms. I re-proved three grade lemmas that had picked up propext through core Nat lemmas, to match the existing kernel, which is also axiom-free.

grep -ni converg Marches/Cut.lean → only the delimitation line (45).

CI: two red checks that are not this PR's

  • CI (the lake build + no-sorries job) ends in startup_failure. This has happened on every run since the Dependabot bump chore(deps): bump the actions group with 2 updates #34 (runs 78–81, including on main). That bump moved ci.yml to leanprover/lean-action@v1.6.1 and codeql.yml to codeql-action@v4.38.2, but .github/workflows/actions.lock still pins @v1.6.0 / @v4.38.0. The lockfile is enforced at startup ("Using locked action versions from the workflow's lockfile"). Fix: re-run gh actions-lock on main, as chore(actions): relock drifted action pins #25 did. I have not hand-edited the machine-generated lockfile. Until that lands, the local gate output above is the build evidence.
  • estate-audit fails at the Required Files Gate. This is red on main since at least run 41 (1 Oct). Reproduced locally against cicd-suite@5a10b72: the gate runs under bash -e -o pipefail, and for this repo's comment-only .github/CODEOWNERS, functional_lines=$(grep -vE '^\s*(#|//|;|$)' "$f" | wc -l) selects no lines. grep exits 1, pipefail fails the assignment, and the step exits with no ::error::. That is the very case the gate's "Rule 1" means to allow. The fix belongs in hyperpolymath/cicd-suite, e.g. { grep -vE … "$f" || true; } | wc -l.

Status rows

New README rows are PROVEN by lake build, and "conditional" where they consume Acyclic. No cross-prover claim is made in this PR. Rung 3 stays OPEN.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX


Generated by Claude Code

Marches/Cut.lean (new): a cut of the region DAG is a set of regions
closed under predecessors.
- Cut.edge_crosses_past: in an acyclic graph every edge leaves the
  principal cut of its source; Cut.path_back_crosses_no_cut: an edge on a
  cycle crosses no cut, so Acyclic is load-bearing.
- DiscSys.trace_cross_crosses_cut: every crossing in a well-typed
  composite trace crosses a cut holding the trace's start, not its end.
- DiscSys.trace_mem_back / trace_inside / no_reentry: a trace ending in a
  cut was inside it all along; a trace that leaves a cut never re-enters
  (no_back_cross lifted from one interface to every cut).
- DiscSys.composeCut: compose restricted to a cut prefix is a Discipline
  (prefix-closure); composeCut_trace_embed / composeCut_trace_reflect: its
  traces are exactly the composite's traces that end in the prefix.
- Two-region Interface: trace_cross_crosses_cut, trace_stays_in_B.
- CutExhibit: a concrete twoTropical trace, and a negative control.

Marches/Tropical.lean: TropicalGrade reads TropicalNat as a (min,+)
grade. seq_unitl and alt_idem are the two laws K-CUT-LOSS uses (K-4).
better_reverses_altLe, altLe_one and s3_witness record that marches'
`better` runs against its own induced order (S-3 / W-4 direction).

Every new declaration depends on no axioms (#print axioms) and nothing
re-declares an Agda definition.

Gates: lake build -> Build completed successfully (15 jobs);
grep -rnw sorry empty; #eval orbit unchanged.

Rung: 3 (rung stays OPEN)

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

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

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 45 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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 47561225-a1fc-4bac-9763-850f24306666
📥 Commits

Reviewing files that changed from the base of the PR and between 1152b03 and 1ea9a85.

📒 Files selected for processing: 4
  • Marches.lean
  • Marches/Cut.lean
  • Marches/Tropical.lean
  • README.adoc
  • 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

Comment @coderabbitai help to get the list of available commands.

@hyperpolymath
hyperpolymath marked this pull request as ready for review October 14, 2026 01:22
@hyperpolymath
hyperpolymath merged commit 3ca64b4 into main Oct 14, 2026
7 of 8 checks passed
@hyperpolymath
hyperpolymath deleted the claude/new-session-up7579 branch October 14, 2026 01:22
hyperpolymath pushed a commit that referenced this pull request Oct 14, 2026
hyperpolymath added a commit that referenced this pull request Oct 14, 2026
…tes (#38)

**Stack 3/3 for MRC-01 (rung 3).** 1/3 merged as
#36 (toolchain) and 2/3 as #37
(`Marches/Cut.lean` + K-4 laws). This branch was cut from #37's head
before its squash. `main` has since been merged in, without rewriting
history. The squash tree is byte-identical to that head, so the diff
against `main` is only this PR's docs and shell glue, plus one Lean
comment (the `Tropical.lean` seam note).

## What

- **`docs/kcut-correspondence.adoc`**: marches' Lean names paired with
choreographic-types' Agda names, at pinned commits. It is a table, not a
link. Every pairing is **ASSUMED (port-and-reprove)**, in
resource-algebra's M-2 idiom. Rows KC-1…KC-8 cover cuts, downward
closure, K-5 (`cut-projectable`), K-2 (`proj-cut`), the K-4 laws, the
S-3/W-4 direction, and M-2.
- **`scripts/fetch-siblings.sh`**: clones the siblings at their pins
into `_build/dependencies` (now git-ignored), using the
choreographic-types pattern. Pins: choreographic-types `edb784a`,
resource-algebra `cf9235c`, tropical-types `e172f8a`.
- **`scripts/check-correspondence.sh`**: the mechanical part. It checks
that every Lean name cited exists in this build (`#check`), that every
Agda name exists at its pin, and that every pin appears in the table.
Negative control: a fabricated Lean name and a fabricated Agda name go
through the same checks and must be refused. It checks **names, not
meanings**.
- **`FALSIFIERS.adoc` F6**: "the correspondence is nominal." It **fires
on one proposed row**. At `edb784a`, Agda's `Consistent p c`
(`Projection.agda:89`) is a party-indexed merge condition at choices,
and marches has no parties. So MRC-01's `Acyclic ↔ Consistent` pairing
is withdrawn (KC-3, status OPEN). F6 stays open, narrowed.
- **`Marches/Tropical.lean` seam note**: now points at resource-algebra
M-2, and records where `TropicalAdapterPath.lean` actually lives
(below).
- **`ROADMAP.adoc` rung 3**: now a gated table. 3a–3c are met; 3d
(TropicalAdapterPath import), 3e (echo-types bridge) and 3f (postern)
are OPEN, so the rung stays OPEN and there is no tag.
- **`STATE.adoc`**: records the session. **`README`** gets one ASSUMED
row and a note on the check script; **`LIMITATIONS`** gets one bullet;
**`ARCHITECTURE`** lists `docs/` and `scripts/`.

## Citation corrections found while reading the pins

- T-2's `receiver-knows` / `sender-knows` are in
`src/Choreographic/Instances.agda` (lines 172 and 177), not
`Transport.agda`. `Transport.agda` holds the generic `knows-local-cut`.
- `TropicalAdapterPath.lean` is in **hyperpolymath/tropical-types**. Its
lake package is named `tropical-resource-typing`, which is the name the
ROADMAP used. It is pinned to Lean **v4.13.0**, so expect friction when
3d imports it into v4.34.0.
- marches' `TropicalNat` is min-plus, so it sits with `Loss`, not
`MaxPlus`. It is not one of M-2's two (max-plus) objects (KC-8).

## Evidence (this head)

```
$ lake build
Build completed successfully (15 jobs).
$ grep -rnw sorry Marches/ Marches.lean ; echo $?
1
$ lake env lean Marches/BadGadget.lean
[(false, false), (true, true), (false, false), (true, true)]
$ scripts/check-correspondence.sh
choreographic-types at edb784a
resource-algebra at cf9235c
tropical-types at e172f8a
PASS: 15 Lean names and 16 sibling names exist at the pins; both negative controls refused
$ shellcheck scripts/*.sh   # clean
$ grep -ni converg Marches/Cut.lean docs/kcut-correspondence.adoc scripts/*.sh
Marches/Cut.lean:45:  not protocol convergence; agda-routing owns that ground (LIMITATIONS.adoc).
docs/kcut-correspondence.adoc:20:Delimitation: nothing here is a convergence claim; agda-routing owns that
```

Mutation test: I renamed one Lean name, one Agda name and one pin in the
doc. The script printed `MISSING (Lean)`, `MISSING (sibling)` and `PIN
NOT IN TABLE`, then `FAIL` with exit 1. Restoring the doc gives `PASS`
again.

## postern

Not reachable from this account on 2026-10-14 (`add_repo`: not found or
no access; no `list_repos` match). No cross-issue was filed. The MRC-01
import plan is kept in the correspondence doc, ready to file.

## CI

The same two pre-existing red checks as on `main` apply here, and
neither is caused by this PR:

- `CI` ends in `startup_failure`: `actions.lock` has drifted since
#34. The fix is `gh actions-lock`, as in
#25.
- `estate-audit` fails because of a cicd-suite pipefail bug on a
comment-only CODEOWNERS.

The full diagnosis is in #37.
`check-correspondence.sh` needs network access, so it is not wired into
CI here.

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

https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Oct 14, 2026
Follow-up to the CodeRabbit review on #36 (thread
on `lean-toolchain`, flagged Major / security): pin v4.34.1, the patched
release of the 4.34 line.

## Verified against the primary source, not the bot's summary

`git log v4.34.0..v4.34.1` in leanprover/lean4 shows:

- three runtime reference-count fixes:
  - leanprover/lean4#15241: preserve sticky counts in deletion cascades
- leanprover/lean4#15288: mark the children of objects whose
single-threaded count overflowed
- leanprover/lean4#15307: panic instead of wrapping counts in
`sharecommon_quick_fn`
- a `BitVec.ofNatClamp` backport
- `chore: prepare release` (`5045d00`, 2026-09-24)

marches checks only its own proofs, not untrusted input, so the
practical risk was low. Still, this is a same-line patch bump, it costs
nothing, and it keeps the estate's 4.34 soundness floor on the patched
build.

## Change

- `lean-toolchain`: `v4.34.0` → `v4.34.1`
- `README.adoc`: the two version mentions
- `STATE.adoc`: a dated entry. The v4.34.0 results are now marked
historical.

No source change.

## Gates (v4.34.1)

```
$ rm -rf .lake && lake build
Build completed successfully (15 jobs).
$ grep -rnw sorry Marches/ Marches.lean ; echo $?
1
$ lake env lean Marches/BadGadget.lean
[(false, false), (true, true), (false, false), (true, true)]
```

## Note on the stack

#38 (rung-3 docs) is independent of this PR. Both
add a `STATE.adoc` entry at the top, so whichever merges second will
need a trivial merge, which I'll handle.

CI here shows the same two pre-existing reds as `main` (`CI`
`startup_failure` from `actions.lock` drift, and `estate-audit` from the
cicd-suite pipefail bug). Both are diagnosed in
#37.

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

https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX

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

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