Skip to content

Commit 8ed5765

Browse files
committed
Add model for vstd Set and prove its axioms
1 parent 0e54fc9 commit 8ed5765

File tree

5 files changed

+598
-65
lines changed

5 files changed

+598
-65
lines changed

source/rust_verify_test/tests/sets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test_verify_one_file! {
111111

112112
proof fn test() {
113113
let s: Set<nat> = set![9];
114-
reveal_with_fuel(Set::fold, 10);
114+
broadcast use fold::lemma_fold_insert, fold::lemma_fold_empty;
115115
assert(s.finite());
116116
assert(s.len() > 0);
117117
assert(s.fold(0, |p: nat, a: nat| p + a) == 9);

source/vstd/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ impl<K, V> Map<K, V> {
4141

4242
/// Gives a `Map<K, V>` whose domain contains every key, and maps each key
4343
/// to the value given by `fv`.
44-
pub open spec fn total(fv: impl Fn(K) -> V) -> Map<K, V> {
44+
pub open spec fn total(fv: spec_fn(K) -> V) -> Map<K, V> {
4545
Set::full().mk_map(fv)
4646
}
4747

4848
/// Gives a `Map<K, V>` whose domain is given by the boolean predicate on keys `fk`,
4949
/// and maps each key to the value given by `fv`.
50-
pub open spec fn new(fk: impl Fn(K) -> bool, fv: impl Fn(K) -> V) -> Map<K, V> {
50+
pub open spec fn new(fk: spec_fn(K) -> bool, fv: spec_fn(K) -> V) -> Map<K, V> {
5151
Set::new(fk).mk_map(fv)
5252
}
5353

0 commit comments

Comments
 (0)