summaryrefslogtreecommitdiff
path: root/tests/fstar/hashmap_on_disk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/fstar/hashmap_on_disk/HashmapMain.Clauses.Template.fst38
-rw-r--r--tests/fstar/hashmap_on_disk/HashmapMain.Clauses.fst32
-rw-r--r--tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst569
-rw-r--r--tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti8
-rw-r--r--tests/fstar/hashmap_on_disk/HashmapMain.Types.fsti16
5 files changed, 333 insertions, 330 deletions
diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.Template.fst b/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.Template.fst
index 615c670d..61885ac7 100644
--- a/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.Template.fst
+++ b/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.Template.fst
@@ -8,56 +8,56 @@ open HashmapMain.Types
(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots]: decreases clause *)
unfold
-let hashmap_hash_map_allocate_slots_loop_decreases (t : Type0)
- (slots : vec (hashmap_list_t t)) (n : usize) : nat =
+let hashmap_HashMap_allocate_slots_loop_decreases (t : Type0)
+ (slots : alloc_vec_Vec (hashmap_List_t t)) (n : usize) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::clear]: decreases clause *)
unfold
-let hashmap_hash_map_clear_loop_decreases (t : Type0)
- (slots : vec (hashmap_list_t t)) (i : usize) : nat =
+let hashmap_HashMap_clear_loop_decreases (t : Type0)
+ (slots : alloc_vec_Vec (hashmap_List_t t)) (i : usize) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_insert_in_list_loop_decreases (t : Type0) (key : usize)
- (value : t) (ls : hashmap_list_t t) : nat =
+let hashmap_HashMap_insert_in_list_loop_decreases (t : Type0) (key : usize)
+ (value : t) (ls : hashmap_List_t t) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list]: decreases clause *)
unfold
-let hashmap_hash_map_move_elements_from_list_loop_decreases (t : Type0)
- (ntable : hashmap_hash_map_t t) (ls : hashmap_list_t t) : nat =
+let hashmap_HashMap_move_elements_from_list_loop_decreases (t : Type0)
+ (ntable : hashmap_HashMap_t t) (ls : hashmap_List_t t) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::move_elements]: decreases clause *)
unfold
-let hashmap_hash_map_move_elements_loop_decreases (t : Type0)
- (ntable : hashmap_hash_map_t t) (slots : vec (hashmap_list_t t)) (i : usize)
- : nat =
+let hashmap_HashMap_move_elements_loop_decreases (t : Type0)
+ (ntable : hashmap_HashMap_t t) (slots : alloc_vec_Vec (hashmap_List_t t))
+ (i : usize) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_contains_key_in_list_loop_decreases (t : Type0)
- (key : usize) (ls : hashmap_list_t t) : nat =
+let hashmap_HashMap_contains_key_in_list_loop_decreases (t : Type0)
+ (key : usize) (ls : hashmap_List_t t) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::get_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_get_in_list_loop_decreases (t : Type0) (key : usize)
- (ls : hashmap_list_t t) : nat =
+let hashmap_HashMap_get_in_list_loop_decreases (t : Type0) (key : usize)
+ (ls : hashmap_List_t t) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_get_mut_in_list_loop_decreases (t : Type0)
- (ls : hashmap_list_t t) (key : usize) : nat =
+let hashmap_HashMap_get_mut_in_list_loop_decreases (t : Type0)
+ (ls : hashmap_List_t t) (key : usize) : nat =
admit ()
(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: decreases clause *)
unfold
-let hashmap_hash_map_remove_from_list_loop_decreases (t : Type0) (key : usize)
- (ls : hashmap_list_t t) : nat =
+let hashmap_HashMap_remove_from_list_loop_decreases (t : Type0) (key : usize)
+ (ls : hashmap_List_t t) : nat =
admit ()
diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.fst b/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.fst
index 699ff3b2..be5a4ab1 100644
--- a/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.fst
+++ b/tests/fstar/hashmap_on_disk/HashmapMain.Clauses.fst
@@ -8,54 +8,54 @@ open HashmapMain.Types
(** [hashmap::HashMap::allocate_slots]: decreases clause *)
unfold
-let hashmap_hash_map_allocate_slots_loop_decreases (t : Type0) (slots : vec (hashmap_list_t t))
+let hashmap_HashMap_allocate_slots_loop_decreases (t : Type0) (slots : alloc_vec_Vec (hashmap_List_t t))
(n : usize) : nat = n
(** [hashmap::HashMap::clear]: decreases clause *)
unfold
-let hashmap_hash_map_clear_loop_decreases (t : Type0) (slots : vec (hashmap_list_t t))
+let hashmap_HashMap_clear_loop_decreases (t : Type0) (slots : alloc_vec_Vec (hashmap_List_t t))
(i : usize) : nat =
if i < length slots then length slots - i else 0
(** [hashmap::HashMap::insert_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_insert_in_list_loop_decreases (t : Type0) (key : usize) (value : t)
- (ls : hashmap_list_t t) : hashmap_list_t t =
+let hashmap_HashMap_insert_in_list_loop_decreases (t : Type0) (key : usize) (value : t)
+ (ls : hashmap_List_t t) : hashmap_List_t t =
ls
(** [hashmap::HashMap::move_elements_from_list]: decreases clause *)
unfold
-let hashmap_hash_map_move_elements_from_list_loop_decreases (t : Type0)
- (ntable : hashmap_hash_map_t t) (ls : hashmap_list_t t) : hashmap_list_t t =
+let hashmap_HashMap_move_elements_from_list_loop_decreases (t : Type0)
+ (ntable : hashmap_HashMap_t t) (ls : hashmap_List_t t) : hashmap_List_t t =
ls
(** [hashmap::HashMap::move_elements]: decreases clause *)
unfold
-let hashmap_hash_map_move_elements_loop_decreases (t : Type0) (ntable : hashmap_hash_map_t t)
- (slots : vec (hashmap_list_t t)) (i : usize) : nat =
+let hashmap_HashMap_move_elements_loop_decreases (t : Type0) (ntable : hashmap_HashMap_t t)
+ (slots : alloc_vec_Vec (hashmap_List_t t)) (i : usize) : nat =
if i < length slots then length slots - i else 0
(** [hashmap::HashMap::contains_key_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_contains_key_in_list_loop_decreases (t : Type0) (key : usize)
- (ls : hashmap_list_t t) : hashmap_list_t t =
+let hashmap_HashMap_contains_key_in_list_loop_decreases (t : Type0) (key : usize)
+ (ls : hashmap_List_t t) : hashmap_List_t t =
ls
(** [hashmap::HashMap::get_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_get_in_list_loop_decreases (t : Type0) (key : usize) (ls : hashmap_list_t t) :
- hashmap_list_t t =
+let hashmap_HashMap_get_in_list_loop_decreases (t : Type0) (key : usize) (ls : hashmap_List_t t) :
+ hashmap_List_t t =
ls
(** [hashmap::HashMap::get_mut_in_list]: decreases clause *)
unfold
-let hashmap_hash_map_get_mut_in_list_loop_decreases (t : Type0)
- (ls : hashmap_list_t t) (key : usize) : hashmap_list_t t =
+let hashmap_HashMap_get_mut_in_list_loop_decreases (t : Type0)
+ (ls : hashmap_List_t t) (key : usize) : hashmap_List_t t =
ls
(** [hashmap::HashMap::remove_from_list]: decreases clause *)
unfold
-let hashmap_hash_map_remove_from_list_loop_decreases (t : Type0) (key : usize)
- (ls : hashmap_list_t t) : hashmap_list_t t =
+let hashmap_HashMap_remove_from_list_loop_decreases (t : Type0) (key : usize)
+ (ls : hashmap_List_t t) : hashmap_List_t t =
ls
diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst
index 5af90bd8..5f227596 100644
--- a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst
+++ b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst
@@ -9,525 +9,528 @@ include HashmapMain.Clauses
#set-options "--z3rlimit 50 --fuel 1 --ifuel 1"
(** [hashmap_main::hashmap::hash_key]: forward function *)
-let hashmap_hash_key_fwd (k : usize) : result usize =
+let hashmap_hash_key (k : usize) : result usize =
Return k
(** [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)))
- (decreases (hashmap_hash_map_allocate_slots_loop_decreases t slots n))
+let rec hashmap_HashMap_allocate_slots_loop
+ (t : Type0) (slots : alloc_vec_Vec (hashmap_List_t t)) (n : usize) :
+ Tot (result (alloc_vec_Vec (hashmap_List_t t)))
+ (decreases (hashmap_HashMap_allocate_slots_loop_decreases t slots n))
=
if n > 0
then
- let* slots0 = vec_push_back (hashmap_list_t t) slots HashmapListNil in
+ let* slots0 = alloc_vec_Vec_push (hashmap_List_t t) slots Hashmap_List_Nil
+ in
let* n0 = usize_sub n 1 in
- hashmap_hash_map_allocate_slots_loop_fwd t slots0 n0
+ hashmap_HashMap_allocate_slots_loop t slots0 n0
else Return 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))
+let hashmap_HashMap_allocate_slots
+ (t : Type0) (slots : alloc_vec_Vec (hashmap_List_t t)) (n : usize) :
+ result (alloc_vec_Vec (hashmap_List_t t))
=
- hashmap_hash_map_allocate_slots_loop_fwd t slots n
+ hashmap_HashMap_allocate_slots_loop t slots n
(** [hashmap_main::hashmap::HashMap::{0}::new_with_capacity]: forward function *)
-let hashmap_hash_map_new_with_capacity_fwd
+let hashmap_HashMap_new_with_capacity
(t : Type0) (capacity : usize) (max_load_dividend : usize)
(max_load_divisor : usize) :
- result (hashmap_hash_map_t t)
+ result (hashmap_HashMap_t t)
=
- let v = vec_new (hashmap_list_t t) in
- let* slots = hashmap_hash_map_allocate_slots_fwd t v capacity in
+ let v = alloc_vec_Vec_new (hashmap_List_t t) in
+ let* slots = hashmap_HashMap_allocate_slots t v capacity in
let* i = usize_mul capacity max_load_dividend in
let* i0 = usize_div i max_load_divisor in
Return
{
- hashmap_hash_map_num_entries = 0;
- hashmap_hash_map_max_load_factor = (max_load_dividend, max_load_divisor);
- hashmap_hash_map_max_load = i0;
- hashmap_hash_map_slots = slots
+ num_entries = 0;
+ max_load_factor = (max_load_dividend, max_load_divisor);
+ max_load = i0;
+ slots = slots
}
(** [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
+let hashmap_HashMap_new (t : Type0) : result (hashmap_HashMap_t t) =
+ hashmap_HashMap_new_with_capacity t 32 4 5
(** [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)))
- (decreases (hashmap_hash_map_clear_loop_decreases t slots i))
+let rec hashmap_HashMap_clear_loop
+ (t : Type0) (slots : alloc_vec_Vec (hashmap_List_t t)) (i : usize) :
+ Tot (result (alloc_vec_Vec (hashmap_List_t t)))
+ (decreases (hashmap_HashMap_clear_loop_decreases t slots i))
=
- let i0 = vec_len (hashmap_list_t t) slots in
+ let i0 = alloc_vec_Vec_len (hashmap_List_t t) slots in
if i < i0
then
let* i1 = usize_add i 1 in
- let* slots0 = vec_index_mut_back (hashmap_list_t t) slots i HashmapListNil
- in
- hashmap_hash_map_clear_loop_fwd_back t slots0 i1
+ let* slots0 =
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) slots i Hashmap_List_Nil in
+ hashmap_HashMap_clear_loop t slots0 i1
else Return slots
(** [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
- in
- Return
- { self with hashmap_hash_map_num_entries = 0; hashmap_hash_map_slots = v }
+let hashmap_HashMap_clear
+ (t : Type0) (self : hashmap_HashMap_t t) : result (hashmap_HashMap_t t) =
+ let* v = hashmap_HashMap_clear_loop t self.slots 0 in
+ Return { self with num_entries = 0; slots = v }
(** [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
+let hashmap_HashMap_len
+ (t : Type0) (self : hashmap_HashMap_t t) : result usize =
+ Return self.num_entries
(** [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) :
+let rec hashmap_HashMap_insert_in_list_loop
+ (t : Type0) (key : usize) (value : t) (ls : hashmap_List_t t) :
Tot (result bool)
- (decreases (hashmap_hash_map_insert_in_list_loop_decreases t key value ls))
+ (decreases (hashmap_HashMap_insert_in_list_loop_decreases t key value ls))
=
begin match ls with
- | HashmapListCons ckey cvalue tl ->
+ | Hashmap_List_Cons ckey cvalue tl ->
if ckey = key
then Return false
- else hashmap_hash_map_insert_in_list_loop_fwd t key value tl
- | HashmapListNil -> Return true
+ else hashmap_HashMap_insert_in_list_loop t key value tl
+ | Hashmap_List_Nil -> Return true
end
(** [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
+let hashmap_HashMap_insert_in_list
+ (t : Type0) (key : usize) (value : t) (ls : hashmap_List_t t) : result bool =
+ hashmap_HashMap_insert_in_list_loop t key value ls
(** [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))
- (decreases (hashmap_hash_map_insert_in_list_loop_decreases t key value ls))
+let rec hashmap_HashMap_insert_in_list_loop_back
+ (t : Type0) (key : usize) (value : t) (ls : hashmap_List_t t) :
+ Tot (result (hashmap_List_t t))
+ (decreases (hashmap_HashMap_insert_in_list_loop_decreases t key value ls))
=
begin match ls with
- | HashmapListCons ckey cvalue tl ->
+ | Hashmap_List_Cons ckey cvalue tl ->
if ckey = key
- then Return (HashmapListCons ckey value tl)
+ then Return (Hashmap_List_Cons ckey value tl)
else
- let* tl0 = hashmap_hash_map_insert_in_list_loop_back t key value tl in
- Return (HashmapListCons ckey cvalue tl0)
- | HashmapListNil ->
- let l = HashmapListNil in Return (HashmapListCons key value l)
+ let* tl0 = hashmap_HashMap_insert_in_list_loop_back t key value tl in
+ Return (Hashmap_List_Cons ckey cvalue tl0)
+ | Hashmap_List_Nil ->
+ let l = Hashmap_List_Nil in Return (Hashmap_List_Cons key value l)
end
(** [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)
+let hashmap_HashMap_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_HashMap_insert_in_list_loop_back t key value ls
(** [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)
+let hashmap_HashMap_insert_no_resize
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) (value : t) :
+ result (hashmap_HashMap_t t)
=
- let* hash = hashmap_hash_key_fwd key in
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- vec_index_mut_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod
- in
- let* inserted = hashmap_hash_map_insert_in_list_fwd t key value l in
+ alloc_vec_Vec_index_mut (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ let* inserted = hashmap_HashMap_insert_in_list t key value l in
if inserted
then
- let* i0 = usize_add self.hashmap_hash_map_num_entries 1 in
- let* l0 = hashmap_hash_map_insert_in_list_back t key value l in
+ let* i0 = usize_add self.num_entries 1 in
+ let* l0 = hashmap_HashMap_insert_in_list_back t key value l in
let* v =
- vec_index_mut_back (hashmap_list_t t) self.hashmap_hash_map_slots
- hash_mod l0 in
- Return
- { self with hashmap_hash_map_num_entries = i0; hashmap_hash_map_slots = v
- }
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) self.slots hash_mod l0 in
+ Return { self with num_entries = i0; slots = v }
else
- let* l0 = hashmap_hash_map_insert_in_list_back t key value l in
+ let* l0 = hashmap_HashMap_insert_in_list_back t key value l in
let* v =
- vec_index_mut_back (hashmap_list_t t) self.hashmap_hash_map_slots
- hash_mod l0 in
- Return { self with hashmap_hash_map_slots = v }
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) self.slots hash_mod l0 in
+ Return { self with slots = v }
(** [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))
+let rec hashmap_HashMap_move_elements_from_list_loop
+ (t : Type0) (ntable : hashmap_HashMap_t t) (ls : hashmap_List_t t) :
+ Tot (result (hashmap_HashMap_t t))
(decreases (
- hashmap_hash_map_move_elements_from_list_loop_decreases t ntable ls))
+ hashmap_HashMap_move_elements_from_list_loop_decreases t ntable ls))
=
begin match ls with
- | HashmapListCons k v tl ->
- let* ntable0 = hashmap_hash_map_insert_no_resize_fwd_back t ntable k v in
- hashmap_hash_map_move_elements_from_list_loop_fwd_back t ntable0 tl
- | HashmapListNil -> Return ntable
+ | Hashmap_List_Cons k v tl ->
+ let* ntable0 = hashmap_HashMap_insert_no_resize t ntable k v in
+ hashmap_HashMap_move_elements_from_list_loop t ntable0 tl
+ | Hashmap_List_Nil -> Return ntable
end
(** [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)
+let hashmap_HashMap_move_elements_from_list
+ (t : Type0) (ntable : hashmap_HashMap_t t) (ls : hashmap_List_t t) :
+ result (hashmap_HashMap_t t)
=
- hashmap_hash_map_move_elements_from_list_loop_fwd_back t ntable ls
+ hashmap_HashMap_move_elements_from_list_loop t ntable ls
(** [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) :
- Tot (result ((hashmap_hash_map_t t) & (vec (hashmap_list_t t))))
- (decreases (hashmap_hash_map_move_elements_loop_decreases t ntable slots i))
+let rec hashmap_HashMap_move_elements_loop
+ (t : Type0) (ntable : hashmap_HashMap_t t)
+ (slots : alloc_vec_Vec (hashmap_List_t t)) (i : usize) :
+ Tot (result ((hashmap_HashMap_t t) & (alloc_vec_Vec (hashmap_List_t t))))
+ (decreases (hashmap_HashMap_move_elements_loop_decreases t ntable slots i))
=
- let i0 = vec_len (hashmap_list_t t) slots in
+ let i0 = alloc_vec_Vec_len (hashmap_List_t t) slots in
if i < i0
then
- let* l = vec_index_mut_fwd (hashmap_list_t t) slots i in
- let ls = mem_replace_fwd (hashmap_list_t t) l HashmapListNil in
- let* ntable0 =
- hashmap_hash_map_move_elements_from_list_fwd_back t ntable ls in
+ let* l =
+ alloc_vec_Vec_index_mut (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) slots i in
+ let ls = core_mem_replace (hashmap_List_t t) l Hashmap_List_Nil in
+ let* ntable0 = hashmap_HashMap_move_elements_from_list t ntable ls in
let* i1 = usize_add i 1 in
- let l0 = mem_replace_back (hashmap_list_t t) l HashmapListNil in
- let* slots0 = vec_index_mut_back (hashmap_list_t t) slots i l0 in
- hashmap_hash_map_move_elements_loop_fwd_back t ntable0 slots0 i1
+ let l0 = core_mem_replace_back (hashmap_List_t t) l Hashmap_List_Nil in
+ let* slots0 =
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) slots i l0 in
+ hashmap_HashMap_move_elements_loop t ntable0 slots0 i1
else Return (ntable, slots)
(** [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) :
- result ((hashmap_hash_map_t t) & (vec (hashmap_list_t t)))
+let hashmap_HashMap_move_elements
+ (t : Type0) (ntable : hashmap_HashMap_t t)
+ (slots : alloc_vec_Vec (hashmap_List_t t)) (i : usize) :
+ result ((hashmap_HashMap_t t) & (alloc_vec_Vec (hashmap_List_t t)))
=
- hashmap_hash_map_move_elements_loop_fwd_back t ntable slots i
+ hashmap_HashMap_move_elements_loop t ntable slots i
(** [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 hashmap_HashMap_try_resize
+ (t : Type0) (self : hashmap_HashMap_t t) : result (hashmap_HashMap_t t) =
let* max_usize = scalar_cast U32 Usize core_u32_max in
- let capacity = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+ let capacity = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* n1 = usize_div max_usize 2 in
- let (i, i0) = self.hashmap_hash_map_max_load_factor in
+ let (i, i0) = self.max_load_factor in
let* i1 = usize_div n1 i in
if capacity <= i1
then
let* i2 = usize_mul capacity 2 in
- let* ntable = hashmap_hash_map_new_with_capacity_fwd t i2 i i0 in
- let* (ntable0, _) =
- hashmap_hash_map_move_elements_fwd_back t ntable
- self.hashmap_hash_map_slots 0 in
+ let* ntable = hashmap_HashMap_new_with_capacity t i2 i i0 in
+ let* (ntable0, _) = hashmap_HashMap_move_elements t ntable self.slots 0 in
Return
- {
- ntable0
- with
- hashmap_hash_map_num_entries = self.hashmap_hash_map_num_entries;
- hashmap_hash_map_max_load_factor = (i, i0)
+ { ntable0 with num_entries = self.num_entries; max_load_factor = (i, i0)
}
- else Return { self with hashmap_hash_map_max_load_factor = (i, i0) }
+ else Return { self with max_load_factor = (i, i0) }
(** [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)
+let hashmap_HashMap_insert
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) (value : t) :
+ result (hashmap_HashMap_t t)
=
- let* self0 = hashmap_hash_map_insert_no_resize_fwd_back t self key value in
- let* i = hashmap_hash_map_len_fwd t self0 in
- if i > self0.hashmap_hash_map_max_load
- then hashmap_hash_map_try_resize_fwd_back t self0
+ let* self0 = hashmap_HashMap_insert_no_resize t self key value in
+ let* i = hashmap_HashMap_len t self0 in
+ if i > self0.max_load
+ then hashmap_HashMap_try_resize t self0
else Return self0
(** [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) :
+let rec hashmap_HashMap_contains_key_in_list_loop
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) :
Tot (result bool)
- (decreases (hashmap_hash_map_contains_key_in_list_loop_decreases t key ls))
+ (decreases (hashmap_HashMap_contains_key_in_list_loop_decreases t key ls))
=
begin match ls with
- | HashmapListCons ckey x tl ->
+ | Hashmap_List_Cons ckey x tl ->
if ckey = key
then Return true
- else hashmap_hash_map_contains_key_in_list_loop_fwd t key tl
- | HashmapListNil -> Return false
+ else hashmap_HashMap_contains_key_in_list_loop t key tl
+ | Hashmap_List_Nil -> Return false
end
(** [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
+let hashmap_HashMap_contains_key_in_list
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) : result bool =
+ hashmap_HashMap_contains_key_in_list_loop t key ls
(** [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
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+let hashmap_HashMap_contains_key
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) : result bool =
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- 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
+ alloc_vec_Vec_index (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ hashmap_HashMap_contains_key_in_list t key l
(** [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) :
+let rec hashmap_HashMap_get_in_list_loop
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) :
Tot (result t)
- (decreases (hashmap_hash_map_get_in_list_loop_decreases t key ls))
+ (decreases (hashmap_HashMap_get_in_list_loop_decreases t key ls))
=
begin match ls with
- | HashmapListCons ckey cvalue tl ->
+ | Hashmap_List_Cons ckey cvalue tl ->
if ckey = key
then Return cvalue
- else hashmap_hash_map_get_in_list_loop_fwd t key tl
- | HashmapListNil -> Fail Failure
+ else hashmap_HashMap_get_in_list_loop t key tl
+ | Hashmap_List_Nil -> Fail Failure
end
(** [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
+let hashmap_HashMap_get_in_list
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) : result t =
+ hashmap_HashMap_get_in_list_loop t key ls
(** [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
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+let hashmap_HashMap_get
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) : result t =
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- 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
+ alloc_vec_Vec_index (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ hashmap_HashMap_get_in_list t key l
(** [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) :
+let rec hashmap_HashMap_get_mut_in_list_loop
+ (t : Type0) (ls : hashmap_List_t t) (key : usize) :
Tot (result t)
- (decreases (hashmap_hash_map_get_mut_in_list_loop_decreases t ls key))
+ (decreases (hashmap_HashMap_get_mut_in_list_loop_decreases t ls key))
=
begin match ls with
- | HashmapListCons ckey cvalue tl ->
+ | Hashmap_List_Cons ckey cvalue tl ->
if ckey = key
then Return cvalue
- else hashmap_hash_map_get_mut_in_list_loop_fwd t tl key
- | HashmapListNil -> Fail Failure
+ else hashmap_HashMap_get_mut_in_list_loop t tl key
+ | Hashmap_List_Nil -> Fail Failure
end
(** [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
+let hashmap_HashMap_get_mut_in_list
+ (t : Type0) (ls : hashmap_List_t t) (key : usize) : result t =
+ hashmap_HashMap_get_mut_in_list_loop t ls key
(** [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))
- (decreases (hashmap_hash_map_get_mut_in_list_loop_decreases t ls key))
+let rec hashmap_HashMap_get_mut_in_list_loop_back
+ (t : Type0) (ls : hashmap_List_t t) (key : usize) (ret : t) :
+ Tot (result (hashmap_List_t t))
+ (decreases (hashmap_HashMap_get_mut_in_list_loop_decreases t ls key))
=
begin match ls with
- | HashmapListCons ckey cvalue tl ->
+ | Hashmap_List_Cons ckey cvalue tl ->
if ckey = key
- then Return (HashmapListCons ckey ret tl)
+ then Return (Hashmap_List_Cons ckey ret tl)
else
- let* tl0 = hashmap_hash_map_get_mut_in_list_loop_back t tl key ret in
- Return (HashmapListCons ckey cvalue tl0)
- | HashmapListNil -> Fail Failure
+ let* tl0 = hashmap_HashMap_get_mut_in_list_loop_back t tl key ret in
+ Return (Hashmap_List_Cons ckey cvalue tl0)
+ | Hashmap_List_Nil -> Fail Failure
end
(** [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)
+let hashmap_HashMap_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_HashMap_get_mut_in_list_loop_back t ls key ret
(** [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
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+let hashmap_HashMap_get_mut
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) : result t =
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- vec_index_mut_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod
- in
- hashmap_hash_map_get_mut_in_list_fwd t l key
+ alloc_vec_Vec_index_mut (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ hashmap_HashMap_get_mut_in_list t l key
(** [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)
+let hashmap_HashMap_get_mut_back
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) (ret : t) :
+ result (hashmap_HashMap_t t)
=
- let* hash = hashmap_hash_key_fwd key in
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- vec_index_mut_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod
- in
- let* l0 = hashmap_hash_map_get_mut_in_list_back t l key ret in
+ alloc_vec_Vec_index_mut (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ let* l0 = hashmap_HashMap_get_mut_in_list_back t l key ret in
let* v =
- vec_index_mut_back (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod
- l0 in
- Return { self with hashmap_hash_map_slots = v }
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod l0 in
+ Return { self with slots = v }
(** [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) :
+let rec hashmap_HashMap_remove_from_list_loop
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) :
Tot (result (option t))
- (decreases (hashmap_hash_map_remove_from_list_loop_decreases t key ls))
+ (decreases (hashmap_HashMap_remove_from_list_loop_decreases t key ls))
=
begin match ls with
- | HashmapListCons ckey x tl ->
+ | Hashmap_List_Cons ckey x tl ->
if ckey = key
then
let mv_ls =
- mem_replace_fwd (hashmap_list_t t) (HashmapListCons ckey x tl)
- HashmapListNil in
+ core_mem_replace (hashmap_List_t t) (Hashmap_List_Cons ckey x tl)
+ Hashmap_List_Nil in
begin match mv_ls with
- | HashmapListCons i cvalue tl0 -> Return (Some cvalue)
- | HashmapListNil -> Fail Failure
+ | Hashmap_List_Cons i cvalue tl0 -> Return (Some cvalue)
+ | Hashmap_List_Nil -> Fail Failure
end
- else hashmap_hash_map_remove_from_list_loop_fwd t key tl
- | HashmapListNil -> Return None
+ else hashmap_HashMap_remove_from_list_loop t key tl
+ | Hashmap_List_Nil -> Return None
end
(** [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
+let hashmap_HashMap_remove_from_list
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) : result (option t) =
+ hashmap_HashMap_remove_from_list_loop t key ls
(** [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))
- (decreases (hashmap_hash_map_remove_from_list_loop_decreases t key ls))
+let rec hashmap_HashMap_remove_from_list_loop_back
+ (t : Type0) (key : usize) (ls : hashmap_List_t t) :
+ Tot (result (hashmap_List_t t))
+ (decreases (hashmap_HashMap_remove_from_list_loop_decreases t key ls))
=
begin match ls with
- | HashmapListCons ckey x tl ->
+ | Hashmap_List_Cons ckey x tl ->
if ckey = key
then
let mv_ls =
- mem_replace_fwd (hashmap_list_t t) (HashmapListCons ckey x tl)
- HashmapListNil in
+ core_mem_replace (hashmap_List_t t) (Hashmap_List_Cons ckey x tl)
+ Hashmap_List_Nil in
begin match mv_ls with
- | HashmapListCons i cvalue tl0 -> Return tl0
- | HashmapListNil -> Fail Failure
+ | Hashmap_List_Cons i cvalue tl0 -> Return tl0
+ | Hashmap_List_Nil -> Fail Failure
end
else
- let* tl0 = hashmap_hash_map_remove_from_list_loop_back t key tl in
- Return (HashmapListCons ckey x tl0)
- | HashmapListNil -> Return HashmapListNil
+ let* tl0 = hashmap_HashMap_remove_from_list_loop_back t key tl in
+ Return (Hashmap_List_Cons ckey x tl0)
+ | Hashmap_List_Nil -> Return Hashmap_List_Nil
end
(** [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)
+let hashmap_HashMap_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_HashMap_remove_from_list_loop_back t key ls
(** [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
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+let hashmap_HashMap_remove
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) : result (option t) =
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- vec_index_mut_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod
- in
- let* x = hashmap_hash_map_remove_from_list_fwd t key l in
+ alloc_vec_Vec_index_mut (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ let* x = hashmap_HashMap_remove_from_list t key l in
begin match x with
| None -> Return None
- | Some x0 ->
- let* _ = usize_sub self.hashmap_hash_map_num_entries 1 in Return (Some x0)
+ | Some x0 -> let* _ = usize_sub self.num_entries 1 in Return (Some x0)
end
(** [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)
+let hashmap_HashMap_remove_back
+ (t : Type0) (self : hashmap_HashMap_t t) (key : usize) :
+ result (hashmap_HashMap_t t)
=
- let* hash = hashmap_hash_key_fwd key in
- let i = vec_len (hashmap_list_t t) self.hashmap_hash_map_slots in
+ let* hash = hashmap_hash_key key in
+ let i = alloc_vec_Vec_len (hashmap_List_t t) self.slots in
let* hash_mod = usize_rem hash i in
let* l =
- vec_index_mut_fwd (hashmap_list_t t) self.hashmap_hash_map_slots hash_mod
- in
- let* x = hashmap_hash_map_remove_from_list_fwd t key l in
+ alloc_vec_Vec_index_mut (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t t))
+ self.slots hash_mod in
+ let* x = hashmap_HashMap_remove_from_list t key l in
begin match x with
| None ->
- let* l0 = hashmap_hash_map_remove_from_list_back t key l in
+ let* l0 = hashmap_HashMap_remove_from_list_back t key l in
let* v =
- vec_index_mut_back (hashmap_list_t t) self.hashmap_hash_map_slots
- hash_mod l0 in
- Return { self with hashmap_hash_map_slots = v }
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) self.slots hash_mod l0 in
+ Return { self with slots = v }
| Some x0 ->
- let* i0 = usize_sub self.hashmap_hash_map_num_entries 1 in
- let* l0 = hashmap_hash_map_remove_from_list_back t key l in
+ let* i0 = usize_sub self.num_entries 1 in
+ let* l0 = hashmap_HashMap_remove_from_list_back t key l in
let* v =
- vec_index_mut_back (hashmap_list_t t) self.hashmap_hash_map_slots
- hash_mod l0 in
- Return
- { self with hashmap_hash_map_num_entries = i0; hashmap_hash_map_slots = v
- }
+ alloc_vec_Vec_index_mut_back (hashmap_List_t t) usize
+ (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t
+ t)) self.slots hash_mod l0 in
+ Return { self with num_entries = i0; slots = v }
end
(** [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
- let* hm1 = hashmap_hash_map_insert_fwd_back u64 hm0 128 18 in
- let* hm2 = hashmap_hash_map_insert_fwd_back u64 hm1 1024 138 in
- let* hm3 = hashmap_hash_map_insert_fwd_back u64 hm2 1056 256 in
- let* i = hashmap_hash_map_get_fwd u64 hm3 128 in
+let hashmap_test1 : result unit =
+ let* hm = hashmap_HashMap_new u64 in
+ let* hm0 = hashmap_HashMap_insert u64 hm 0 42 in
+ let* hm1 = hashmap_HashMap_insert u64 hm0 128 18 in
+ let* hm2 = hashmap_HashMap_insert u64 hm1 1024 138 in
+ let* hm3 = hashmap_HashMap_insert u64 hm2 1056 256 in
+ let* i = hashmap_HashMap_get u64 hm3 128 in
if not (i = 18)
then Fail Failure
else
- let* hm4 = hashmap_hash_map_get_mut_back u64 hm3 1024 56 in
- let* i0 = hashmap_hash_map_get_fwd u64 hm4 1024 in
+ let* hm4 = hashmap_HashMap_get_mut_back u64 hm3 1024 56 in
+ let* i0 = hashmap_HashMap_get u64 hm4 1024 in
if not (i0 = 56)
then Fail Failure
else
- let* x = hashmap_hash_map_remove_fwd u64 hm4 1024 in
+ let* x = hashmap_HashMap_remove u64 hm4 1024 in
begin match x with
| None -> Fail Failure
| Some x0 ->
if not (x0 = 56)
then Fail Failure
else
- let* hm5 = hashmap_hash_map_remove_back u64 hm4 1024 in
- let* i1 = hashmap_hash_map_get_fwd u64 hm5 0 in
+ let* hm5 = hashmap_HashMap_remove_back u64 hm4 1024 in
+ let* i1 = hashmap_HashMap_get u64 hm5 0 in
if not (i1 = 42)
then Fail Failure
else
- let* i2 = hashmap_hash_map_get_fwd u64 hm5 128 in
+ let* i2 = hashmap_HashMap_get u64 hm5 128 in
if not (i2 = 18)
then Fail Failure
else
- let* i3 = hashmap_hash_map_get_fwd u64 hm5 1056 in
+ let* i3 = hashmap_HashMap_get u64 hm5 1056 in
if not (i3 = 256) then Fail Failure else Return ()
end
-(** Unit test for [hashmap_main::hashmap::test1] *)
-let _ = assert_norm (hashmap_test1_fwd = Return ())
-
(** [hashmap_main::insert_on_disk]: forward function *)
-let insert_on_disk_fwd
+let insert_on_disk
(key : usize) (value : u64) (st : state) : result (state & unit) =
- let* (st0, hm) = hashmap_utils_deserialize_fwd st in
- let* hm0 = hashmap_hash_map_insert_fwd_back u64 hm key value in
- let* (st1, _) = hashmap_utils_serialize_fwd hm0 st0 in
+ let* (st0, hm) = hashmap_utils_deserialize st in
+ let* hm0 = hashmap_HashMap_insert u64 hm key value in
+ let* (st1, _) = hashmap_utils_serialize hm0 st0 in
Return (st1, ())
(** [hashmap_main::main]: forward function *)
-let main_fwd : result unit =
+let main : result unit =
Return ()
-(** Unit test for [hashmap_main::main] *)
-let _ = assert_norm (main_fwd = Return ())
-
diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti b/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti
index 78a6c3ba..d6cecf36 100644
--- a/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti
+++ b/tests/fstar/hashmap_on_disk/HashmapMain.Opaque.fsti
@@ -7,10 +7,10 @@ include HashmapMain.Types
#set-options "--z3rlimit 50 --fuel 1 --ifuel 1"
(** [hashmap_main::hashmap_utils::deserialize]: forward function *)
-val hashmap_utils_deserialize_fwd
- : state -> result (state & (hashmap_hash_map_t u64))
+val hashmap_utils_deserialize
+ : state -> result (state & (hashmap_HashMap_t u64))
(** [hashmap_main::hashmap_utils::serialize]: forward function *)
-val hashmap_utils_serialize_fwd
- : hashmap_hash_map_t u64 -> state -> result (state & unit)
+val hashmap_utils_serialize
+ : hashmap_HashMap_t u64 -> state -> result (state & unit)
diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Types.fsti b/tests/fstar/hashmap_on_disk/HashmapMain.Types.fsti
index e289174b..24b78c2a 100644
--- a/tests/fstar/hashmap_on_disk/HashmapMain.Types.fsti
+++ b/tests/fstar/hashmap_on_disk/HashmapMain.Types.fsti
@@ -6,17 +6,17 @@ open Primitives
#set-options "--z3rlimit 50 --fuel 1 --ifuel 1"
(** [hashmap_main::hashmap::List] *)
-type hashmap_list_t (t : Type0) =
-| HashmapListCons : usize -> t -> hashmap_list_t t -> hashmap_list_t t
-| HashmapListNil : hashmap_list_t t
+type hashmap_List_t (t : Type0) =
+| Hashmap_List_Cons : usize -> t -> hashmap_List_t t -> hashmap_List_t t
+| Hashmap_List_Nil : hashmap_List_t t
(** [hashmap_main::hashmap::HashMap] *)
-type hashmap_hash_map_t (t : Type0) =
+type hashmap_HashMap_t (t : Type0) =
{
- hashmap_hash_map_num_entries : usize;
- hashmap_hash_map_max_load_factor : (usize & usize);
- hashmap_hash_map_max_load : usize;
- hashmap_hash_map_slots : vec (hashmap_list_t t);
+ num_entries : usize;
+ max_load_factor : (usize & usize);
+ max_load : usize;
+ slots : alloc_vec_Vec (hashmap_List_t t);
}
(** The state type used in the state-error monad *)