diff options
Diffstat (limited to 'tests/fstar')
-rw-r--r-- | tests/fstar/array/Array.Funs.fst | 18 | ||||
-rw-r--r-- | tests/fstar/betree/BetreeMain.Funs.fst | 33 | ||||
-rw-r--r-- | tests/fstar/betree_back_stateful/BetreeMain.Funs.fst | 33 | ||||
-rw-r--r-- | tests/fstar/hashmap/Hashmap.Funs.fst | 9 | ||||
-rw-r--r-- | tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst | 10 | ||||
-rw-r--r-- | tests/fstar/misc/External.Funs.fst | 4 | ||||
-rw-r--r-- | tests/fstar/misc/NoNestedBorrows.fst | 37 | ||||
-rw-r--r-- | tests/fstar/misc/Paper.fst | 11 | ||||
-rw-r--r-- | tests/fstar/misc/PoloniusList.fst | 6 | ||||
-rw-r--r-- | tests/fstar/traits/Traits.fst | 2 |
10 files changed, 58 insertions, 105 deletions
diff --git a/tests/fstar/array/Array.Funs.fst b/tests/fstar/array/Array.Funs.fst index da4164bc..4193ba7d 100644 --- a/tests/fstar/array/Array.Funs.fst +++ b/tests/fstar/array/Array.Funs.fst @@ -24,8 +24,7 @@ let array_to_mut_slice_ result ((slice t) & (slice t -> result (array t 32))) = let* (s1, to_slice_mut_back) = array_to_slice_mut t 32 s in - let back = fun ret -> to_slice_mut_back ret in - Return (s1, back) + Return (s1, to_slice_mut_back) (** [array::array_len]: Source: 'src/array.rs', lines 25:0-25:40 *) @@ -64,8 +63,7 @@ let index_mut_array result (t & (t -> result (array t 32))) = let* (x, index_mut_back) = array_index_mut_usize t 32 s i in - let back = fun ret -> index_mut_back ret in - Return (x, back) + Return (x, index_mut_back) (** [array::index_slice]: Source: 'src/array.rs', lines 56:0-56:46 *) @@ -79,8 +77,7 @@ let index_mut_slice result (t & (t -> result (slice t))) = let* (x, index_mut_back) = slice_index_mut_usize t s i in - let back = fun ret -> index_mut_back ret in - Return (x, back) + Return (x, index_mut_back) (** [array::slice_subslice_shared_]: Source: 'src/array.rs', lines 64:0-64:70 *) @@ -100,8 +97,7 @@ let slice_subslice_mut_ core_slice_index_Slice_index_mut u32 (core_ops_range_Range usize) (core_slice_index_SliceIndexRangeUsizeSliceTInst u32) x { start = y; end_ = z } in - let back = fun ret -> index_mut_back ret in - Return (s, back) + Return (s, index_mut_back) (** [array::array_to_slice_shared_]: Source: 'src/array.rs', lines 72:0-72:54 *) @@ -115,8 +111,7 @@ let array_to_slice_mut_ result ((slice u32) & (slice u32 -> result (array u32 32))) = let* (s, to_slice_mut_back) = array_to_slice_mut u32 32 x in - let back = fun ret -> to_slice_mut_back ret in - Return (s, back) + Return (s, to_slice_mut_back) (** [array::array_subslice_shared_]: Source: 'src/array.rs', lines 80:0-80:74 *) @@ -138,8 +133,7 @@ let array_subslice_mut_ (core_ops_index_IndexMutSliceTIInst u32 (core_ops_range_Range usize) (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) x { start = y; end_ = z } in - let back = fun ret -> index_mut_back ret in - Return (s, back) + Return (s, index_mut_back) (** [array::index_slice_0]: Source: 'src/array.rs', lines 88:0-88:38 *) diff --git a/tests/fstar/betree/BetreeMain.Funs.fst b/tests/fstar/betree/BetreeMain.Funs.fst index a3065f3d..196f120c 100644 --- a/tests/fstar/betree/BetreeMain.Funs.fst +++ b/tests/fstar/betree/BetreeMain.Funs.fst @@ -103,8 +103,7 @@ let rec betree_List_split_at let* i = u64_sub n 1 in let* p = betree_List_split_at t tl i in let (ls0, ls1) = p in - let l = ls0 in - Return (Betree_List_Cons hd l, ls1) + Return (Betree_List_Cons hd ls0, ls1) | Betree_List_Nil -> Fail Failure end @@ -113,8 +112,7 @@ let rec betree_List_split_at let betree_List_push_front (t : Type0) (self : betree_List_t t) (x : t) : result (betree_List_t t) = let (tl, _) = core_mem_replace (betree_List_t t) self Betree_List_Nil in - let l = tl in - Return (Betree_List_Cons x l) + Return (Betree_List_Cons x tl) (** [betree_main::betree::{betree_main::betree::List<T>#1}::pop_front]: Source: 'src/betree.rs', lines 306:4-306:32 *) @@ -158,8 +156,7 @@ let rec betree_ListTupleU64T_partition_at_pivot else let* p = betree_ListTupleU64T_partition_at_pivot t tl pivot in let (ls0, ls1) = p in - let l = ls0 in - Return (Betree_List_Cons (i, x) l, ls1) + Return (Betree_List_Cons (i, x) ls0, ls1) | Betree_List_Nil -> Return (Betree_List_Nil, Betree_List_Nil) end @@ -195,9 +192,7 @@ let rec betree_Node_lookup_first_message_for_key | Betree_List_Cons x next_msgs -> let (i, m) = x in if i >= key - then - let back_'a = fun ret -> Return ret in - Return (Betree_List_Cons (i, m) next_msgs, back_'a) + then Return (Betree_List_Cons (i, m) next_msgs, Return) else let* (l, lookup_first_message_for_key_back) = betree_Node_lookup_first_message_for_key key next_msgs in @@ -206,8 +201,7 @@ let rec betree_Node_lookup_first_message_for_key let* next_msgs1 = lookup_first_message_for_key_back ret in Return (Betree_List_Cons (i, m) next_msgs1) in Return (l, back_'a) - | Betree_List_Nil -> - let back_'a = fun ret -> Return ret in Return (Betree_List_Nil, back_'a) + | Betree_List_Nil -> Return (Betree_List_Nil, Return) end (** [betree_main::betree::{betree_main::betree::Node#5}::lookup_in_bindings]: @@ -362,11 +356,8 @@ let rec betree_Node_lookup_first_message_after_key let* next_msgs1 = lookup_first_message_after_key_back ret in Return (Betree_List_Cons (k, m) next_msgs1) in Return (l, back_'a) - else - let back_'a = fun ret -> Return ret in - Return (Betree_List_Cons (k, m) next_msgs, back_'a) - | Betree_List_Nil -> - let back_'a = fun ret -> Return ret in Return (Betree_List_Nil, back_'a) + else Return (Betree_List_Cons (k, m) next_msgs, Return) + | Betree_List_Nil -> Return (Betree_List_Nil, Return) end (** [betree_main::betree::{betree_main::betree::Node#5}::apply_to_internal]: @@ -455,9 +446,7 @@ let rec betree_Node_lookup_mut_in_bindings | Betree_List_Cons hd tl -> let (i, i1) = hd in if i >= key - then - let back_'a = fun ret -> Return ret in - Return (Betree_List_Cons (i, i1) tl, back_'a) + then Return (Betree_List_Cons (i, i1) tl, Return) else let* (l, lookup_mut_in_bindings_back) = betree_Node_lookup_mut_in_bindings key tl in @@ -466,8 +455,7 @@ let rec betree_Node_lookup_mut_in_bindings let* tl1 = lookup_mut_in_bindings_back ret in Return (Betree_List_Cons (i, i1) tl1) in Return (l, back_'a) - | Betree_List_Nil -> - let back_'a = fun ret -> Return ret in Return (Betree_List_Nil, back_'a) + | Betree_List_Nil -> Return (Betree_List_Nil, Return) end (** [betree_main::betree::{betree_main::betree::Node#5}::apply_to_leaf]: @@ -608,10 +596,9 @@ let betree_Node_apply (new_msg : betree_Message_t) (st : state) : result (state & (betree_Node_t & betree_NodeIdCounter_t)) = - let l = Betree_List_Nil in let* (st1, p) = betree_Node_apply_messages self params node_id_cnt (Betree_List_Cons (key, - new_msg) l) st in + new_msg) Betree_List_Nil) st in let (self1, node_id_cnt1) = p in Return (st1, (self1, node_id_cnt1)) diff --git a/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst b/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst index a3065f3d..196f120c 100644 --- a/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst +++ b/tests/fstar/betree_back_stateful/BetreeMain.Funs.fst @@ -103,8 +103,7 @@ let rec betree_List_split_at let* i = u64_sub n 1 in let* p = betree_List_split_at t tl i in let (ls0, ls1) = p in - let l = ls0 in - Return (Betree_List_Cons hd l, ls1) + Return (Betree_List_Cons hd ls0, ls1) | Betree_List_Nil -> Fail Failure end @@ -113,8 +112,7 @@ let rec betree_List_split_at let betree_List_push_front (t : Type0) (self : betree_List_t t) (x : t) : result (betree_List_t t) = let (tl, _) = core_mem_replace (betree_List_t t) self Betree_List_Nil in - let l = tl in - Return (Betree_List_Cons x l) + Return (Betree_List_Cons x tl) (** [betree_main::betree::{betree_main::betree::List<T>#1}::pop_front]: Source: 'src/betree.rs', lines 306:4-306:32 *) @@ -158,8 +156,7 @@ let rec betree_ListTupleU64T_partition_at_pivot else let* p = betree_ListTupleU64T_partition_at_pivot t tl pivot in let (ls0, ls1) = p in - let l = ls0 in - Return (Betree_List_Cons (i, x) l, ls1) + Return (Betree_List_Cons (i, x) ls0, ls1) | Betree_List_Nil -> Return (Betree_List_Nil, Betree_List_Nil) end @@ -195,9 +192,7 @@ let rec betree_Node_lookup_first_message_for_key | Betree_List_Cons x next_msgs -> let (i, m) = x in if i >= key - then - let back_'a = fun ret -> Return ret in - Return (Betree_List_Cons (i, m) next_msgs, back_'a) + then Return (Betree_List_Cons (i, m) next_msgs, Return) else let* (l, lookup_first_message_for_key_back) = betree_Node_lookup_first_message_for_key key next_msgs in @@ -206,8 +201,7 @@ let rec betree_Node_lookup_first_message_for_key let* next_msgs1 = lookup_first_message_for_key_back ret in Return (Betree_List_Cons (i, m) next_msgs1) in Return (l, back_'a) - | Betree_List_Nil -> - let back_'a = fun ret -> Return ret in Return (Betree_List_Nil, back_'a) + | Betree_List_Nil -> Return (Betree_List_Nil, Return) end (** [betree_main::betree::{betree_main::betree::Node#5}::lookup_in_bindings]: @@ -362,11 +356,8 @@ let rec betree_Node_lookup_first_message_after_key let* next_msgs1 = lookup_first_message_after_key_back ret in Return (Betree_List_Cons (k, m) next_msgs1) in Return (l, back_'a) - else - let back_'a = fun ret -> Return ret in - Return (Betree_List_Cons (k, m) next_msgs, back_'a) - | Betree_List_Nil -> - let back_'a = fun ret -> Return ret in Return (Betree_List_Nil, back_'a) + else Return (Betree_List_Cons (k, m) next_msgs, Return) + | Betree_List_Nil -> Return (Betree_List_Nil, Return) end (** [betree_main::betree::{betree_main::betree::Node#5}::apply_to_internal]: @@ -455,9 +446,7 @@ let rec betree_Node_lookup_mut_in_bindings | Betree_List_Cons hd tl -> let (i, i1) = hd in if i >= key - then - let back_'a = fun ret -> Return ret in - Return (Betree_List_Cons (i, i1) tl, back_'a) + then Return (Betree_List_Cons (i, i1) tl, Return) else let* (l, lookup_mut_in_bindings_back) = betree_Node_lookup_mut_in_bindings key tl in @@ -466,8 +455,7 @@ let rec betree_Node_lookup_mut_in_bindings let* tl1 = lookup_mut_in_bindings_back ret in Return (Betree_List_Cons (i, i1) tl1) in Return (l, back_'a) - | Betree_List_Nil -> - let back_'a = fun ret -> Return ret in Return (Betree_List_Nil, back_'a) + | Betree_List_Nil -> Return (Betree_List_Nil, Return) end (** [betree_main::betree::{betree_main::betree::Node#5}::apply_to_leaf]: @@ -608,10 +596,9 @@ let betree_Node_apply (new_msg : betree_Message_t) (st : state) : result (state & (betree_Node_t & betree_NodeIdCounter_t)) = - let l = Betree_List_Nil in let* (st1, p) = betree_Node_apply_messages self params node_id_cnt (Betree_List_Cons (key, - new_msg) l) st in + new_msg) Betree_List_Nil) st in let (self1, node_id_cnt1) = p in Return (st1, (self1, node_id_cnt1)) diff --git a/tests/fstar/hashmap/Hashmap.Funs.fst b/tests/fstar/hashmap/Hashmap.Funs.fst index 9fc5d8a0..447f9b49 100644 --- a/tests/fstar/hashmap/Hashmap.Funs.fst +++ b/tests/fstar/hashmap/Hashmap.Funs.fst @@ -41,8 +41,8 @@ let hashMap_new_with_capacity (max_load_divisor : usize) : result (hashMap_t t) = - let v = alloc_vec_Vec_new (list_t t) in - let* slots = hashMap_allocate_slots t v capacity in + let* slots = hashMap_allocate_slots t (alloc_vec_Vec_new (list_t t)) capacity + in let* i = usize_mul capacity max_load_dividend in let* i1 = usize_div i max_load_divisor in Return @@ -101,7 +101,7 @@ let rec hashMap_insert_in_list_loop else let* (b, back) = hashMap_insert_in_list_loop t key value tl in Return (b, List_Cons ckey cvalue back) - | List_Nil -> let l = List_Nil in Return (true, List_Cons key value l) + | List_Nil -> Return (true, List_Cons key value List_Nil) end (** [hashmap::{hashmap::HashMap<T>}::insert_in_list]: @@ -309,8 +309,7 @@ let hashMap_get_mut_in_list result (t & (t -> result (list_t t))) = let* (x, back_'a) = hashMap_get_mut_in_list_loop t ls key in - let back_'a1 = fun ret -> back_'a ret in - Return (x, back_'a1) + Return (x, back_'a) (** [hashmap::{hashmap::HashMap<T>}::get_mut]: Source: 'src/hashmap.rs', lines 257:4-257:67 *) diff --git a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst index 3a042678..b16dcada 100644 --- a/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst +++ b/tests/fstar/hashmap_on_disk/HashmapMain.Funs.fst @@ -42,8 +42,9 @@ let hashmap_HashMap_new_with_capacity (max_load_divisor : usize) : result (hashmap_HashMap_t t) = - let v = alloc_vec_Vec_new (hashmap_List_t t) in - let* slots = hashmap_HashMap_allocate_slots t v capacity in + let* slots = + hashmap_HashMap_allocate_slots t (alloc_vec_Vec_new (hashmap_List_t t)) + capacity in let* i = usize_mul capacity max_load_dividend in let* i1 = usize_div i max_load_divisor in Return @@ -106,7 +107,7 @@ let rec hashmap_HashMap_insert_in_list_loop let* (b, back) = hashmap_HashMap_insert_in_list_loop t key value tl in Return (b, Hashmap_List_Cons ckey cvalue back) | Hashmap_List_Nil -> - let l = Hashmap_List_Nil in Return (true, Hashmap_List_Cons key value l) + Return (true, Hashmap_List_Cons key value Hashmap_List_Nil) end (** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::insert_in_list]: @@ -324,8 +325,7 @@ let hashmap_HashMap_get_mut_in_list result (t & (t -> result (hashmap_List_t t))) = let* (x, back_'a) = hashmap_HashMap_get_mut_in_list_loop t ls key in - let back_'a1 = fun ret -> back_'a ret in - Return (x, back_'a1) + Return (x, back_'a) (** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap<T>}::get_mut]: Source: 'src/hashmap.rs', lines 257:4-257:67 *) diff --git a/tests/fstar/misc/External.Funs.fst b/tests/fstar/misc/External.Funs.fst index bb1b9a64..6672b523 100644 --- a/tests/fstar/misc/External.Funs.fst +++ b/tests/fstar/misc/External.Funs.fst @@ -22,9 +22,7 @@ let test_new_non_zero_u32 (** [external::test_vec]: Source: 'src/external.rs', lines 17:0-17:17 *) let test_vec : result unit = - let v = alloc_vec_Vec_new u32 in - let* _ = alloc_vec_Vec_push u32 v 0 in - Return () + let* _ = alloc_vec_Vec_push u32 (alloc_vec_Vec_new u32) 0 in Return () (** Unit test for [external::test_vec] *) let _ = assert_norm (test_vec = Return ()) diff --git a/tests/fstar/misc/NoNestedBorrows.fst b/tests/fstar/misc/NoNestedBorrows.fst index 0fd0c1dc..ffcc32f3 100644 --- a/tests/fstar/misc/NoNestedBorrows.fst +++ b/tests/fstar/misc/NoNestedBorrows.fst @@ -220,10 +220,9 @@ let _ = assert_norm (test_list1 = Return ()) (** [no_nested_borrows::test_box1]: Source: 'src/no_nested_borrows.rs', lines 208:0-208:18 *) let test_box1 : result unit = - let b = 0 in - let* (_, deref_mut_back) = alloc_boxed_Box_deref_mut i32 b in - let* b1 = deref_mut_back 1 in - let* x = alloc_boxed_Box_deref i32 b1 in + let* (_, deref_mut_back) = alloc_boxed_Box_deref_mut i32 0 in + let* b = deref_mut_back 1 in + let* x = alloc_boxed_Box_deref i32 b in if not (x = 1) then Fail Failure else Return () (** Unit test for [no_nested_borrows::test_box1] *) @@ -263,8 +262,7 @@ let is_cons (t : Type0) (l : list_t t) : result bool = (** [no_nested_borrows::test_is_cons]: Source: 'src/no_nested_borrows.rs', lines 253:0-253:21 *) let test_is_cons : result unit = - let l = List_Nil in - let* b = is_cons i32 (List_Cons 0 l) in + let* b = is_cons i32 (List_Cons 0 List_Nil) in if not b then Fail Failure else Return () (** Unit test for [no_nested_borrows::test_is_cons] *) @@ -281,8 +279,7 @@ let split_list (t : Type0) (l : list_t t) : result (t & (list_t t)) = (** [no_nested_borrows::test_split_list]: Source: 'src/no_nested_borrows.rs', lines 267:0-267:24 *) let test_split_list : result unit = - let l = List_Nil in - let* p = split_list i32 (List_Cons 0 l) in + let* p = split_list i32 (List_Cons 0 List_Nil) in let (hd, _) = p in if not (hd = 0) then Fail Failure else Return () @@ -388,26 +385,25 @@ let list_rev (t : Type0) (l : list_t t) : result (list_t t) = (** [no_nested_borrows::test_list_functions]: Source: 'src/no_nested_borrows.rs', lines 398:0-398:28 *) let test_list_functions : result unit = - let l = List_Nil in - let l1 = List_Cons 2 l in - let l2 = List_Cons 1 l1 in - let* i = list_length i32 (List_Cons 0 l2) in + let l = List_Cons 2 List_Nil in + let l1 = List_Cons 1 l in + let* i = list_length i32 (List_Cons 0 l1) in if not (i = 3) then Fail Failure else - let* i1 = list_nth_shared i32 (List_Cons 0 l2) 0 in + let* i1 = list_nth_shared i32 (List_Cons 0 l1) 0 in if not (i1 = 0) then Fail Failure else - let* i2 = list_nth_shared i32 (List_Cons 0 l2) 1 in + let* i2 = list_nth_shared i32 (List_Cons 0 l1) 1 in if not (i2 = 1) then Fail Failure else - let* i3 = list_nth_shared i32 (List_Cons 0 l2) 2 in + let* i3 = list_nth_shared i32 (List_Cons 0 l1) 2 in if not (i3 = 2) then Fail Failure else - let* (_, list_nth_mut_back) = list_nth_mut i32 (List_Cons 0 l2) 1 in + let* (_, list_nth_mut_back) = list_nth_mut i32 (List_Cons 0 l1) 1 in let* ls = list_nth_mut_back 3 in let* i4 = list_nth_shared i32 ls 0 in if not (i4 = 0) @@ -448,9 +444,7 @@ let id_mut_pair3 (t1 t2 : Type0) (x : t1) (y : t2) : result ((t1 & t2) & (t1 -> result t1) & (t2 -> result t2)) = - let back_'a = fun ret -> Return ret in - let back_'b = fun ret -> Return ret in - Return ((x, y), back_'a, back_'b) + Return ((x, y), Return, Return) (** [no_nested_borrows::id_mut_pair4]: Source: 'src/no_nested_borrows.rs', lines 426:0-426:92 *) @@ -458,10 +452,7 @@ let id_mut_pair4 (t1 t2 : Type0) (p : (t1 & t2)) : result ((t1 & t2) & (t1 -> result t1) & (t2 -> result t2)) = - let (x, x1) = p in - let back_'a = fun ret -> Return ret in - let back_'b = fun ret -> Return ret in - Return ((x, x1), back_'a, back_'b) + let (x, x1) = p in Return ((x, x1), Return, Return) (** [no_nested_borrows::StructWithTuple] Source: 'src/no_nested_borrows.rs', lines 433:0-433:34 *) diff --git a/tests/fstar/misc/Paper.fst b/tests/fstar/misc/Paper.fst index c6082929..cf4dc454 100644 --- a/tests/fstar/misc/Paper.fst +++ b/tests/fstar/misc/Paper.fst @@ -80,13 +80,12 @@ let rec sum (l : list_t i32) : result i32 = (** [paper::test_nth]: Source: 'src/paper.rs', lines 68:0-68:17 *) let test_nth : result unit = - let l = List_Nil in - let l1 = List_Cons 3 l in - let l2 = List_Cons 2 l1 in - let* (x, list_nth_mut_back) = list_nth_mut i32 (List_Cons 1 l2) 2 in + let l = List_Cons 3 List_Nil in + let l1 = List_Cons 2 l in + let* (x, list_nth_mut_back) = list_nth_mut i32 (List_Cons 1 l1) 2 in let* x1 = i32_add x 1 in - let* l3 = list_nth_mut_back x1 in - let* i = sum l3 in + let* l2 = list_nth_mut_back x1 in + let* i = sum l2 in if not (i = 7) then Fail Failure else Return () (** Unit test for [paper::test_nth] *) diff --git a/tests/fstar/misc/PoloniusList.fst b/tests/fstar/misc/PoloniusList.fst index cbe7d6b8..b477802b 100644 --- a/tests/fstar/misc/PoloniusList.fst +++ b/tests/fstar/misc/PoloniusList.fst @@ -20,15 +20,13 @@ let rec get_list_at_x begin match ls with | List_Cons hd tl -> if hd = x - then - let back_'a = fun ret -> Return ret in Return (List_Cons hd tl, back_'a) + then Return (List_Cons hd tl, Return) else let* (l, get_list_at_x_back) = get_list_at_x tl x in let back_'a = fun ret -> let* tl1 = get_list_at_x_back ret in Return (List_Cons hd tl1) in Return (l, back_'a) - | List_Nil -> - let back_'a = fun ret -> Return ret in Return (List_Nil, back_'a) + | List_Nil -> Return (List_Nil, Return) end diff --git a/tests/fstar/traits/Traits.fst b/tests/fstar/traits/Traits.fst index 3543bd73..cb9c1654 100644 --- a/tests/fstar/traits/Traits.fst +++ b/tests/fstar/traits/Traits.fst @@ -273,7 +273,7 @@ let use_with_const_ty1 (h : Type0) (len : usize) (withConstTyHLENInst : withConstTy_t h len) : result usize = - let i = withConstTyHLENInst.cLEN1 in Return i + Return withConstTyHLENInst.cLEN1 (** [traits::use_with_const_ty2]: Source: 'src/traits.rs', lines 187:0-187:73 *) |