-
-
Notifications
You must be signed in to change notification settings - Fork 0
tracking: Lean and Why3 (experimental) backends drop return control flow — early returns silently mis-emitted #624
Copy link
Copy link
Open
Labels
choreRoutine maintenance with no behaviour changeRoutine maintenance with no behaviour changefeeds:valence-shellFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes thereFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes theremeta:umbrellaParent issue aggregating child issuesParent issue aggregating child issuespriority:p3Low - nice to haveLow - nice to haveproofsFormal verification: Agda, Coq, Idris, Lean, Z3/SMT, axiom debtFormal verification: Agda, Coq, Idris, Lean, Z3/SMT, axiom debtscope:repoConfined to this repositoryConfined to this repositorystatus:readyFully specified and ready to be picked upFully specified and ready to be picked up
Description
Activity
Metadata
Metadata
Assignees
Labels
choreRoutine maintenance with no behaviour changeRoutine maintenance with no behaviour changefeeds:valence-shellFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes thereFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes theremeta:umbrellaParent issue aggregating child issuesParent issue aggregating child issuespriority:p3Low - nice to haveLow - nice to haveproofsFormal verification: Agda, Coq, Idris, Lean, Z3/SMT, axiom debtFormal verification: Agda, Coq, Idris, Lean, Z3/SMT, axiom debtscope:repoConfined to this repositoryConfined to this repositorystatus:readyFully specified and ready to be picked upFully specified and ready to be picked up
What
The Lean and Why3 source-emitter backends (both experimental per
docs/CAPABILITY-MATRIX.adoc) lower areturnexpression to just its operand:lib/lean_codegen.ml:62—| ExprReturn (Some e) -> gen_expr elib/why3_codegen.ml:68—| ExprReturn (Some e) -> gen_expr eThis discards the non-local control transfer. For a tail-position
return ein a pure expression target that is harmless, but for a statement-position / earlyreturn(e.g. a guard that returns before the rest of the block) the emitted Lean/Why3 keeps executing the remainder of the block — a silent wrong-output miscompile.Class
A broader codegen-honesty gap than #555 (which fenced effect handlers). Flagged, not yet fenced. Low priority — these are experimental backends, not the reference WASM target — but it violates the project's "fail loud, never silent" rule.
Suggested fix
Mirror the #555 remedy: emit a loud
UnsupportedFeaturefor early/statement-positionreturnin these backends until real control flow is modelled (e.g. lower to an exception/option in Why3, or ado-block early-exit in Lean). Cheapest correct step is the loud fence.Status
Listed under "Still open" in
docs/SOUNDNESS.adoc.Filed from the docs-soundness pass (PR #622).