docs: Add exit-semantics design documentation#1080
Open
seebees wants to merge 1 commit intostrata-org:mainfrom
Open
docs: Add exit-semantics design documentation#1080seebees wants to merge 1 commit intostrata-org:mainfrom
seebees wants to merge 1 commit intostrata-org:mainfrom
Conversation
Adds a spec and decisions document for the small-step semantics of `exit` and labeled blocks in `Strata/DL/Imperative/StmtSemantics.lean`, plus two thin Lean files giving each spec requirement a descriptive public name. ## Documentation (`docs/design/exit-semantics/`) The spec uses RFC 2119 normative language only where an obligation maps to a specific Lean construct: - Preservation of well-formedness by every step, discharged by `step_preserves_exitsCoveredByBlocks`. - No-escape (exit does not leave a well-formed procedure body), discharged by `exitsCoveredByBlocks_noEscape` and its statement-list companion. Per-transition behavior is documented descriptively, since each transition is directly realized by a constructor of `StepStmt` and does not carry a separate normative obligation. The decisions document records six design choices and a future-work section, incorporating feedback from strata-org#993 and strata-org#869. ## Lean - `ExitProperties.lean` — seven per-transition lemmas (`exit_preserves_env`, `exit_skips_remaining`, `matching_block_consumes`, `nonmatching_exit_propagates`, `normal_block_completion`, `unlabeled_exit_consumed`, `block_body_steps`) plus two multi-step companions (`exit_eval`, `matching_block_eval`). - `ExitWellFormedness.lean` — `exit_target_in_labels` and `exit_none_has_enclosing` over `Stmt.exitsCoveredByBlocks`. Each lemma is a single-line proof over an existing `StepStmt` constructor or `Stmt.exitsCoveredByBlocks` definitional equation. No new mathematical content. Zero sorries. Also promotes `step_preserves_exitsCoveredByBlocks` from private to public so the spec's §4.3 requirement cites a public symbol. Tracks: strata-org#993
867c5d2 to
b28fd4d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a spec and decisions document for the small-step semantics of
exitand labeled blocks inStrata/DL/Imperative/StmtSemantics.lean.The spec uses RFC 2119 normative language only where an obligation maps to a specific Lean construct:
step_preserves_exitsCoveredByBlocks.exitsCoveredByBlocks_noEscapeand its statement-list companion.Per-transition behavior is documented descriptively, since each transition is directly realized by a constructor of
StepStmtand does not carry a separate normative obligation.The decisions document records six design choices and a future-work section, incorporating feedback from #993 and #869.
Tracks: #993
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.