summaryrefslogtreecommitdiff
path: root/fstar
diff options
context:
space:
mode:
authorSon Ho2022-02-10 02:12:02 +0100
committerSon Ho2022-02-10 02:12:02 +0100
commit7d00c246dd0a8c1f0a843ee95f843a800d0fc5f2 (patch)
tree9e4a5ec8c0a9bb0b81b0027f736107181ef1dbe1 /fstar
parenta1a0f62c200857afcd2090b39f1980d34cd638f2 (diff)
Update Primitives.fst
Diffstat (limited to 'fstar')
-rw-r--r--fstar/Primitives.fst11
1 files changed, 10 insertions, 1 deletions
diff --git a/fstar/Primitives.fst b/fstar/Primitives.fst
index 78697259..fbf8140a 100644
--- a/fstar/Primitives.fst
+++ b/fstar/Primitives.fst
@@ -242,7 +242,16 @@ let vec_len (a : Type0) (v : vec a) : usize = length v
// The **forward** function shouldn't be used
let vec_push_fwd (a : Type0) (v : vec a) (x : a) : unit = ()
-let vec_push_back (a : Type0) (v : vec a) (x : a) : result (vec a) =
+
+// The **forward** function shouldn't be used
+let vec_push_fwd (a : Type0) (v : vec a) (x : a) : unit = ()
+let vec_push_back (a : Type0) (v : vec a) (x : a) :
+ Pure (result (vec a))
+ (requires True)
+ (ensures (fun res ->
+ match res with
+ | Fail -> True
+ | Return v' -> length v' = length v + 1)) =
if length v < usize_max then begin
(**) assert_norm(length [x] == 1);
(**) append_length v [x];