Skip to content
Draft
Show file tree
Hide file tree
Changes from 189 commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
ec101c3
Add examples of styles of iterator specification from last year's dis…
Chris-Hawblitzel Jun 17, 2025
2c6443b
Eliminate compiler errors/warnings.
parno Jul 17, 2025
e203f3c
Factor code into two separate modules, so that we can `broadcast use`
parno Jul 17, 2025
b7f6c4c
Import work on iters3.rs into a project for faster iteration in VS Code.
parno Jul 17, 2025
ac84622
Restore the iters to a verifying state.
parno Jul 18, 2025
0702c69
Remove some redundancy and update crate versions.
parno Jul 25, 2025
44fadba
Add a constructor for Take3 and use it in a some tests
parno Jul 25, 2025
d1ead26
It turns out we don't need the "inner details" of the vec iterator
parno Jul 25, 2025
3daf608
Specify the postcondition of reaches_monotonic more succinctly
parno Jul 25, 2025
8bffda8
Work towards a DoubleEndedIterator
parno Jul 25, 2025
0b46fa9
Attempt to prove apply_ops_concat
parno Jul 27, 2025
09c27db
Prove `reaches_monotonic`
parno Jul 29, 2025
d17c285
Prove that next() maintains `inv`.
parno Jul 29, 2025
cdcec84
Prove Next given an assumed lemma
parno Jul 30, 2025
275c705
Prove the final lemma.
parno Jul 30, 2025
11219b7
Proof for next_back
parno Jul 30, 2025
cb63eba
Prove that new establishes a valid MyVecFancyIter
parno Jul 30, 2025
abb76ef
Restore all but one test
parno Jul 30, 2025
aa44d64
Fix the last test
parno Jul 30, 2025
11c7288
Additional experiments with a Rev iterator, and a generic test
parno Jul 31, 2025
9678f7b
New approach works on the first test.
parno Jul 31, 2025
6e538c7
Work on reviving Take3
parno Jul 31, 2025
ae4dfeb
Eliminate outputs()
parno Jul 31, 2025
a8124bf
Clean up
parno Jul 31, 2025
577c23f
Restore more examples. This time, Take3 doesn't need to know about
parno Jul 31, 2025
751b889
Eliminate the all_next requirement for Skip3 and replace it with a more
parno Jul 31, 2025
827bdca
Restore more tests.
parno Jul 31, 2025
b1cf25b
Simplify definition of events for Skip3
parno Jul 31, 2025
33a64b7
Adjust triggers so that our generic example goes through.
parno Jul 31, 2025
12761d5
Restore DoubleEndedIter
parno Jul 31, 2025
e2f86eb
Work towards getting Rev to work
parno Jul 31, 2025
11c66df
Basic rev test passes!
parno Aug 1, 2025
afb8dea
Impl DoubleEndedIter for Rev
parno Aug 1, 2025
3ba1604
Clean up
parno Aug 1, 2025
6bd553a
Clean up
parno Aug 1, 2025
ae48c7c
Remove invariants that dno't appear to be needed.
parno Aug 1, 2025
9861554
A new test that doesn't verify yet.
parno Aug 1, 2025
b565dc6
Fix an assertion so that it should be true.
parno Aug 6, 2025
dc8f194
Add in a `done()` predicate, and attempt to use it in our generic
parno Aug 19, 2025
a401c2f
Add Travis's version
parno Sep 1, 2025
8c8d59d
Add Take3 and Skip3 to the prophetic encoding.
parno Sep 2, 2025
ac89a02
Edits from today's meeting
parno Sep 2, 2025
2f90251
Merge branch 'main' into iter_consolidated
parno Sep 2, 2025
1a1607d
Comment out partial progress on the all_true_simpler_caller proof.
parno Sep 2, 2025
20eaa7e
Turns out Take3 `next` doesn't verify yet.
parno Sep 2, 2025
eba7a19
add prophetic iter examples: vec, map, skip, take, collect
tjhance Sep 4, 2025
9e1588e
DoubleEndedIterator
tjhance Sep 4, 2025
121ffca
prophetic_iters
tjhance Sep 4, 2025
603e34f
Reorganize iter files and shuffle the prior attempts into a dedicated
parno Sep 29, 2025
082b1f4
Add a test that's generic in the underlying iterator.
parno Sep 29, 2025
b0a98ca
Make guarantees depend on `obeys_iter_laws`, in preparation for move to
parno Sep 29, 2025
a615af2
Experiments with for loops
parno Sep 29, 2025
98ac649
More attempts
parno Sep 30, 2025
16cd635
Comments
parno Oct 1, 2025
0116032
Add accessors to the VecIterator, so that we can talk about its state
parno Oct 1, 2025
2acfb03
Fix the comment
parno Oct 1, 2025
c9e0fe2
Double check we can prove something after the loop.
parno Oct 1, 2025
cda4ad4
I don't think we need peek_next after all
parno Oct 1, 2025
a0d1c5a
Map's interaction with the for loop is tricky (and not yet working)
parno Oct 1, 2025
07f08cd
With a strengthened postcondition for `next`,
parno Oct 1, 2025
7b7a8a9
The current skip iterator is problematic.
parno Oct 1, 2025
ddcfbcc
Second version of Skip fails also, because the evolution of `seq`
parno Oct 2, 2025
3470103
Tailor the for-loop encoding even further towards the prophetic
parno Oct 2, 2025
c51c78c
Get Skip working using an Ord/Cmp-based Decrease type
parno Oct 3, 2025
46e293a
Get ReverseIterator working
parno Oct 3, 2025
fd6c5a4
Revive other examples
parno Oct 3, 2025
35041a3
Attempt to revive the map test example.
parno Oct 3, 2025
8221411
Partial progress on getting the MapIterator to work with for loops,
parno Oct 6, 2025
ff369f3
Clean up
parno Oct 6, 2025
70e07cc
Separate code into distinct modules, to ensure we're not depending
parno Oct 6, 2025
b1a3a00
More experiments with MapIter
parno Oct 7, 2025
acd7670
Swap back to using a version of `decreases`, but problems with type
parno Oct 8, 2025
b9a0eef
Update our desugaring again, so that we mostly talk about an immutable
parno Nov 19, 2025
e71cbe5
Update Vec to the new style
parno Nov 19, 2025
f94aadc
Fix the value that decreases so we can prove termination.
parno Nov 19, 2025
3bc08ff
Clean up
parno Nov 19, 2025
e6d9fb8
More cleaning
parno Nov 19, 2025
c67fbc8
Close some spec functions
parno Nov 19, 2025
3f08380
Update the rest of the for-loop examples
parno Nov 19, 2025
73ad1e0
Partial progress on decreases issue
parno Nov 19, 2025
81d0f45
Decreases continues to baffle.
parno Nov 20, 2025
d854bbc
Broadcast the decreases in the examples mod.
parno Nov 20, 2025
355f3d9
Clean up an uncomment the other examples. They don't go through yet
parno Nov 20, 2025
f617322
Debug some of the verification issues.
parno Nov 20, 2025
50a19e6
All of the examples verify again.
parno Nov 21, 2025
9b32800
Remove unnecessary postconditions
parno Nov 21, 2025
f4b75a7
Minor clean up
parno Nov 25, 2025
41efacc
Aspirational loop invariant.
parno Nov 25, 2025
f418e1d
Add a quantified version of the user-supplied loop invariant.
parno Nov 29, 2025
8694d73
Get map example working in quantified form
parno Dec 1, 2025
657b28b
Remove an old file
parno Dec 2, 2025
ce31ebc
Reorganize files
parno Dec 2, 2025
075fa91
Split the definitions and basic tests from the for-loop examples.
parno Dec 2, 2025
018df9c
Finish converting quantified invariants.
parno Dec 2, 2025
4e1ea70
Example desugaring for `#[verifier::exec_allows_no_decreases_clause]`
parno Dec 2, 2025
b8390e8
Add a file for experimenting with loops that include a break.
parno Dec 3, 2025
ac2ba47
Encapsulate most of the internal invariants inside a wf predicate
parno Dec 3, 2025
a64f7b7
Update the rest of the files.
parno Dec 3, 2025
0489d64
Use `y.seq()` consistently instead of `y.snapshot.seq()`
parno Dec 3, 2025
e5af6ce
Get a version of a for-loop with a break statement to verify.
parno Dec 3, 2025
b186e83
Alternate formulation of the user-supplied invariant that does go thr…
parno Dec 3, 2025
f5d962b
Make the version with a while loop more closely resemble the for-loop
parno Dec 3, 2025
fb613b1
Illustrate mis-alignment.
parno Dec 3, 2025
b9cdc26
Retire the version with invariants based on sequence operations.
parno Dec 3, 2025
514cad5
Move old history-based iters into the attic
parno Dec 3, 2025
96f78bf
Try adding a feature to track the expression that initialized the for
parno Dec 4, 2025
07c5918
Clean up the wf interface. However, we're still struggling to relate
parno Dec 5, 2025
dc88a0d
Verifies modulo an assumption.
parno Dec 5, 2025
e682f2c
Add a broadcast proof fn, so we can remove our final assume
parno Dec 6, 2025
742a546
Try out Chris's idea for synchronizing the loop body's version of the
parno Dec 6, 2025
555b7aa
Remove an unnecessary assert.
parno Dec 10, 2025
53ba5ea
Restore the no_term code
parno Dec 12, 2025
f678794
Import the iterator trait definitions and start updating the syntax
parno Dec 13, 2025
d7811d1
Merge branch 'main' into iter_consolidated_init
parno Dec 13, 2025
1840245
Fix some compile errors
parno Dec 13, 2025
612d209
Use same polymorphic SMT functions to define decreases for both int a…
Chris-Hawblitzel Nov 25, 2025
300efe5
Take advantage of the newly polymorphic decreases to remove our
parno Dec 13, 2025
dc31335
Migrate iterator specs into iter.rs. Tried but failed to get Verus to
parno Dec 13, 2025
c9d0761
Debugging the modified syntax macro
parno Dec 13, 2025
0a2338a
Notes from today's meeting
parno Dec 16, 2025
5607227
Remove the associated Decrease type from our Iterator trait,
parno Dec 17, 2025
aa928e7
Progress from syntax to type errors
parno Dec 18, 2025
34fc961
Convert std_spec Iterator Decrease to just nat.
parno Dec 18, 2025
83c45a0
Partial progress on updating the iterator-specs related to Vec
parno Dec 18, 2025
ee7a513
Down to two type errors with the basic for-loop example, both about
parno Dec 18, 2025
a685e1b
Finally reach the point where we hit actual verification errors.
parno Dec 19, 2025
e7c1439
Fix one verification error.
parno Dec 19, 2025
44926ff
Eliminate the second verification failure.
parno Dec 19, 2025
8fb40ce
Prove that we can track the length of the accumulated vec.
parno Dec 19, 2025
b4d5332
Most(?) of the way towards proving the next user-level invariant but
parno Dec 19, 2025
2899584
Confirm that the less ergonomic invariant does work!
parno Dec 19, 2025
0b1be53
Clean up iter.rs and remove an assume(false);
parno Dec 23, 2025
f3a5037
More tests and an improved custom error message
parno Dec 24, 2025
05ec417
Clean up vec.rs
parno Jan 13, 2026
411859f
Remove invariant_except_break clauses that relate to termination if the
parno Jan 13, 2026
1f08cee
Partial progress towards supporting user-provided break statements,
parno Jan 13, 2026
e2d7245
Update auto-generated syn files
parno Jan 15, 2026
5898b5b
Use uninterp specs for specifying vec's IntoIter
parno Jan 15, 2026
6c45b41
Document automated-codegen for synx
parno Jan 15, 2026
55b72b1
Fix uninterp syntax
parno Jan 20, 2026
ee8d93e
Renaming
parno Jan 27, 2026
f1afe8b
Remove redundant `into_iter_elts`, but stuck on Verus's cyclic checking
parno Jan 28, 2026
b6bdfcd
Attempted fix of GitHub issue #2047, where an external_trait
parno Jan 31, 2026
53c7861
Merge branch 'main' into iter_consolidated_init
parno Jan 31, 2026
a1b09b5
Merge branch 'iter-new-user-break' into iter_consolidated_init
parno Jan 31, 2026
d6db403
Fix up types in the test case
parno Feb 1, 2026
a4a086c
Improve syntax.rs comments, and add `#[verifier::allow_complex_invari…
parno Feb 1, 2026
68d3cec
Adjust ast_to_sst loop handling, since the presence of
parno Feb 1, 2026
9ee1e26
Merge branch 'iter-new-no-decreases' into iter_consolidated_init
parno Feb 1, 2026
a89f561
Filter out auto-generated ensures clause(s) when the user adds their own
parno Feb 1, 2026
15b08ff
Apply a fix so that our basic example also goes through.
parno Feb 1, 2026
5587aae
Add a test case that succeeds and a test case that fails.
parno Feb 1, 2026
f52fe01
Remove dbg output
parno Feb 1, 2026
7bd0f3b
Merge branch 'main' into iter_consolidated_init
parno Feb 2, 2026
342c769
More clean up
parno Feb 1, 2026
0d4e1f2
Fix compile error
parno Feb 3, 2026
3f10cbd
Revert "Attempted fix of GitHub issue #2047, where an external_trait"
parno Feb 7, 2026
5107704
new-mut-ref: support let-else
tjhance Feb 2, 2026
30169cc
remove extra lint reference in crates that are not in the `source` wo…
bsdinis Feb 2, 2026
f264d0f
Add two more arxiv papers, and a link to Atmosphere's code
parno Feb 2, 2026
16b911b
Add layout axioms (#2119)
elanortang Feb 2, 2026
6baab9e
fix Singular download in CI (#2133)
mkovaxx Feb 2, 2026
5322f42
Fix specifications as recommended by AI (#2126)
jaylorch Feb 2, 2026
bee52fb
treat params as mut-by-default (#2116)
tjhance Feb 3, 2026
15314c0
internal docs: more docs for VIR Place
tjhance Feb 3, 2026
0292fb5
update comment
tjhance Feb 3, 2026
2ed06f7
enforce alignment for PointsTo (#1900)
tjhance Feb 3, 2026
afafb48
vstd cell restructuring (#2032)
tjhance Feb 3, 2026
7d90eda
cfg_features: add `verus_in_verification` feature and documentation o…
bsdinis Feb 4, 2026
806a405
Allow mut refs to tracked locations (#2121)
tjhance Feb 4, 2026
9a5a703
add a test about Tracked<&mut _> params
tjhance Feb 4, 2026
1ba5123
fix implicit reborrows in tracked code
tjhance Jan 30, 2026
3045237
Fix redirect_calls_in_default_methods to account for generic trait fu…
Chris-Hawblitzel Feb 5, 2026
a7b4011
ci: cancel in progress worflows for the same PR (#2139)
bsdinis Feb 6, 2026
8452fdf
Fix of GitHub issue #2047 (#2129)
parno Feb 6, 2026
5c6bf77
add migrate_postconditions_with_mut_refs to vstd (#2144)
tjhance Feb 6, 2026
7f2f9fc
Remove notes from clean branch.
parno Feb 10, 2026
11dc405
Unify deguar functions
parno Feb 10, 2026
714f25b
Merge branch 'main' into iter-clean
parno Feb 10, 2026
93d85d0
Initial effort to add a new Iterator spec for Range
parno Feb 3, 2026
d4cd561
Implement the new Iterator trait for Range, to the point where
parno Feb 7, 2026
bf77fa2
Work towards getting Range examples working.
parno Feb 7, 2026
bae7472
Strengthen Range's initial_value_inv, so that the test cases pass.
parno Feb 7, 2026
70a783d
Fix some test cases.
parno Feb 8, 2026
2785833
Adjust some failing tests.
parno Feb 9, 2026
99e9c3d
loops test passes
parno Feb 10, 2026
f995d28
Apply similar changes to loops_no_spinoff.rs
parno Feb 10, 2026
2efb8f2
Fix some failing example tests.
parno Feb 10, 2026
c1047ec
vargo fmt
parno Feb 10, 2026
a141900
Placate clippy.
parno Feb 10, 2026
30ffc81
Make an invariant of the Range iterator more explicit
parno Feb 24, 2026
ae1485b
Try a simpler fix to the Range invariant
parno Feb 24, 2026
50c820b
Simplify the initial_value_inv; now it only takes `init: &Self` instead
parno Feb 24, 2026
af62865
Rename the Iterator trait `seq()` function to `remaining` to make the
parno Feb 24, 2026
c7df31b
Extend VerusForLoopWrapper with a history field (and spec fn) to track
parno Feb 25, 2026
069179d
Add some more basic for-loop tests
parno Feb 25, 2026
64e8b8d
Update VecDeque to use the new Iterator trait definitions.
parno Feb 25, 2026
e947e6a
Part way through adding support for DoubleEndedIterator
parno Feb 26, 2026
3a16860
Disable double-ended for now, while we track down trait issue.
parno Feb 27, 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
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,7 @@ vargo build --vstd-no-verify
# for tests
vargo test --vstd-no-verify -p rust_verify_test --test <test file> <test name>
```

