Skip to content

Lean packet and transaction refinement foundation - #28

Merged
Th0rgal merged 6 commits into
mainfrom
codex/lean-refinement-foundation-1
Jul 28, 2026
Merged

Lean packet and transaction refinement foundation#28
Th0rgal merged 6 commits into
mainfrom
codex/lean-refinement-foundation-1

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • add stable checksum-parametric Lean request/response envelope interfaces
  • prove canonical request/response round trips and leading validation precedence
  • add a pure transaction lifecycle model for staging, RETIRE, abort, and reset
  • prove atomic staging, commit/mismatch behavior, and exactly-once retirement
  • add executable examples, theorem inventory, proof-boundary notes, and refreshed checksums

Scope boundaries

This PR does not change SystemVerilog, FPGA files, Python production semantics,
or the BLAKE3 protocol. The packet checksum remains an explicit refinement seam:
this slice does not claim a CRC-32 correctness theorem, an oracle refinement,
or an RTL/netlist refinement.

Validation

  • exact base: 2fa58d4d00e007dbd806bf459db77ee643557cf5
  • head: 3f4499ab023379567d1af3810ddeaa7b379dc7df
  • forbidden global sorry|admit|axiom|unsafe scan: exit 0
  • new-module native_decide scan: exit 0
  • cd lean && lake build: exit 0
  • cd lean && lake build LeanVMBMinCore: exit 0
  • python3 tools/generate_checksums.py --check: exit 0
  • independent remote Lean job 90210396329 on node GitHub Actions 1000018601: success (exit 0) at exact head

Note

Low Risk
Changes are confined to Lean proofs and documentation; production SystemVerilog, host runtime, and protocol transport are untouched, and the docs state no CRC-32 or RTL refinement claims yet.

Overview
Adds a Lean formal layer for LSC-1 v1 packet envelopes and transaction lifecycle, without changing RTL, host Python, or FPGA artifacts.

Packet.lean models parsed request/response wires with a checksum-parametric encode/decode API (CRC-32 left as a later refinement seam). It proves round-trip correctness for in-cap payloads and ordered request validation precedence (SOF → length cap → checksum → version → flags).

Transaction.lean is a pure functional stage / RETIRE / abort / reset model where instruction semantics supply proposed Transition values. Proved properties include atomic staging, index-range rejection, abort without committing, matching vs mismatched retirement, reset, and exactly-once successful retirement.

Docs add a THEOREM_INVENTORY, a proof-boundaries row and status ledger entry for this slice, and lean/README module notes; SHA256SUMS is refreshed. Open work (byte-stream decode, per-opcode payloads, CRC-32 instantiation, oracle/RTL refinement) is explicitly scoped out.

Reviewed by Cursor Bugbot for commit 965317c. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b9c973f6-0d74-42de-9833-723801c7184d)

@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: 3f4499ab02

ℹ️ 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 lean/LeanVMBMinCore/Packet.lean
Comment thread lean/LeanVMBMinCore/Packet.lean
@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_77327010-8959-4da6-82f7-1ba5e2bf49c5)

@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: 3441895750

ℹ️ 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 lean/LeanVMBMinCore/Transaction.lean
@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5d0621d1-7d0c-4337-bb22-35af48d6de4d)

@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: 287ba3f301

ℹ️ 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 lean/LeanVMBMinCore/Transaction.lean Outdated
@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_1de86faa-c54a-4487-8b11-3a8c5e51df05)

@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_77479a21-e538-4f8c-a10b-3383f4376b7d)

@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: 965317c464

ℹ️ 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 lean/LeanVMBMinCore/Transaction.lean Outdated
@Th0rgal
Th0rgal merged commit fda85f5 into main Jul 28, 2026
11 of 12 checks passed
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