Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
391 commits
Select commit Hold shift + click to select a range
ad07e73
Fix build errors after merge: update AST usage and grammar
keyboardDrummer-bot Apr 23, 2026
df6ccdc
Disallow transparent statement bodies (rebased on main)
keyboardDrummer-bot Apr 23, 2026
c4878eb
Merge remote-tracking branch 'origin/disallow-transparent-statement-b…
keyboardDrummer-bot Apr 23, 2026
674fcfa
Fix HeapParameterization and LaurelToCoreTranslator for new Variable-…
keyboardDrummer-bot Apr 23, 2026
2212161
Add missing 'opaque' keyword to Any_len_pos procedure
keyboardDrummer-bot Apr 23, 2026
66bc82b
Fix pre-existing test failures in DictNoneTest and AnalyzeLaurelTest
keyboardDrummer-bot Apr 23, 2026
7f8ad0e
Fix CI: skip Java TestGen test 12 gracefully when javac or jar is mis…
keyboardDrummer-bot Apr 23, 2026
0feec54
Add Resolution check for assign target count, remove LaurelToCore pad…
keyboardDrummer-bot Apr 23, 2026
6f1a531
Revert "Fix Python->Laurel: Havoc callee or Heap after unmodeled Inst…
keyboardDrummer Apr 23, 2026
c253ba7
Merge branch 'issue-21-assign-variable-type' of github.com:keyboardDr…
keyboardDrummer Apr 23, 2026
fea039a
Fixes
keyboardDrummer Apr 23, 2026
2b0b010
Resolve merge conflicts in PythonToLaurel and fix test expectations
keyboardDrummer-bot Apr 23, 2026
a5303ef
Fix CI failures: contract pass, grammar roundtrip, and test updates
keyboardDrummer-bot Apr 23, 2026
d31c0df
:Revert "Fix pre-existing test failures in DictNoneTest and AnalyzeLa…
keyboardDrummer Apr 23, 2026
dfc8fdf
Revert "Fix CI: skip Java TestGen test 12 gracefully when javac or ja…
keyboardDrummer Apr 23, 2026
70717c3
Merge branch 'issue-21-assign-variable-type' of github.com:keyboardDr…
keyboardDrummer Apr 23, 2026
185f9da
Use Declare targets in Assign to eliminate extraDecls in HeapParamete…
keyboardDrummer-bot Apr 23, 2026
76d22d8
Fix merge issues with disallow-transparent-statement-bodies
keyboardDrummer-bot Apr 23, 2026
a38fd43
Fix pre-existing test failures in DictNoneTest and TestGen
keyboardDrummer-bot Apr 23, 2026
22d347b
Use Declare targets instead of extraDecls in HeapParameterization
keyboardDrummer-bot Apr 23, 2026
5c131f5
Fix DictNoneTest: handle expected error inside callback so test passe…
keyboardDrummer-bot Apr 23, 2026
779b2af
Add `modifies *` wildcard support to Laurel
keyboardDrummer-bot Apr 23, 2026
93af49b
Retry CI: all checks pass locally
keyboardDrummer-bot Apr 23, 2026
69316fd
Fix contract pass: use pure postcondition functions with output param…
keyboardDrummer-bot Apr 23, 2026
9475765
Fix pyAnalyze expected output for test_class_methods and test_class_w…
keyboardDrummer-bot Apr 23, 2026
36c7d7e
Fix doc build: add persist-credentials: false to checkout step
keyboardDrummer-bot Apr 23, 2026
b7debab
Fix implicit heap args in contract pass and eliminateMultipleOutputs
keyboardDrummer-bot Apr 23, 2026
3df9e8a
Merge branch 'main' into issue-21-assign-variable-type
keyboardDrummer Apr 23, 2026
4c2c951
Fix DictNoneTest and improve pipeline resolution error check
keyboardDrummer-bot Apr 23, 2026
d55020c
Address review comments
keyboardDrummer-bot Apr 23, 2026
29a460c
Merge branch 'main' into add-modifies-wildcard
shigoel Apr 23, 2026
f04db23
Fix heap parameter handling in HeapParameterization, ContractPass, an…
keyboardDrummer-bot Apr 23, 2026
33159ee
Fix DictNoneTest Test 6: len() rejection is an error, not a diagnostic
tautschnig Apr 23, 2026
b410bb7
Maintain all modifies clauses in concrete grammar translation
keyboardDrummer-bot Apr 23, 2026
6e6563a
Merge branch 'main' into issue-21-assign-variable-type and revert Dic…
keyboardDrummer-bot Apr 24, 2026
7fe1d09
Do not eleminate multipleOutputs
keyboardDrummer Apr 24, 2026
59d79fd
Merge strata-org/Strata#1034 (generalize multi-target assign)
keyboardDrummer-bot Apr 24, 2026
2ea8e82
Fix ContractPass: use .Quantifier .Forall instead of removed .Forall …
keyboardDrummer-bot Apr 24, 2026
202a3f9
Merge branch 'issue-924-contract-and-proof-pass' of github.com:keyboa…
keyboardDrummer Apr 24, 2026
4fa2eee
Apply suggestion from @Copilot
keyboardDrummer Apr 24, 2026
f32139d
Merge remote-tracking branch 'origin/tautschnig/DictNoneTest' into is…
keyboardDrummer Apr 24, 2026
873d9ad
Revert PR 978: https://github.com/strata-org/Strata/pull/978 (#1029)
keyboardDrummer Apr 23, 2026
50050a5
Add test for modifies * on transparent body (no ensures)
keyboardDrummer-bot Apr 24, 2026
143c09e
Merge branch 'main' into add-opaque-keyword
robin-aws Apr 24, 2026
c5ca718
Fix
keyboardDrummer Apr 27, 2026
e836f9d
Add test combining modifies c and modifies *
keyboardDrummer-bot Apr 27, 2026
a5b17b0
Merge remote-tracking branch 'origin/main' into issue-21-assign-varia…
keyboardDrummer Apr 27, 2026
a638b8c
Merge branch 'main' into add-modifies-wildcard
thanhnguyen-aws Apr 27, 2026
70f1012
Merge branch 'main' into add-modifies-wildcard
keyboardDrummer-bot Apr 28, 2026
9584b73
Merge upstream/main into issue-21-assign-variable-type, resolve confl…
keyboardDrummer-bot Apr 28, 2026
9be587d
Fix modifies wildcard tests for opaque keyword grammar
keyboardDrummer-bot Apr 28, 2026
f3e9511
Fix issues
keyboardDrummer Apr 28, 2026
3243df4
Merge branch 'add-modifies-wildcard' of github.com:strata-org/Strata …
keyboardDrummer Apr 28, 2026
e53d5e0
Remove temp files
keyboardDrummer Apr 28, 2026
6c549bd
Fix conflicts
keyboardDrummer Apr 28, 2026
d14b93e
Remove obsolete test
keyboardDrummer Apr 28, 2026
0b90c56
Fix test
keyboardDrummer Apr 28, 2026
36ece7d
Fix T22_MultipleReturns: add missing 'opaque' keyword
keyboardDrummer-bot Apr 28, 2026
6c5dcdb
Extract StmtExprMd.isWildcard predicate to eliminate duplication
keyboardDrummer-bot Apr 28, 2026
71a4357
Merge branch 'main' into add-modifies-wildcard
tautschnig Apr 28, 2026
9f96122
Add more resolution checks
keyboardDrummer Apr 28, 2026
afff624
Add Laurel tests for resolution kind-mismatch errors
keyboardDrummer-bot Apr 28, 2026
77b18a8
Merge upstream/main into issue-21-assign-variable-type, resolve confl…
keyboardDrummer-bot Apr 28, 2026
bcfccb6
Merge branch 'main' into moreResolutionChecks
olivier-aws Apr 29, 2026
fc6c280
Merge remote-tracking branch 'origin/moreResolutionChecks' into issue…
keyboardDrummer Apr 29, 2026
ea85952
Do not generate core on pass diagnostics
keyboardDrummer Apr 29, 2026
198034b
Merge commit 'fe4578675012~1' into disallow-transparent-statement-bodies
keyboardDrummer Apr 29, 2026
c318dea
Merge remote-tracking branch 'fork/add-opaque-keyword' into disallow-…
keyboardDrummer Apr 29, 2026
6e057c9
Merge commit 'fe4578675012' into disallow-transparent-statement-bodies
keyboardDrummer Apr 29, 2026
b0ea928
Merge branch 'main' into add-modifies-wildcard
keyboardDrummer-bot Apr 29, 2026
e5d9752
Merge remote-tracking branch 'origin/main' into disallow-transparent-…
keyboardDrummer Apr 29, 2026
2c94491
Fix test
keyboardDrummer Apr 29, 2026
feaa876
Fix: don't skip core translation when pass diagnostics exist
keyboardDrummer-bot Apr 29, 2026
83c490b
Fixes
keyboardDrummer Apr 29, 2026
6a1d196
Remove gitignore addition
keyboardDrummer Apr 29, 2026
4fb9d74
Revert "Fix: don't skip core translation when pass diagnostics exist"
keyboardDrummer Apr 29, 2026
87c87f3
Fix test
keyboardDrummer Apr 29, 2026
d9404aa
update tests
keyboardDrummer Apr 29, 2026
2b9f2b0
Update tests
keyboardDrummer Apr 29, 2026
b68b31a
Merge remote-tracking branch 'origin/add-modifies-wildcard' into disa…
keyboardDrummer Apr 29, 2026
5602edc
Merge commit 'eee972e813d16~1' into disallow-transparent-statement-bo…
keyboardDrummer Apr 29, 2026
63ed7df
Merge commit 'eee972e813d16' into disallow-transparent-statement-bodies
keyboardDrummer Apr 29, 2026
71a600a
Update test
keyboardDrummer Apr 29, 2026
6efab79
Fix tests
keyboardDrummer Apr 29, 2026
51661e0
Update test
keyboardDrummer Apr 29, 2026
28cae40
Fix tests
keyboardDrummer Apr 29, 2026
a1730d7
Merge remote-tracking branch 'origin/main' into issue-21-assign-varia…
keyboardDrummer Apr 29, 2026
541d596
Fixes
keyboardDrummer Apr 29, 2026
5914743
Improve modified diagnostic
keyboardDrummer Apr 29, 2026
ad76318
Fixes
keyboardDrummer Apr 29, 2026
fb859b8
Undo small change
keyboardDrummer Apr 29, 2026
664ab31
Update expect files
keyboardDrummer Apr 29, 2026
6694822
Undo fix to call to main, since it triggers a latent bug
keyboardDrummer Apr 29, 2026
178425c
Update tests
keyboardDrummer Apr 30, 2026
fe02be1
Merge branch 'main' into disallow-transparent-statement-bodies
keyboardDrummer Apr 30, 2026
6043f2f
Improve source location creation in InferHoleType
keyboardDrummer Apr 30, 2026
8a97cd7
More improvements to source locations
keyboardDrummer Apr 30, 2026
5cb4822
More debugging improvements
keyboardDrummer Apr 30, 2026
f22f29c
Fix bug in resolution
keyboardDrummer Apr 30, 2026
107b72a
Add compilation bug check
keyboardDrummer Apr 30, 2026
f1f783f
update commment
keyboardDrummer Apr 30, 2026
99630d7
Fix test
keyboardDrummer Apr 29, 2026
b0c1bdd
Merge branch 'disallow-transparent-statement-bodies' of github.com:st…
keyboardDrummer Apr 30, 2026
64daf7c
Merge branch 'main' into disallow-transparent-statement-bodies
keyboardDrummer Apr 30, 2026
373e6c4
Tweak in infer hole types
keyboardDrummer Apr 30, 2026
7493074
Merge branch 'disallow-transparent-statement-bodies' of github.com:st…
keyboardDrummer Apr 30, 2026
8834318
Remove unused code
keyboardDrummer Apr 30, 2026
02a895b
Add missing defineNameCheckDup
keyboardDrummer Apr 30, 2026
dbc9da8
Fixes
keyboardDrummer Apr 30, 2026
a42c339
Fixes
keyboardDrummer Apr 30, 2026
c091620
Refactoring
keyboardDrummer Apr 30, 2026
75c037c
Merge branch 'disallow-transparent-statement-bodies' of github.com:ke…
keyboardDrummer Apr 30, 2026
ee0e39b
Fix merge mistake
keyboardDrummer Apr 30, 2026
fd2988e
Revert "Fix test"
keyboardDrummer Apr 30, 2026
5fb8577
Merge branch 'main' into disallow-transparent-statement-bodies
keyboardDrummer Apr 30, 2026
da915bf
Merge issue-21-assign-variable-type into disallow-transparent-stateme…
keyboardDrummer-bot May 1, 2026
942ff8d
Merge origin/main into merge-1076-1077, resolve conflicts
keyboardDrummer-bot May 1, 2026
63c492c
Fix merge conflicts between PR #1076 and PR #1077
keyboardDrummer-bot May 1, 2026
a549f5f
Merge branch 'merge-1076-1077' into issue-924-contract-and-proof-pass
keyboardDrummer-bot May 1, 2026
7a30a9b
Update golden files for test_class_methods and test_class_with_methods
keyboardDrummer-bot May 1, 2026
836e8d1
Add opaque keyword to CBMC Laurel test files
keyboardDrummer-bot May 1, 2026
e8a39f5
Fix build errors from merge: update code for AstNode/Identifier field…
keyboardDrummer-bot May 1, 2026
abe3a68
Updates
keyboardDrummer May 1, 2026
4faec9a
Undo bad changes related to options
keyboardDrummer May 1, 2026
d0ee36d
Fix
keyboardDrummer May 1, 2026
36382ce
Bring back let-expression inlining pass
keyboardDrummer May 1, 2026
4369522
Test fixes
keyboardDrummer May 1, 2026
1a3e5be
Merge main into issue-21-assign-variable-type, resolve conflicts
keyboardDrummer-bot May 1, 2026
dbae896
Debug improvements
keyboardDrummer May 1, 2026
8ae0e3c
Fix
keyboardDrummer May 1, 2026
57708dc
Fixes
keyboardDrummer May 1, 2026
3fdd851
Remove special casing for assert and assume in liftImperativeExpressions
keyboardDrummer May 1, 2026
8f18a32
Generalize liftImperativeExpressions
keyboardDrummer May 1, 2026
0744a01
Address review feedback: naming, comments, error handling
keyboardDrummer-bot May 1, 2026
23846a4
Fix lint: add nopanic:ok suppression to stmtExprToVar
keyboardDrummer-bot May 1, 2026
3745ced
Address MikaelMayer review: fix InstanceCall bug, deduplicate call tr…
keyboardDrummer-bot May 1, 2026
0f9d668
Revert "Fix test"
keyboardDrummer May 1, 2026
07cb9f7
Recurse into Field target in collectExpr Assign case
keyboardDrummer-bot May 1, 2026
18b74e1
Merge branch 'issue-21-assign-variable-type' of github.com:strata-org…
keyboardDrummer May 1, 2026
5a85348
Add comment to early return
keyboardDrummer May 1, 2026
e672786
Merge branch 'main' into issue-21-assign-variable-type
keyboardDrummer May 1, 2026
63f1719
Remove Variable formatters from Laurel.lean
keyboardDrummer-bot May 1, 2026
29f181a
Fix doc comment inside do block causing build failure
keyboardDrummer-bot May 1, 2026
38e441e
Address review feedback: merge conflicts, inferArgsTyped arity check,…
keyboardDrummer-bot May 1, 2026
be7bb41
Reapply "Fix test"
keyboardDrummer May 1, 2026
3485da0
Merge branch 'main' into issue-21-assign-variable-type
keyboardDrummer May 1, 2026
3800ad0
Revert: restore servicelib_Storage_ label filter in AnalyzeLaurelTest
keyboardDrummer-bot May 1, 2026
4592a65
Refactor: avoid stmtExprToVar where Variable can be captured directly
keyboardDrummer-bot May 1, 2026
d6151eb
Review comment
keyboardDrummer May 2, 2026
a2503e6
Improvements related to free postconditions and the unordered part of…
keyboardDrummer May 3, 2026
698682e
T8_Postconditions passes now
keyboardDrummer May 3, 2026
346ff37
Replace fragile line-number reference in comment with case-name refer…
keyboardDrummer-bot May 4, 2026
964b2d6
update messages
keyboardDrummer May 4, 2026
fe42aba
Simplify a proof
keyboardDrummer May 4, 2026
7d53b9f
Refactoring
keyboardDrummer May 4, 2026
601512d
More comments
keyboardDrummer May 4, 2026
28eb58e
Merge remote-tracking branch 'fork/merge-1076-1077' into issue-21-ass…
keyboardDrummer May 4, 2026
224e1b7
Merge remote-tracking branch 'origin/disallow-transparent-statement-b…
keyboardDrummer May 4, 2026
5244d5e
Merge commit 'd95396fc61245' into issue-21-assign-variable-type
keyboardDrummer May 4, 2026
db66551
Check for multi-target function call
keyboardDrummer May 4, 2026
ec66975
Merge remote-tracking branch 'origin/disallow-transparent-statement-b…
keyboardDrummer May 4, 2026
828e362
Tweaks
keyboardDrummer May 4, 2026
aeb1f22
Add commit explaining the use of !
keyboardDrummer May 4, 2026
4e04832
Fix merge mistakes
keyboardDrummer May 4, 2026
6226226
Remove bareVar usages
keyboardDrummer May 4, 2026
39af273
Refactoring
keyboardDrummer May 4, 2026
a26fe05
Improve printing of Laurel blocks so newlines are inserted
keyboardDrummer May 4, 2026
3ce6673
Merge remote-tracking branch 'origin/issue-21-assign-variable-type' i…
keyboardDrummer May 4, 2026
2a27857
Improve testing code
keyboardDrummer May 4, 2026
74df61f
Update StrataTest/Languages/Laurel/Examples/Fundamentals/T20_Transpar…
keyboardDrummer May 4, 2026
a088f83
Fixes
keyboardDrummer May 4, 2026
7b9ba21
Some experiments with the lift pass
keyboardDrummer May 5, 2026
4d34998
Update test to expose HeapParameterization bug
keyboardDrummer May 5, 2026
7760c92
Add fix
keyboardDrummer May 5, 2026
f8acfc6
Update
keyboardDrummer May 5, 2026
39189f3
update comment
keyboardDrummer May 5, 2026
515f13d
Replace panic
keyboardDrummer May 5, 2026
4c72dc4
Fixes
keyboardDrummer May 5, 2026
9788a1b
Fix bug in ConstrainedTypeElim
keyboardDrummer May 5, 2026
60cedac
Merge branch 'main' into heapParamScopeBug
keyboardDrummer May 5, 2026
a5a6d5c
Fix test
keyboardDrummer May 5, 2026
702bf34
Update Strata/Languages/Laurel/LaurelCompilationPipeline.lean
keyboardDrummer May 5, 2026
906fe44
Fix oops
keyboardDrummer May 5, 2026
e9a84fb
Fixes, but this needs the heapParam fix as well
keyboardDrummer May 8, 2026
4732b2e
Update ContractPass to PR #34 design: functional $post with input+out…
keyboardDrummer-bot May 18, 2026
dd17265
Rename Build/ to IntermediatePrograms/ and fix trailing newline
keyboardDrummer-bot May 18, 2026
d5e90af
Add comment
keyboardDrummer May 18, 2026
b9db6ee
Fixes
keyboardDrummer May 18, 2026
1e1a89f
Fix bug in lifting pass
keyboardDrummer May 18, 2026
6fd3edf
Merge branch 'formatting-and-debugging-improvements' into issue-924-c…
keyboardDrummer May 19, 2026
87a87cd
Fixes
keyboardDrummer May 19, 2026
6e095dd
Remove some usages of bare
keyboardDrummer May 19, 2026
35b0c37
Fixes
keyboardDrummer May 19, 2026
06f14a1
Fixes
keyboardDrummer May 19, 2026
c2e5305
Fixes
keyboardDrummer May 19, 2026
1d9c088
Simplify second lifting to only work on procedures
keyboardDrummer May 19, 2026
31e9284
Fix related to quantifiers
keyboardDrummer May 19, 2026
5d89017
Test fixes
keyboardDrummer May 19, 2026
36ff47d
Resolution fix
keyboardDrummer May 19, 2026
83b19ee
Test fixes
keyboardDrummer May 19, 2026
b92c531
Fix related to axioms
keyboardDrummer May 19, 2026
66c9707
Refactor HeapParameterization to use list-returning traversal (#1192)
keyboardDrummer-bot May 20, 2026
426d53b
Remove unused mapStmtExprFlattenGoM and move wrapList to HeapParamete…
keyboardDrummer-bot May 20, 2026
b548999
Fix for short circuit operators
keyboardDrummer May 20, 2026
fc0dbcf
Add datatype constructor test functions in a separate pass
keyboardDrummer May 20, 2026
04f04fb
Fix test
keyboardDrummer May 20, 2026
30acc3d
Fix test
keyboardDrummer May 20, 2026
e01f41f
Fix consistency check: use dbg_trace instead of aborting pipeline
keyboardDrummer-bot May 20, 2026
c5aa92e
Tweaks
keyboardDrummer May 20, 2026
19e61a2
improve handling of free ensures
keyboardDrummer May 20, 2026
b5910c1
Update some python tests
keyboardDrummer May 20, 2026
d0f8349
Update test
keyboardDrummer May 20, 2026
9370033
Debugging improvements
keyboardDrummer May 20, 2026
d9d7889
Remove dbg_trace from consistency check
keyboardDrummer-bot May 20, 2026
1d54bda
Merge remote-tracking branch 'origin/main' into heapParamScopeBug
MikaelMayer May 20, 2026
b381cc0
Factor out heap variable name constants and move intermediate program…
MikaelMayer May 20, 2026
bcf4c4a
Merge remote-tracking branch 'origin/main' into heapParamScopeBug
MikaelMayer May 20, 2026
f5025ab
Fix to lifting ifthenelse
keyboardDrummer May 21, 2026
159c7b7
Fix
keyboardDrummer May 21, 2026
406697d
Fixes
keyboardDrummer May 21, 2026
9cae242
Merge commit '792abccc1d7~1' into issue-924-contract-and-proof-pass
keyboardDrummer May 21, 2026
7655175
Merge commit '792abccc1d7' into issue-924-contract-and-proof-pass
keyboardDrummer May 21, 2026
9721737
Merge remote-tracking branch 'origin/heapParamScopeBug' into issue-92…
keyboardDrummer May 21, 2026
bac51ff
Fix thing
keyboardDrummer May 21, 2026
7b6000a
Merge remote-tracking branch 'origin/main' into issue-924-contract-an…
keyboardDrummer May 21, 2026
62b0238
Merge remote-tracking branch 'origin/formatting-and-debugging-improve…
keyboardDrummer May 21, 2026
c5dfc77
Fix test
keyboardDrummer May 21, 2026
914d118
Fix
keyboardDrummer May 21, 2026
6415b7e
Fixes
keyboardDrummer May 21, 2026
254a9ab
TransparencyPass: convert transparent body to opaque with explicit ou…
keyboardDrummer-bot May 21, 2026
aba6ad5
update tests
keyboardDrummer May 21, 2026
fd184f6
Merge branch 'issue-924-contract-and-proof-pass' of github.com:keyboa…
keyboardDrummer May 21, 2026
f45111f
Update tests
keyboardDrummer May 21, 2026
0ba20d0
Fixes
keyboardDrummer May 22, 2026
ca73c59
Move expression return pass
keyboardDrummer May 22, 2026
c2c9520
Move contract pass to after transparency pass
keyboardDrummer May 22, 2026
84313cd
Fix
keyboardDrummer May 22, 2026
a6578b5
Fixes
keyboardDrummer May 22, 2026
fcdfb19
Fixes
keyboardDrummer May 22, 2026
3eca958
Fix test
keyboardDrummer May 22, 2026
553df90
Fixes
keyboardDrummer May 22, 2026
9cfc104
Fixes
keyboardDrummer May 22, 2026
681aff1
Fixes
keyboardDrummer May 22, 2026
e7f785b
Small fix
keyboardDrummer May 22, 2026
87b1590
Remove bad files
keyboardDrummer May 22, 2026
d6e2d7c
Fix test
keyboardDrummer May 22, 2026
1968387
TransparencyPass: convert transparent function body to Opaque with ex…
keyboardDrummer-bot May 22, 2026
7f9e5b9
Fix translation of Opaque function bodies after TransparencyPass change
keyboardDrummer-bot May 22, 2026
e511152
Fix: wrap expression-style bodies in Return when promoting transparen…
keyboardDrummer-bot May 22, 2026
2d7788f
Fix test failures from PrecondElim pass
keyboardDrummer-bot May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Strata/Languages/Core/Factory.lean
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def KnownLTys : LTys :=
t[real],
t[Triggers],
t[TriggerGroup],
t[errorVoid],
-- Note: t[bv<n>] elaborates to (.forAll [] .tcons "bitvec" <n>).
-- We can simply add the following here.
t[∀n. bitvec n],
Expand Down
4 changes: 2 additions & 2 deletions Strata/Languages/Core/ProcedureEval.lean
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ def eval (E : Env) (p : Procedure) : Env × Statistics :=
match check.attr with
| .Free =>
-- NOTE: A free postcondition is not checked.
-- We simply change a free-postcondition to "true", but
-- We simply change a free-postcondition to "assume true", but
-- keep a record in the metadata field.
-- TODO: Perhaps introduce an "opaque" expression construct
-- that hides the expression from the evaluator, allowing us
-- to retain the postcondition body instead of replacing it
-- with "true".
(.assert label (.true ())
(.assume label (.true ())
((Imperative.MetaData.pushElem
#[]
(.label label)
Expand Down
7 changes: 6 additions & 1 deletion Strata/Languages/Core/SMTEncoder.lean
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ def LMonoTy.toSMTType (E: Env) (ty : LMonoTy) (ctx : SMT.Context) (useArrayTheor
| .ftvar tyv => match ctx.tySubst.find? tyv with
| .some termTy =>
.ok (termTy, ctx)
| _ => .error f!"Unimplemented encoding for type var {tyv}"
| _ =>
-- Unresolved type variables can arise from polymorphic
-- precondition assertions (PrecondElim) where the element
-- type is unconstrained. Default to `int` since the
-- assertion's semantics are independent of the type.
.ok (.int, ctx)

def LMonoTys.toSMTType (E: Env) (args : LMonoTys) (ctx : SMT.Context) (useArrayTheory : Bool := false) :
Except Format ((List TermType) × SMT.Context) := do
Expand Down
550 changes: 550 additions & 0 deletions Strata/Languages/Laurel/ContractPass.lean

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions Strata/Languages/Laurel/CoreDefinitionsForLaurel.lean
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@ program Laurel;

datatype LaurelResolutionErrorPlaceholder {}
datatype Float64IsNotSupportedYet {}
datatype LaurelUnit { MkLaurelUnit() }

// The types for these Map functions are incorrect.
// We'll fix them when Laurel supports polymorphism
function select(map: int, key: int) : int
// And then we can remove the datatype Box as well
// And remove the hacky filter in HeapParameterization
datatype Box { MkBox() }

function select(map: int, key: int) : Box
external;

function update(map: int, key: int, value: int) : int
function update(map: int, key: int, value: int) : Box
external;

function const(value: int) : int
function const(value: int) : Box
external;

#end
Expand Down
142 changes: 82 additions & 60 deletions Strata/Languages/Laurel/CoreGroupingAndOrdering.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
-/

module
public import Strata.Languages.Laurel.Laurel
public import Strata.Languages.Laurel.TransparencyPass
import Strata.DL.Lambda.LExpr
import Strata.DDM.Util.Graph.Tarjan
import Strata.Languages.Laurel.Grammar.AbstractToConcreteTreeTranslator

/-!
## Grouping and Ordering for Core Translation

Utilities for computing the grouping and topological ordering of Laurel
declarations before they are emitted as Strata Core declarations.

- `groupDatatypesByScc` — groups mutually recursive datatypes into SCC groups
using Tarjan's SCC algorithm.
- `computeSccDecls` — builds the procedure call graph, runs Tarjan's SCC
algorithm, and returns each SCC as a list of procedures paired with a flag
indicating whether the SCC is recursive. The result is in reverse topological
Expand Down Expand Up @@ -90,7 +89,7 @@ def collectStaticCallNames (expr : StmtExprMd) : List String :=
| .InstanceCall t _ args =>
collectStaticCallNames t ++ args.flatMap (fun a => collectStaticCallNames a)
| .Old v | .Fresh v | .Assume v => collectStaticCallNames v
| .Assert ⟨cond, _summary⟩ => collectStaticCallNames cond
| .Assert ⟨cond, _summary, _⟩ => collectStaticCallNames cond
| .ProveBy v p => collectStaticCallNames v ++ collectStaticCallNames p
| .ReferenceEquals l r => collectStaticCallNames l ++ collectStaticCallNames r
| .AsType t _ | .IsType t _ => collectStaticCallNames t
Expand All @@ -113,27 +112,24 @@ Build the procedure call graph, run Tarjan's SCC algorithm, and return each SCC
as a list of procedures paired with a flag indicating whether the SCC is recursive.
Results are in reverse topological order: dependencies before dependents.

Procedures with an `invokeOn` trigger are placed as early as possible — before
unrelated procedures without one — by stably partitioning them first before building
Procedures with axioms are placed as early as possible — before
unrelated procedures without them — by stably partitioning them first before building
the graph. Tarjan then naturally assigns them lower indices, causing them to appear
earlier in the output.

External procedures are excluded.
-/
public def computeSccDecls (program : Program) : List (List Procedure × Bool) :=
-- External procedures are completely ignored (not translated to Core).
-- Stable partition: procedures with invokeOn come first, preserving relative
public def computeSccDecls (program : UnorderedCoreWithLaurelTypes) : List (List Procedure × Bool) :=
-- Stable partition: procedures with axioms come first, preserving relative
-- order within each group. Tarjan then places them earlier in the topological output.
let (withInvokeOn, withoutInvokeOn) :=
(program.staticProcedures.filter (fun p => !p.body.isExternal))
|>.partition (fun p => p.invokeOn.isSome)
let nonExternal : List Procedure := withInvokeOn ++ withoutInvokeOn
let allProcs := program.functions ++ program.coreProcedures
let (withAxioms, withoutAxioms) :=
allProcs.partition (fun p => !p.axioms.isEmpty)
let orderedProcs : List Procedure := withAxioms ++ withoutAxioms

-- Build a call-graph over all non-external procedures.
-- Build a call-graph over all procedures.
-- An edge proc → callee means proc's body/contracts contain a StaticCall to callee.
let nonExternalArr : Array Procedure := nonExternal.toArray
let procsArr : Array Procedure := orderedProcs.toArray
let nameToIdx : Std.HashMap String Nat :=
nonExternalArr.foldl (fun (acc : Std.HashMap String Nat × Nat) proc =>
procsArr.foldl (fun (acc : Std.HashMap String Nat × Nat) proc =>
(acc.1.insert proc.name.text acc.2, acc.2 + 1)) ({}, 0) |>.1

-- Collect all callee names from a procedure's body and contracts.
Expand All @@ -145,13 +141,14 @@ public def computeSccDecls (program : Program) : List (List Procedure × Bool) :
| _ => []
let contractExprs : List StmtExprMd :=
proc.preconditions.map (·.condition) ++
proc.invokeOn.toList
proc.invokeOn.toList ++
proc.axioms
(bodyExprs ++ contractExprs).flatMap collectStaticCallNames

-- Build the OutGraph for Tarjan.
let n := nonExternalArr.size
let n := procsArr.size
let graph : Strata.OutGraph n :=
nonExternalArr.foldl (fun (acc : Strata.OutGraph n × Nat) proc =>
procsArr.foldl (fun (acc : Strata.OutGraph n × Nat) proc =>
let callerIdx := acc.2
let g := acc.1
let callees := procCallees proc
Expand All @@ -167,7 +164,7 @@ public def computeSccDecls (program : Program) : List (List Procedure × Bool) :

sccs.toList.filterMap fun scc =>
let procs := scc.toList.filterMap fun idx =>
nonExternalArr[idx.val]?
procsArr[idx.val]?
if procs.isEmpty then none else
let isRecursive := procs.length > 1 ||
(match scc.toList.head? with
Expand All @@ -176,60 +173,85 @@ public def computeSccDecls (program : Program) : List (List Procedure × Bool) :
some (procs, isRecursive)

/--
A single declaration in an ordered Laurel program. Declarations are in
A single declaration in a CoreWithLaurelTypes program. Declarations are in
dependency order (dependencies before dependents).
-/
public inductive OrderedDecl where
/-- A group of functions (single non-recursive, or mutually recursive). -/
| procs (procs : List Procedure) (isRecursive : Bool)
/-- A group of functions (single non-recursive, or mutually recursive).
Invariant: `funcs.length > 1 → isRecursive = true`. -/
| funcs (funcs : List Procedure) (isRecursive : Bool)
/-- A single (non-functional) procedure. -/
| procedure (procedure : Procedure)
/-- A group of (possibly mutually recursive) datatypes. -/
| datatypes (dts : List DatatypeDefinition)
/-- A named constant. -/
| constant (c : Constant)

/--
A Laurel program whose declarations have been grouped and topologically ordered.
Produced by `orderProgram` from a `Program`.
A program whose declarations have been grouped and topologically ordered,
using Laurel types. Produced by `orderFunctionsAndProofs` from a
`UnorderedCoreWithLaurelTypes`.
-/
public structure OrderedLaurel where
public structure CoreWithLaurelTypes where
decls : List OrderedDecl

/--
Group mutually recursive datatypes into SCC groups using Tarjan's SCC algorithm.
Returns groups in topological order (dependencies before dependents).
-/
public def groupDatatypesByScc (program : Program) : List (List DatatypeDefinition) :=
let laurelDatatypes := program.types.filterMap fun td => match td with
| .Datatype dt => some dt
| _ => none
let n := laurelDatatypes.length
if n == 0 then [] else
let nameToIdx : Std.HashMap String Nat :=
laurelDatatypes.foldlIdx (fun m i dt => m.insert dt.name.text i) {}
let edges : List (Nat × Nat) :=
laurelDatatypes.foldlIdx (fun acc i dt =>
(datatypeRefs dt).filterMap nameToIdx.get? |>.foldl (fun acc j => (j, i) :: acc) acc) []
let g := OutGraph.ofEdges! n edges
let dtsArr := laurelDatatypes.toArray
OutGraph.tarjan g |>.toList.filterMap fun comp =>
let members := comp.toList.filterMap fun idx => dtsArr[idx]?
if members.isEmpty then none else some members
open Std (Format ToFormat)

/--
Group procedures into SCC groups and wrap them as `OrderedDecl.procs`.
-/
public def groupProcsByScc (program : Program) : List OrderedDecl :=
(computeSccDecls program).map fun (procs, isRecursive) =>
OrderedDecl.procs procs isRecursive
public section

def formatOrderedDecl : OrderedDecl → Format
| .funcs funcs _ => Format.joinSep (funcs.map ToFormat.format) "\n\n"
| .procedure proc => ToFormat.format proc
| .datatypes dts => Format.joinSep (dts.map ToFormat.format) "\n\n"
| .constant c => ToFormat.format c

instance : ToFormat OrderedDecl where
format := formatOrderedDecl

def formatCoreWithLaurelTypes (p : CoreWithLaurelTypes) : Format :=
Format.joinSep (p.decls.map formatOrderedDecl) "\n\n"

instance : ToFormat CoreWithLaurelTypes where
format := formatCoreWithLaurelTypes

end -- public section

/--
Produce an `OrderedLaurel` from a `Program` by grouping and ordering
procedures via SCC, collecting datatypes, and constants.
Produce a `CoreWithLaurelTypes` from a `UnorderedCoreWithLaurelTypes` by
computing a combined ordering of functions and proofs using the call graph,
then collecting datatypes and constants.

Functions are grouped into SCCs (for mutual recursion). Proofs are emitted
as individual `procedure` decls. Both participate in the topological ordering
so that axioms are available to functions that need them.
-/
public def orderProgram (program : Program) : OrderedLaurel :=
let datatypeDecls := (groupDatatypesByScc program).map OrderedDecl.datatypes
public def orderFunctionsAndProofs (program : UnorderedCoreWithLaurelTypes) : CoreWithLaurelTypes :=
let datatypeDecls := (groupDatatypesByScc' program).map OrderedDecl.datatypes
let constantDecls := program.constants.map OrderedDecl.constant
let procDecls := groupProcsByScc program
{ decls := datatypeDecls ++ constantDecls ++ procDecls }
let funcNames : Std.HashSet String :=
program.functions.foldl (fun s p => s.insert p.name.text) {}
let orderedDecls := (computeSccDecls program).flatMap fun (procs, isRecursive) =>
-- Split the SCC into functions and proofs
let (funcs, proofs) := procs.partition (fun p => funcNames.contains p.name.text)
let funcDecl := if funcs.isEmpty then [] else [OrderedDecl.funcs funcs isRecursive]
let proofDecls := proofs.map OrderedDecl.procedure
funcDecl ++ proofDecls
{ decls := datatypeDecls ++ constantDecls ++ orderedDecls }
where
/-- Group datatypes from a UnorderedCoreWithLaurelTypes by SCC. -/
groupDatatypesByScc' (program : UnorderedCoreWithLaurelTypes) : List (List DatatypeDefinition) :=
let laurelDatatypes := program.datatypes
let n := laurelDatatypes.length
if n == 0 then [] else
let nameToIdx : Std.HashMap String Nat :=
laurelDatatypes.foldlIdx (fun m i dt => m.insert dt.name.text i) {}
let edges : List (Nat × Nat) :=
laurelDatatypes.foldlIdx (fun acc i dt =>
(datatypeRefs dt).filterMap nameToIdx.get? |>.foldl (fun acc j => (j, i) :: acc) acc) []
let g := OutGraph.ofEdges! n edges
let dtsArr := laurelDatatypes.toArray
OutGraph.tarjan g |>.toList.filterMap fun comp =>
let members := comp.toList.filterMap fun idx => dtsArr[idx]?
if members.isEmpty then none else some members

end Strata.Laurel
54 changes: 54 additions & 0 deletions Strata/Languages/Laurel/DatatypeTesters.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/-
Copyright Strata Contributors

SPDX-License-Identifier: Apache-2.0 OR MIT
-/
module

public import Strata.Languages.Laurel.Laurel

/-!
## Datatype Tester Generation

For each constructor of a datatype, generate an external testing function.
The tester function takes a single argument of the datatype's type and returns
`bool`. Its name is determined by `DatatypeDefinition.testerName`.

This pass runs at the start of the Laurel pipeline, before resolution, so that
the tester functions are available as normal static procedures.
-/

namespace Strata.Laurel

public section

/-- Generate an external tester function for a single constructor of a datatype. -/
private def mkTesterFunction (dt : DatatypeDefinition) (ctor : DatatypeConstructor) : Procedure :=
let testerName := dt.testerName ctor
let inputParam : Parameter := {
name := mkId "value"
type := { val := .UserDefined dt.name, source := none }
}
let outputParam : Parameter := {
name := mkId "$result"
type := { val := .TBool, source := none }
}
{ name := mkId testerName
inputs := [inputParam]
outputs := [outputParam]
preconditions := []
decreases := none
isFunctional := true
body := .External }

/-- Generate external tester functions for all constructors of all datatypes in the program. -/
def generateDatatypeTesters (program : Program) : Program :=
let testers := program.types.flatMap fun td =>
match td with
| .Datatype dt => dt.constructors.map (mkTesterFunction dt)
| _ => []
{ program with staticProcedures := testers ++ program.staticProcedures }

end -- public section

end Strata.Laurel
17 changes: 9 additions & 8 deletions Strata/Languages/Laurel/DesugarShortCircuit.lean
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,33 @@ namespace Strata.Laurel

public section

private def bare (v : StmtExpr) : StmtExprMd := ⟨v, none⟩

/-- Local rewrite of a single short-circuit node. Recursion is handled by `mapStmtExpr`. -/
private def desugarShortCircuitNode (model : SemanticModel) (expr : StmtExprMd) : StmtExprMd :=
private def desugarShortCircuitNode (imperativeCallees : List String) (expr : StmtExprMd) : StmtExprMd :=
let source := expr.source
let wrap (v : StmtExpr) : StmtExprMd := ⟨v, source⟩
match expr.val with
| .PrimitiveOp op args =>
match op, args with
-- With bottom-up traversal, `a` and `b` are already desugared (nested
-- short-circuits converted to IfThenElse). The check still works because
-- `containsAssignmentOrImperativeCall` recurses into IfThenElse.
| .AndThen, [a, b] | .Implies, [a, b] =>
if containsAssignmentOrImperativeCall model b then
if containsAssignmentOrImperativeCall imperativeCallees b then
let elseVal := match op with | .AndThen => false | _ => true
⟨.IfThenElse a b (some (bare (.LiteralBool elseVal))), source⟩
⟨.IfThenElse a b (some (wrap (.LiteralBool elseVal))), source⟩
else expr
| .OrElse, [a, b] =>
if containsAssignmentOrImperativeCall model b then
⟨.IfThenElse a (bare (.LiteralBool true)) (some b), source⟩
if containsAssignmentOrImperativeCall imperativeCallees b then
⟨.IfThenElse a (wrap (.LiteralBool true)) (some b), source⟩
else expr
| _, _ => expr
| _ => expr

/-- Desugar short-circuit operators in a program. -/
def desugarShortCircuit (model : SemanticModel) (program : Program) : Program :=
mapProgram (mapStmtExpr (desugarShortCircuitNode model)) program
def desugarShortCircuit (program : Program) : Program :=
let imperativeCallees := program.staticProcedures.map (fun p => p.name.text)
mapProgram (mapStmtExpr (desugarShortCircuitNode imperativeCallees)) program

end -- public section
end Strata.Laurel
Loading
Loading