If you modify the syntax parsing inside of the `dependencies/syn/src` directory,
be sure to regenerate the auto-generated files in the `dependencies/syn/src/gen` directory.
See `dependencies/syn/README.md` for details.
7 changes: 7 additions & 0 deletions dependencies/syn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ warning: come on, pick a more creative name

<br>

## Building

**IMPORTANT**: If you introduce new items (e.g., `ast_struct`s) or modify the
fields in existing items, you need to go into the `codegen`directory and run
`cargo run` to regenerate the files in the `src/gen` directory.


## Testing

When testing macros, we often care not just that the macro can be used
Expand Down
8 changes: 8 additions & 0 deletions dependencies/syn/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ ast_struct! {
pub in_token: Token![in],
pub expr_name: Option<Box<(Ident, Token![:])>>,
pub expr: Box<Expr>,
pub invariant_except_break: Option<InvariantExceptBreak>,
pub invariant: Option<Invariant>,
pub ensures: Option<Ensures>,
pub decreases: Option<Decreases>,
pub body: Block,
}
Expand Down Expand Up @@ -2534,7 +2536,9 @@ pub(crate) mod parsing {
None
};
let expr: Expr = input.call(Expr::parse_without_eager_brace)?;
let invariant_except_break = input.parse()?;
let invariant = input.parse()?;
let ensures = input.parse()?;
let decreases = input.parse()?;

