Add contract and transparency pass#16
Draft
keyboardDrummer wants to merge 317 commits intomainfrom
Draft
Conversation
…ons' into issue-924-contract-and-proof-pass
…opaqueSpec - Changed procedureToOp to produce opaqueSpec op with ensures and modifies as nested args (matching the grammar), instead of separate top-level args - Added missing opaque keyword in MapStmtExprTest and T2_ModifiesClauses tests
At most call sites, a Variable was wrapped in StmtExpr.Var to create a StmtExprMd, then immediately unwrapped by stmtExprToVar. Instead, keep the VariableMd and use it directly in Assign targets. - Rename freeVar to freeVarMd (returns VariableMd) and add freeVarExpr (returns StmtExprMd) for expression positions - Change maybeExceptVar and nullcall_var to VariableMd - Use mkVariableMd directly for targetExpr and fieldAccess - stmtExprToVar is retained only for the 2 call sites where the StmtExprMd comes from translateExpr
…ent procedures (strata-org#1076) ### Changes #### Functional - Add a resolution check that disallows transparent bodies on non-functional procedures. A procedure declared with `procedure` (not `function`) that has no `opaque` clause now emits a diagnostic: `transparent bodies on procedures are not yet supported. Add 'opaque'; to make the procedure opaque` - When a procedure has a body, always use the body to determine whether it has heap parameters, instead of always using the modifies clause - Improve error message when modifies clause can not be proven, so it refers to "modifies clause" instead of "assertion" #### Bug fixes and debugging improvements - Fix a bug in Laurel's Resolution.lean that caused a later error "could not infer type" - Change the error "could not infer type" to "bug in Laurel: unknown type encountered while translating to Core" - Replace many usages of empty source locations with concrete ones - Fix defaults for LaurelTranslateOptions and LaurelVerifyOptions ### Testing - Many existing tests have been updated to add `opaque` - Added the test `T20_TransparentBodyError.lean` --------- Co-authored-by: keyboardDrummer-bot <keyboardDrummer-bot@users.noreply.github.com> Co-authored-by: Remy Willems <rwillems@amazon.com> Co-authored-by: Michael Tautschnig <mt@debian.org> Co-authored-by: Shilpi Goel <shigoel@gmail.com> Co-authored-by: Robin Salkeld <salkeldr@amazon.com> Co-authored-by: thanhnguyen-aws <ntson@amazon.com>
…ign-variable-type
…odies' into issue-21-assign-variable-type
…odies' into issue-21-assign-variable-type
…nto issue-924-contract-and-proof-pass
da18905 to
3ce6673
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.
Builds on:
No longer, maybe we can close this:
Summary
Add these passes:
returntoexitstatements, needed for the next pass.$asFunction. If a Core procedure is marked as transparent, attempt to generate a functional version of it, where assertions are erased and all calls are to functional versions. Tie the functional version to the procedure using a free postcondition.The effect of the contract and transparency pass:
The combined effect of 2 and 4 is that there is no more difference between Laurel functions and transparent procedures.
TODO
FunctionsAndProofsProgramtoUnorderedCoreWithLaurelTypesandFunctionsAndProof.leantoTransparencyPass.leanFollow-up work