Skip to content

proofs(front-a12): close #465 P2/P3, eliminate onHeaderModule, and complete zero-callback BSM refinement in BsmZeroCallback.lean - #469

Merged
CommaBot merged 3 commits into
mainfrom
feat/p3-front-a12-bsm-zero-callback-refinement
Dec 6, 2026
Merged

CommaBot merged 3 commits into
mainfrom
feat/p3-front-a12-bsm-zero-callback-refinement

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Front A-12 closes all 4 review items from PR #465 (1 P2 + 3 P3), structurally eliminates onHeaderModule (and all s.currentModule = proj.modAtom obligations across onMain / onPredHoisted / onFailureRegion), and introduces proofs/BeamcProofs/Opt/Extracted/BsmZeroCallback.lean to eliminate ALL remaining per-step in-function callbacks (onMain, onPredHoisted, onFailureRegion) toward a 100% zero-callback end-to-end refinement theorem for BsmExt.opt.bsm.hoist_starts on general CoreToFullSsa.program.

Strictly pure Lean (proofs/BeamcProofs/** + proofs/BeamcProofs.lean only; 0 Rust / 0 BeamcCore/** edits / 0 *Cbv transitive dependencies).

1. Closed PR #465 Carbon Review Items (1 P2 + 3 P3)

  • P2-1 (BsmProgramEvidence.lean):
    • Removed redundant hpidxHdr / hparamAt / hparamLast hypotheses from hoistProgram_predHoisted_of_plainPred, deriving them internally via last_parameter_shape edit.sourceSlot edit.slotPresent;
    • Removed redundant entryParamsEq field from HoistExtProgramLayout, replacing it with the derived theorem HoistExtProgramLayout.entryParamsEq (from proj.entryS + proj.entryT + proj.blkParamsEq 0#u32).
  • P3-2 (BsmProgramEvidence.lean): Factored the 3× repeated in-function callback signatures into structure HoistInFunctionCallbacks.
  • P3-3 (BsmProgramEvidence.lean): Fixed the two header comments (0 BeamcCore/** edits + 0 *Cbv transitive dependencies, and hoistProgram_predHoisted_of_plainPred).
  • P3-1 (BsmProgramEvidence.lean): Documented the natural external / sourceCore.exports non-interference and arity preconditions in HoistExtProgramLayout.

2. Complete Elimination of onHeaderModule & s.currentModule = proj.modAtom

  • Added s.currentModule = before.mod_atom.val to HoistFrameMeta (BsmRefinement.lean), cS.frame.point.modAtom = before.mod_atom.val to HoistContRel.{inMain, inFailure} (BsmRefinement.lean), sp.modAtom = before.mod_atom.val to HoistCalleeEntry.toOptimized (BsmWholeFunction.lean), and modAtomEq : modAtom = before.mod_atom.val to HoistFuncProjection (BsmWholeFunction.lean).
  • Deleted onHeaderModule from HoistWholeFunctionEvidence and HoistInFunctionCallbacks, and deleted s.currentModule = proj.modAtom from onMain, onPredHoisted, and onFailureRegion.

3. Zero-Callback End-to-End Refinement (proofs/BeamcProofs/Opt/Extracted/BsmZeroCallback.lean)

  • Constructive Dichotomies:
    • started_or_rejectsStart: every (proc, v) constructively splits into (∃ addr proc', Started proc v addr proc') ∨ RejectsStart proc v;
    • failureReachable_ne_header: FailureReachable before h (UScalar.cast .Usize edit.fail) b → b.val ≠ h.val directly from edit.distinct.
  • Unified In-Function Call & RedsCheck Discharge:
    • hoistInFunc_invokeExport_match, hoistInFunc_callLocal_match, hoistInFunc_callExt_match, hoistInFunc_callFun_match, hoistInFunc_apply_match, hoistInFunc_redsCheck_match, and hoistInFunc_controlContinuations constructively discharge ALL 6 fields of ControlInstrContinuations and ALL 4 tail-call continuations in HoistMainOrFailureSite.retainedTerm.
  • Constructive Failure-Path Segment Builder:
    • hoistZero_build_failed_segment: constructively executes a plain predecessor's Jump h args plus the entire header prefix 0 .. edit.index - 1 (HeaderPrefix: .RedsCheck / .Line via header_start_shape edit.selected) to build Segment runtime source s costs atHeader, StartAt source before atHeader ..., HoistFrameMeta, SameProcess, and ValuesExcept ... (HoistExemptFailure before edit).
  • Pure Static Layout & Zero-Callback Assembly:
    • HoistFuncStaticLayout (100% state-/step-/callback-free static IR/CFG/projection bundle) + minimal 4-field HoistReachableInvariants → hoistZero_onPredHoisted, hoistZero_onMainOrFailure, hoistZero_callbacks, hoistZero_wholeFunctionLink, hoistZero_toLinked, hoistZero_refines, and multi-edit loop-level hoistZero_semantic_refinement_ext (wiring BsmExt.opt.bsm.hoist_starts).

Verification

  • lake build BeamcProofs.Opt.Extracted.BsmRefinement BeamcProofs.Opt.Extracted.BsmWholeFunction BeamcProofs.Opt.Extracted.BsmProgramEvidence BeamcProofs.Opt.Extracted.BsmZeroCallback BeamcProofs.Opt.Extracted.PipelineDriverInline BeamcProofs.Opt.FullPassSound.ExtractedPassFullTrace BeamcProofs.Opt.FullPassSound.All12.ExtractedStages: 4,322 jobs succeeded, 0 errors, 0 warnings in all modified/new files.
  • bash proofs/scripts/audit.sh --static: OK (1,034 proof files + 26 model files).
  • Transitive *Cbv import check on BeamcProofs.Opt.Extracted.BsmZeroCallback: 211 transitive modules, Cbv=[].
  • #print axioms on all 12 public theorems in BsmZeroCallback: only [propext, Classical.choice, Quot.sound].

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…mplete zero-callback BSM refinement in BsmZeroCallback.lean
…(P1-1) and gate inputNotHdrParam by FailureReachable (P1-2)
…Param), P2-1 (RewriteSubst.lookup), and P3-1 (CoreToFullSsa.slot_injective)
@CommaBot
CommaBot merged commit e06edee into main Dec 6, 2026
1 check passed
@CommaBot
CommaBot deleted the feat/p3-front-a12-bsm-zero-callback-refinement branch December 6, 2026 01:03
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