let content;
Expand All @@ -2550,7 +2554,9 @@ pub(crate) mod parsing {
in_token,
expr_name,
expr: Box::new(expr),
invariant_except_break,
invariant,
ensures,
decreases,
body: Block { brace_token, stmts },
})
Expand Down Expand Up @@ -3936,7 +3942,9 @@ pub(crate) mod printing {
colon.to_tokens(tokens);
}
print_expr(&self.expr, tokens, FixupContext::new_condition());
self.invariant_except_break.to_tokens(tokens);
self.invariant.to_tokens(tokens);
self.ensures.to_tokens(tokens);
self.decreases.to_tokens(tokens);
self.body.brace_token.surround(tokens, |tokens| {
inner_attrs_to_tokens(&self.attrs, tokens);
Expand Down
2 changes: 2 additions & 0 deletions dependencies/syn/src/gen/clone.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dependencies/syn/src/gen/debug.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dependencies/syn/src/gen/eq.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dependencies/syn/src/gen/fold.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dependencies/syn/src/gen/hash.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dependencies/syn/src/gen/visit.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dependencies/syn/src/gen/visit_mut.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion dependencies/syn/syn.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions dependencies/syn/tests/debug/gen.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/exec_termination_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ verus! {
fn exec_for_loop() {
let mut n: u64 = 0;
for x in iter: 0..10
invariant n == iter.cur * 3,
invariant n == x * 3,
// You can write a `decreases` if you want, but it's not needed
// because Verus inserts a decreases automatically for `for` loops:
// decreases 10 - iter.cur,
Expand All @@ -84,7 +84,7 @@ verus! {
let mut end = 10;
for x in iter: 0..end
invariant
n == iter.cur * 3,
n == x * 3,
end == 10,
// You can write a `decreases` if you want, but it's not needed
// because Verus inserts a decreases automatically for `for` loops:
Expand All @@ -111,4 +111,4 @@ verus! {
i -= 1;
}
}
}
}
1 change: 1 addition & 0 deletions examples/mergesort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fn extend_from_idx(r: &mut Vec<u64>, v: &Vec<u64>, start: usize)
{
for i in start..v.len()
invariant
start <= i <= v.len(), // REVIEW: We didn't need this previously
r@ =~= old(r)@ + v@.subrange(start as int, i as int),
{
r.push(v[i]);
Expand Down
Loading
Loading