diff options
Diffstat (limited to '')
-rw-r--r-- | tests/fstar/betree/BetreeMain.Funs.fst | 118 | ||||
-rw-r--r-- | tests/fstar/betree/BetreeMain.Opaque.fsti | 12 | ||||
-rw-r--r-- | tests/fstar/betree_back_stateful/BetreeMain.Funs.fst | 128 | ||||
-rw-r--r-- | tests/fstar/betree_back_stateful/BetreeMain.Opaque.fsti | 12 | ||||
-rw-r--r-- | tests/fstar/hashmap/Hashmap.Funs.fst | 85 | ||||
-rw-r--r-- | tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst | 89 | ||||
-rw-r--r-- | tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti | 6 | ||||
-rw-r--r-- | tests/fstar/misc/Constants.fst | 16 | ||||
-rw-r--r-- | tests/fstar/misc/External.Funs.fst | 18 | ||||
-rw-r--r-- | tests/fstar/misc/External.Opaque.fsti | 12 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Funs.fst | 124 | ||||
-rw-r--r-- | tests/fstar/misc/NoNestedBorrows.fst | 112 | ||||
-rw-r--r-- | tests/fstar/misc/Paper.fst | 21 | ||||
-rw-r--r-- | tests/fstar/misc/PoloniusList.fst | 4 |
14 files changed, 396 insertions, 361 deletions
diff --git a/tests/fstar/betree/BetreeMain.Funs.fst b/tests/fstar/betree/BetreeMain.Funs.fst index 0c868f47..f1bc1191 100644 --- a/tests/fstar/betree/BetreeMain.Funs.fst +++ b/tests/fstar/betree/BetreeMain.Funs.fst @@ -8,14 +8,14 @@ include BetreeMain.Clauses #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [betree_main::betree::load_internal_node] *) +(** [betree_main::betree::load_internal_node]: forward function *) let betree_load_internal_node_fwd (id : u64) (st : state) : result (state & (betree_list_t (u64 & betree_message_t))) = betree_utils_load_internal_node_fwd id st -(** [betree_main::betree::store_internal_node] *) +(** [betree_main::betree::store_internal_node]: forward function *) let betree_store_internal_node_fwd (id : u64) (content : betree_list_t (u64 & betree_message_t)) (st : state) : result (state & unit) @@ -23,12 +23,12 @@ let betree_store_internal_node_fwd let* (st0, _) = betree_utils_store_internal_node_fwd id content st in Return (st0, ()) -(** [betree_main::betree::load_leaf_node] *) +(** [betree_main::betree::load_leaf_node]: forward function *) let betree_load_leaf_node_fwd (id : u64) (st : state) : result (state & (betree_list_t (u64 & u64))) = betree_utils_load_leaf_node_fwd id st -(** [betree_main::betree::store_leaf_node] *) +(** [betree_main::betree::store_leaf_node]: forward function *) let betree_store_leaf_node_fwd (id : u64) (content : betree_list_t (u64 & u64)) (st : state) : result (state & unit) @@ -36,25 +36,25 @@ let betree_store_leaf_node_fwd let* (st0, _) = betree_utils_store_leaf_node_fwd id content st in Return (st0, ()) -(** [betree_main::betree::fresh_node_id] *) +(** [betree_main::betree::fresh_node_id]: forward function *) let betree_fresh_node_id_fwd (counter : u64) : result u64 = let* _ = u64_add counter 1 in Return counter -(** [betree_main::betree::fresh_node_id] *) +(** [betree_main::betree::fresh_node_id]: backward function 0 *) let betree_fresh_node_id_back (counter : u64) : result u64 = u64_add counter 1 -(** [betree_main::betree::NodeIdCounter::{0}::new] *) +(** [betree_main::betree::NodeIdCounter::{0}::new]: forward function *) let betree_node_id_counter_new_fwd : result betree_node_id_counter_t = Return { betree_node_id_counter_next_node_id = 0 } -(** [betree_main::betree::NodeIdCounter::{0}::fresh_id] *) +(** [betree_main::betree::NodeIdCounter::{0}::fresh_id]: forward function *) let betree_node_id_counter_fresh_id_fwd (self : betree_node_id_counter_t) : result u64 = let* _ = u64_add self.betree_node_id_counter_next_node_id 1 in Return self.betree_node_id_counter_next_node_id -(** [betree_main::betree::NodeIdCounter::{0}::fresh_id] *) +(** [betree_main::betree::NodeIdCounter::{0}::fresh_id]: backward function 0 *) let betree_node_id_counter_fresh_id_back (self : betree_node_id_counter_t) : result betree_node_id_counter_t = let* i = u64_add self.betree_node_id_counter_next_node_id 1 in @@ -64,7 +64,7 @@ let betree_node_id_counter_fresh_id_back let core_num_u64_max_body : result u64 = Return 18446744073709551615 let core_num_u64_max_c : u64 = eval_global core_num_u64_max_body -(** [betree_main::betree::upsert_update] *) +(** [betree_main::betree::upsert_update]: forward function *) let betree_upsert_update_fwd (prev : option u64) (st : betree_upsert_fun_state_t) : result u64 = begin match prev with @@ -83,7 +83,7 @@ let betree_upsert_update_fwd end end -(** [betree_main::betree::List::{1}::len] *) +(** [betree_main::betree::List::{1}::len]: forward function *) let rec betree_list_len_fwd (t : Type0) (self : betree_list_t t) : Tot (result u64) (decreases (betree_list_len_decreases t self)) @@ -93,7 +93,7 @@ let rec betree_list_len_fwd | BetreeListNil -> Return 0 end -(** [betree_main::betree::List::{1}::split_at] *) +(** [betree_main::betree::List::{1}::split_at]: forward function *) let rec betree_list_split_at_fwd (t : Type0) (self : betree_list_t t) (n : u64) : Tot (result ((betree_list_t t) & (betree_list_t t))) @@ -112,14 +112,15 @@ let rec betree_list_split_at_fwd | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{1}::push_front] *) +(** [betree_main::betree::List::{1}::push_front]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let betree_list_push_front_fwd_back (t : Type0) (self : betree_list_t t) (x : t) : result (betree_list_t t) = let tl = mem_replace_fwd (betree_list_t t) self BetreeListNil in let l = tl in Return (BetreeListCons x l) -(** [betree_main::betree::List::{1}::pop_front] *) +(** [betree_main::betree::List::{1}::pop_front]: forward function *) let betree_list_pop_front_fwd (t : Type0) (self : betree_list_t t) : result t = let ls = mem_replace_fwd (betree_list_t t) self BetreeListNil in begin match ls with @@ -127,7 +128,7 @@ let betree_list_pop_front_fwd (t : Type0) (self : betree_list_t t) : result t = | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{1}::pop_front] *) +(** [betree_main::betree::List::{1}::pop_front]: backward function 0 *) let betree_list_pop_front_back (t : Type0) (self : betree_list_t t) : result (betree_list_t t) = let ls = mem_replace_fwd (betree_list_t t) self BetreeListNil in @@ -136,14 +137,14 @@ let betree_list_pop_front_back | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{1}::hd] *) +(** [betree_main::betree::List::{1}::hd]: forward function *) let betree_list_hd_fwd (t : Type0) (self : betree_list_t t) : result t = begin match self with | BetreeListCons hd l -> Return hd | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{2}::head_has_key] *) +(** [betree_main::betree::List::{2}::head_has_key]: forward function *) let betree_list_head_has_key_fwd (t : Type0) (self : betree_list_t (u64 & t)) (key : u64) : result bool = begin match self with @@ -151,7 +152,7 @@ let betree_list_head_has_key_fwd | BetreeListNil -> Return false end -(** [betree_main::betree::List::{2}::partition_at_pivot] *) +(** [betree_main::betree::List::{2}::partition_at_pivot]: forward function *) let rec betree_list_partition_at_pivot_fwd (t : Type0) (self : betree_list_t (u64 & t)) (pivot : u64) : Tot (result ((betree_list_t (u64 & t)) & (betree_list_t (u64 & t)))) @@ -170,7 +171,7 @@ let rec betree_list_partition_at_pivot_fwd | BetreeListNil -> Return (BetreeListNil, BetreeListNil) end -(** [betree_main::betree::Leaf::{3}::split] *) +(** [betree_main::betree::Leaf::{3}::split]: forward function *) let betree_leaf_split_fwd (self : betree_leaf_t) (content : betree_list_t (u64 & u64)) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -202,7 +203,7 @@ let betree_leaf_split_fwd betree_internal_right = n0 }) -(** [betree_main::betree::Leaf::{3}::split] *) +(** [betree_main::betree::Leaf::{3}::split]: backward function 2 *) let betree_leaf_split_back (self : betree_leaf_t) (content : betree_list_t (u64 & u64)) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -221,7 +222,7 @@ let betree_leaf_split_back let* _ = betree_store_leaf_node_fwd id1 content1 st0 in betree_node_id_counter_fresh_id_back node_id_cnt0 -(** [betree_main::betree::Node::{5}::lookup_in_bindings] *) +(** [betree_main::betree::Node::{5}::lookup_in_bindings]: forward function *) let rec betree_node_lookup_in_bindings_fwd (key : u64) (bindings : betree_list_t (u64 & u64)) : Tot (result (option u64)) @@ -239,7 +240,7 @@ let rec betree_node_lookup_in_bindings_fwd | BetreeListNil -> Return None end -(** [betree_main::betree::Node::{5}::lookup_first_message_for_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_for_key]: forward function *) let rec betree_node_lookup_first_message_for_key_fwd (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) : Tot (result (betree_list_t (u64 & betree_message_t))) @@ -254,7 +255,7 @@ let rec betree_node_lookup_first_message_for_key_fwd | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_first_message_for_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_for_key]: backward function 0 *) let rec betree_node_lookup_first_message_for_key_back (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) (ret : betree_list_t (u64 & betree_message_t)) : @@ -273,7 +274,7 @@ let rec betree_node_lookup_first_message_for_key_back | BetreeListNil -> Return ret end -(** [betree_main::betree::Node::{5}::apply_upserts] *) +(** [betree_main::betree::Node::{5}::apply_upserts]: forward function *) let rec betree_node_apply_upserts_fwd (msgs : betree_list_t (u64 & betree_message_t)) (prev : option u64) (key : u64) (st : state) : @@ -300,7 +301,7 @@ let rec betree_node_apply_upserts_fwd BetreeMessageInsert v) in Return (st0, v) -(** [betree_main::betree::Node::{5}::apply_upserts] *) +(** [betree_main::betree::Node::{5}::apply_upserts]: backward function 0 *) let rec betree_node_apply_upserts_back (msgs : betree_list_t (u64 & betree_message_t)) (prev : option u64) (key : u64) (st : state) : @@ -325,7 +326,7 @@ let rec betree_node_apply_upserts_back betree_list_push_front_fwd_back (u64 & betree_message_t) msgs (key, BetreeMessageInsert v) -(** [betree_main::betree::Node::{5}::lookup] *) +(** [betree_main::betree::Node::{5}::lookup]: forward function *) let rec betree_node_lookup_fwd (self : betree_node_t) (key : u64) (st : state) : Tot (result (state & (option u64))) @@ -388,7 +389,7 @@ let rec betree_node_lookup_fwd Return (st0, opt) end -(** [betree_main::betree::Node::{5}::lookup] *) +(** [betree_main::betree::Node::{5}::lookup]: backward function 0 *) and betree_node_lookup_back (self : betree_node_t) (key : u64) (st : state) : Tot (result betree_node_t) @@ -450,7 +451,7 @@ and betree_node_lookup_back Return (BetreeNodeLeaf node) end -(** [betree_main::betree::Internal::{4}::lookup_in_children] *) +(** [betree_main::betree::Internal::{4}::lookup_in_children]: forward function *) and betree_internal_lookup_in_children_fwd (self : betree_internal_t) (key : u64) (st : state) : Tot (result (state & (option u64))) @@ -460,7 +461,7 @@ and betree_internal_lookup_in_children_fwd then betree_node_lookup_fwd self.betree_internal_left key st else betree_node_lookup_fwd self.betree_internal_right key st -(** [betree_main::betree::Internal::{4}::lookup_in_children] *) +(** [betree_main::betree::Internal::{4}::lookup_in_children]: backward function 0 *) and betree_internal_lookup_in_children_back (self : betree_internal_t) (key : u64) (st : state) : Tot (result betree_internal_t) @@ -474,7 +475,7 @@ and betree_internal_lookup_in_children_back let* n = betree_node_lookup_back self.betree_internal_right key st in Return { self with betree_internal_right = n } -(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings] *) +(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings]: forward function *) let rec betree_node_lookup_mut_in_bindings_fwd (key : u64) (bindings : betree_list_t (u64 & u64)) : Tot (result (betree_list_t (u64 & u64))) @@ -489,7 +490,7 @@ let rec betree_node_lookup_mut_in_bindings_fwd | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings] *) +(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings]: backward function 0 *) let rec betree_node_lookup_mut_in_bindings_back (key : u64) (bindings : betree_list_t (u64 & u64)) (ret : betree_list_t (u64 & u64)) : @@ -507,7 +508,8 @@ let rec betree_node_lookup_mut_in_bindings_back | BetreeListNil -> Return ret end -(** [betree_main::betree::Node::{5}::apply_to_leaf] *) +(** [betree_main::betree::Node::{5}::apply_to_leaf]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let betree_node_apply_to_leaf_fwd_back (bindings : betree_list_t (u64 & u64)) (key : u64) (new_msg : betree_message_t) : @@ -550,7 +552,8 @@ let betree_node_apply_to_leaf_fwd_back betree_node_lookup_mut_in_bindings_back key bindings bindings1 end -(** [betree_main::betree::Node::{5}::apply_messages_to_leaf] *) +(** [betree_main::betree::Node::{5}::apply_messages_to_leaf]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec betree_node_apply_messages_to_leaf_fwd_back (bindings : betree_list_t (u64 & u64)) (new_msgs : betree_list_t (u64 & betree_message_t)) : @@ -565,7 +568,8 @@ let rec betree_node_apply_messages_to_leaf_fwd_back | BetreeListNil -> Return bindings end -(** [betree_main::betree::Node::{5}::filter_messages_for_key] *) +(** [betree_main::betree::Node::{5}::filter_messages_for_key]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec betree_node_filter_messages_for_key_fwd_back (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) : Tot (result (betree_list_t (u64 & betree_message_t))) @@ -584,7 +588,7 @@ let rec betree_node_filter_messages_for_key_fwd_back | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_first_message_after_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_after_key]: forward function *) let rec betree_node_lookup_first_message_after_key_fwd (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) : Tot (result (betree_list_t (u64 & betree_message_t))) @@ -599,7 +603,7 @@ let rec betree_node_lookup_first_message_after_key_fwd | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_first_message_after_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_after_key]: backward function 0 *) let rec betree_node_lookup_first_message_after_key_back (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) (ret : betree_list_t (u64 & betree_message_t)) : @@ -618,7 +622,8 @@ let rec betree_node_lookup_first_message_after_key_back | BetreeListNil -> Return ret end -(** [betree_main::betree::Node::{5}::apply_to_internal] *) +(** [betree_main::betree::Node::{5}::apply_to_internal]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let betree_node_apply_to_internal_fwd_back (msgs : betree_list_t (u64 & betree_message_t)) (key : u64) (new_msg : betree_message_t) : @@ -678,7 +683,8 @@ let betree_node_apply_to_internal_fwd_back new_msg) in betree_node_lookup_first_message_for_key_back key msgs msgs1 -(** [betree_main::betree::Node::{5}::apply_messages_to_internal] *) +(** [betree_main::betree::Node::{5}::apply_messages_to_internal]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec betree_node_apply_messages_to_internal_fwd_back (msgs : betree_list_t (u64 & betree_message_t)) (new_msgs : betree_list_t (u64 & betree_message_t)) : @@ -693,7 +699,7 @@ let rec betree_node_apply_messages_to_internal_fwd_back | BetreeListNil -> Return msgs end -(** [betree_main::betree::Node::{5}::apply_messages] *) +(** [betree_main::betree::Node::{5}::apply_messages]: forward function *) let rec betree_node_apply_messages_fwd (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -740,7 +746,7 @@ let rec betree_node_apply_messages_fwd Return (st1, ()) end -(** [betree_main::betree::Node::{5}::apply_messages] *) +(** [betree_main::betree::Node::{5}::apply_messages]: backward function 0 *) and betree_node_apply_messages_back (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -788,7 +794,7 @@ and betree_node_apply_messages_back Return (BetreeNodeLeaf { node with betree_leaf_size = len }, node_id_cnt) end -(** [betree_main::betree::Internal::{4}::flush] *) +(** [betree_main::betree::Internal::{4}::flush]: forward function *) and betree_internal_flush_fwd (self : betree_internal_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -830,7 +836,7 @@ and betree_internal_flush_fwd node_id_cnt msgs_right st in Return (st0, msgs_left) -(** [betree_main::betree::Internal::{4}::flush] *) +(** [betree_main::betree::Internal::{4}::flush]: backward function 0 *) and betree_internal_flush_back (self : betree_internal_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -868,7 +874,7 @@ and betree_internal_flush_back node_id_cnt msgs_right st in Return ({ self with betree_internal_right = n }, node_id_cnt0) -(** [betree_main::betree::Node::{5}::apply] *) +(** [betree_main::betree::Node::{5}::apply]: forward function *) let betree_node_apply_fwd (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) (key : u64) @@ -884,7 +890,7 @@ let betree_node_apply_fwd (key, new_msg) l) st in Return (st0, ()) -(** [betree_main::betree::Node::{5}::apply] *) +(** [betree_main::betree::Node::{5}::apply]: backward function 0 *) let betree_node_apply_back (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) (key : u64) @@ -895,7 +901,7 @@ let betree_node_apply_back betree_node_apply_messages_back self params node_id_cnt (BetreeListCons (key, new_msg) l) st -(** [betree_main::betree::BeTree::{6}::new] *) +(** [betree_main::betree::BeTree::{6}::new]: forward function *) let betree_be_tree_new_fwd (min_flush_size : u64) (split_size : u64) (st : state) : result (state & betree_be_tree_t) @@ -916,7 +922,7 @@ let betree_be_tree_new_fwd (BetreeNodeLeaf { betree_leaf_id = id; betree_leaf_size = 0 }) }) -(** [betree_main::betree::BeTree::{6}::apply] *) +(** [betree_main::betree::BeTree::{6}::apply]: forward function *) let betree_be_tree_apply_fwd (self : betree_be_tree_t) (key : u64) (msg : betree_message_t) (st : state) : result (state & unit) @@ -929,7 +935,7 @@ let betree_be_tree_apply_fwd self.betree_be_tree_node_id_cnt key msg st in Return (st0, ()) -(** [betree_main::betree::BeTree::{6}::apply] *) +(** [betree_main::betree::BeTree::{6}::apply]: backward function 0 *) let betree_be_tree_apply_back (self : betree_be_tree_t) (key : u64) (msg : betree_message_t) (st : state) : result betree_be_tree_t @@ -940,7 +946,7 @@ let betree_be_tree_apply_back Return { self with betree_be_tree_node_id_cnt = nic; betree_be_tree_root = n } -(** [betree_main::betree::BeTree::{6}::insert] *) +(** [betree_main::betree::BeTree::{6}::insert]: forward function *) let betree_be_tree_insert_fwd (self : betree_be_tree_t) (key : u64) (value : u64) (st : state) : result (state & unit) @@ -950,28 +956,28 @@ let betree_be_tree_insert_fwd let* _ = betree_be_tree_apply_back self key (BetreeMessageInsert value) st in Return (st0, ()) -(** [betree_main::betree::BeTree::{6}::insert] *) +(** [betree_main::betree::BeTree::{6}::insert]: backward function 0 *) let betree_be_tree_insert_back (self : betree_be_tree_t) (key : u64) (value : u64) (st : state) : result betree_be_tree_t = betree_be_tree_apply_back self key (BetreeMessageInsert value) st -(** [betree_main::betree::BeTree::{6}::delete] *) +(** [betree_main::betree::BeTree::{6}::delete]: forward function *) let betree_be_tree_delete_fwd (self : betree_be_tree_t) (key : u64) (st : state) : result (state & unit) = let* (st0, _) = betree_be_tree_apply_fwd self key BetreeMessageDelete st in let* _ = betree_be_tree_apply_back self key BetreeMessageDelete st in Return (st0, ()) -(** [betree_main::betree::BeTree::{6}::delete] *) +(** [betree_main::betree::BeTree::{6}::delete]: backward function 0 *) let betree_be_tree_delete_back (self : betree_be_tree_t) (key : u64) (st : state) : result betree_be_tree_t = betree_be_tree_apply_back self key BetreeMessageDelete st -(** [betree_main::betree::BeTree::{6}::upsert] *) +(** [betree_main::betree::BeTree::{6}::upsert]: forward function *) let betree_be_tree_upsert_fwd (self : betree_be_tree_t) (key : u64) (upd : betree_upsert_fun_state_t) (st : state) : @@ -982,7 +988,7 @@ let betree_be_tree_upsert_fwd let* _ = betree_be_tree_apply_back self key (BetreeMessageUpsert upd) st in Return (st0, ()) -(** [betree_main::betree::BeTree::{6}::upsert] *) +(** [betree_main::betree::BeTree::{6}::upsert]: backward function 0 *) let betree_be_tree_upsert_back (self : betree_be_tree_t) (key : u64) (upd : betree_upsert_fun_state_t) (st : state) : @@ -990,14 +996,14 @@ let betree_be_tree_upsert_back = betree_be_tree_apply_back self key (BetreeMessageUpsert upd) st -(** [betree_main::betree::BeTree::{6}::lookup] *) +(** [betree_main::betree::BeTree::{6}::lookup]: forward function *) let betree_be_tree_lookup_fwd (self : betree_be_tree_t) (key : u64) (st : state) : result (state & (option u64)) = betree_node_lookup_fwd self.betree_be_tree_root key st -(** [betree_main::betree::BeTree::{6}::lookup] *) +(** [betree_main::betree::BeTree::{6}::lookup]: backward function 0 *) let betree_be_tree_lookup_back (self : betree_be_tree_t) (key : u64) (st : state) : result betree_be_tree_t @@ -1005,7 +1011,7 @@ let betree_be_tree_lookup_back let* n = betree_node_lookup_back self.betree_be_tree_root key st in Return { self with betree_be_tree_root = n } -(** [betree_main::main] *) +(** [betree_main::main]: forward function *) let main_fwd : result unit = Return () diff --git a/tests/fstar/betree/BetreeMain.Opaque.fsti b/tests/fstar/betree/BetreeMain.Opaque.fsti index dc49601a..c33cf225 100644 --- a/tests/fstar/betree/BetreeMain.Opaque.fsti +++ b/tests/fstar/betree/BetreeMain.Opaque.fsti @@ -1,30 +1,30 @@ (** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) -(** [betree_main]: opaque function definitions *) +(** [betree_main]: external function declarations *) module BetreeMain.Opaque open Primitives include BetreeMain.Types #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [betree_main::betree_utils::load_internal_node] *) +(** [betree_main::betree_utils::load_internal_node]: forward function *) val betree_utils_load_internal_node_fwd : u64 -> state -> result (state & (betree_list_t (u64 & betree_message_t))) -(** [betree_main::betree_utils::store_internal_node] *) +(** [betree_main::betree_utils::store_internal_node]: forward function *) val betree_utils_store_internal_node_fwd : u64 -> betree_list_t (u64 & betree_message_t) -> state -> result (state & unit) -(** [betree_main::betree_utils::load_leaf_node] *) +(** [betree_main::betree_utils::load_leaf_node]: forward function *) val betree_utils_load_leaf_node_fwd : u64 -> state -> result (state & (betree_list_t (u64 & u64))) -(** [betree_main::betree_utils::store_leaf_node] *) +(** [betree_main::betree_utils::store_leaf_node]: forward function *) val betree_utils_store_leaf_node_fwd : u64 -> betree_list_t (u64 & u64) -> state -> result (state & unit) -(** [core::option::Option::{0}::unwrap] *) +(** [core::option::Option::{0}::unwrap]: forward function *) val core_option_option_unwrap_fwd (t : Type0) : option t -> state -> result (state & t) diff --git a/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst b/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst index c70bef08..12402fb4 100644 --- a/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst +++ b/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst @@ -8,14 +8,14 @@ include BetreeMain.Clauses #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [betree_main::betree::load_internal_node] *) +(** [betree_main::betree::load_internal_node]: forward function *) let betree_load_internal_node_fwd (id : u64) (st : state) : result (state & (betree_list_t (u64 & betree_message_t))) = betree_utils_load_internal_node_fwd id st -(** [betree_main::betree::store_internal_node] *) +(** [betree_main::betree::store_internal_node]: forward function *) let betree_store_internal_node_fwd (id : u64) (content : betree_list_t (u64 & betree_message_t)) (st : state) : result (state & unit) @@ -23,12 +23,12 @@ let betree_store_internal_node_fwd let* (st0, _) = betree_utils_store_internal_node_fwd id content st in Return (st0, ()) -(** [betree_main::betree::load_leaf_node] *) +(** [betree_main::betree::load_leaf_node]: forward function *) let betree_load_leaf_node_fwd (id : u64) (st : state) : result (state & (betree_list_t (u64 & u64))) = betree_utils_load_leaf_node_fwd id st -(** [betree_main::betree::store_leaf_node] *) +(** [betree_main::betree::store_leaf_node]: forward function *) let betree_store_leaf_node_fwd (id : u64) (content : betree_list_t (u64 & u64)) (st : state) : result (state & unit) @@ -36,25 +36,25 @@ let betree_store_leaf_node_fwd let* (st0, _) = betree_utils_store_leaf_node_fwd id content st in Return (st0, ()) -(** [betree_main::betree::fresh_node_id] *) +(** [betree_main::betree::fresh_node_id]: forward function *) let betree_fresh_node_id_fwd (counter : u64) : result u64 = let* _ = u64_add counter 1 in Return counter -(** [betree_main::betree::fresh_node_id] *) +(** [betree_main::betree::fresh_node_id]: backward function 0 *) let betree_fresh_node_id_back (counter : u64) : result u64 = u64_add counter 1 -(** [betree_main::betree::NodeIdCounter::{0}::new] *) +(** [betree_main::betree::NodeIdCounter::{0}::new]: forward function *) let betree_node_id_counter_new_fwd : result betree_node_id_counter_t = Return { betree_node_id_counter_next_node_id = 0 } -(** [betree_main::betree::NodeIdCounter::{0}::fresh_id] *) +(** [betree_main::betree::NodeIdCounter::{0}::fresh_id]: forward function *) let betree_node_id_counter_fresh_id_fwd (self : betree_node_id_counter_t) : result u64 = let* _ = u64_add self.betree_node_id_counter_next_node_id 1 in Return self.betree_node_id_counter_next_node_id -(** [betree_main::betree::NodeIdCounter::{0}::fresh_id] *) +(** [betree_main::betree::NodeIdCounter::{0}::fresh_id]: backward function 0 *) let betree_node_id_counter_fresh_id_back (self : betree_node_id_counter_t) : result betree_node_id_counter_t = let* i = u64_add self.betree_node_id_counter_next_node_id 1 in @@ -64,7 +64,7 @@ let betree_node_id_counter_fresh_id_back let core_num_u64_max_body : result u64 = Return 18446744073709551615 let core_num_u64_max_c : u64 = eval_global core_num_u64_max_body -(** [betree_main::betree::upsert_update] *) +(** [betree_main::betree::upsert_update]: forward function *) let betree_upsert_update_fwd (prev : option u64) (st : betree_upsert_fun_state_t) : result u64 = begin match prev with @@ -83,7 +83,7 @@ let betree_upsert_update_fwd end end -(** [betree_main::betree::List::{1}::len] *) +(** [betree_main::betree::List::{1}::len]: forward function *) let rec betree_list_len_fwd (t : Type0) (self : betree_list_t t) : Tot (result u64) (decreases (betree_list_len_decreases t self)) @@ -93,7 +93,7 @@ let rec betree_list_len_fwd | BetreeListNil -> Return 0 end -(** [betree_main::betree::List::{1}::split_at] *) +(** [betree_main::betree::List::{1}::split_at]: forward function *) let rec betree_list_split_at_fwd (t : Type0) (self : betree_list_t t) (n : u64) : Tot (result ((betree_list_t t) & (betree_list_t t))) @@ -112,14 +112,15 @@ let rec betree_list_split_at_fwd | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{1}::push_front] *) +(** [betree_main::betree::List::{1}::push_front]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let betree_list_push_front_fwd_back (t : Type0) (self : betree_list_t t) (x : t) : result (betree_list_t t) = let tl = mem_replace_fwd (betree_list_t t) self BetreeListNil in let l = tl in Return (BetreeListCons x l) -(** [betree_main::betree::List::{1}::pop_front] *) +(** [betree_main::betree::List::{1}::pop_front]: forward function *) let betree_list_pop_front_fwd (t : Type0) (self : betree_list_t t) : result t = let ls = mem_replace_fwd (betree_list_t t) self BetreeListNil in begin match ls with @@ -127,7 +128,7 @@ let betree_list_pop_front_fwd (t : Type0) (self : betree_list_t t) : result t = | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{1}::pop_front] *) +(** [betree_main::betree::List::{1}::pop_front]: backward function 0 *) let betree_list_pop_front_back (t : Type0) (self : betree_list_t t) : result (betree_list_t t) = let ls = mem_replace_fwd (betree_list_t t) self BetreeListNil in @@ -136,14 +137,14 @@ let betree_list_pop_front_back | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{1}::hd] *) +(** [betree_main::betree::List::{1}::hd]: forward function *) let betree_list_hd_fwd (t : Type0) (self : betree_list_t t) : result t = begin match self with | BetreeListCons hd l -> Return hd | BetreeListNil -> Fail Failure end -(** [betree_main::betree::List::{2}::head_has_key] *) +(** [betree_main::betree::List::{2}::head_has_key]: forward function *) let betree_list_head_has_key_fwd (t : Type0) (self : betree_list_t (u64 & t)) (key : u64) : result bool = begin match self with @@ -151,7 +152,7 @@ let betree_list_head_has_key_fwd | BetreeListNil -> Return false end -(** [betree_main::betree::List::{2}::partition_at_pivot] *) +(** [betree_main::betree::List::{2}::partition_at_pivot]: forward function *) let rec betree_list_partition_at_pivot_fwd (t : Type0) (self : betree_list_t (u64 & t)) (pivot : u64) : Tot (result ((betree_list_t (u64 & t)) & (betree_list_t (u64 & t)))) @@ -170,7 +171,7 @@ let rec betree_list_partition_at_pivot_fwd | BetreeListNil -> Return (BetreeListNil, BetreeListNil) end -(** [betree_main::betree::Leaf::{3}::split] *) +(** [betree_main::betree::Leaf::{3}::split]: forward function *) let betree_leaf_split_fwd (self : betree_leaf_t) (content : betree_list_t (u64 & u64)) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -202,7 +203,7 @@ let betree_leaf_split_fwd betree_internal_right = n0 }) -(** [betree_main::betree::Leaf::{3}::split] *) +(** [betree_main::betree::Leaf::{3}::split]: backward function 0 *) let betree_leaf_split_back0 (self : betree_leaf_t) (content : betree_list_t (u64 & u64)) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -221,7 +222,7 @@ let betree_leaf_split_back0 let* _ = betree_store_leaf_node_fwd id1 content1 st1 in Return (st0, ()) -(** [betree_main::betree::Leaf::{3}::split] *) +(** [betree_main::betree::Leaf::{3}::split]: backward function 1 *) let betree_leaf_split_back1 (self : betree_leaf_t) (content : betree_list_t (u64 & u64)) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -240,7 +241,7 @@ let betree_leaf_split_back1 let* _ = betree_store_leaf_node_fwd id1 content1 st1 in Return (st0, ()) -(** [betree_main::betree::Leaf::{3}::split] *) +(** [betree_main::betree::Leaf::{3}::split]: backward function 2 *) let betree_leaf_split_back2 (self : betree_leaf_t) (content : betree_list_t (u64 & u64)) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -260,7 +261,7 @@ let betree_leaf_split_back2 let* node_id_cnt1 = betree_node_id_counter_fresh_id_back node_id_cnt0 in Return (st0, node_id_cnt1) -(** [betree_main::betree::Node::{5}::lookup_in_bindings] *) +(** [betree_main::betree::Node::{5}::lookup_in_bindings]: forward function *) let rec betree_node_lookup_in_bindings_fwd (key : u64) (bindings : betree_list_t (u64 & u64)) : Tot (result (option u64)) @@ -278,7 +279,7 @@ let rec betree_node_lookup_in_bindings_fwd | BetreeListNil -> Return None end -(** [betree_main::betree::Node::{5}::lookup_first_message_for_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_for_key]: forward function *) let rec betree_node_lookup_first_message_for_key_fwd (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) : Tot (result (betree_list_t (u64 & betree_message_t))) @@ -293,7 +294,7 @@ let rec betree_node_lookup_first_message_for_key_fwd | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_first_message_for_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_for_key]: backward function 0 *) let rec betree_node_lookup_first_message_for_key_back (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) (ret : betree_list_t (u64 & betree_message_t)) : @@ -312,7 +313,7 @@ let rec betree_node_lookup_first_message_for_key_back | BetreeListNil -> Return ret end -(** [betree_main::betree::Node::{5}::apply_upserts] *) +(** [betree_main::betree::Node::{5}::apply_upserts]: forward function *) let rec betree_node_apply_upserts_fwd (msgs : betree_list_t (u64 & betree_message_t)) (prev : option u64) (key : u64) (st : state) : @@ -339,7 +340,7 @@ let rec betree_node_apply_upserts_fwd BetreeMessageInsert v) in Return (st0, v) -(** [betree_main::betree::Node::{5}::apply_upserts] *) +(** [betree_main::betree::Node::{5}::apply_upserts]: backward function 0 *) let rec betree_node_apply_upserts_back (msgs : betree_list_t (u64 & betree_message_t)) (prev : option u64) (key : u64) (st : state) (st0 : state) : @@ -366,7 +367,7 @@ let rec betree_node_apply_upserts_back BetreeMessageInsert v) in Return (st0, msgs0) -(** [betree_main::betree::Node::{5}::lookup] *) +(** [betree_main::betree::Node::{5}::lookup]: forward function *) let rec betree_node_lookup_fwd (self : betree_node_t) (key : u64) (st : state) : Tot (result (state & (option u64))) @@ -430,7 +431,7 @@ let rec betree_node_lookup_fwd Return (st0, opt) end -(** [betree_main::betree::Node::{5}::lookup] *) +(** [betree_main::betree::Node::{5}::lookup]: backward function 0 *) and betree_node_lookup_back (self : betree_node_t) (key : u64) (st : state) (st0 : state) : Tot (result (state & betree_node_t)) @@ -495,7 +496,7 @@ and betree_node_lookup_back Return (st0, BetreeNodeLeaf node) end -(** [betree_main::betree::Internal::{4}::lookup_in_children] *) +(** [betree_main::betree::Internal::{4}::lookup_in_children]: forward function *) and betree_internal_lookup_in_children_fwd (self : betree_internal_t) (key : u64) (st : state) : Tot (result (state & (option u64))) @@ -505,7 +506,7 @@ and betree_internal_lookup_in_children_fwd then betree_node_lookup_fwd self.betree_internal_left key st else betree_node_lookup_fwd self.betree_internal_right key st -(** [betree_main::betree::Internal::{4}::lookup_in_children] *) +(** [betree_main::betree::Internal::{4}::lookup_in_children]: backward function 0 *) and betree_internal_lookup_in_children_back (self : betree_internal_t) (key : u64) (st : state) (st0 : state) : Tot (result (state & betree_internal_t)) @@ -521,7 +522,7 @@ and betree_internal_lookup_in_children_back betree_node_lookup_back self.betree_internal_right key st st0 in Return (st1, { self with betree_internal_right = n }) -(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings] *) +(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings]: forward function *) let rec betree_node_lookup_mut_in_bindings_fwd (key : u64) (bindings : betree_list_t (u64 & u64)) : Tot (result (betree_list_t (u64 & u64))) @@ -536,7 +537,7 @@ let rec betree_node_lookup_mut_in_bindings_fwd | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings] *) +(** [betree_main::betree::Node::{5}::lookup_mut_in_bindings]: backward function 0 *) let rec betree_node_lookup_mut_in_bindings_back (key : u64) (bindings : betree_list_t (u64 & u64)) (ret : betree_list_t (u64 & u64)) : @@ -554,7 +555,8 @@ let rec betree_node_lookup_mut_in_bindings_back | BetreeListNil -> Return ret end -(** [betree_main::betree::Node::{5}::apply_to_leaf] *) +(** [betree_main::betree::Node::{5}::apply_to_leaf]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let betree_node_apply_to_leaf_fwd_back (bindings : betree_list_t (u64 & u64)) (key : u64) (new_msg : betree_message_t) : @@ -597,7 +599,8 @@ let betree_node_apply_to_leaf_fwd_back betree_node_lookup_mut_in_bindings_back key bindings bindings1 end -(** [betree_main::betree::Node::{5}::apply_messages_to_leaf] *) +(** [betree_main::betree::Node::{5}::apply_messages_to_leaf]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec betree_node_apply_messages_to_leaf_fwd_back (bindings : betree_list_t (u64 & u64)) (new_msgs : betree_list_t (u64 & betree_message_t)) : @@ -612,7 +615,8 @@ let rec betree_node_apply_messages_to_leaf_fwd_back | BetreeListNil -> Return bindings end -(** [betree_main::betree::Node::{5}::filter_messages_for_key] *) +(** [betree_main::betree::Node::{5}::filter_messages_for_key]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec betree_node_filter_messages_for_key_fwd_back (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) : Tot (result (betree_list_t (u64 & betree_message_t))) @@ -631,7 +635,7 @@ let rec betree_node_filter_messages_for_key_fwd_back | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_first_message_after_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_after_key]: forward function *) let rec betree_node_lookup_first_message_after_key_fwd (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) : Tot (result (betree_list_t (u64 & betree_message_t))) @@ -646,7 +650,7 @@ let rec betree_node_lookup_first_message_after_key_fwd | BetreeListNil -> Return BetreeListNil end -(** [betree_main::betree::Node::{5}::lookup_first_message_after_key] *) +(** [betree_main::betree::Node::{5}::lookup_first_message_after_key]: backward function 0 *) let rec betree_node_lookup_first_message_after_key_back (key : u64) (msgs : betree_list_t (u64 & betree_message_t)) (ret : betree_list_t (u64 & betree_message_t)) : @@ -665,7 +669,8 @@ let rec betree_node_lookup_first_message_after_key_back | BetreeListNil -> Return ret end -(** [betree_main::betree::Node::{5}::apply_to_internal] *) +(** [betree_main::betree::Node::{5}::apply_to_internal]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let betree_node_apply_to_internal_fwd_back (msgs : betree_list_t (u64 & betree_message_t)) (key : u64) (new_msg : betree_message_t) : @@ -725,7 +730,8 @@ let betree_node_apply_to_internal_fwd_back new_msg) in betree_node_lookup_first_message_for_key_back key msgs msgs1 -(** [betree_main::betree::Node::{5}::apply_messages_to_internal] *) +(** [betree_main::betree::Node::{5}::apply_messages_to_internal]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec betree_node_apply_messages_to_internal_fwd_back (msgs : betree_list_t (u64 & betree_message_t)) (new_msgs : betree_list_t (u64 & betree_message_t)) : @@ -740,7 +746,7 @@ let rec betree_node_apply_messages_to_internal_fwd_back | BetreeListNil -> Return msgs end -(** [betree_main::betree::Node::{5}::apply_messages] *) +(** [betree_main::betree::Node::{5}::apply_messages]: forward function *) let rec betree_node_apply_messages_fwd (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -788,7 +794,7 @@ let rec betree_node_apply_messages_fwd Return (st1, ()) end -(** [betree_main::betree::Node::{5}::apply_messages] *) +(** [betree_main::betree::Node::{5}::apply_messages]: backward function 0 *) and betree_node_apply_messages_back'a (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -840,7 +846,7 @@ and betree_node_apply_messages_back'a node_id_cnt)) end -(** [betree_main::betree::Node::{5}::apply_messages] *) +(** [betree_main::betree::Node::{5}::apply_messages]: backward function 1 *) and betree_node_apply_messages_back1 (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -889,7 +895,7 @@ and betree_node_apply_messages_back1 Return (st0, ()) end -(** [betree_main::betree::Internal::{4}::flush] *) +(** [betree_main::betree::Internal::{4}::flush]: forward function *) and betree_internal_flush_fwd (self : betree_internal_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -940,7 +946,7 @@ and betree_internal_flush_fwd node_id_cnt msgs_right st st1 in Return (st2, msgs_left) -(** [betree_main::betree::Internal::{4}::flush] *) +(** [betree_main::betree::Internal::{4}::flush]: backward function 0 *) and betree_internal_flush_back'a (self : betree_internal_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -994,7 +1000,7 @@ and betree_internal_flush_back'a node_id_cnt msgs_right st st2 in Return (st0, ({ self with betree_internal_right = n }, node_id_cnt0)) -(** [betree_main::betree::Internal::{4}::flush] *) +(** [betree_main::betree::Internal::{4}::flush]: backward function 1 *) and betree_internal_flush_back1 (self : betree_internal_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) @@ -1046,7 +1052,7 @@ and betree_internal_flush_back1 node_id_cnt msgs_right st st2 in Return (st0, ()) -(** [betree_main::betree::Node::{5}::apply] *) +(** [betree_main::betree::Node::{5}::apply]: forward function *) let betree_node_apply_fwd (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) (key : u64) @@ -1063,7 +1069,7 @@ let betree_node_apply_fwd betree_node_apply_messages_back1 self params node_id_cnt (BetreeListCons (key, new_msg) l) st st1 -(** [betree_main::betree::Node::{5}::apply] *) +(** [betree_main::betree::Node::{5}::apply]: backward function 0 *) let betree_node_apply_back'a (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) (key : u64) @@ -1082,7 +1088,7 @@ let betree_node_apply_back'a (key, new_msg) l) st st2 in Return (st0, (self0, node_id_cnt0)) -(** [betree_main::betree::Node::{5}::apply] *) +(** [betree_main::betree::Node::{5}::apply]: backward function 1 *) let betree_node_apply_back1 (self : betree_node_t) (params : betree_params_t) (node_id_cnt : betree_node_id_counter_t) (key : u64) @@ -1101,7 +1107,7 @@ let betree_node_apply_back1 (key, new_msg) l) st st2 in Return (st0, ()) -(** [betree_main::betree::BeTree::{6}::new] *) +(** [betree_main::betree::BeTree::{6}::new]: forward function *) let betree_be_tree_new_fwd (min_flush_size : u64) (split_size : u64) (st : state) : result (state & betree_be_tree_t) @@ -1122,7 +1128,7 @@ let betree_be_tree_new_fwd (BetreeNodeLeaf { betree_leaf_id = id; betree_leaf_size = 0 }) }) -(** [betree_main::betree::BeTree::{6}::apply] *) +(** [betree_main::betree::BeTree::{6}::apply]: forward function *) let betree_be_tree_apply_fwd (self : betree_be_tree_t) (key : u64) (msg : betree_message_t) (st : state) : result (state & unit) @@ -1137,7 +1143,7 @@ let betree_be_tree_apply_fwd betree_node_apply_back1 self.betree_be_tree_root self.betree_be_tree_params self.betree_be_tree_node_id_cnt key msg st st1 -(** [betree_main::betree::BeTree::{6}::apply] *) +(** [betree_main::betree::BeTree::{6}::apply]: backward function 0 *) let betree_be_tree_apply_back (self : betree_be_tree_t) (key : u64) (msg : betree_message_t) (st : state) (st0 : state) : @@ -1156,7 +1162,7 @@ let betree_be_tree_apply_back Return (st0, { self with betree_be_tree_node_id_cnt = nic; betree_be_tree_root = n }) -(** [betree_main::betree::BeTree::{6}::insert] *) +(** [betree_main::betree::BeTree::{6}::insert]: forward function *) let betree_be_tree_insert_fwd (self : betree_be_tree_t) (key : u64) (value : u64) (st : state) : result (state & unit) @@ -1167,7 +1173,7 @@ let betree_be_tree_insert_fwd betree_be_tree_apply_back self key (BetreeMessageInsert value) st st0 in Return (st1, ()) -(** [betree_main::betree::BeTree::{6}::insert] *) +(** [betree_main::betree::BeTree::{6}::insert]: backward function 0 *) let betree_be_tree_insert_back (self : betree_be_tree_t) (key : u64) (value : u64) (st : state) (st0 : state) : @@ -1179,7 +1185,7 @@ let betree_be_tree_insert_back betree_be_tree_apply_back self key (BetreeMessageInsert value) st st1 in Return (st0, self0) -(** [betree_main::betree::BeTree::{6}::delete] *) +(** [betree_main::betree::BeTree::{6}::delete]: forward function *) let betree_be_tree_delete_fwd (self : betree_be_tree_t) (key : u64) (st : state) : result (state & unit) = let* (st0, _) = betree_be_tree_apply_fwd self key BetreeMessageDelete st in @@ -1187,7 +1193,7 @@ let betree_be_tree_delete_fwd in Return (st1, ()) -(** [betree_main::betree::BeTree::{6}::delete] *) +(** [betree_main::betree::BeTree::{6}::delete]: backward function 0 *) let betree_be_tree_delete_back (self : betree_be_tree_t) (key : u64) (st : state) (st0 : state) : result (state & betree_be_tree_t) @@ -1197,7 +1203,7 @@ let betree_be_tree_delete_back betree_be_tree_apply_back self key BetreeMessageDelete st st1 in Return (st0, self0) -(** [betree_main::betree::BeTree::{6}::upsert] *) +(** [betree_main::betree::BeTree::{6}::upsert]: forward function *) let betree_be_tree_upsert_fwd (self : betree_be_tree_t) (key : u64) (upd : betree_upsert_fun_state_t) (st : state) : @@ -1209,7 +1215,7 @@ let betree_be_tree_upsert_fwd betree_be_tree_apply_back self key (BetreeMessageUpsert upd) st st0 in Return (st1, ()) -(** [betree_main::betree::BeTree::{6}::upsert] *) +(** [betree_main::betree::BeTree::{6}::upsert]: backward function 0 *) let betree_be_tree_upsert_back (self : betree_be_tree_t) (key : u64) (upd : betree_upsert_fun_state_t) (st : state) (st0 : state) : @@ -1221,14 +1227,14 @@ let betree_be_tree_upsert_back betree_be_tree_apply_back self key (BetreeMessageUpsert upd) st st1 in Return (st0, self0) -(** [betree_main::betree::BeTree::{6}::lookup] *) +(** [betree_main::betree::BeTree::{6}::lookup]: forward function *) let betree_be_tree_lookup_fwd (self : betree_be_tree_t) (key : u64) (st : state) : result (state & (option u64)) = betree_node_lookup_fwd self.betree_be_tree_root key st -(** [betree_main::betree::BeTree::{6}::lookup] *) +(** [betree_main::betree::BeTree::{6}::lookup]: backward function 0 *) let betree_be_tree_lookup_back (self : betree_be_tree_t) (key : u64) (st : state) (st0 : state) : result (state & betree_be_tree_t) @@ -1237,7 +1243,7 @@ let betree_be_tree_lookup_back in Return (st1, { self with betree_be_tree_root = n }) -(** [betree_main::main] *) +(** [betree_main::main]: forward function *) let main_fwd : result unit = Return () diff --git a/tests/fstar/betree_back_stateful/BetreeMain.Opaque.fsti b/tests/fstar/betree_back_stateful/BetreeMain.Opaque.fsti index dc49601a..c33cf225 100644 --- a/tests/fstar/betree_back_stateful/BetreeMain.Opaque.fsti +++ b/tests/fstar/betree_back_stateful/BetreeMain.Opaque.fsti @@ -1,30 +1,30 @@ (** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) -(** [betree_main]: opaque function definitions *) +(** [betree_main]: external function declarations *) module BetreeMain.Opaque open Primitives include BetreeMain.Types #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [betree_main::betree_utils::load_internal_node] *) +(** [betree_main::betree_utils::load_internal_node]: forward function *) val betree_utils_load_internal_node_fwd : u64 -> state -> result (state & (betree_list_t (u64 & betree_message_t))) -(** [betree_main::betree_utils::store_internal_node] *) +(** [betree_main::betree_utils::store_internal_node]: forward function *) val betree_utils_store_internal_node_fwd : u64 -> betree_list_t (u64 & betree_message_t) -> state -> result (state & unit) -(** [betree_main::betree_utils::load_leaf_node] *) +(** [betree_main::betree_utils::load_leaf_node]: forward function *) val betree_utils_load_leaf_node_fwd : u64 -> state -> result (state & (betree_list_t (u64 & u64))) -(** [betree_main::betree_utils::store_leaf_node] *) +(** [betree_main::betree_utils::store_leaf_node]: forward function *) val betree_utils_store_leaf_node_fwd : u64 -> betree_list_t (u64 & u64) -> state -> result (state & unit) -(** [core::option::Option::{0}::unwrap] *) +(** [core::option::Option::{0}::unwrap]: forward function *) val core_option_option_unwrap_fwd (t : Type0) : option t -> state -> result (state & t) diff --git a/tests/fstar/hashmap/Hashmap.Funs.fst b/tests/fstar/hashmap/Hashmap.Funs.fst index 44ad7463..950f1490 100644 --- a/tests/fstar/hashmap/Hashmap.Funs.fst +++ b/tests/fstar/hashmap/Hashmap.Funs.fst @@ -7,11 +7,11 @@ include Hashmap.Clauses #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [hashmap::hash_key] *) +(** [hashmap::hash_key]: forward function *) let hash_key_fwd (k : usize) : result usize = Return k -(** [hashmap::HashMap::{0}::allocate_slots] *) +(** [hashmap::HashMap::{0}::allocate_slots]: loop 0: forward function *) let rec hash_map_allocate_slots_loop_fwd (t : Type0) (slots : vec (list_t t)) (n : usize) : Tot (result (vec (list_t t))) @@ -24,12 +24,12 @@ let rec hash_map_allocate_slots_loop_fwd hash_map_allocate_slots_loop_fwd t slots0 n0 else Return slots -(** [hashmap::HashMap::{0}::allocate_slots] *) +(** [hashmap::HashMap::{0}::allocate_slots]: forward function *) let hash_map_allocate_slots_fwd (t : Type0) (slots : vec (list_t t)) (n : usize) : result (vec (list_t t)) = hash_map_allocate_slots_loop_fwd t slots n -(** [hashmap::HashMap::{0}::new_with_capacity] *) +(** [hashmap::HashMap::{0}::new_with_capacity]: forward function *) let hash_map_new_with_capacity_fwd (t : Type0) (capacity : usize) (max_load_dividend : usize) (max_load_divisor : usize) : @@ -47,11 +47,12 @@ let hash_map_new_with_capacity_fwd hash_map_slots = slots } -(** [hashmap::HashMap::{0}::new] *) +(** [hashmap::HashMap::{0}::new]: forward function *) let hash_map_new_fwd (t : Type0) : result (hash_map_t t) = hash_map_new_with_capacity_fwd t 32 4 5 -(** [hashmap::HashMap::{0}::clear] *) +(** [hashmap::HashMap::{0}::clear]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec hash_map_clear_loop_fwd_back (t : Type0) (slots : vec (list_t t)) (i : usize) : Tot (result (vec (list_t t))) @@ -65,17 +66,18 @@ let rec hash_map_clear_loop_fwd_back hash_map_clear_loop_fwd_back t slots0 i1 else Return slots -(** [hashmap::HashMap::{0}::clear] *) +(** [hashmap::HashMap::{0}::clear]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hash_map_clear_fwd_back (t : Type0) (self : hash_map_t t) : result (hash_map_t t) = let* v = hash_map_clear_loop_fwd_back t self.hash_map_slots 0 in Return { self with hash_map_num_entries = 0; hash_map_slots = v } -(** [hashmap::HashMap::{0}::len] *) +(** [hashmap::HashMap::{0}::len]: forward function *) let hash_map_len_fwd (t : Type0) (self : hash_map_t t) : result usize = Return self.hash_map_num_entries -(** [hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap::HashMap::{0}::insert_in_list]: loop 0: forward function *) let rec hash_map_insert_in_list_loop_fwd (t : Type0) (key : usize) (value : t) (ls : list_t t) : Tot (result bool) @@ -89,12 +91,12 @@ let rec hash_map_insert_in_list_loop_fwd | ListNil -> Return true end -(** [hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap::HashMap::{0}::insert_in_list]: forward function *) let hash_map_insert_in_list_fwd (t : Type0) (key : usize) (value : t) (ls : list_t t) : result bool = hash_map_insert_in_list_loop_fwd t key value ls -(** [hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap::HashMap::{0}::insert_in_list]: loop 0: backward function 0 *) let rec hash_map_insert_in_list_loop_back (t : Type0) (key : usize) (value : t) (ls : list_t t) : Tot (result (list_t t)) @@ -110,12 +112,13 @@ let rec hash_map_insert_in_list_loop_back | ListNil -> let l = ListNil in Return (ListCons key value l) end -(** [hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap::HashMap::{0}::insert_in_list]: backward function 0 *) let hash_map_insert_in_list_back (t : Type0) (key : usize) (value : t) (ls : list_t t) : result (list_t t) = hash_map_insert_in_list_loop_back t key value ls -(** [hashmap::HashMap::{0}::insert_no_resize] *) +(** [hashmap::HashMap::{0}::insert_no_resize]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hash_map_insert_no_resize_fwd_back (t : Type0) (self : hash_map_t t) (key : usize) (value : t) : result (hash_map_t t) @@ -140,7 +143,8 @@ let hash_map_insert_no_resize_fwd_back let core_num_u32_max_body : result u32 = Return 4294967295 let core_num_u32_max_c : u32 = eval_global core_num_u32_max_body -(** [hashmap::HashMap::{0}::move_elements_from_list] *) +(** [hashmap::HashMap::{0}::move_elements_from_list]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec hash_map_move_elements_from_list_loop_fwd_back (t : Type0) (ntable : hash_map_t t) (ls : list_t t) : Tot (result (hash_map_t t)) @@ -153,12 +157,14 @@ let rec hash_map_move_elements_from_list_loop_fwd_back | ListNil -> Return ntable end -(** [hashmap::HashMap::{0}::move_elements_from_list] *) +(** [hashmap::HashMap::{0}::move_elements_from_list]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hash_map_move_elements_from_list_fwd_back (t : Type0) (ntable : hash_map_t t) (ls : list_t t) : result (hash_map_t t) = hash_map_move_elements_from_list_loop_fwd_back t ntable ls -(** [hashmap::HashMap::{0}::move_elements] *) +(** [hashmap::HashMap::{0}::move_elements]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec hash_map_move_elements_loop_fwd_back (t : Type0) (ntable : hash_map_t t) (slots : vec (list_t t)) (i : usize) : Tot (result ((hash_map_t t) & (vec (list_t t)))) @@ -176,14 +182,16 @@ let rec hash_map_move_elements_loop_fwd_back hash_map_move_elements_loop_fwd_back t ntable0 slots0 i1 else Return (ntable, slots) -(** [hashmap::HashMap::{0}::move_elements] *) +(** [hashmap::HashMap::{0}::move_elements]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hash_map_move_elements_fwd_back (t : Type0) (ntable : hash_map_t t) (slots : vec (list_t t)) (i : usize) : result ((hash_map_t t) & (vec (list_t t))) = hash_map_move_elements_loop_fwd_back t ntable slots i -(** [hashmap::HashMap::{0}::try_resize] *) +(** [hashmap::HashMap::{0}::try_resize]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hash_map_try_resize_fwd_back (t : Type0) (self : hash_map_t t) : result (hash_map_t t) = let* max_usize = scalar_cast U32 Usize core_num_u32_max_c in @@ -206,7 +214,8 @@ let hash_map_try_resize_fwd_back } else Return { self with hash_map_max_load_factor = (i, i0) } -(** [hashmap::HashMap::{0}::insert] *) +(** [hashmap::HashMap::{0}::insert]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hash_map_insert_fwd_back (t : Type0) (self : hash_map_t t) (key : usize) (value : t) : result (hash_map_t t) @@ -217,7 +226,7 @@ let hash_map_insert_fwd_back then hash_map_try_resize_fwd_back t self0 else Return self0 -(** [hashmap::HashMap::{0}::contains_key_in_list] *) +(** [hashmap::HashMap::{0}::contains_key_in_list]: loop 0: forward function *) let rec hash_map_contains_key_in_list_loop_fwd (t : Type0) (key : usize) (ls : list_t t) : Tot (result bool) @@ -231,12 +240,12 @@ let rec hash_map_contains_key_in_list_loop_fwd | ListNil -> Return false end -(** [hashmap::HashMap::{0}::contains_key_in_list] *) +(** [hashmap::HashMap::{0}::contains_key_in_list]: forward function *) let hash_map_contains_key_in_list_fwd (t : Type0) (key : usize) (ls : list_t t) : result bool = hash_map_contains_key_in_list_loop_fwd t key ls -(** [hashmap::HashMap::{0}::contains_key] *) +(** [hashmap::HashMap::{0}::contains_key]: forward function *) let hash_map_contains_key_fwd (t : Type0) (self : hash_map_t t) (key : usize) : result bool = let* hash = hash_key_fwd key in @@ -245,7 +254,7 @@ let hash_map_contains_key_fwd let* l = vec_index_fwd (list_t t) self.hash_map_slots hash_mod in hash_map_contains_key_in_list_fwd t key l -(** [hashmap::HashMap::{0}::get_in_list] *) +(** [hashmap::HashMap::{0}::get_in_list]: loop 0: forward function *) let rec hash_map_get_in_list_loop_fwd (t : Type0) (key : usize) (ls : list_t t) : Tot (result t) (decreases (hash_map_get_in_list_loop_decreases t key ls)) @@ -258,12 +267,12 @@ let rec hash_map_get_in_list_loop_fwd | ListNil -> Fail Failure end -(** [hashmap::HashMap::{0}::get_in_list] *) +(** [hashmap::HashMap::{0}::get_in_list]: forward function *) let hash_map_get_in_list_fwd (t : Type0) (key : usize) (ls : list_t t) : result t = hash_map_get_in_list_loop_fwd t key ls -(** [hashmap::HashMap::{0}::get] *) +(** [hashmap::HashMap::{0}::get]: forward function *) let hash_map_get_fwd (t : Type0) (self : hash_map_t t) (key : usize) : result t = let* hash = hash_key_fwd key in @@ -272,7 +281,7 @@ let hash_map_get_fwd let* l = vec_index_fwd (list_t t) self.hash_map_slots hash_mod in hash_map_get_in_list_fwd t key l -(** [hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap::HashMap::{0}::get_mut_in_list]: loop 0: forward function *) let rec hash_map_get_mut_in_list_loop_fwd (t : Type0) (ls : list_t t) (key : usize) : Tot (result t) (decreases (hash_map_get_mut_in_list_loop_decreases t ls key)) @@ -285,12 +294,12 @@ let rec hash_map_get_mut_in_list_loop_fwd | ListNil -> Fail Failure end -(** [hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap::HashMap::{0}::get_mut_in_list]: forward function *) let hash_map_get_mut_in_list_fwd (t : Type0) (ls : list_t t) (key : usize) : result t = hash_map_get_mut_in_list_loop_fwd t ls key -(** [hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap::HashMap::{0}::get_mut_in_list]: loop 0: backward function 0 *) let rec hash_map_get_mut_in_list_loop_back (t : Type0) (ls : list_t t) (key : usize) (ret : t) : Tot (result (list_t t)) @@ -306,12 +315,12 @@ let rec hash_map_get_mut_in_list_loop_back | ListNil -> Fail Failure end -(** [hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap::HashMap::{0}::get_mut_in_list]: backward function 0 *) let hash_map_get_mut_in_list_back (t : Type0) (ls : list_t t) (key : usize) (ret : t) : result (list_t t) = hash_map_get_mut_in_list_loop_back t ls key ret -(** [hashmap::HashMap::{0}::get_mut] *) +(** [hashmap::HashMap::{0}::get_mut]: forward function *) let hash_map_get_mut_fwd (t : Type0) (self : hash_map_t t) (key : usize) : result t = let* hash = hash_key_fwd key in @@ -320,7 +329,7 @@ let hash_map_get_mut_fwd let* l = vec_index_mut_fwd (list_t t) self.hash_map_slots hash_mod in hash_map_get_mut_in_list_fwd t l key -(** [hashmap::HashMap::{0}::get_mut] *) +(** [hashmap::HashMap::{0}::get_mut]: backward function 0 *) let hash_map_get_mut_back (t : Type0) (self : hash_map_t t) (key : usize) (ret : t) : result (hash_map_t t) @@ -333,7 +342,7 @@ let hash_map_get_mut_back let* v = vec_index_mut_back (list_t t) self.hash_map_slots hash_mod l0 in Return { self with hash_map_slots = v } -(** [hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap::HashMap::{0}::remove_from_list]: loop 0: forward function *) let rec hash_map_remove_from_list_loop_fwd (t : Type0) (key : usize) (ls : list_t t) : Tot (result (option t)) @@ -352,12 +361,12 @@ let rec hash_map_remove_from_list_loop_fwd | ListNil -> Return None end -(** [hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap::HashMap::{0}::remove_from_list]: forward function *) let hash_map_remove_from_list_fwd (t : Type0) (key : usize) (ls : list_t t) : result (option t) = hash_map_remove_from_list_loop_fwd t key ls -(** [hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap::HashMap::{0}::remove_from_list]: loop 0: backward function 1 *) let rec hash_map_remove_from_list_loop_back (t : Type0) (key : usize) (ls : list_t t) : Tot (result (list_t t)) @@ -378,12 +387,12 @@ let rec hash_map_remove_from_list_loop_back | ListNil -> Return ListNil end -(** [hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap::HashMap::{0}::remove_from_list]: backward function 1 *) let hash_map_remove_from_list_back (t : Type0) (key : usize) (ls : list_t t) : result (list_t t) = hash_map_remove_from_list_loop_back t key ls -(** [hashmap::HashMap::{0}::remove] *) +(** [hashmap::HashMap::{0}::remove]: forward function *) let hash_map_remove_fwd (t : Type0) (self : hash_map_t t) (key : usize) : result (option t) = let* hash = hash_key_fwd key in @@ -397,7 +406,7 @@ let hash_map_remove_fwd let* _ = usize_sub self.hash_map_num_entries 1 in Return (Some x0) end -(** [hashmap::HashMap::{0}::remove] *) +(** [hashmap::HashMap::{0}::remove]: backward function 0 *) let hash_map_remove_back (t : Type0) (self : hash_map_t t) (key : usize) : result (hash_map_t t) = let* hash = hash_key_fwd key in @@ -417,7 +426,7 @@ let hash_map_remove_back Return { self with hash_map_num_entries = i0; hash_map_slots = v } end -(** [hashmap::test1] *) +(** [hashmap::test1]: forward function *) let test1_fwd : result unit = let* hm = hash_map_new_fwd u64 in let* hm0 = hash_map_insert_fwd_back u64 hm 0 42 in diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst index e8cd54c1..f6d9c8cf 100644 --- a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst +++ b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst @@ -8,11 +8,11 @@ include HashmapMain.Clauses #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [hashmap_main::hashmap::hash_key] *) +(** [hashmap_main::hashmap::hash_key]: forward function *) let hashmap_hash_key_fwd (k : usize) : result usize = Return k -(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots] *) +(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots]: loop 0: forward function *) let rec hashmap_hash_map_allocate_slots_loop_fwd (t : Type0) (slots : vec (hashmap_list_t t)) (n : usize) : Tot (result (vec (hashmap_list_t t))) @@ -25,14 +25,14 @@ let rec hashmap_hash_map_allocate_slots_loop_fwd hashmap_hash_map_allocate_slots_loop_fwd t slots0 n0 else Return slots -(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots] *) +(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots]: forward function *) let hashmap_hash_map_allocate_slots_fwd (t : Type0) (slots : vec (hashmap_list_t t)) (n : usize) : result (vec (hashmap_list_t t)) = hashmap_hash_map_allocate_slots_loop_fwd t slots n -(** [hashmap_main::hashmap::HashMap::{0}::new_with_capacity] *) +(** [hashmap_main::hashmap::HashMap::{0}::new_with_capacity]: forward function *) let hashmap_hash_map_new_with_capacity_fwd (t : Type0) (capacity : usize) (max_load_dividend : usize) (max_load_divisor : usize) : @@ -50,11 +50,12 @@ let hashmap_hash_map_new_with_capacity_fwd hashmap_hash_map_slots = slots } -(** [hashmap_main::hashmap::HashMap::{0}::new] *) +(** [hashmap_main::hashmap::HashMap::{0}::new]: forward function *) let hashmap_hash_map_new_fwd (t : Type0) : result (hashmap_hash_map_t t) = hashmap_hash_map_new_with_capacity_fwd t 32 4 5 -(** [hashmap_main::hashmap::HashMap::{0}::clear] *) +(** [hashmap_main::hashmap::HashMap::{0}::clear]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec hashmap_hash_map_clear_loop_fwd_back (t : Type0) (slots : vec (hashmap_list_t t)) (i : usize) : Tot (result (vec (hashmap_list_t t))) @@ -69,7 +70,8 @@ let rec hashmap_hash_map_clear_loop_fwd_back hashmap_hash_map_clear_loop_fwd_back t slots0 i1 else Return slots -(** [hashmap_main::hashmap::HashMap::{0}::clear] *) +(** [hashmap_main::hashmap::HashMap::{0}::clear]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hashmap_hash_map_clear_fwd_back (t : Type0) (self : hashmap_hash_map_t t) : result (hashmap_hash_map_t t) = let* v = hashmap_hash_map_clear_loop_fwd_back t self.hashmap_hash_map_slots 0 @@ -77,12 +79,12 @@ let hashmap_hash_map_clear_fwd_back Return { self with hashmap_hash_map_num_entries = 0; hashmap_hash_map_slots = v } -(** [hashmap_main::hashmap::HashMap::{0}::len] *) +(** [hashmap_main::hashmap::HashMap::{0}::len]: forward function *) let hashmap_hash_map_len_fwd (t : Type0) (self : hashmap_hash_map_t t) : result usize = Return self.hashmap_hash_map_num_entries -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: loop 0: forward function *) let rec hashmap_hash_map_insert_in_list_loop_fwd (t : Type0) (key : usize) (value : t) (ls : hashmap_list_t t) : Tot (result bool) @@ -96,12 +98,12 @@ let rec hashmap_hash_map_insert_in_list_loop_fwd | HashmapListNil -> Return true end -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: forward function *) let hashmap_hash_map_insert_in_list_fwd (t : Type0) (key : usize) (value : t) (ls : hashmap_list_t t) : result bool = hashmap_hash_map_insert_in_list_loop_fwd t key value ls -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: loop 0: backward function 0 *) let rec hashmap_hash_map_insert_in_list_loop_back (t : Type0) (key : usize) (value : t) (ls : hashmap_list_t t) : Tot (result (hashmap_list_t t)) @@ -118,14 +120,15 @@ let rec hashmap_hash_map_insert_in_list_loop_back let l = HashmapListNil in Return (HashmapListCons key value l) end -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: backward function 0 *) let hashmap_hash_map_insert_in_list_back (t : Type0) (key : usize) (value : t) (ls : hashmap_list_t t) : result (hashmap_list_t t) = hashmap_hash_map_insert_in_list_loop_back t key value ls -(** [hashmap_main::hashmap::HashMap::{0}::insert_no_resize] *) +(** [hashmap_main::hashmap::HashMap::{0}::insert_no_resize]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hashmap_hash_map_insert_no_resize_fwd_back (t : Type0) (self : hashmap_hash_map_t t) (key : usize) (value : t) : result (hashmap_hash_map_t t) @@ -158,7 +161,8 @@ let hashmap_hash_map_insert_no_resize_fwd_back let core_num_u32_max_body : result u32 = Return 4294967295 let core_num_u32_max_c : u32 = eval_global core_num_u32_max_body -(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec hashmap_hash_map_move_elements_from_list_loop_fwd_back (t : Type0) (ntable : hashmap_hash_map_t t) (ls : hashmap_list_t t) : Tot (result (hashmap_hash_map_t t)) @@ -172,14 +176,16 @@ let rec hashmap_hash_map_move_elements_from_list_loop_fwd_back | HashmapListNil -> Return ntable end -(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hashmap_hash_map_move_elements_from_list_fwd_back (t : Type0) (ntable : hashmap_hash_map_t t) (ls : hashmap_list_t t) : result (hashmap_hash_map_t t) = hashmap_hash_map_move_elements_from_list_loop_fwd_back t ntable ls -(** [hashmap_main::hashmap::HashMap::{0}::move_elements] *) +(** [hashmap_main::hashmap::HashMap::{0}::move_elements]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec hashmap_hash_map_move_elements_loop_fwd_back (t : Type0) (ntable : hashmap_hash_map_t t) (slots : vec (hashmap_list_t t)) (i : usize) : @@ -199,7 +205,8 @@ let rec hashmap_hash_map_move_elements_loop_fwd_back hashmap_hash_map_move_elements_loop_fwd_back t ntable0 slots0 i1 else Return (ntable, slots) -(** [hashmap_main::hashmap::HashMap::{0}::move_elements] *) +(** [hashmap_main::hashmap::HashMap::{0}::move_elements]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hashmap_hash_map_move_elements_fwd_back (t : Type0) (ntable : hashmap_hash_map_t t) (slots : vec (hashmap_list_t t)) (i : usize) : @@ -207,7 +214,8 @@ let hashmap_hash_map_move_elements_fwd_back = hashmap_hash_map_move_elements_loop_fwd_back t ntable slots i -(** [hashmap_main::hashmap::HashMap::{0}::try_resize] *) +(** [hashmap_main::hashmap::HashMap::{0}::try_resize]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hashmap_hash_map_try_resize_fwd_back (t : Type0) (self : hashmap_hash_map_t t) : result (hashmap_hash_map_t t) = let* max_usize = scalar_cast U32 Usize core_num_u32_max_c in @@ -231,7 +239,8 @@ let hashmap_hash_map_try_resize_fwd_back } else Return { self with hashmap_hash_map_max_load_factor = (i, i0) } -(** [hashmap_main::hashmap::HashMap::{0}::insert] *) +(** [hashmap_main::hashmap::HashMap::{0}::insert]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let hashmap_hash_map_insert_fwd_back (t : Type0) (self : hashmap_hash_map_t t) (key : usize) (value : t) : result (hashmap_hash_map_t t) @@ -242,7 +251,7 @@ let hashmap_hash_map_insert_fwd_back then hashmap_hash_map_try_resize_fwd_back t self0 else Return self0 -(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list]: loop 0: forward function *) let rec hashmap_hash_map_contains_key_in_list_loop_fwd (t : Type0) (key : usize) (ls : hashmap_list_t t) : Tot (result bool) @@ -256,12 +265,12 @@ let rec hashmap_hash_map_contains_key_in_list_loop_fwd | HashmapListNil -> Return false end -(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list]: forward function *) let hashmap_hash_map_contains_key_in_list_fwd (t : Type0) (key : usize) (ls : hashmap_list_t t) : result bool = hashmap_hash_map_contains_key_in_list_loop_fwd t key ls -(** [hashmap_main::hashmap::HashMap::{0}::contains_key] *) +(** [hashmap_main::hashmap::HashMap::{0}::contains_key]: forward function *) let hashmap_hash_map_contains_key_fwd (t : Type0) (self : hashmap_hash_map_t t) (key : usize) : result bool = let* hash = hashmap_hash_key_fwd key in @@ -271,7 +280,7 @@ let hashmap_hash_map_contains_key_fwd vec_index_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod in hashmap_hash_map_contains_key_in_list_fwd t key l -(** [hashmap_main::hashmap::HashMap::{0}::get_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_in_list]: loop 0: forward function *) let rec hashmap_hash_map_get_in_list_loop_fwd (t : Type0) (key : usize) (ls : hashmap_list_t t) : Tot (result t) @@ -285,12 +294,12 @@ let rec hashmap_hash_map_get_in_list_loop_fwd | HashmapListNil -> Fail Failure end -(** [hashmap_main::hashmap::HashMap::{0}::get_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_in_list]: forward function *) let hashmap_hash_map_get_in_list_fwd (t : Type0) (key : usize) (ls : hashmap_list_t t) : result t = hashmap_hash_map_get_in_list_loop_fwd t key ls -(** [hashmap_main::hashmap::HashMap::{0}::get] *) +(** [hashmap_main::hashmap::HashMap::{0}::get]: forward function *) let hashmap_hash_map_get_fwd (t : Type0) (self : hashmap_hash_map_t t) (key : usize) : result t = let* hash = hashmap_hash_key_fwd key in @@ -300,7 +309,7 @@ let hashmap_hash_map_get_fwd vec_index_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod in hashmap_hash_map_get_in_list_fwd t key l -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: loop 0: forward function *) let rec hashmap_hash_map_get_mut_in_list_loop_fwd (t : Type0) (ls : hashmap_list_t t) (key : usize) : Tot (result t) @@ -314,12 +323,12 @@ let rec hashmap_hash_map_get_mut_in_list_loop_fwd | HashmapListNil -> Fail Failure end -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: forward function *) let hashmap_hash_map_get_mut_in_list_fwd (t : Type0) (ls : hashmap_list_t t) (key : usize) : result t = hashmap_hash_map_get_mut_in_list_loop_fwd t ls key -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: loop 0: backward function 0 *) let rec hashmap_hash_map_get_mut_in_list_loop_back (t : Type0) (ls : hashmap_list_t t) (key : usize) (ret : t) : Tot (result (hashmap_list_t t)) @@ -335,14 +344,14 @@ let rec hashmap_hash_map_get_mut_in_list_loop_back | HashmapListNil -> Fail Failure end -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: backward function 0 *) let hashmap_hash_map_get_mut_in_list_back (t : Type0) (ls : hashmap_list_t t) (key : usize) (ret : t) : result (hashmap_list_t t) = hashmap_hash_map_get_mut_in_list_loop_back t ls key ret -(** [hashmap_main::hashmap::HashMap::{0}::get_mut] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_mut]: forward function *) let hashmap_hash_map_get_mut_fwd (t : Type0) (self : hashmap_hash_map_t t) (key : usize) : result t = let* hash = hashmap_hash_key_fwd key in @@ -353,7 +362,7 @@ let hashmap_hash_map_get_mut_fwd in hashmap_hash_map_get_mut_in_list_fwd t l key -(** [hashmap_main::hashmap::HashMap::{0}::get_mut] *) +(** [hashmap_main::hashmap::HashMap::{0}::get_mut]: backward function 0 *) let hashmap_hash_map_get_mut_back (t : Type0) (self : hashmap_hash_map_t t) (key : usize) (ret : t) : result (hashmap_hash_map_t t) @@ -370,7 +379,7 @@ let hashmap_hash_map_get_mut_back l0 in Return { self with hashmap_hash_map_slots = v } -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: loop 0: forward function *) let rec hashmap_hash_map_remove_from_list_loop_fwd (t : Type0) (key : usize) (ls : hashmap_list_t t) : Tot (result (option t)) @@ -391,12 +400,12 @@ let rec hashmap_hash_map_remove_from_list_loop_fwd | HashmapListNil -> Return None end -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: forward function *) let hashmap_hash_map_remove_from_list_fwd (t : Type0) (key : usize) (ls : hashmap_list_t t) : result (option t) = hashmap_hash_map_remove_from_list_loop_fwd t key ls -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: loop 0: backward function 1 *) let rec hashmap_hash_map_remove_from_list_loop_back (t : Type0) (key : usize) (ls : hashmap_list_t t) : Tot (result (hashmap_list_t t)) @@ -419,14 +428,14 @@ let rec hashmap_hash_map_remove_from_list_loop_back | HashmapListNil -> Return HashmapListNil end -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list] *) +(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: backward function 1 *) let hashmap_hash_map_remove_from_list_back (t : Type0) (key : usize) (ls : hashmap_list_t t) : result (hashmap_list_t t) = hashmap_hash_map_remove_from_list_loop_back t key ls -(** [hashmap_main::hashmap::HashMap::{0}::remove] *) +(** [hashmap_main::hashmap::HashMap::{0}::remove]: forward function *) let hashmap_hash_map_remove_fwd (t : Type0) (self : hashmap_hash_map_t t) (key : usize) : result (option t) = let* hash = hashmap_hash_key_fwd key in @@ -442,7 +451,7 @@ let hashmap_hash_map_remove_fwd let* _ = usize_sub self.hashmap_hash_map_num_entries 1 in Return (Some x0) end -(** [hashmap_main::hashmap::HashMap::{0}::remove] *) +(** [hashmap_main::hashmap::HashMap::{0}::remove]: backward function 0 *) let hashmap_hash_map_remove_back (t : Type0) (self : hashmap_hash_map_t t) (key : usize) : result (hashmap_hash_map_t t) @@ -472,7 +481,7 @@ let hashmap_hash_map_remove_back } end -(** [hashmap_main::hashmap::test1] *) +(** [hashmap_main::hashmap::test1]: forward function *) let hashmap_test1_fwd : result unit = let* hm = hashmap_hash_map_new_fwd u64 in let* hm0 = hashmap_hash_map_insert_fwd_back u64 hm 0 42 in @@ -511,7 +520,7 @@ let hashmap_test1_fwd : result unit = (** Unit test for [hashmap_main::hashmap::test1] *) let _ = assert_norm (hashmap_test1_fwd = Return ()) -(** [hashmap_main::insert_on_disk] *) +(** [hashmap_main::insert_on_disk]: forward function *) let insert_on_disk_fwd (key : usize) (value : u64) (st : state) : result (state & unit) = let* (st0, hm) = hashmap_utils_deserialize_fwd st in @@ -519,7 +528,7 @@ let insert_on_disk_fwd let* (st1, _) = hashmap_utils_serialize_fwd hm0 st0 in Return (st1, ()) -(** [hashmap_main::main] *) +(** [hashmap_main::main]: forward function *) let main_fwd : result unit = Return () diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti b/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti index 6e54ea10..78a6c3ba 100644 --- a/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti +++ b/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti @@ -1,16 +1,16 @@ (** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) -(** [hashmap_main]: opaque function definitions *) +(** [hashmap_main]: external function declarations *) module HashmapMain.Opaque open Primitives include HashmapMain.Types #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [hashmap_main::hashmap_utils::deserialize] *) +(** [hashmap_main::hashmap_utils::deserialize]: forward function *) val hashmap_utils_deserialize_fwd : state -> result (state & (hashmap_hash_map_t u64)) -(** [hashmap_main::hashmap_utils::serialize] *) +(** [hashmap_main::hashmap_utils::serialize]: forward function *) val hashmap_utils_serialize_fwd : hashmap_hash_map_t u64 -> state -> result (state & unit) diff --git a/tests/fstar/misc/Constants.fst b/tests/fstar/misc/Constants.fst index bf2f0b1b..aae997fa 100644 --- a/tests/fstar/misc/Constants.fst +++ b/tests/fstar/misc/Constants.fst @@ -21,7 +21,7 @@ let x1_c : u32 = eval_global x1_body let x2_body : result u32 = Return 3 let x2_c : u32 = eval_global x2_body -(** [constants::incr] *) +(** [constants::incr]: forward function *) let incr_fwd (n : u32) : result u32 = u32_add n 1 @@ -29,14 +29,14 @@ let incr_fwd (n : u32) : result u32 = let x3_body : result u32 = incr_fwd 32 let x3_c : u32 = eval_global x3_body -(** [constants::mk_pair0] *) +(** [constants::mk_pair0]: forward function *) let mk_pair0_fwd (x : u32) (y : u32) : result (u32 & u32) = Return (x, y) (** [constants::Pair] *) type pair_t (t1 t2 : Type0) = { pair_x : t1; pair_y : t2; } -(** [constants::mk_pair1] *) +(** [constants::mk_pair1]: forward function *) let mk_pair1_fwd (x : u32) (y : u32) : result (pair_t u32 u32) = Return { pair_x = x; pair_y = y } @@ -59,7 +59,7 @@ let p3_c : pair_t u32 u32 = eval_global p3_body (** [constants::Wrap] *) type wrap_t (t : Type0) = { wrap_val : t; } -(** [constants::Wrap::{0}::new] *) +(** [constants::Wrap::{0}::new]: forward function *) let wrap_new_fwd (t : Type0) (val0 : t) : result (wrap_t t) = Return { wrap_val = val0 } @@ -67,7 +67,7 @@ let wrap_new_fwd (t : Type0) (val0 : t) : result (wrap_t t) = let y_body : result (wrap_t i32) = wrap_new_fwd i32 2 let y_c : wrap_t i32 = eval_global y_body -(** [constants::unwrap_y] *) +(** [constants::unwrap_y]: forward function *) let unwrap_y_fwd : result i32 = Return y_c.wrap_val @@ -79,11 +79,11 @@ let yval_c : i32 = eval_global yval_body let get_z1_z1_body : result i32 = Return 3 let get_z1_z1_c : i32 = eval_global get_z1_z1_body -(** [constants::get_z1] *) +(** [constants::get_z1]: forward function *) let get_z1_fwd : result i32 = Return get_z1_z1_c -(** [constants::add] *) +(** [constants::add]: forward function *) let add_fwd (a : i32) (b : i32) : result i32 = i32_add a b @@ -99,7 +99,7 @@ let q2_c : i32 = eval_global q2_body let q3_body : result i32 = add_fwd q2_c 3 let q3_c : i32 = eval_global q3_body -(** [constants::get_z2] *) +(** [constants::get_z2]: forward function *) let get_z2_fwd : result i32 = let* i = get_z1_fwd in let* i0 = add_fwd i q3_c in add_fwd q1_c i0 diff --git a/tests/fstar/misc/External.Funs.fst b/tests/fstar/misc/External.Funs.fst index f70a9fc6..f118a2cf 100644 --- a/tests/fstar/misc/External.Funs.fst +++ b/tests/fstar/misc/External.Funs.fst @@ -7,14 +7,14 @@ include External.Opaque #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [external::swap] *) +(** [external::swap]: forward function *) let swap_fwd (t : Type0) (x : t) (y : t) (st : state) : result (state & unit) = let* (st0, _) = core_mem_swap_fwd t x y st in let* (st1, _) = core_mem_swap_back0 t x y st st0 in let* (st2, _) = core_mem_swap_back1 t x y st st1 in Return (st2, ()) -(** [external::swap] *) +(** [external::swap]: backward function 0 *) let swap_back (t : Type0) (x : t) (y : t) (st : state) (st0 : state) : result (state & (t & t)) @@ -24,20 +24,20 @@ let swap_back let* (_, y0) = core_mem_swap_back1 t x y st st2 in Return (st0, (x0, y0)) -(** [external::test_new_non_zero_u32] *) +(** [external::test_new_non_zero_u32]: forward function *) let test_new_non_zero_u32_fwd (x : u32) (st : state) : result (state & core_num_nonzero_non_zero_u32_t) = let* (st0, opt) = core_num_nonzero_non_zero_u32_new_fwd x st in core_option_option_unwrap_fwd core_num_nonzero_non_zero_u32_t opt st0 -(** [external::test_vec] *) +(** [external::test_vec]: forward function *) let test_vec_fwd : result unit = let v = vec_new u32 in let* _ = vec_push_back u32 v 0 in Return () (** Unit test for [external::test_vec] *) let _ = assert_norm (test_vec_fwd = Return ()) -(** [external::custom_swap] *) +(** [external::custom_swap]: forward function *) let custom_swap_fwd (t : Type0) (x : t) (y : t) (st : state) : result (state & t) = let* (st0, _) = core_mem_swap_fwd t x y st in @@ -45,7 +45,7 @@ let custom_swap_fwd let* (st2, _) = core_mem_swap_back1 t x y st st1 in Return (st2, x0) -(** [external::custom_swap] *) +(** [external::custom_swap]: backward function 0 *) let custom_swap_back (t : Type0) (x : t) (y : t) (st : state) (ret : t) (st0 : state) : result (state & (t & t)) @@ -55,19 +55,19 @@ let custom_swap_back let* (_, y0) = core_mem_swap_back1 t x y st st2 in Return (st0, (ret, y0)) -(** [external::test_custom_swap] *) +(** [external::test_custom_swap]: forward function *) let test_custom_swap_fwd (x : u32) (y : u32) (st : state) : result (state & unit) = let* (st0, _) = custom_swap_fwd u32 x y st in Return (st0, ()) -(** [external::test_custom_swap] *) +(** [external::test_custom_swap]: backward function 0 *) let test_custom_swap_back (x : u32) (y : u32) (st : state) (st0 : state) : result (state & (u32 & u32)) = custom_swap_back u32 x y st 1 st0 -(** [external::test_swap_non_zero] *) +(** [external::test_swap_non_zero]: forward function *) let test_swap_non_zero_fwd (x : u32) (st : state) : result (state & u32) = let* (st0, _) = swap_fwd u32 x 0 st in let* (st1, (x0, _)) = swap_back u32 x 0 st st0 in diff --git a/tests/fstar/misc/External.Opaque.fsti b/tests/fstar/misc/External.Opaque.fsti index 7d86405a..2e19f767 100644 --- a/tests/fstar/misc/External.Opaque.fsti +++ b/tests/fstar/misc/External.Opaque.fsti @@ -1,27 +1,27 @@ (** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) -(** [external]: opaque function definitions *) +(** [external]: external function declarations *) module External.Opaque open Primitives include External.Types #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [core::mem::swap] *) +(** [core::mem::swap]: forward function *) val core_mem_swap_fwd (t : Type0) : t -> t -> state -> result (state & unit) -(** [core::mem::swap] *) +(** [core::mem::swap]: backward function 0 *) val core_mem_swap_back0 (t : Type0) : t -> t -> state -> state -> result (state & t) -(** [core::mem::swap] *) +(** [core::mem::swap]: backward function 1 *) val core_mem_swap_back1 (t : Type0) : t -> t -> state -> state -> result (state & t) -(** [core::num::nonzero::NonZeroU32::{14}::new] *) +(** [core::num::nonzero::NonZeroU32::{14}::new]: forward function *) val core_num_nonzero_non_zero_u32_new_fwd : u32 -> state -> result (state & (option core_num_nonzero_non_zero_u32_t)) -(** [core::option::Option::{0}::unwrap] *) +(** [core::option::Option::{0}::unwrap]: forward function *) val core_option_option_unwrap_fwd (t : Type0) : option t -> state -> result (state & t) diff --git a/tests/fstar/misc/Loops.Funs.fst b/tests/fstar/misc/Loops.Funs.fst index 7fe175e5..9a80f415 100644 --- a/tests/fstar/misc/Loops.Funs.fst +++ b/tests/fstar/misc/Loops.Funs.fst @@ -7,7 +7,7 @@ include Loops.Clauses #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [loops::sum] *) +(** [loops::sum]: loop 0: forward function *) let rec sum_loop_fwd (max : u32) (i : u32) (s : u32) : Tot (result u32) (decreases (sum_loop_decreases max i s)) @@ -16,11 +16,11 @@ let rec sum_loop_fwd then let* s0 = u32_add s i in let* i0 = u32_add i 1 in sum_loop_fwd max i0 s0 else u32_mul s 2 -(** [loops::sum] *) +(** [loops::sum]: forward function *) let sum_fwd (max : u32) : result u32 = sum_loop_fwd max 0 0 -(** [loops::sum_with_mut_borrows] *) +(** [loops::sum_with_mut_borrows]: loop 0: forward function *) let rec sum_with_mut_borrows_loop_fwd (max : u32) (mi : u32) (ms : u32) : Tot (result u32) (decreases (sum_with_mut_borrows_loop_decreases max mi ms)) @@ -32,11 +32,11 @@ let rec sum_with_mut_borrows_loop_fwd sum_with_mut_borrows_loop_fwd max mi0 ms0 else u32_mul ms 2 -(** [loops::sum_with_mut_borrows] *) +(** [loops::sum_with_mut_borrows]: forward function *) let sum_with_mut_borrows_fwd (max : u32) : result u32 = sum_with_mut_borrows_loop_fwd max 0 0 -(** [loops::sum_with_shared_borrows] *) +(** [loops::sum_with_shared_borrows]: loop 0: forward function *) let rec sum_with_shared_borrows_loop_fwd (max : u32) (i : u32) (s : u32) : Tot (result u32) (decreases (sum_with_shared_borrows_loop_decreases max i s)) @@ -48,11 +48,12 @@ let rec sum_with_shared_borrows_loop_fwd sum_with_shared_borrows_loop_fwd max i0 s0 else u32_mul s 2 -(** [loops::sum_with_shared_borrows] *) +(** [loops::sum_with_shared_borrows]: forward function *) let sum_with_shared_borrows_fwd (max : u32) : result u32 = sum_with_shared_borrows_loop_fwd max 0 0 -(** [loops::clear] *) +(** [loops::clear]: loop 0: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let rec clear_loop_fwd_back (v : vec u32) (i : usize) : Tot (result (vec u32)) (decreases (clear_loop_decreases v i)) @@ -65,11 +66,12 @@ let rec clear_loop_fwd_back clear_loop_fwd_back v0 i1 else Return v -(** [loops::clear] *) +(** [loops::clear]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let clear_fwd_back (v : vec u32) : result (vec u32) = clear_loop_fwd_back v 0 -(** [loops::list_mem] *) +(** [loops::list_mem]: loop 0: forward function *) let rec list_mem_loop_fwd (x : u32) (ls : list_t u32) : Tot (result bool) (decreases (list_mem_loop_decreases x ls)) @@ -79,11 +81,11 @@ let rec list_mem_loop_fwd | ListNil -> Return false end -(** [loops::list_mem] *) +(** [loops::list_mem]: forward function *) let list_mem_fwd (x : u32) (ls : list_t u32) : result bool = list_mem_loop_fwd x ls -(** [loops::list_nth_mut_loop] *) +(** [loops::list_nth_mut_loop]: loop 0: forward function *) let rec list_nth_mut_loop_loop_fwd (t : Type0) (ls : list_t t) (i : u32) : Tot (result t) (decreases (list_nth_mut_loop_loop_decreases t ls i)) @@ -96,11 +98,11 @@ let rec list_nth_mut_loop_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop] *) +(** [loops::list_nth_mut_loop]: forward function *) let list_nth_mut_loop_fwd (t : Type0) (ls : list_t t) (i : u32) : result t = list_nth_mut_loop_loop_fwd t ls i -(** [loops::list_nth_mut_loop] *) +(** [loops::list_nth_mut_loop]: loop 0: backward function 0 *) let rec list_nth_mut_loop_loop_back (t : Type0) (ls : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) (decreases (list_nth_mut_loop_loop_decreases t ls i)) @@ -116,12 +118,12 @@ let rec list_nth_mut_loop_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop] *) +(** [loops::list_nth_mut_loop]: backward function 0 *) let list_nth_mut_loop_back (t : Type0) (ls : list_t t) (i : u32) (ret : t) : result (list_t t) = list_nth_mut_loop_loop_back t ls i ret -(** [loops::list_nth_shared_loop] *) +(** [loops::list_nth_shared_loop]: loop 0: forward function *) let rec list_nth_shared_loop_loop_fwd (t : Type0) (ls : list_t t) (i : u32) : Tot (result t) (decreases (list_nth_shared_loop_loop_decreases t ls i)) @@ -134,11 +136,11 @@ let rec list_nth_shared_loop_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_shared_loop] *) +(** [loops::list_nth_shared_loop]: forward function *) let list_nth_shared_loop_fwd (t : Type0) (ls : list_t t) (i : u32) : result t = list_nth_shared_loop_loop_fwd t ls i -(** [loops::get_elem_mut] *) +(** [loops::get_elem_mut]: loop 0: forward function *) let rec get_elem_mut_loop_fwd (x : usize) (ls : list_t usize) : Tot (result usize) (decreases (get_elem_mut_loop_decreases x ls)) @@ -148,12 +150,12 @@ let rec get_elem_mut_loop_fwd | ListNil -> Fail Failure end -(** [loops::get_elem_mut] *) +(** [loops::get_elem_mut]: forward function *) let get_elem_mut_fwd (slots : vec (list_t usize)) (x : usize) : result usize = let* l = vec_index_mut_fwd (list_t usize) slots 0 in get_elem_mut_loop_fwd x l -(** [loops::get_elem_mut] *) +(** [loops::get_elem_mut]: loop 0: backward function 0 *) let rec get_elem_mut_loop_back (x : usize) (ls : list_t usize) (ret : usize) : Tot (result (list_t usize)) (decreases (get_elem_mut_loop_decreases x ls)) @@ -166,7 +168,7 @@ let rec get_elem_mut_loop_back | ListNil -> Fail Failure end -(** [loops::get_elem_mut] *) +(** [loops::get_elem_mut]: backward function 0 *) let get_elem_mut_back (slots : vec (list_t usize)) (x : usize) (ret : usize) : result (vec (list_t usize)) @@ -175,7 +177,7 @@ let get_elem_mut_back let* l0 = get_elem_mut_loop_back x l ret in vec_index_mut_back (list_t usize) slots 0 l0 -(** [loops::get_elem_shared] *) +(** [loops::get_elem_shared]: loop 0: forward function *) let rec get_elem_shared_loop_fwd (x : usize) (ls : list_t usize) : Tot (result usize) (decreases (get_elem_shared_loop_decreases x ls)) @@ -185,25 +187,25 @@ let rec get_elem_shared_loop_fwd | ListNil -> Fail Failure end -(** [loops::get_elem_shared] *) +(** [loops::get_elem_shared]: forward function *) let get_elem_shared_fwd (slots : vec (list_t usize)) (x : usize) : result usize = let* l = vec_index_fwd (list_t usize) slots 0 in get_elem_shared_loop_fwd x l -(** [loops::id_mut] *) +(** [loops::id_mut]: forward function *) let id_mut_fwd (t : Type0) (ls : list_t t) : result (list_t t) = Return ls -(** [loops::id_mut] *) +(** [loops::id_mut]: backward function 0 *) let id_mut_back (t : Type0) (ls : list_t t) (ret : list_t t) : result (list_t t) = Return ret -(** [loops::id_shared] *) +(** [loops::id_shared]: forward function *) let id_shared_fwd (t : Type0) (ls : list_t t) : result (list_t t) = Return ls -(** [loops::list_nth_mut_loop_with_id] *) +(** [loops::list_nth_mut_loop_with_id]: loop 0: forward function *) let rec list_nth_mut_loop_with_id_loop_fwd (t : Type0) (i : u32) (ls : list_t t) : Tot (result t) (decreases (list_nth_mut_loop_with_id_loop_decreases t i ls)) @@ -216,12 +218,12 @@ let rec list_nth_mut_loop_with_id_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_with_id] *) +(** [loops::list_nth_mut_loop_with_id]: forward function *) let list_nth_mut_loop_with_id_fwd (t : Type0) (ls : list_t t) (i : u32) : result t = let* ls0 = id_mut_fwd t ls in list_nth_mut_loop_with_id_loop_fwd t i ls0 -(** [loops::list_nth_mut_loop_with_id] *) +(** [loops::list_nth_mut_loop_with_id]: loop 0: backward function 0 *) let rec list_nth_mut_loop_with_id_loop_back (t : Type0) (i : u32) (ls : list_t t) (ret : t) : Tot (result (list_t t)) @@ -238,14 +240,14 @@ let rec list_nth_mut_loop_with_id_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_with_id] *) +(** [loops::list_nth_mut_loop_with_id]: backward function 0 *) let list_nth_mut_loop_with_id_back (t : Type0) (ls : list_t t) (i : u32) (ret : t) : result (list_t t) = let* ls0 = id_mut_fwd t ls in let* l = list_nth_mut_loop_with_id_loop_back t i ls0 ret in id_mut_back t ls l -(** [loops::list_nth_shared_loop_with_id] *) +(** [loops::list_nth_shared_loop_with_id]: loop 0: forward function *) let rec list_nth_shared_loop_with_id_loop_fwd (t : Type0) (i : u32) (ls : list_t t) : Tot (result t) @@ -259,13 +261,13 @@ let rec list_nth_shared_loop_with_id_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_shared_loop_with_id] *) +(** [loops::list_nth_shared_loop_with_id]: forward function *) let list_nth_shared_loop_with_id_fwd (t : Type0) (ls : list_t t) (i : u32) : result t = let* ls0 = id_shared_fwd t ls in list_nth_shared_loop_with_id_loop_fwd t i ls0 -(** [loops::list_nth_mut_loop_pair] *) +(** [loops::list_nth_mut_loop_pair]: loop 0: forward function *) let rec list_nth_mut_loop_pair_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -284,12 +286,12 @@ let rec list_nth_mut_loop_pair_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_pair] *) +(** [loops::list_nth_mut_loop_pair]: forward function *) let list_nth_mut_loop_pair_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_loop_pair_loop_fwd t ls0 ls1 i -(** [loops::list_nth_mut_loop_pair] *) +(** [loops::list_nth_mut_loop_pair]: loop 0: backward function 0 *) let rec list_nth_mut_loop_pair_loop_back'a (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) @@ -310,14 +312,14 @@ let rec list_nth_mut_loop_pair_loop_back'a | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_pair] *) +(** [loops::list_nth_mut_loop_pair]: backward function 0 *) let list_nth_mut_loop_pair_back'a (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : result (list_t t) = list_nth_mut_loop_pair_loop_back'a t ls0 ls1 i ret -(** [loops::list_nth_mut_loop_pair] *) +(** [loops::list_nth_mut_loop_pair]: loop 0: backward function 1 *) let rec list_nth_mut_loop_pair_loop_back'b (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) @@ -338,14 +340,14 @@ let rec list_nth_mut_loop_pair_loop_back'b | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_pair] *) +(** [loops::list_nth_mut_loop_pair]: backward function 1 *) let list_nth_mut_loop_pair_back'b (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : result (list_t t) = list_nth_mut_loop_pair_loop_back'b t ls0 ls1 i ret -(** [loops::list_nth_shared_loop_pair] *) +(** [loops::list_nth_shared_loop_pair]: loop 0: forward function *) let rec list_nth_shared_loop_pair_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -365,12 +367,12 @@ let rec list_nth_shared_loop_pair_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_shared_loop_pair] *) +(** [loops::list_nth_shared_loop_pair]: forward function *) let list_nth_shared_loop_pair_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_loop_fwd t ls0 ls1 i -(** [loops::list_nth_mut_loop_pair_merge] *) +(** [loops::list_nth_mut_loop_pair_merge]: loop 0: forward function *) let rec list_nth_mut_loop_pair_merge_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -390,12 +392,12 @@ let rec list_nth_mut_loop_pair_merge_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_pair_merge] *) +(** [loops::list_nth_mut_loop_pair_merge]: forward function *) let list_nth_mut_loop_pair_merge_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_loop_pair_merge_loop_fwd t ls0 ls1 i -(** [loops::list_nth_mut_loop_pair_merge] *) +(** [loops::list_nth_mut_loop_pair_merge]: loop 0: backward function 0 *) let rec list_nth_mut_loop_pair_merge_loop_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : (t & t)) : Tot (result ((list_t t) & (list_t t))) @@ -417,14 +419,14 @@ let rec list_nth_mut_loop_pair_merge_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_mut_loop_pair_merge] *) +(** [loops::list_nth_mut_loop_pair_merge]: backward function 0 *) let list_nth_mut_loop_pair_merge_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : (t & t)) : result ((list_t t) & (list_t t)) = list_nth_mut_loop_pair_merge_loop_back t ls0 ls1 i ret -(** [loops::list_nth_shared_loop_pair_merge] *) +(** [loops::list_nth_shared_loop_pair_merge]: loop 0: forward function *) let rec list_nth_shared_loop_pair_merge_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -444,12 +446,12 @@ let rec list_nth_shared_loop_pair_merge_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_shared_loop_pair_merge] *) +(** [loops::list_nth_shared_loop_pair_merge]: forward function *) let list_nth_shared_loop_pair_merge_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_merge_loop_fwd t ls0 ls1 i -(** [loops::list_nth_mut_shared_loop_pair] *) +(** [loops::list_nth_mut_shared_loop_pair]: loop 0: forward function *) let rec list_nth_mut_shared_loop_pair_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -469,12 +471,12 @@ let rec list_nth_mut_shared_loop_pair_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_mut_shared_loop_pair] *) +(** [loops::list_nth_mut_shared_loop_pair]: forward function *) let list_nth_mut_shared_loop_pair_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_shared_loop_pair_loop_fwd t ls0 ls1 i -(** [loops::list_nth_mut_shared_loop_pair] *) +(** [loops::list_nth_mut_shared_loop_pair]: loop 0: backward function 0 *) let rec list_nth_mut_shared_loop_pair_loop_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) @@ -495,14 +497,14 @@ let rec list_nth_mut_shared_loop_pair_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_mut_shared_loop_pair] *) +(** [loops::list_nth_mut_shared_loop_pair]: backward function 0 *) let list_nth_mut_shared_loop_pair_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : result (list_t t) = list_nth_mut_shared_loop_pair_loop_back t ls0 ls1 i ret -(** [loops::list_nth_mut_shared_loop_pair_merge] *) +(** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0: forward function *) let rec list_nth_mut_shared_loop_pair_merge_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -522,12 +524,12 @@ let rec list_nth_mut_shared_loop_pair_merge_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_mut_shared_loop_pair_merge] *) +(** [loops::list_nth_mut_shared_loop_pair_merge]: forward function *) let list_nth_mut_shared_loop_pair_merge_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_shared_loop_pair_merge_loop_fwd t ls0 ls1 i -(** [loops::list_nth_mut_shared_loop_pair_merge] *) +(** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0: backward function 0 *) let rec list_nth_mut_shared_loop_pair_merge_loop_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) @@ -549,14 +551,14 @@ let rec list_nth_mut_shared_loop_pair_merge_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_mut_shared_loop_pair_merge] *) +(** [loops::list_nth_mut_shared_loop_pair_merge]: backward function 0 *) let list_nth_mut_shared_loop_pair_merge_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : result (list_t t) = list_nth_mut_shared_loop_pair_merge_loop_back t ls0 ls1 i ret -(** [loops::list_nth_shared_mut_loop_pair] *) +(** [loops::list_nth_shared_mut_loop_pair]: loop 0: forward function *) let rec list_nth_shared_mut_loop_pair_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -576,12 +578,12 @@ let rec list_nth_shared_mut_loop_pair_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_shared_mut_loop_pair] *) +(** [loops::list_nth_shared_mut_loop_pair]: forward function *) let list_nth_shared_mut_loop_pair_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_mut_loop_pair_loop_fwd t ls0 ls1 i -(** [loops::list_nth_shared_mut_loop_pair] *) +(** [loops::list_nth_shared_mut_loop_pair]: loop 0: backward function 1 *) let rec list_nth_shared_mut_loop_pair_loop_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) @@ -602,14 +604,14 @@ let rec list_nth_shared_mut_loop_pair_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_shared_mut_loop_pair] *) +(** [loops::list_nth_shared_mut_loop_pair]: backward function 1 *) let list_nth_shared_mut_loop_pair_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : result (list_t t) = list_nth_shared_mut_loop_pair_loop_back t ls0 ls1 i ret -(** [loops::list_nth_shared_mut_loop_pair_merge] *) +(** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0: forward function *) let rec list_nth_shared_mut_loop_pair_merge_loop_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -629,12 +631,12 @@ let rec list_nth_shared_mut_loop_pair_merge_loop_fwd | ListNil -> Fail Failure end -(** [loops::list_nth_shared_mut_loop_pair_merge] *) +(** [loops::list_nth_shared_mut_loop_pair_merge]: forward function *) let list_nth_shared_mut_loop_pair_merge_fwd (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_mut_loop_pair_merge_loop_fwd t ls0 ls1 i -(** [loops::list_nth_shared_mut_loop_pair_merge] *) +(** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0: backward function 0 *) let rec list_nth_shared_mut_loop_pair_merge_loop_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : Tot (result (list_t t)) @@ -656,7 +658,7 @@ let rec list_nth_shared_mut_loop_pair_merge_loop_back | ListNil -> Fail Failure end -(** [loops::list_nth_shared_mut_loop_pair_merge] *) +(** [loops::list_nth_shared_mut_loop_pair_merge]: backward function 0 *) let list_nth_shared_mut_loop_pair_merge_back (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) (ret : t) : result (list_t t) diff --git a/tests/fstar/misc/NoNestedBorrows.fst b/tests/fstar/misc/NoNestedBorrows.fst index 3770ab5d..d790bfa9 100644 --- a/tests/fstar/misc/NoNestedBorrows.fst +++ b/tests/fstar/misc/NoNestedBorrows.fst @@ -30,46 +30,46 @@ type sum_t (t1 t2 : Type0) = | SumLeft : t1 -> sum_t t1 t2 | SumRight : t2 -> sum_t t1 t2 -(** [no_nested_borrows::neg_test] *) +(** [no_nested_borrows::neg_test]: forward function *) let neg_test_fwd (x : i32) : result i32 = i32_neg x -(** [no_nested_borrows::add_test] *) +(** [no_nested_borrows::add_test]: forward function *) let add_test_fwd (x : u32) (y : u32) : result u32 = u32_add x y -(** [no_nested_borrows::subs_test] *) +(** [no_nested_borrows::subs_test]: forward function *) let subs_test_fwd (x : u32) (y : u32) : result u32 = u32_sub x y -(** [no_nested_borrows::div_test] *) +(** [no_nested_borrows::div_test]: forward function *) let div_test_fwd (x : u32) (y : u32) : result u32 = u32_div x y -(** [no_nested_borrows::div_test1] *) +(** [no_nested_borrows::div_test1]: forward function *) let div_test1_fwd (x : u32) : result u32 = u32_div x 2 -(** [no_nested_borrows::rem_test] *) +(** [no_nested_borrows::rem_test]: forward function *) let rem_test_fwd (x : u32) (y : u32) : result u32 = u32_rem x y -(** [no_nested_borrows::cast_test] *) +(** [no_nested_borrows::cast_test]: forward function *) let cast_test_fwd (x : u32) : result i32 = scalar_cast U32 I32 x -(** [no_nested_borrows::test2] *) +(** [no_nested_borrows::test2]: forward function *) let test2_fwd : result unit = let* _ = u32_add 23 44 in Return () (** Unit test for [no_nested_borrows::test2] *) let _ = assert_norm (test2_fwd = Return ()) -(** [no_nested_borrows::get_max] *) +(** [no_nested_borrows::get_max]: forward function *) let get_max_fwd (x : u32) (y : u32) : result u32 = if x >= y then Return x else Return y -(** [no_nested_borrows::test3] *) +(** [no_nested_borrows::test3]: forward function *) let test3_fwd : result unit = let* x = get_max_fwd 4 3 in let* y = get_max_fwd 10 11 in @@ -79,21 +79,21 @@ let test3_fwd : result unit = (** Unit test for [no_nested_borrows::test3] *) let _ = assert_norm (test3_fwd = Return ()) -(** [no_nested_borrows::test_neg1] *) +(** [no_nested_borrows::test_neg1]: forward function *) let test_neg1_fwd : result unit = let* y = i32_neg 3 in if not (y = -3) then Fail Failure else Return () (** Unit test for [no_nested_borrows::test_neg1] *) let _ = assert_norm (test_neg1_fwd = Return ()) -(** [no_nested_borrows::refs_test1] *) +(** [no_nested_borrows::refs_test1]: forward function *) let refs_test1_fwd : result unit = if not (1 = 1) then Fail Failure else Return () (** Unit test for [no_nested_borrows::refs_test1] *) let _ = assert_norm (refs_test1_fwd = Return ()) -(** [no_nested_borrows::refs_test2] *) +(** [no_nested_borrows::refs_test2]: forward function *) let refs_test2_fwd : result unit = if not (2 = 2) then Fail Failure @@ -108,47 +108,47 @@ let refs_test2_fwd : result unit = (** Unit test for [no_nested_borrows::refs_test2] *) let _ = assert_norm (refs_test2_fwd = Return ()) -(** [no_nested_borrows::test_list1] *) +(** [no_nested_borrows::test_list1]: forward function *) let test_list1_fwd : result unit = Return () (** Unit test for [no_nested_borrows::test_list1] *) let _ = assert_norm (test_list1_fwd = Return ()) -(** [no_nested_borrows::test_box1] *) +(** [no_nested_borrows::test_box1]: forward function *) let test_box1_fwd : result unit = let b = 1 in let x = b in if not (x = 1) then Fail Failure else Return () (** Unit test for [no_nested_borrows::test_box1] *) let _ = assert_norm (test_box1_fwd = Return ()) -(** [no_nested_borrows::copy_int] *) +(** [no_nested_borrows::copy_int]: forward function *) let copy_int_fwd (x : i32) : result i32 = Return x -(** [no_nested_borrows::test_unreachable] *) +(** [no_nested_borrows::test_unreachable]: forward function *) let test_unreachable_fwd (b : bool) : result unit = if b then Fail Failure else Return () -(** [no_nested_borrows::test_panic] *) +(** [no_nested_borrows::test_panic]: forward function *) let test_panic_fwd (b : bool) : result unit = if b then Fail Failure else Return () -(** [no_nested_borrows::test_copy_int] *) +(** [no_nested_borrows::test_copy_int]: forward function *) let test_copy_int_fwd : result unit = let* y = copy_int_fwd 0 in if not (0 = y) then Fail Failure else Return () (** Unit test for [no_nested_borrows::test_copy_int] *) let _ = assert_norm (test_copy_int_fwd = Return ()) -(** [no_nested_borrows::is_cons] *) +(** [no_nested_borrows::is_cons]: forward function *) let is_cons_fwd (t : Type0) (l : list_t t) : result bool = begin match l with | ListCons x l0 -> Return true | ListNil -> Return false end -(** [no_nested_borrows::test_is_cons] *) +(** [no_nested_borrows::test_is_cons]: forward function *) let test_is_cons_fwd : result unit = let l = ListNil in let* b = is_cons_fwd i32 (ListCons 0 l) in @@ -157,14 +157,14 @@ let test_is_cons_fwd : result unit = (** Unit test for [no_nested_borrows::test_is_cons] *) let _ = assert_norm (test_is_cons_fwd = Return ()) -(** [no_nested_borrows::split_list] *) +(** [no_nested_borrows::split_list]: forward function *) let split_list_fwd (t : Type0) (l : list_t t) : result (t & (list_t t)) = begin match l with | ListCons hd tl -> Return (hd, tl) | ListNil -> Fail Failure end -(** [no_nested_borrows::test_split_list] *) +(** [no_nested_borrows::test_split_list]: forward function *) let test_split_list_fwd : result unit = let l = ListNil in let* p = split_list_fwd i32 (ListCons 0 l) in @@ -174,16 +174,16 @@ let test_split_list_fwd : result unit = (** Unit test for [no_nested_borrows::test_split_list] *) let _ = assert_norm (test_split_list_fwd = Return ()) -(** [no_nested_borrows::choose] *) +(** [no_nested_borrows::choose]: forward function *) let choose_fwd (t : Type0) (b : bool) (x : t) (y : t) : result t = if b then Return x else Return y -(** [no_nested_borrows::choose] *) +(** [no_nested_borrows::choose]: backward function 0 *) let choose_back (t : Type0) (b : bool) (x : t) (y : t) (ret : t) : result (t & t) = if b then Return (ret, y) else Return (x, ret) -(** [no_nested_borrows::choose_test] *) +(** [no_nested_borrows::choose_test]: forward function *) let choose_test_fwd : result unit = let* z = choose_fwd i32 true 0 0 in let* z0 = i32_add z 1 in @@ -198,7 +198,7 @@ let choose_test_fwd : result unit = (** Unit test for [no_nested_borrows::choose_test] *) let _ = assert_norm (choose_test_fwd = Return ()) -(** [no_nested_borrows::test_char] *) +(** [no_nested_borrows::test_char]: forward function *) let test_char_fwd : result char = Return 'a' @@ -212,14 +212,14 @@ and tree_t (t : Type0) = | TreeLeaf : t -> tree_t t | TreeNode : t -> node_elem_t t -> tree_t t -> tree_t t -(** [no_nested_borrows::list_length] *) +(** [no_nested_borrows::list_length]: forward function *) let rec list_length_fwd (t : Type0) (l : list_t t) : result u32 = begin match l with | ListCons x l1 -> let* i = list_length_fwd t l1 in u32_add 1 i | ListNil -> Return 0 end -(** [no_nested_borrows::list_nth_shared] *) +(** [no_nested_borrows::list_nth_shared]: forward function *) let rec list_nth_shared_fwd (t : Type0) (l : list_t t) (i : u32) : result t = begin match l with | ListCons x tl -> @@ -229,7 +229,7 @@ let rec list_nth_shared_fwd (t : Type0) (l : list_t t) (i : u32) : result t = | ListNil -> Fail Failure end -(** [no_nested_borrows::list_nth_mut] *) +(** [no_nested_borrows::list_nth_mut]: forward function *) let rec list_nth_mut_fwd (t : Type0) (l : list_t t) (i : u32) : result t = begin match l with | ListCons x tl -> @@ -239,7 +239,7 @@ let rec list_nth_mut_fwd (t : Type0) (l : list_t t) (i : u32) : result t = | ListNil -> Fail Failure end -(** [no_nested_borrows::list_nth_mut] *) +(** [no_nested_borrows::list_nth_mut]: backward function 0 *) let rec list_nth_mut_back (t : Type0) (l : list_t t) (i : u32) (ret : t) : result (list_t t) = begin match l with @@ -253,7 +253,7 @@ let rec list_nth_mut_back | ListNil -> Fail Failure end -(** [no_nested_borrows::list_rev_aux] *) +(** [no_nested_borrows::list_rev_aux]: forward function *) let rec list_rev_aux_fwd (t : Type0) (li : list_t t) (lo : list_t t) : result (list_t t) = begin match li with @@ -261,12 +261,13 @@ let rec list_rev_aux_fwd | ListNil -> Return lo end -(** [no_nested_borrows::list_rev] *) +(** [no_nested_borrows::list_rev]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let list_rev_fwd_back (t : Type0) (l : list_t t) : result (list_t t) = let li = mem_replace_fwd (list_t t) l ListNil in list_rev_aux_fwd t li ListNil -(** [no_nested_borrows::test_list_functions] *) +(** [no_nested_borrows::test_list_functions]: forward function *) let test_list_functions_fwd : result unit = let l = ListNil in let l0 = ListCons 2 l in @@ -302,48 +303,48 @@ let test_list_functions_fwd : result unit = (** Unit test for [no_nested_borrows::test_list_functions] *) let _ = assert_norm (test_list_functions_fwd = Return ()) -(** [no_nested_borrows::id_mut_pair1] *) +(** [no_nested_borrows::id_mut_pair1]: forward function *) let id_mut_pair1_fwd (t1 t2 : Type0) (x : t1) (y : t2) : result (t1 & t2) = Return (x, y) -(** [no_nested_borrows::id_mut_pair1] *) +(** [no_nested_borrows::id_mut_pair1]: backward function 0 *) let id_mut_pair1_back (t1 t2 : Type0) (x : t1) (y : t2) (ret : (t1 & t2)) : result (t1 & t2) = let (x0, x1) = ret in Return (x0, x1) -(** [no_nested_borrows::id_mut_pair2] *) +(** [no_nested_borrows::id_mut_pair2]: forward function *) let id_mut_pair2_fwd (t1 t2 : Type0) (p : (t1 & t2)) : result (t1 & t2) = let (x, x0) = p in Return (x, x0) -(** [no_nested_borrows::id_mut_pair2] *) +(** [no_nested_borrows::id_mut_pair2]: backward function 0 *) let id_mut_pair2_back (t1 t2 : Type0) (p : (t1 & t2)) (ret : (t1 & t2)) : result (t1 & t2) = let (x, x0) = ret in Return (x, x0) -(** [no_nested_borrows::id_mut_pair3] *) +(** [no_nested_borrows::id_mut_pair3]: forward function *) let id_mut_pair3_fwd (t1 t2 : Type0) (x : t1) (y : t2) : result (t1 & t2) = Return (x, y) -(** [no_nested_borrows::id_mut_pair3] *) +(** [no_nested_borrows::id_mut_pair3]: backward function 0 *) let id_mut_pair3_back'a (t1 t2 : Type0) (x : t1) (y : t2) (ret : t1) : result t1 = Return ret -(** [no_nested_borrows::id_mut_pair3] *) +(** [no_nested_borrows::id_mut_pair3]: backward function 1 *) let id_mut_pair3_back'b (t1 t2 : Type0) (x : t1) (y : t2) (ret : t2) : result t2 = Return ret -(** [no_nested_borrows::id_mut_pair4] *) +(** [no_nested_borrows::id_mut_pair4]: forward function *) let id_mut_pair4_fwd (t1 t2 : Type0) (p : (t1 & t2)) : result (t1 & t2) = let (x, x0) = p in Return (x, x0) -(** [no_nested_borrows::id_mut_pair4] *) +(** [no_nested_borrows::id_mut_pair4]: backward function 0 *) let id_mut_pair4_back'a (t1 t2 : Type0) (p : (t1 & t2)) (ret : t1) : result t1 = Return ret -(** [no_nested_borrows::id_mut_pair4] *) +(** [no_nested_borrows::id_mut_pair4]: backward function 1 *) let id_mut_pair4_back'b (t1 t2 : Type0) (p : (t1 & t2)) (ret : t2) : result t2 = Return ret @@ -351,15 +352,15 @@ let id_mut_pair4_back'b (** [no_nested_borrows::StructWithTuple] *) type struct_with_tuple_t (t1 t2 : Type0) = { struct_with_tuple_p : (t1 & t2); } -(** [no_nested_borrows::new_tuple1] *) +(** [no_nested_borrows::new_tuple1]: forward function *) let new_tuple1_fwd : result (struct_with_tuple_t u32 u32) = Return { struct_with_tuple_p = (1, 2) } -(** [no_nested_borrows::new_tuple2] *) +(** [no_nested_borrows::new_tuple2]: forward function *) let new_tuple2_fwd : result (struct_with_tuple_t i16 i16) = Return { struct_with_tuple_p = (1, 2) } -(** [no_nested_borrows::new_tuple3] *) +(** [no_nested_borrows::new_tuple3]: forward function *) let new_tuple3_fwd : result (struct_with_tuple_t u64 i64) = Return { struct_with_tuple_p = (1, 2) } @@ -369,11 +370,11 @@ type struct_with_pair_t (t1 t2 : Type0) = struct_with_pair_p : pair_t t1 t2; } -(** [no_nested_borrows::new_pair1] *) +(** [no_nested_borrows::new_pair1]: forward function *) let new_pair1_fwd : result (struct_with_pair_t u32 u32) = Return { struct_with_pair_p = { pair_x = 1; pair_y = 2 } } -(** [no_nested_borrows::test_constants] *) +(** [no_nested_borrows::test_constants]: forward function *) let test_constants_fwd : result unit = let* swt = new_tuple1_fwd in let (i, _) = swt.struct_with_tuple_p in @@ -398,31 +399,32 @@ let test_constants_fwd : result unit = (** Unit test for [no_nested_borrows::test_constants] *) let _ = assert_norm (test_constants_fwd = Return ()) -(** [no_nested_borrows::test_weird_borrows1] *) +(** [no_nested_borrows::test_weird_borrows1]: forward function *) let test_weird_borrows1_fwd : result unit = Return () (** Unit test for [no_nested_borrows::test_weird_borrows1] *) let _ = assert_norm (test_weird_borrows1_fwd = Return ()) -(** [no_nested_borrows::test_mem_replace] *) +(** [no_nested_borrows::test_mem_replace]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let test_mem_replace_fwd_back (px : u32) : result u32 = let y = mem_replace_fwd u32 px 1 in if not (y = 0) then Fail Failure else Return 2 -(** [no_nested_borrows::test_shared_borrow_bool1] *) +(** [no_nested_borrows::test_shared_borrow_bool1]: forward function *) let test_shared_borrow_bool1_fwd (b : bool) : result u32 = if b then Return 0 else Return 1 -(** [no_nested_borrows::test_shared_borrow_bool2] *) +(** [no_nested_borrows::test_shared_borrow_bool2]: forward function *) let test_shared_borrow_bool2_fwd : result u32 = Return 0 -(** [no_nested_borrows::test_shared_borrow_enum1] *) +(** [no_nested_borrows::test_shared_borrow_enum1]: forward function *) let test_shared_borrow_enum1_fwd (l : list_t u32) : result u32 = begin match l with | ListCons i l0 -> Return 1 | ListNil -> Return 0 end -(** [no_nested_borrows::test_shared_borrow_enum2] *) +(** [no_nested_borrows::test_shared_borrow_enum2]: forward function *) let test_shared_borrow_enum2_fwd : result u32 = Return 0 diff --git a/tests/fstar/misc/Paper.fst b/tests/fstar/misc/Paper.fst index 4ab31de3..e2d692c2 100644 --- a/tests/fstar/misc/Paper.fst +++ b/tests/fstar/misc/Paper.fst @@ -5,11 +5,12 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" -(** [paper::ref_incr] *) +(** [paper::ref_incr]: merged forward/backward function + (there is a single backward function, and the forward function returns ()) *) let ref_incr_fwd_back (x : i32) : result i32 = i32_add x 1 -(** [paper::test_incr] *) +(** [paper::test_incr]: forward function *) let test_incr_fwd : result unit = let* x = ref_incr_fwd_back 0 in if not (x = 1) then Fail Failure else Return () @@ -17,16 +18,16 @@ let test_incr_fwd : result unit = (** Unit test for [paper::test_incr] *) let _ = assert_norm (test_incr_fwd = Return ()) -(** [paper::choose] *) +(** [paper::choose]: forward function *) let choose_fwd (t : Type0) (b : bool) (x : t) (y : t) : result t = if b then Return x else Return y -(** [paper::choose] *) +(** [paper::choose]: backward function 0 *) let choose_back (t : Type0) (b : bool) (x : t) (y : t) (ret : t) : result (t & t) = if b then Return (ret, y) else Return (x, ret) -(** [paper::test_choose] *) +(** [paper::test_choose]: forward function *) let test_choose_fwd : result unit = let* z = choose_fwd i32 true 0 0 in let* z0 = i32_add z 1 in @@ -46,7 +47,7 @@ type list_t (t : Type0) = | ListCons : t -> list_t t -> list_t t | ListNil : list_t t -(** [paper::list_nth_mut] *) +(** [paper::list_nth_mut]: forward function *) let rec list_nth_mut_fwd (t : Type0) (l : list_t t) (i : u32) : result t = begin match l with | ListCons x tl -> @@ -56,7 +57,7 @@ let rec list_nth_mut_fwd (t : Type0) (l : list_t t) (i : u32) : result t = | ListNil -> Fail Failure end -(** [paper::list_nth_mut] *) +(** [paper::list_nth_mut]: backward function 0 *) let rec list_nth_mut_back (t : Type0) (l : list_t t) (i : u32) (ret : t) : result (list_t t) = begin match l with @@ -70,14 +71,14 @@ let rec list_nth_mut_back | ListNil -> Fail Failure end -(** [paper::sum] *) +(** [paper::sum]: forward function *) let rec sum_fwd (l : list_t i32) : result i32 = begin match l with | ListCons x tl -> let* i = sum_fwd tl in i32_add x i | ListNil -> Return 0 end -(** [paper::test_nth] *) +(** [paper::test_nth]: forward function *) let test_nth_fwd : result unit = let l = ListNil in let l0 = ListCons 3 l in @@ -91,7 +92,7 @@ let test_nth_fwd : result unit = (** Unit test for [paper::test_nth] *) let _ = assert_norm (test_nth_fwd = Return ()) -(** [paper::call_choose] *) +(** [paper::call_choose]: forward function *) let call_choose_fwd (p : (u32 & u32)) : result u32 = let (px, py) = p in let* pz = choose_fwd u32 true px py in diff --git a/tests/fstar/misc/PoloniusList.fst b/tests/fstar/misc/PoloniusList.fst index e2144487..79c86606 100644 --- a/tests/fstar/misc/PoloniusList.fst +++ b/tests/fstar/misc/PoloniusList.fst @@ -10,7 +10,7 @@ type list_t (t : Type0) = | ListCons : t -> list_t t -> list_t t | ListNil : list_t t -(** [polonius_list::get_list_at_x] *) +(** [polonius_list::get_list_at_x]: forward function *) let rec get_list_at_x_fwd (ls : list_t u32) (x : u32) : result (list_t u32) = begin match ls with | ListCons hd tl -> @@ -18,7 +18,7 @@ let rec get_list_at_x_fwd (ls : list_t u32) (x : u32) : result (list_t u32) = | ListNil -> Return ListNil end -(** [polonius_list::get_list_at_x] *) +(** [polonius_list::get_list_at_x]: backward function 0 *) let rec get_list_at_x_back (ls : list_t u32) (x : u32) (ret : list_t u32) : result (list_t u32) = begin match ls with |