summaryrefslogtreecommitdiff
path: root/tests/fstar
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fstar')
-rw-r--r--tests/fstar/arrays/Arrays.Funs.fst27
-rw-r--r--tests/fstar/betree/BetreeMain.Funs.fst147
-rw-r--r--tests/fstar/betree_back_stateful/BetreeMain.Funs.fst147
-rw-r--r--tests/fstar/demo/Demo.fst47
-rw-r--r--tests/fstar/hashmap/Hashmap.Funs.fst27
-rw-r--r--tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst33
-rw-r--r--tests/fstar/misc/External.Funs.fst4
-rw-r--r--tests/fstar/misc/Loops.Clauses.Template.fst3
-rw-r--r--tests/fstar/misc/Loops.Funs.fst59
-rw-r--r--tests/fstar/misc/NoNestedBorrows.fst7
-rw-r--r--tests/fstar/misc/Paper.fst2
11 files changed, 251 insertions, 252 deletions
diff --git a/tests/fstar/arrays/Arrays.Funs.fst b/tests/fstar/arrays/Arrays.Funs.fst
index cf0f4f8b..731c7290 100644
--- a/tests/fstar/arrays/Arrays.Funs.fst
+++ b/tests/fstar/arrays/Arrays.Funs.fst
@@ -23,23 +23,22 @@ let array_to_mut_slice_
(t : Type0) (s : array t 32) :
result ((slice t) & (slice t -> result (array t 32)))
=
- let* (s1, to_slice_mut_back) = array_to_slice_mut t 32 s in
- Return (s1, to_slice_mut_back)
+ array_to_slice_mut t 32 s
(** [arrays::array_len]:
Source: 'src/arrays.rs', lines 25:0-25:40 *)
let array_len (t : Type0) (s : array t 32) : result usize =
- let* s1 = array_to_slice t 32 s in let i = slice_len t s1 in Return i
+ let* s1 = array_to_slice t 32 s in Return (slice_len t s1)
(** [arrays::shared_array_len]:
Source: 'src/arrays.rs', lines 29:0-29:48 *)
let shared_array_len (t : Type0) (s : array t 32) : result usize =
- let* s1 = array_to_slice t 32 s in let i = slice_len t s1 in Return i
+ let* s1 = array_to_slice t 32 s in Return (slice_len t s1)
(** [arrays::shared_slice_len]:
Source: 'src/arrays.rs', lines 33:0-33:44 *)
let shared_slice_len (t : Type0) (s : slice t) : result usize =
- let i = slice_len t s in Return i
+ Return (slice_len t s)
(** [arrays::index_array_shared]:
Source: 'src/arrays.rs', lines 37:0-37:57 *)
@@ -62,8 +61,7 @@ let index_mut_array
(t : Type0) (s : array t 32) (i : usize) :
result (t & (t -> result (array t 32)))
=
- let* (x, index_mut_back) = array_index_mut_usize t 32 s i in
- Return (x, index_mut_back)
+ array_index_mut_usize t 32 s i
(** [arrays::index_slice]:
Source: 'src/arrays.rs', lines 56:0-56:46 *)
@@ -76,8 +74,7 @@ let index_mut_slice
(t : Type0) (s : slice t) (i : usize) :
result (t & (t -> result (slice t)))
=
- let* (x, index_mut_back) = slice_index_mut_usize t s i in
- Return (x, index_mut_back)
+ slice_index_mut_usize t s i
(** [arrays::slice_subslice_shared_]:
Source: 'src/arrays.rs', lines 64:0-64:70 *)
@@ -110,8 +107,7 @@ let array_to_slice_mut_
(x : array u32 32) :
result ((slice u32) & (slice u32 -> result (array u32 32)))
=
- let* (s, to_slice_mut_back) = array_to_slice_mut u32 32 x in
- Return (s, to_slice_mut_back)
+ array_to_slice_mut u32 32 x
(** [arrays::array_subslice_shared_]:
Source: 'src/arrays.rs', lines 80:0-80:74 *)
@@ -272,8 +268,8 @@ let update_mut_slice (x : slice u32) : result (slice u32) =
let update_all : result unit =
let* _ = update_array (mk_array u32 2 [ 0; 0 ]) in
let* _ = update_array (mk_array u32 2 [ 0; 0 ]) in
- let* a = update_array_mut_borrow (mk_array u32 2 [ 0; 0 ]) in
- let* (s, to_slice_mut_back) = array_to_slice_mut u32 2 a in
+ let* x = update_array_mut_borrow (mk_array u32 2 [ 0; 0 ]) in
+ let* (s, to_slice_mut_back) = array_to_slice_mut u32 2 x in
let* s1 = update_mut_slice s in
let* _ = to_slice_mut_back s1 in
Return ()
@@ -308,7 +304,7 @@ let take_array_t (a : array aB_t 2) : result unit =
(** [arrays::non_copyable_array]:
Source: 'src/arrays.rs', lines 229:0-229:27 *)
let non_copyable_array : result unit =
- let* _ = take_array_t (mk_array aB_t 2 [ AB_A; AB_B ]) in Return ()
+ take_array_t (mk_array aB_t 2 [ AB_A; AB_B ])
(** [arrays::sum]: loop 0:
Source: 'src/arrays.rs', lines 242:0-250:1 *)
@@ -444,8 +440,7 @@ let rec iter_mut_slice_loop
Tot (result unit) (decreases (iter_mut_slice_loop_decreases len i))
=
if i < len
- then
- let* i1 = usize_add i 1 in let* _ = iter_mut_slice_loop len i1 in Return ()
+ then let* i1 = usize_add i 1 in iter_mut_slice_loop len i1
else Return ()
(** [arrays::iter_mut_slice]:
diff --git a/tests/fstar/betree/BetreeMain.Funs.fst b/tests/fstar/betree/BetreeMain.Funs.fst
index ec042fb3..2469f98c 100644
--- a/tests/fstar/betree/BetreeMain.Funs.fst
+++ b/tests/fstar/betree/BetreeMain.Funs.fst
@@ -22,8 +22,7 @@ let betree_store_internal_node
(id : u64) (content : betree_List_t (u64 & betree_Message_t)) (st : state) :
result (state & unit)
=
- let* (st1, _) = betree_utils_store_internal_node id content st in
- Return (st1, ())
+ betree_utils_store_internal_node id content st
(** [betree_main::betree::load_leaf_node]:
Source: 'src/betree.rs', lines 46:0-46:44 *)
@@ -37,8 +36,7 @@ let betree_store_leaf_node
(id : u64) (content : betree_List_t (u64 & u64)) (st : state) :
result (state & unit)
=
- let* (st1, _) = betree_utils_store_leaf_node id content st in
- Return (st1, ())
+ betree_utils_store_leaf_node id content st
(** [betree_main::betree::fresh_node_id]:
Source: 'src/betree.rs', lines 55:0-55:48 *)
@@ -172,13 +170,14 @@ let betree_Leaf_split
let (content0, content1) = p in
let* p1 = betree_List_hd (u64 & u64) content1 in
let (pivot, _) = p1 in
- let* (id0, nic) = betree_NodeIdCounter_fresh_id node_id_cnt in
- let* (id1, nic1) = betree_NodeIdCounter_fresh_id nic in
+ let* (id0, node_id_cnt1) = betree_NodeIdCounter_fresh_id node_id_cnt in
+ let* (id1, node_id_cnt2) = betree_NodeIdCounter_fresh_id node_id_cnt1 in
let* (st1, _) = betree_store_leaf_node id0 content0 st in
let* (st2, _) = betree_store_leaf_node id1 content1 st1 in
let n = Betree_Node_Leaf { id = id0; size = params.split_size } in
let n1 = Betree_Node_Leaf { id = id1; size = params.split_size } in
- Return (st2, ({ id = self.id; pivot = pivot; left = n; right = n1 }, nic1))
+ Return (st2, ({ id = self.id; pivot = pivot; left = n; right = n1 },
+ node_id_cnt2))
(** [betree_main::betree::{betree_main::betree::Node#5}::lookup_first_message_for_key]:
Source: 'src/betree.rs', lines 789:4-792:34 *)
@@ -231,21 +230,21 @@ let rec betree_Node_apply_upserts
let* b = betree_ListPairU64T_head_has_key betree_Message_t msgs key in
if b
then
- let* (msg, l) = betree_List_pop_front (u64 & betree_Message_t) msgs in
+ let* (msg, msgs1) = betree_List_pop_front (u64 & betree_Message_t) msgs in
let (_, m) = msg in
begin match m with
| Betree_Message_Insert _ -> Fail Failure
| Betree_Message_Delete -> Fail Failure
| Betree_Message_Upsert s ->
let* v = betree_upsert_update prev s in
- betree_Node_apply_upserts l (Some v) key st
+ betree_Node_apply_upserts msgs1 (Some v) key st
end
else
let* (st1, v) = core_option_Option_unwrap u64 prev st in
- let* l =
+ let* msgs1 =
betree_List_push_front (u64 & betree_Message_t) msgs (key,
Betree_Message_Insert v) in
- Return (st1, (v, l))
+ Return (st1, (v, msgs1))
(** [betree_main::betree::{betree_main::betree::Internal#4}::lookup_in_children]:
Source: 'src/betree.rs', lines 395:4-395:63 *)
@@ -279,10 +278,11 @@ and betree_Node_lookup
let (k, msg) = p in
if k <> key
then
- let* (st2, (o, i)) = betree_Internal_lookup_in_children node key st1 in
+ let* (st2, (o, node1)) =
+ betree_Internal_lookup_in_children node key st1 in
let* _ =
lookup_first_message_for_key_back (Betree_List_Cons (k, msg) l) in
- Return (st2, (o, Betree_Node_Internal i))
+ Return (st2, (o, Betree_Node_Internal node1))
else
begin match msg with
| Betree_Message_Insert v ->
@@ -296,19 +296,20 @@ and betree_Node_lookup
Betree_Message_Delete) l) in
Return (st1, (None, Betree_Node_Internal node))
| Betree_Message_Upsert ufs ->
- let* (st2, (v, i)) = betree_Internal_lookup_in_children node key st1
- in
- let* (st3, (v1, l1)) =
+ let* (st2, (v, node1)) =
+ betree_Internal_lookup_in_children node key st1 in
+ let* (st3, (v1, pending1)) =
betree_Node_apply_upserts (Betree_List_Cons (k,
Betree_Message_Upsert ufs) l) v key st2 in
- let* msgs1 = lookup_first_message_for_key_back l1 in
- let* (st4, _) = betree_store_internal_node i.id msgs1 st3 in
- Return (st4, (Some v1, Betree_Node_Internal i))
+ let* msgs1 = lookup_first_message_for_key_back pending1 in
+ let* (st4, _) = betree_store_internal_node node1.id msgs1 st3 in
+ Return (st4, (Some v1, Betree_Node_Internal node1))
end
| Betree_List_Nil ->
- let* (st2, (o, i)) = betree_Internal_lookup_in_children node key st1 in
+ let* (st2, (o, node1)) = betree_Internal_lookup_in_children node key st1
+ in
let* _ = lookup_first_message_for_key_back Betree_List_Nil in
- Return (st2, (o, Betree_Node_Internal i))
+ Return (st2, (o, Betree_Node_Internal node1))
end
| Betree_Node_Leaf node ->
let* (st1, bindings) = betree_load_leaf_node node.id st in
@@ -328,10 +329,10 @@ let rec betree_Node_filter_messages_for_key
let (k, m) = p in
if k = key
then
- let* (_, l1) =
+ let* (_, msgs1) =
betree_List_pop_front (u64 & betree_Message_t) (Betree_List_Cons (k, m)
l) in
- betree_Node_filter_messages_for_key key l1
+ betree_Node_filter_messages_for_key key msgs1
else Return (Betree_List_Cons (k, m) l)
| Betree_List_Nil -> Return Betree_List_Nil
end
@@ -374,49 +375,51 @@ let betree_Node_apply_to_internal
then
begin match new_msg with
| Betree_Message_Insert i ->
- let* l = betree_Node_filter_messages_for_key key msgs1 in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* msgs2 = betree_Node_filter_messages_for_key key msgs1 in
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Insert i) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Delete ->
- let* l = betree_Node_filter_messages_for_key key msgs1 in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* msgs2 = betree_Node_filter_messages_for_key key msgs1 in
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Delete) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Upsert s ->
let* p = betree_List_hd (u64 & betree_Message_t) msgs1 in
let (_, m) = p in
begin match m with
| Betree_Message_Insert prev ->
let* v = betree_upsert_update (Some prev) s in
- let* (_, l) = betree_List_pop_front (u64 & betree_Message_t) msgs1 in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* (_, msgs2) = betree_List_pop_front (u64 & betree_Message_t) msgs1
+ in
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Insert v) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Delete ->
- let* (_, l) = betree_List_pop_front (u64 & betree_Message_t) msgs1 in
+ let* (_, msgs2) = betree_List_pop_front (u64 & betree_Message_t) msgs1
+ in
let* v = betree_upsert_update None s in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Insert v) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Upsert _ ->
let* (msgs2, lookup_first_message_after_key_back) =
betree_Node_lookup_first_message_after_key key msgs1 in
- let* l =
+ let* msgs3 =
betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Upsert s) in
- let* msgs3 = lookup_first_message_after_key_back l in
- lookup_first_message_for_key_back msgs3
+ let* msgs4 = lookup_first_message_after_key_back msgs3 in
+ lookup_first_message_for_key_back msgs4
end
end
else
- let* l =
+ let* msgs2 =
betree_List_push_front (u64 & betree_Message_t) msgs1 (key, new_msg) in
- lookup_first_message_for_key_back l
+ lookup_first_message_for_key_back msgs2
(** [betree_main::betree::{betree_main::betree::Node#5}::apply_messages_to_internal]:
Source: 'src/betree.rs', lines 502:4-505:5 *)
@@ -429,8 +432,8 @@ let rec betree_Node_apply_messages_to_internal
begin match new_msgs with
| Betree_List_Cons new_msg new_msgs_tl ->
let (i, m) = new_msg in
- let* l = betree_Node_apply_to_internal msgs i m in
- betree_Node_apply_messages_to_internal l new_msgs_tl
+ let* msgs1 = betree_Node_apply_to_internal msgs i m in
+ betree_Node_apply_messages_to_internal msgs1 new_msgs_tl
| Betree_List_Nil -> Return msgs
end
@@ -470,28 +473,28 @@ let betree_Node_apply_to_leaf
let* b = betree_ListPairU64T_head_has_key u64 bindings1 key in
if b
then
- let* (hd, l) = betree_List_pop_front (u64 & u64) bindings1 in
+ let* (hd, bindings2) = betree_List_pop_front (u64 & u64) bindings1 in
begin match new_msg with
| Betree_Message_Insert v ->
- let* l1 = betree_List_push_front (u64 & u64) l (key, v) in
- lookup_mut_in_bindings_back l1
- | Betree_Message_Delete -> lookup_mut_in_bindings_back l
+ let* bindings3 = betree_List_push_front (u64 & u64) bindings2 (key, v) in
+ lookup_mut_in_bindings_back bindings3
+ | Betree_Message_Delete -> lookup_mut_in_bindings_back bindings2
| Betree_Message_Upsert s ->
let (_, i) = hd in
let* v = betree_upsert_update (Some i) s in
- let* l1 = betree_List_push_front (u64 & u64) l (key, v) in
- lookup_mut_in_bindings_back l1
+ let* bindings3 = betree_List_push_front (u64 & u64) bindings2 (key, v) in
+ lookup_mut_in_bindings_back bindings3
end
else
begin match new_msg with
| Betree_Message_Insert v ->
- let* l = betree_List_push_front (u64 & u64) bindings1 (key, v) in
- lookup_mut_in_bindings_back l
+ let* bindings2 = betree_List_push_front (u64 & u64) bindings1 (key, v) in
+ lookup_mut_in_bindings_back bindings2
| Betree_Message_Delete -> lookup_mut_in_bindings_back bindings1
| Betree_Message_Upsert s ->
let* v = betree_upsert_update None s in
- let* l = betree_List_push_front (u64 & u64) bindings1 (key, v) in
- lookup_mut_in_bindings_back l
+ let* bindings2 = betree_List_push_front (u64 & u64) bindings1 (key, v) in
+ lookup_mut_in_bindings_back bindings2
end
(** [betree_main::betree::{betree_main::betree::Node#5}::apply_messages_to_leaf]:
@@ -505,8 +508,8 @@ let rec betree_Node_apply_messages_to_leaf
begin match new_msgs with
| Betree_List_Cons new_msg new_msgs_tl ->
let (i, m) = new_msg in
- let* l = betree_Node_apply_to_leaf bindings i m in
- betree_Node_apply_messages_to_leaf l new_msgs_tl
+ let* bindings1 = betree_Node_apply_to_leaf bindings i m in
+ betree_Node_apply_messages_to_leaf bindings1 new_msgs_tl
| Betree_List_Nil -> Return bindings
end
@@ -560,31 +563,31 @@ and betree_Node_apply_messages
begin match self with
| Betree_Node_Internal node ->
let* (st1, content) = betree_load_internal_node node.id st in
- let* l = betree_Node_apply_messages_to_internal content msgs in
- let* num_msgs = betree_List_len (u64 & betree_Message_t) l in
+ let* content1 = betree_Node_apply_messages_to_internal content msgs in
+ let* num_msgs = betree_List_len (u64 & betree_Message_t) content1 in
if num_msgs >= params.min_flush_size
then
- let* (st2, (content1, p)) =
- betree_Internal_flush node params node_id_cnt l st1 in
+ let* (st2, (content2, p)) =
+ betree_Internal_flush node params node_id_cnt content1 st1 in
let (node1, node_id_cnt1) = p in
- let* (st3, _) = betree_store_internal_node node1.id content1 st2 in
+ let* (st3, _) = betree_store_internal_node node1.id content2 st2 in
Return (st3, (Betree_Node_Internal node1, node_id_cnt1))
else
- let* (st2, _) = betree_store_internal_node node.id l st1 in
+ let* (st2, _) = betree_store_internal_node node.id content1 st1 in
Return (st2, (Betree_Node_Internal node, node_id_cnt))
| Betree_Node_Leaf node ->
let* (st1, content) = betree_load_leaf_node node.id st in
- let* l = betree_Node_apply_messages_to_leaf content msgs in
- let* len = betree_List_len (u64 & u64) l in
+ let* content1 = betree_Node_apply_messages_to_leaf content msgs in
+ let* len = betree_List_len (u64 & u64) content1 in
let* i = u64_mul 2 params.split_size in
if len >= i
then
- let* (st2, (new_node, nic)) =
- betree_Leaf_split node l params node_id_cnt st1 in
+ let* (st2, (new_node, node_id_cnt1)) =
+ betree_Leaf_split node content1 params node_id_cnt st1 in
let* (st3, _) = betree_store_leaf_node node.id Betree_List_Nil st2 in
- Return (st3, (Betree_Node_Internal new_node, nic))
+ Return (st3, (Betree_Node_Internal new_node, node_id_cnt1))
else
- let* (st2, _) = betree_store_leaf_node node.id l st1 in
+ let* (st2, _) = betree_store_leaf_node node.id content1 st1 in
Return (st2, (Betree_Node_Leaf { node with size = len }, node_id_cnt))
end
@@ -609,12 +612,12 @@ let betree_BeTree_new
result (state & betree_BeTree_t)
=
let* node_id_cnt = betree_NodeIdCounter_new in
- let* (id, nic) = betree_NodeIdCounter_fresh_id node_id_cnt in
+ let* (id, node_id_cnt1) = betree_NodeIdCounter_fresh_id node_id_cnt in
let* (st1, _) = betree_store_leaf_node id Betree_List_Nil st in
Return (st1,
{
params = { min_flush_size = min_flush_size; split_size = split_size };
- node_id_cnt = nic;
+ node_id_cnt = node_id_cnt1;
root = (Betree_Node_Leaf { id = id; size = 0 })
})
diff --git a/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst b/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst
index ec042fb3..2469f98c 100644
--- a/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst
+++ b/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst
@@ -22,8 +22,7 @@ let betree_store_internal_node
(id : u64) (content : betree_List_t (u64 & betree_Message_t)) (st : state) :
result (state & unit)
=
- let* (st1, _) = betree_utils_store_internal_node id content st in
- Return (st1, ())
+ betree_utils_store_internal_node id content st
(** [betree_main::betree::load_leaf_node]:
Source: 'src/betree.rs', lines 46:0-46:44 *)
@@ -37,8 +36,7 @@ let betree_store_leaf_node
(id : u64) (content : betree_List_t (u64 & u64)) (st : state) :
result (state & unit)
=
- let* (st1, _) = betree_utils_store_leaf_node id content st in
- Return (st1, ())
+ betree_utils_store_leaf_node id content st
(** [betree_main::betree::fresh_node_id]:
Source: 'src/betree.rs', lines 55:0-55:48 *)
@@ -172,13 +170,14 @@ let betree_Leaf_split
let (content0, content1) = p in
let* p1 = betree_List_hd (u64 & u64) content1 in
let (pivot, _) = p1 in
- let* (id0, nic) = betree_NodeIdCounter_fresh_id node_id_cnt in
- let* (id1, nic1) = betree_NodeIdCounter_fresh_id nic in
+ let* (id0, node_id_cnt1) = betree_NodeIdCounter_fresh_id node_id_cnt in
+ let* (id1, node_id_cnt2) = betree_NodeIdCounter_fresh_id node_id_cnt1 in
let* (st1, _) = betree_store_leaf_node id0 content0 st in
let* (st2, _) = betree_store_leaf_node id1 content1 st1 in
let n = Betree_Node_Leaf { id = id0; size = params.split_size } in
let n1 = Betree_Node_Leaf { id = id1; size = params.split_size } in
- Return (st2, ({ id = self.id; pivot = pivot; left = n; right = n1 }, nic1))
+ Return (st2, ({ id = self.id; pivot = pivot; left = n; right = n1 },
+ node_id_cnt2))
(** [betree_main::betree::{betree_main::betree::Node#5}::lookup_first_message_for_key]:
Source: 'src/betree.rs', lines 789:4-792:34 *)
@@ -231,21 +230,21 @@ let rec betree_Node_apply_upserts
let* b = betree_ListPairU64T_head_has_key betree_Message_t msgs key in
if b
then
- let* (msg, l) = betree_List_pop_front (u64 & betree_Message_t) msgs in
+ let* (msg, msgs1) = betree_List_pop_front (u64 & betree_Message_t) msgs in
let (_, m) = msg in
begin match m with
| Betree_Message_Insert _ -> Fail Failure
| Betree_Message_Delete -> Fail Failure
| Betree_Message_Upsert s ->
let* v = betree_upsert_update prev s in
- betree_Node_apply_upserts l (Some v) key st
+ betree_Node_apply_upserts msgs1 (Some v) key st
end
else
let* (st1, v) = core_option_Option_unwrap u64 prev st in
- let* l =
+ let* msgs1 =
betree_List_push_front (u64 & betree_Message_t) msgs (key,
Betree_Message_Insert v) in
- Return (st1, (v, l))
+ Return (st1, (v, msgs1))
(** [betree_main::betree::{betree_main::betree::Internal#4}::lookup_in_children]:
Source: 'src/betree.rs', lines 395:4-395:63 *)
@@ -279,10 +278,11 @@ and betree_Node_lookup
let (k, msg) = p in
if k <> key
then
- let* (st2, (o, i)) = betree_Internal_lookup_in_children node key st1 in
+ let* (st2, (o, node1)) =
+ betree_Internal_lookup_in_children node key st1 in
let* _ =
lookup_first_message_for_key_back (Betree_List_Cons (k, msg) l) in
- Return (st2, (o, Betree_Node_Internal i))
+ Return (st2, (o, Betree_Node_Internal node1))
else
begin match msg with
| Betree_Message_Insert v ->
@@ -296,19 +296,20 @@ and betree_Node_lookup
Betree_Message_Delete) l) in
Return (st1, (None, Betree_Node_Internal node))
| Betree_Message_Upsert ufs ->
- let* (st2, (v, i)) = betree_Internal_lookup_in_children node key st1
- in
- let* (st3, (v1, l1)) =
+ let* (st2, (v, node1)) =
+ betree_Internal_lookup_in_children node key st1 in
+ let* (st3, (v1, pending1)) =
betree_Node_apply_upserts (Betree_List_Cons (k,
Betree_Message_Upsert ufs) l) v key st2 in
- let* msgs1 = lookup_first_message_for_key_back l1 in
- let* (st4, _) = betree_store_internal_node i.id msgs1 st3 in
- Return (st4, (Some v1, Betree_Node_Internal i))
+ let* msgs1 = lookup_first_message_for_key_back pending1 in
+ let* (st4, _) = betree_store_internal_node node1.id msgs1 st3 in
+ Return (st4, (Some v1, Betree_Node_Internal node1))
end
| Betree_List_Nil ->
- let* (st2, (o, i)) = betree_Internal_lookup_in_children node key st1 in
+ let* (st2, (o, node1)) = betree_Internal_lookup_in_children node key st1
+ in
let* _ = lookup_first_message_for_key_back Betree_List_Nil in
- Return (st2, (o, Betree_Node_Internal i))
+ Return (st2, (o, Betree_Node_Internal node1))
end
| Betree_Node_Leaf node ->
let* (st1, bindings) = betree_load_leaf_node node.id st in
@@ -328,10 +329,10 @@ let rec betree_Node_filter_messages_for_key
let (k, m) = p in
if k = key
then
- let* (_, l1) =
+ let* (_, msgs1) =
betree_List_pop_front (u64 & betree_Message_t) (Betree_List_Cons (k, m)
l) in
- betree_Node_filter_messages_for_key key l1
+ betree_Node_filter_messages_for_key key msgs1
else Return (Betree_List_Cons (k, m) l)
| Betree_List_Nil -> Return Betree_List_Nil
end
@@ -374,49 +375,51 @@ let betree_Node_apply_to_internal
then
begin match new_msg with
| Betree_Message_Insert i ->
- let* l = betree_Node_filter_messages_for_key key msgs1 in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* msgs2 = betree_Node_filter_messages_for_key key msgs1 in
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Insert i) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Delete ->
- let* l = betree_Node_filter_messages_for_key key msgs1 in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* msgs2 = betree_Node_filter_messages_for_key key msgs1 in
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Delete) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Upsert s ->
let* p = betree_List_hd (u64 & betree_Message_t) msgs1 in
let (_, m) = p in
begin match m with
| Betree_Message_Insert prev ->
let* v = betree_upsert_update (Some prev) s in
- let* (_, l) = betree_List_pop_front (u64 & betree_Message_t) msgs1 in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* (_, msgs2) = betree_List_pop_front (u64 & betree_Message_t) msgs1
+ in
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Insert v) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Delete ->
- let* (_, l) = betree_List_pop_front (u64 & betree_Message_t) msgs1 in
+ let* (_, msgs2) = betree_List_pop_front (u64 & betree_Message_t) msgs1
+ in
let* v = betree_upsert_update None s in
- let* l1 =
- betree_List_push_front (u64 & betree_Message_t) l (key,
+ let* msgs3 =
+ betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Insert v) in
- lookup_first_message_for_key_back l1
+ lookup_first_message_for_key_back msgs3
| Betree_Message_Upsert _ ->
let* (msgs2, lookup_first_message_after_key_back) =
betree_Node_lookup_first_message_after_key key msgs1 in
- let* l =
+ let* msgs3 =
betree_List_push_front (u64 & betree_Message_t) msgs2 (key,
Betree_Message_Upsert s) in
- let* msgs3 = lookup_first_message_after_key_back l in
- lookup_first_message_for_key_back msgs3
+ let* msgs4 = lookup_first_message_after_key_back msgs3 in
+ lookup_first_message_for_key_back msgs4
end
end
else
- let* l =
+ let* msgs2 =
betree_List_push_front (u64 & betree_Message_t) msgs1 (key, new_msg) in
- lookup_first_message_for_key_back l
+ lookup_first_message_for_key_back msgs2
(** [betree_main::betree::{betree_main::betree::Node#5}::apply_messages_to_internal]:
Source: 'src/betree.rs', lines 502:4-505:5 *)
@@ -429,8 +432,8 @@ let rec betree_Node_apply_messages_to_internal
begin match new_msgs with
| Betree_List_Cons new_msg new_msgs_tl ->
let (i, m) = new_msg in
- let* l = betree_Node_apply_to_internal msgs i m in
- betree_Node_apply_messages_to_internal l new_msgs_tl
+ let* msgs1 = betree_Node_apply_to_internal msgs i m in
+ betree_Node_apply_messages_to_internal msgs1 new_msgs_tl
| Betree_List_Nil -> Return msgs
end
@@ -470,28 +473,28 @@ let betree_Node_apply_to_leaf
let* b = betree_ListPairU64T_head_has_key u64 bindings1 key in
if b
then
- let* (hd, l) = betree_List_pop_front (u64 & u64) bindings1 in
+ let* (hd, bindings2) = betree_List_pop_front (u64 & u64) bindings1 in
begin match new_msg with
| Betree_Message_Insert v ->
- let* l1 = betree_List_push_front (u64 & u64) l (key, v) in
- lookup_mut_in_bindings_back l1
- | Betree_Message_Delete -> lookup_mut_in_bindings_back l
+ let* bindings3 = betree_List_push_front (u64 & u64) bindings2 (key, v) in
+ lookup_mut_in_bindings_back bindings3
+ | Betree_Message_Delete -> lookup_mut_in_bindings_back bindings2
| Betree_Message_Upsert s ->
let (_, i) = hd in
let* v = betree_upsert_update (Some i) s in
- let* l1 = betree_List_push_front (u64 & u64) l (key, v) in
- lookup_mut_in_bindings_back l1
+ let* bindings3 = betree_List_push_front (u64 & u64) bindings2 (key, v) in
+ lookup_mut_in_bindings_back bindings3
end
else
begin match new_msg with
| Betree_Message_Insert v ->
- let* l = betree_List_push_front (u64 & u64) bindings1 (key, v) in
- lookup_mut_in_bindings_back l
+ let* bindings2 = betree_List_push_front (u64 & u64) bindings1 (key, v) in
+ lookup_mut_in_bindings_back bindings2
| Betree_Message_Delete -> lookup_mut_in_bindings_back bindings1
| Betree_Message_Upsert s ->
let* v = betree_upsert_update None s in
- let* l = betree_List_push_front (u64 & u64) bindings1 (key, v) in
- lookup_mut_in_bindings_back l
+ let* bindings2 = betree_List_push_front (u64 & u64) bindings1 (key, v) in
+ lookup_mut_in_bindings_back bindings2
end
(** [betree_main::betree::{betree_main::betree::Node#5}::apply_messages_to_leaf]:
@@ -505,8 +508,8 @@ let rec betree_Node_apply_messages_to_leaf
begin match new_msgs with
| Betree_List_Cons new_msg new_msgs_tl ->
let (i, m) = new_msg in
- let* l = betree_Node_apply_to_leaf bindings i m in
- betree_Node_apply_messages_to_leaf l new_msgs_tl
+ let* bindings1 = betree_Node_apply_to_leaf bindings i m in
+ betree_Node_apply_messages_to_leaf bindings1 new_msgs_tl
| Betree_List_Nil -> Return bindings
end
@@ -560,31 +563,31 @@ and betree_Node_apply_messages
begin match self with
| Betree_Node_Internal node ->
let* (st1, content) = betree_load_internal_node node.id st in
- let* l = betree_Node_apply_messages_to_internal content msgs in
- let* num_msgs = betree_List_len (u64 & betree_Message_t) l in
+ let* content1 = betree_Node_apply_messages_to_internal content msgs in
+ let* num_msgs = betree_List_len (u64 & betree_Message_t) content1 in
if num_msgs >= params.min_flush_size
then
- let* (st2, (content1, p)) =
- betree_Internal_flush node params node_id_cnt l st1 in
+ let* (st2, (content2, p)) =
+ betree_Internal_flush node params node_id_cnt content1 st1 in
let (node1, node_id_cnt1) = p in
- let* (st3, _) = betree_store_internal_node node1.id content1 st2 in
+ let* (st3, _) = betree_store_internal_node node1.id content2 st2 in
Return (st3, (Betree_Node_Internal node1, node_id_cnt1))
else
- let* (st2, _) = betree_store_internal_node node.id l st1 in
+ let* (st2, _) = betree_store_internal_node node.id content1 st1 in
Return (st2, (Betree_Node_Internal node, node_id_cnt))
| Betree_Node_Leaf node ->
let* (st1, content) = betree_load_leaf_node node.id st in
- let* l = betree_Node_apply_messages_to_leaf content msgs in
- let* len = betree_List_len (u64 & u64) l in
+ let* content1 = betree_Node_apply_messages_to_leaf content msgs in
+ let* len = betree_List_len (u64 & u64) content1 in
let* i = u64_mul 2 params.split_size in
if len >= i
then
- let* (st2, (new_node, nic)) =
- betree_Leaf_split node l params node_id_cnt st1 in
+ let* (st2, (new_node, node_id_cnt1)) =
+ betree_Leaf_split node content1 params node_id_cnt st1 in
let* (st3, _) = betree_store_leaf_node node.id Betree_List_Nil st2 in
- Return (st3, (Betree_Node_Internal new_node, nic))
+ Return (st3, (Betree_Node_Internal new_node, node_id_cnt1))
else
- let* (st2, _) = betree_store_leaf_node node.id l st1 in
+ let* (st2, _) = betree_store_leaf_node node.id content1 st1 in
Return (st2, (Betree_Node_Leaf { node with size = len }, node_id_cnt))
end
@@ -609,12 +612,12 @@ let betree_BeTree_new
result (state & betree_BeTree_t)
=
let* node_id_cnt = betree_NodeIdCounter_new in
- let* (id, nic) = betree_NodeIdCounter_fresh_id node_id_cnt in
+ let* (id, node_id_cnt1) = betree_NodeIdCounter_fresh_id node_id_cnt in
let* (st1, _) = betree_store_leaf_node id Betree_List_Nil st in
Return (st1,
{
params = { min_flush_size = min_flush_size; split_size = split_size };
- node_id_cnt = nic;
+ node_id_cnt = node_id_cnt1;
root = (Betree_Node_Leaf { id = id; size = 0 })
})
diff --git a/tests/fstar/demo/Demo.fst b/tests/fstar/demo/Demo.fst
index d13d2ba3..d93bc847 100644
--- a/tests/fstar/demo/Demo.fst
+++ b/tests/fstar/demo/Demo.fst
@@ -28,14 +28,19 @@ let use_mul2_add1 (x : u32) (y : u32) : result u32 =
let incr (x : u32) : result u32 =
u32_add x 1
+(** [demo::use_incr]:
+ Source: 'src/demo.rs', lines 25:0-25:17 *)
+let use_incr : result unit =
+ let* x = incr 0 in let* x1 = incr x in let* _ = incr x1 in Return ()
+
(** [demo::CList]
- Source: 'src/demo.rs', lines 27:0-27:17 *)
+ Source: 'src/demo.rs', lines 34:0-34:17 *)
type cList_t (t : Type0) =
| CList_CCons : t -> cList_t t -> cList_t t
| CList_CNil : cList_t t
(** [demo::list_nth]:
- Source: 'src/demo.rs', lines 32:0-32:56 *)
+ Source: 'src/demo.rs', lines 39:0-39:56 *)
let rec list_nth (t : Type0) (n : nat) (l : cList_t t) (i : u32) : result t =
if is_zero n
then Fail OutOfFuel
@@ -48,7 +53,7 @@ let rec list_nth (t : Type0) (n : nat) (l : cList_t t) (i : u32) : result t =
end
(** [demo::list_nth_mut]:
- Source: 'src/demo.rs', lines 47:0-47:68 *)
+ Source: 'src/demo.rs', lines 54:0-54:68 *)
let rec list_nth_mut
(t : Type0) (n : nat) (l : cList_t t) (i : u32) :
result (t & (t -> result (cList_t t)))
@@ -74,7 +79,7 @@ let rec list_nth_mut
end
(** [demo::list_nth_mut1]: loop 0:
- Source: 'src/demo.rs', lines 62:0-71:1 *)
+ Source: 'src/demo.rs', lines 69:0-78:1 *)
let rec list_nth_mut1_loop
(t : Type0) (n : nat) (l : cList_t t) (i : u32) :
result (t & (t -> result (cList_t t)))
@@ -99,15 +104,15 @@ let rec list_nth_mut1_loop
end
(** [demo::list_nth_mut1]:
- Source: 'src/demo.rs', lines 62:0-62:77 *)
+ Source: 'src/demo.rs', lines 69:0-69:77 *)
let list_nth_mut1
(t : Type0) (n : nat) (l : cList_t t) (i : u32) :
result (t & (t -> result (cList_t t)))
=
- let* (x, back_'a) = list_nth_mut1_loop t n l i in Return (x, back_'a)
+ list_nth_mut1_loop t n l i
(** [demo::i32_id]:
- Source: 'src/demo.rs', lines 73:0-73:28 *)
+ Source: 'src/demo.rs', lines 80:0-80:28 *)
let rec i32_id (n : nat) (i : i32) : result i32 =
if is_zero n
then Fail OutOfFuel
@@ -117,21 +122,41 @@ let rec i32_id (n : nat) (i : i32) : result i32 =
then Return 0
else let* i1 = i32_sub i 1 in let* i2 = i32_id n1 i1 in i32_add i2 1
+(** [demo::list_tail]:
+ Source: 'src/demo.rs', lines 88:0-88:64 *)
+let rec list_tail
+ (t : Type0) (n : nat) (l : cList_t t) :
+ result ((cList_t t) & (cList_t t -> result (cList_t t)))
+ =
+ if is_zero n
+ then Fail OutOfFuel
+ else
+ let n1 = decrease n in
+ begin match l with
+ | CList_CCons x tl ->
+ let* (c, list_tail_back) = list_tail t n1 tl in
+ let back_'a =
+ fun ret -> let* tl1 = list_tail_back ret in Return (CList_CCons x tl1)
+ in
+ Return (c, back_'a)
+ | CList_CNil -> Return (CList_CNil, Return)
+ end
+
(** Trait declaration: [demo::Counter]
- Source: 'src/demo.rs', lines 83:0-83:17 *)
+ Source: 'src/demo.rs', lines 97:0-97:17 *)
noeq type counter_t (self : Type0) = { incr : self -> result (usize & self); }
(** [demo::{(demo::Counter for usize)}::incr]:
- Source: 'src/demo.rs', lines 88:4-88:31 *)
+ Source: 'src/demo.rs', lines 102:4-102:31 *)
let counterUsize_incr (self : usize) : result (usize & usize) =
let* self1 = usize_add self 1 in Return (self, self1)
(** Trait implementation: [demo::{(demo::Counter for usize)}]
- Source: 'src/demo.rs', lines 87:0-87:22 *)
+ Source: 'src/demo.rs', lines 101:0-101:22 *)
let counterUsize : counter_t usize = { incr = counterUsize_incr; }
(** [demo::use_counter]:
- Source: 'src/demo.rs', lines 95:0-95:59 *)
+ Source: 'src/demo.rs', lines 109:0-109:59 *)
let use_counter
(t : Type0) (counterInst : counter_t t) (cnt : t) : result (usize & t) =
counterInst.incr cnt
diff --git a/tests/fstar/hashmap/Hashmap.Funs.fst b/tests/fstar/hashmap/Hashmap.Funs.fst
index 447f9b49..fba711f1 100644
--- a/tests/fstar/hashmap/Hashmap.Funs.fst
+++ b/tests/fstar/hashmap/Hashmap.Funs.fst
@@ -21,9 +21,9 @@ let rec hashMap_allocate_slots_loop
=
if n > 0
then
- let* v = alloc_vec_Vec_push (list_t t) slots List_Nil in
+ let* slots1 = alloc_vec_Vec_push (list_t t) slots List_Nil in
let* n1 = usize_sub n 1 in
- hashMap_allocate_slots_loop t v n1
+ hashMap_allocate_slots_loop t slots1 n1
else Return slots
(** [hashmap::{hashmap::HashMap<T>}::allocate_slots]:
@@ -142,8 +142,8 @@ let rec hashMap_move_elements_from_list_loop
=
begin match ls with
| List_Cons k v tl ->
- let* hm = hashMap_insert_no_resize t ntable k v in
- hashMap_move_elements_from_list_loop t hm tl
+ let* ntable1 = hashMap_insert_no_resize t ntable k v in
+ hashMap_move_elements_from_list_loop t ntable1 tl
| List_Nil -> Return ntable
end
@@ -168,12 +168,10 @@ let rec hashMap_move_elements_loop
alloc_vec_Vec_index_mut (list_t t) usize
(core_slice_index_SliceIndexUsizeSliceTInst (list_t t)) slots i in
let (ls, l1) = core_mem_replace (list_t t) l List_Nil in
- let* hm = hashMap_move_elements_from_list t ntable ls in
+ let* ntable1 = hashMap_move_elements_from_list t ntable ls in
let* i2 = usize_add i 1 in
let* slots1 = index_mut_back l1 in
- let* back_'a = hashMap_move_elements_loop t hm slots1 i2 in
- let (hm1, v) = back_'a in
- Return (hm1, v)
+ hashMap_move_elements_loop t ntable1 slots1 i2
else Return (ntable, slots)
(** [hashmap::{hashmap::HashMap<T>}::move_elements]:
@@ -183,9 +181,7 @@ let hashMap_move_elements
(i : usize) :
result ((hashMap_t t) & (alloc_vec_Vec (list_t t)))
=
- let* back_'a = hashMap_move_elements_loop t ntable slots i in
- let (hm, v) = back_'a in
- Return (hm, v)
+ hashMap_move_elements_loop t ntable slots i
(** [hashmap::{hashmap::HashMap<T>}::try_resize]:
Source: 'src/hashmap.rs', lines 140:4-140:28 *)
@@ -213,9 +209,9 @@ let hashMap_insert
(t : Type0) (self : hashMap_t t) (key : usize) (value : t) :
result (hashMap_t t)
=
- let* hm = hashMap_insert_no_resize t self key value in
- let* i = hashMap_len t hm in
- if i > hm.max_load then hashMap_try_resize t hm else Return hm
+ let* self1 = hashMap_insert_no_resize t self key value in
+ let* i = hashMap_len t self1 in
+ if i > self1.max_load then hashMap_try_resize t self1 else Return self1
(** [hashmap::{hashmap::HashMap<T>}::contains_key_in_list]: loop 0:
Source: 'src/hashmap.rs', lines 206:4-219:5 *)
@@ -308,8 +304,7 @@ let hashMap_get_mut_in_list
(t : Type0) (ls : list_t t) (key : usize) :
result (t & (t -> result (list_t t)))
=
- let* (x, back_'a) = hashMap_get_mut_in_list_loop t ls key in
- Return (x, back_'a)
+ hashMap_get_mut_in_list_loop t ls key
(** [hashmap::{hashmap::HashMap<T>}::get_mut]:
Source: 'src/hashmap.rs', lines 257:4-257:67 *)
diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst
index b16dcada..97f4151f 100644
--- a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst
+++ b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst
@@ -22,9 +22,10 @@ let rec hashmap_HashMap_allocate_slots_loop
=
if n > 0
then
- let* v = alloc_vec_Vec_push (hashmap_List_t t) slots Hashmap_List_Nil in
+ let* slots1 = alloc_vec_Vec_push (hashmap_List_t t) slots Hashmap_List_Nil
+ in
let* n1 = usize_sub n 1 in
- hashmap_HashMap_allocate_slots_loop t v n1
+ hashmap_HashMap_allocate_slots_loop t slots1 n1
else Return slots
(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::allocate_slots]:
@@ -149,8 +150,8 @@ let rec hashmap_HashMap_move_elements_from_list_loop
=
begin match ls with
| Hashmap_List_Cons k v tl ->
- let* hm = hashmap_HashMap_insert_no_resize t ntable k v in
- hashmap_HashMap_move_elements_from_list_loop t hm tl
+ let* ntable1 = hashmap_HashMap_insert_no_resize t ntable k v in
+ hashmap_HashMap_move_elements_from_list_loop t ntable1 tl
| Hashmap_List_Nil -> Return ntable
end
@@ -178,12 +179,10 @@ let rec hashmap_HashMap_move_elements_loop
(core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t t)) slots i
in
let (ls, l1) = core_mem_replace (hashmap_List_t t) l Hashmap_List_Nil in
- let* hm = hashmap_HashMap_move_elements_from_list t ntable ls in
+ let* ntable1 = hashmap_HashMap_move_elements_from_list t ntable ls in
let* i2 = usize_add i 1 in
let* slots1 = index_mut_back l1 in
- let* back_'a = hashmap_HashMap_move_elements_loop t hm slots1 i2 in
- let (hm1, v) = back_'a in
- Return (hm1, v)
+ hashmap_HashMap_move_elements_loop t ntable1 slots1 i2
else Return (ntable, slots)
(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::move_elements]:
@@ -193,9 +192,7 @@ let hashmap_HashMap_move_elements
(slots : alloc_vec_Vec (hashmap_List_t t)) (i : usize) :
result ((hashmap_HashMap_t t) & (alloc_vec_Vec (hashmap_List_t t)))
=
- let* back_'a = hashmap_HashMap_move_elements_loop t ntable slots i in
- let (hm, v) = back_'a in
- Return (hm, v)
+ hashmap_HashMap_move_elements_loop t ntable slots i
(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::try_resize]:
Source: 'src/hashmap.rs', lines 140:4-140:28 *)
@@ -223,9 +220,11 @@ let hashmap_HashMap_insert
(t : Type0) (self : hashmap_HashMap_t t) (key : usize) (value : t) :
result (hashmap_HashMap_t t)
=
- let* hm = hashmap_HashMap_insert_no_resize t self key value in
- let* i = hashmap_HashMap_len t hm in
- if i > hm.max_load then hashmap_HashMap_try_resize t hm else Return hm
+ let* self1 = hashmap_HashMap_insert_no_resize t self key value in
+ let* i = hashmap_HashMap_len t self1 in
+ if i > self1.max_load
+ then hashmap_HashMap_try_resize t self1
+ else Return self1
(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::contains_key_in_list]: loop 0:
Source: 'src/hashmap.rs', lines 206:4-219:5 *)
@@ -324,8 +323,7 @@ let hashmap_HashMap_get_mut_in_list
(t : Type0) (ls : hashmap_List_t t) (key : usize) :
result (t & (t -> result (hashmap_List_t t)))
=
- let* (x, back_'a) = hashmap_HashMap_get_mut_in_list_loop t ls key in
- Return (x, back_'a)
+ hashmap_HashMap_get_mut_in_list_loop t ls key
(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::get_mut]:
Source: 'src/hashmap.rs', lines 257:4-257:67 *)
@@ -446,8 +444,7 @@ let insert_on_disk
(key : usize) (value : u64) (st : state) : result (state & unit) =
let* (st1, hm) = hashmap_utils_deserialize st in
let* hm1 = hashmap_HashMap_insert u64 hm key value in
- let* (st2, _) = hashmap_utils_serialize hm1 st1 in
- Return (st2, ())
+ hashmap_utils_serialize hm1 st1
(** [hashmap_main::main]:
Source: 'src/hashmap_main.rs', lines 16:0-16:13 *)
diff --git a/tests/fstar/misc/External.Funs.fst b/tests/fstar/misc/External.Funs.fst
index 6672b523..3ba20022 100644
--- a/tests/fstar/misc/External.Funs.fst
+++ b/tests/fstar/misc/External.Funs.fst
@@ -33,8 +33,8 @@ let custom_swap
(t : Type0) (x : t) (y : t) (st : state) :
result (state & (t & (t -> state -> result (state & (t & t)))))
=
- let* (st1, (x1, x2)) = core_mem_swap t x y st in
- let back_'a = fun ret st2 -> Return (st2, (ret, x2)) in
+ let* (st1, (x1, y1)) = core_mem_swap t x y st in
+ let back_'a = fun ret st2 -> Return (st2, (ret, y1)) in
Return (st1, (x1, back_'a))
(** [external::test_custom_swap]:
diff --git a/tests/fstar/misc/Loops.Clauses.Template.fst b/tests/fstar/misc/Loops.Clauses.Template.fst
index c8ed16f4..e43f8170 100644
--- a/tests/fstar/misc/Loops.Clauses.Template.fst
+++ b/tests/fstar/misc/Loops.Clauses.Template.fst
@@ -13,8 +13,7 @@ unfold let sum_loop_decreases (max : u32) (i : u32) (s : u32) : nat = admit ()
(** [loops::sum_with_mut_borrows]: decreases clause
Source: 'src/loops.rs', lines 19:0-31:1 *)
unfold
-let sum_with_mut_borrows_loop_decreases (max : u32) (mi : u32) (ms : u32) : nat
- =
+let sum_with_mut_borrows_loop_decreases (max : u32) (i : u32) (s : u32) : nat =
admit ()
(** [loops::sum_with_shared_borrows]: decreases clause
diff --git a/tests/fstar/misc/Loops.Funs.fst b/tests/fstar/misc/Loops.Funs.fst
index 5f24fe7a..7c099da2 100644
--- a/tests/fstar/misc/Loops.Funs.fst
+++ b/tests/fstar/misc/Loops.Funs.fst
@@ -25,15 +25,15 @@ let sum (max : u32) : result u32 =
(** [loops::sum_with_mut_borrows]: loop 0:
Source: 'src/loops.rs', lines 19:0-31:1 *)
let rec sum_with_mut_borrows_loop
- (max : u32) (mi : u32) (ms : u32) :
- Tot (result u32) (decreases (sum_with_mut_borrows_loop_decreases max mi ms))
+ (max : u32) (i : u32) (s : u32) :
+ Tot (result u32) (decreases (sum_with_mut_borrows_loop_decreases max i s))
=
- if mi < max
+ if i < max
then
- let* ms1 = u32_add ms mi in
- let* mi1 = u32_add mi 1 in
- sum_with_mut_borrows_loop max mi1 ms1
- else u32_mul ms 2
+ let* ms = u32_add s i in
+ let* mi = u32_add i 1 in
+ sum_with_mut_borrows_loop max mi ms
+ else u32_mul s 2
(** [loops::sum_with_mut_borrows]:
Source: 'src/loops.rs', lines 19:0-19:44 *)
@@ -140,7 +140,7 @@ let list_nth_mut_loop
(t : Type0) (ls : list_t t) (i : u32) :
result (t & (t -> result (list_t t)))
=
- let* (x, back) = list_nth_mut_loop_loop t ls i in Return (x, back)
+ list_nth_mut_loop_loop t ls i
(** [loops::list_nth_shared_loop]: loop 0:
Source: 'src/loops.rs', lines 101:0-111:1 *)
@@ -185,11 +185,11 @@ let get_elem_mut
(slots : alloc_vec_Vec (list_t usize)) (x : usize) :
result (usize & (usize -> result (alloc_vec_Vec (list_t usize))))
=
- let* (l, index_mut_back) =
+ let* (ls, index_mut_back) =
alloc_vec_Vec_index_mut (list_t usize) usize
(core_slice_index_SliceIndexUsizeSliceTInst (list_t usize)) slots 0 in
- let* (i, back) = get_elem_mut_loop x l in
- let back1 = fun ret -> let* l1 = back ret in index_mut_back l1 in
+ let* (i, back) = get_elem_mut_loop x ls in
+ let back1 = fun ret -> let* l = back ret in index_mut_back l in
Return (i, back1)
(** [loops::get_elem_shared]: loop 0:
@@ -207,10 +207,10 @@ let rec get_elem_shared_loop
Source: 'src/loops.rs', lines 129:0-129:68 *)
let get_elem_shared
(slots : alloc_vec_Vec (list_t usize)) (x : usize) : result usize =
- let* l =
+ let* ls =
alloc_vec_Vec_index (list_t usize) usize
(core_slice_index_SliceIndexUsizeSliceTInst (list_t usize)) slots 0 in
- get_elem_shared_loop x l
+ get_elem_shared_loop x ls
(** [loops::id_mut]:
Source: 'src/loops.rs', lines 145:0-145:50 *)
@@ -312,8 +312,7 @@ let list_nth_mut_loop_pair
(t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) :
result ((t & t) & (t -> result (list_t t)) & (t -> result (list_t t)))
=
- let* (p, back_'a, back_'b) = list_nth_mut_loop_pair_loop t ls0 ls1 i in
- Return (p, back_'a, back_'b)
+ list_nth_mut_loop_pair_loop t ls0 ls1 i
(** [loops::list_nth_shared_loop_pair]: loop 0:
Source: 'src/loops.rs', lines 208:0-229:1 *)
@@ -376,8 +375,7 @@ let list_nth_mut_loop_pair_merge
(t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) :
result ((t & t) & ((t & t) -> result ((list_t t) & (list_t t))))
=
- let* (p, back_'a) = list_nth_mut_loop_pair_merge_loop t ls0 ls1 i in
- Return (p, back_'a)
+ list_nth_mut_loop_pair_merge_loop t ls0 ls1 i
(** [loops::list_nth_shared_loop_pair_merge]: loop 0:
Source: 'src/loops.rs', lines 251:0-266:1 *)
@@ -438,8 +436,7 @@ let list_nth_mut_shared_loop_pair
(t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) :
result ((t & t) & (t -> result (list_t t)))
=
- let* (p, back_'a) = list_nth_mut_shared_loop_pair_loop t ls0 ls1 i in
- Return (p, back_'a)
+ list_nth_mut_shared_loop_pair_loop t ls0 ls1 i
(** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0:
Source: 'src/loops.rs', lines 288:0-303:1 *)
@@ -474,8 +471,7 @@ let list_nth_mut_shared_loop_pair_merge
(t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) :
result ((t & t) & (t -> result (list_t t)))
=
- let* (p, back_'a) = list_nth_mut_shared_loop_pair_merge_loop t ls0 ls1 i in
- Return (p, back_'a)
+ list_nth_mut_shared_loop_pair_merge_loop t ls0 ls1 i
(** [loops::list_nth_shared_mut_loop_pair]: loop 0:
Source: 'src/loops.rs', lines 307:0-322:1 *)
@@ -509,8 +505,7 @@ let list_nth_shared_mut_loop_pair
(t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) :
result ((t & t) & (t -> result (list_t t)))
=
- let* (p, back_'b) = list_nth_shared_mut_loop_pair_loop t ls0 ls1 i in
- Return (p, back_'b)
+ list_nth_shared_mut_loop_pair_loop t ls0 ls1 i
(** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0:
Source: 'src/loops.rs', lines 326:0-341:1 *)
@@ -545,8 +540,7 @@ let list_nth_shared_mut_loop_pair_merge
(t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) :
result ((t & t) & (t -> result (list_t t)))
=
- let* (p, back_'a) = list_nth_shared_mut_loop_pair_merge_loop t ls0 ls1 i in
- Return (p, back_'a)
+ list_nth_shared_mut_loop_pair_merge_loop t ls0 ls1 i
(** [loops::ignore_input_mut_borrow]: loop 0:
Source: 'src/loops.rs', lines 345:0-349:1 *)
@@ -555,10 +549,7 @@ let rec ignore_input_mut_borrow_loop
Tot (result unit) (decreases (ignore_input_mut_borrow_loop_decreases i))
=
if i > 0
- then
- let* i1 = u32_sub i 1 in
- let* _ = ignore_input_mut_borrow_loop i1 in
- Return ()
+ then let* i1 = u32_sub i 1 in ignore_input_mut_borrow_loop i1
else Return ()
(** [loops::ignore_input_mut_borrow]:
@@ -573,10 +564,7 @@ let rec incr_ignore_input_mut_borrow_loop
Tot (result unit) (decreases (incr_ignore_input_mut_borrow_loop_decreases i))
=
if i > 0
- then
- let* i1 = u32_sub i 1 in
- let* _ = incr_ignore_input_mut_borrow_loop i1 in
- Return ()
+ then let* i1 = u32_sub i 1 in incr_ignore_input_mut_borrow_loop i1
else Return ()
(** [loops::incr_ignore_input_mut_borrow]:
@@ -593,10 +581,7 @@ let rec ignore_input_shared_borrow_loop
Tot (result unit) (decreases (ignore_input_shared_borrow_loop_decreases i))
=
if i > 0
- then
- let* i1 = u32_sub i 1 in
- let* _ = ignore_input_shared_borrow_loop i1 in
- Return ()
+ then let* i1 = u32_sub i 1 in ignore_input_shared_borrow_loop i1
else Return ()
(** [loops::ignore_input_shared_borrow]:
diff --git a/tests/fstar/misc/NoNestedBorrows.fst b/tests/fstar/misc/NoNestedBorrows.fst
index c71f8dbb..db63eb0d 100644
--- a/tests/fstar/misc/NoNestedBorrows.fst
+++ b/tests/fstar/misc/NoNestedBorrows.fst
@@ -425,8 +425,7 @@ let id_mut_pair1
(t1 t2 : Type0) (x : t1) (y : t2) :
result ((t1 & t2) & ((t1 & t2) -> result (t1 & t2)))
=
- let back_'a = fun ret -> let (x1, x2) = ret in Return (x1, x2) in
- Return ((x, y), back_'a)
+ Return ((x, y), Return)
(** [no_nested_borrows::id_mut_pair2]:
Source: 'src/no_nested_borrows.rs', lines 418:0-418:88 *)
@@ -434,9 +433,7 @@ let id_mut_pair2
(t1 t2 : Type0) (p : (t1 & t2)) :
result ((t1 & t2) & ((t1 & t2) -> result (t1 & t2)))
=
- let (x, x1) = p in
- let back_'a = fun ret -> let (x2, x3) = ret in Return (x2, x3) in
- Return ((x, x1), back_'a)
+ let (x, x1) = p in Return ((x, x1), Return)
(** [no_nested_borrows::id_mut_pair3]:
Source: 'src/no_nested_borrows.rs', lines 422:0-422:93 *)
diff --git a/tests/fstar/misc/Paper.fst b/tests/fstar/misc/Paper.fst
index cf4dc454..ddc5e7a8 100644
--- a/tests/fstar/misc/Paper.fst
+++ b/tests/fstar/misc/Paper.fst
@@ -13,7 +13,7 @@ let ref_incr (x : i32) : result i32 =
(** [paper::test_incr]:
Source: 'src/paper.rs', lines 8:0-8:18 *)
let test_incr : result unit =
- let* i = ref_incr 0 in if not (i = 1) then Fail Failure else Return ()
+ let* x = ref_incr 0 in if not (x = 1) then Fail Failure else Return ()
(** Unit test for [paper::test_incr] *)
let _ = assert_norm (test_incr = Return ())