Skip to content

Commit 525e4e7

Browse files
bsdinistchajed
andauthored
vstd: change Seq to Enum and verify axioms (#2625)
Co-authored-by: Tej Chajed <chajed@wisc.edu>
1 parent 6571723 commit 525e4e7

2 files changed

Lines changed: 656 additions & 62 deletions

File tree

source/rust_verify_test/tests/recursion.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ test_verify_one_file! {
18101810
}
18111811

18121812
pub struct Directory {
1813-
pub entries: Seq<Entry>,
1813+
pub entries: Ghost<Seq<Entry>>,
18141814
}
18151815

18161816
#[verifier(external_body)]
@@ -1821,7 +1821,7 @@ test_verify_one_file! {
18211821
pub open spec fn fn_one(self, layer: nat) -> Directory
18221822
decreases NUM_LAYERS - layer, NUM_ENTRIES, 2nat
18231823
{
1824-
Directory { entries: self.fn_three(layer, seq![]) }
1824+
Directory { entries: Ghost(self.fn_three(layer, seq![])) }
18251825
}
18261826

18271827
pub open spec fn fn_two(self, layer: nat, idx: nat) -> Entry
@@ -2070,16 +2070,16 @@ test_verify_one_file! {
20702070
}
20712071

20722072
struct X {
2073-
y: Seq<X>,
2073+
y: Ghost<Seq<X>>,
20742074
}
20752075

20762076
proof fn bad() {
2077-
let x0 = X { y: seq![] };
2078-
let t = seq![X { y: seq![ x0, x0 ] }];
2077+
let x0 = X { y: Ghost(seq![]) };
2078+
let t = seq![X { y: Ghost(seq![ x0, x0 ]) }];
20792079
assert(decreases_to!(t => t[0]));
20802080
assert(decreases_to!(t[0] => t[0].y));
20812081

2082-
vstd::seq::axiom_seq_len_decreases(t[0].y, t); // FAILS
2082+
vstd::seq::axiom_seq_len_decreases(t[0].y@, t); // FAILS
20832083
assert(decreases_to!(t[0].y => t));
20842084
}
20852085
} => Err(e) => assert_fails(e, 3)

0 commit comments

Comments
 (0)