diff options
Diffstat (limited to '')
-rw-r--r-- | tests/fstar-split/misc/Loops.Clauses.Template.fst | 39 | ||||
-rw-r--r-- | tests/fstar-split/misc/Loops.Funs.fst | 129 | ||||
-rw-r--r-- | tests/fstar-split/misc/Loops.Types.fst | 2 | ||||
-rw-r--r-- | tests/fstar-split/traits/Traits.fst | 52 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Clauses.Template.fst | 39 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Clauses.fst | 5 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Funs.fst | 87 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Types.fst | 2 | ||||
-rw-r--r-- | tests/fstar/traits/Traits.fst | 52 |
9 files changed, 224 insertions, 183 deletions
diff --git a/tests/fstar-split/misc/Loops.Clauses.Template.fst b/tests/fstar-split/misc/Loops.Clauses.Template.fst index 6be351c6..244761d3 100644 --- a/tests/fstar-split/misc/Loops.Clauses.Template.fst +++ b/tests/fstar-split/misc/Loops.Clauses.Template.fst @@ -24,106 +24,113 @@ let sum_with_shared_borrows_loop_decreases (max : u32) (i : u32) (s : u32) : nat = admit () +(** [loops::sum_array]: decreases clause + Source: 'src/loops.rs', lines 50:0-58:1 *) +unfold +let sum_array_loop_decreases (n : usize) (a : array u32 n) (i : usize) + (s : u32) : nat = + admit () + (** [loops::clear]: decreases clause - Source: 'src/loops.rs', lines 52:0-58:1 *) + Source: 'src/loops.rs', lines 62:0-68:1 *) unfold let clear_loop_decreases (v : alloc_vec_Vec u32) (i : usize) : nat = admit () (** [loops::list_mem]: decreases clause - Source: 'src/loops.rs', lines 66:0-75:1 *) + Source: 'src/loops.rs', lines 76:0-85:1 *) unfold let list_mem_loop_decreases (x : u32) (ls : list_t u32) : nat = admit () (** [loops::list_nth_mut_loop]: decreases clause - Source: 'src/loops.rs', lines 78:0-88:1 *) + Source: 'src/loops.rs', lines 88:0-98:1 *) unfold let list_nth_mut_loop_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop]: decreases clause - Source: 'src/loops.rs', lines 91:0-101:1 *) + Source: 'src/loops.rs', lines 101:0-111:1 *) unfold let list_nth_shared_loop_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = admit () (** [loops::get_elem_mut]: decreases clause - Source: 'src/loops.rs', lines 103:0-117:1 *) + Source: 'src/loops.rs', lines 113:0-127:1 *) unfold let get_elem_mut_loop_decreases (x : usize) (ls : list_t usize) : nat = admit () (** [loops::get_elem_shared]: decreases clause - Source: 'src/loops.rs', lines 119:0-133:1 *) + Source: 'src/loops.rs', lines 129:0-143:1 *) unfold let get_elem_shared_loop_decreases (x : usize) (ls : list_t usize) : nat = admit () (** [loops::list_nth_mut_loop_with_id]: decreases clause - Source: 'src/loops.rs', lines 144:0-155:1 *) + Source: 'src/loops.rs', lines 154:0-165:1 *) unfold let list_nth_mut_loop_with_id_loop_decreases (t : Type0) (i : u32) (ls : list_t t) : nat = admit () (** [loops::list_nth_shared_loop_with_id]: decreases clause - Source: 'src/loops.rs', lines 158:0-169:1 *) + Source: 'src/loops.rs', lines 168:0-179:1 *) unfold let list_nth_shared_loop_with_id_loop_decreases (t : Type0) (i : u32) (ls : list_t t) : nat = admit () (** [loops::list_nth_mut_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 174:0-195:1 *) + Source: 'src/loops.rs', lines 184:0-205:1 *) unfold let list_nth_mut_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 198:0-219:1 *) + Source: 'src/loops.rs', lines 208:0-229:1 *) unfold let list_nth_shared_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 223:0-238:1 *) + Source: 'src/loops.rs', lines 233:0-248:1 *) unfold let list_nth_mut_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 241:0-256:1 *) + Source: 'src/loops.rs', lines 251:0-266:1 *) unfold let list_nth_shared_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_shared_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 259:0-274:1 *) + Source: 'src/loops.rs', lines 269:0-284:1 *) unfold let list_nth_mut_shared_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_shared_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 278:0-293:1 *) + Source: 'src/loops.rs', lines 288:0-303:1 *) unfold let list_nth_mut_shared_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_mut_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 297:0-312:1 *) + Source: 'src/loops.rs', lines 307:0-322:1 *) unfold let list_nth_shared_mut_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_mut_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 316:0-331:1 *) + Source: 'src/loops.rs', lines 326:0-341:1 *) unfold let list_nth_shared_mut_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = diff --git a/tests/fstar-split/misc/Loops.Funs.fst b/tests/fstar-split/misc/Loops.Funs.fst index 3168fddb..01d66726 100644 --- a/tests/fstar-split/misc/Loops.Funs.fst +++ b/tests/fstar-split/misc/Loops.Funs.fst @@ -58,9 +58,28 @@ let rec sum_with_shared_borrows_loop let sum_with_shared_borrows (max : u32) : result u32 = sum_with_shared_borrows_loop max 0 0 +(** [loops::sum_array]: loop 0: forward function + Source: 'src/loops.rs', lines 50:0-58:1 *) +let rec sum_array_loop + (n : usize) (a : array u32 n) (i : usize) (s : u32) : + Tot (result u32) (decreases (sum_array_loop_decreases n a i s)) + = + if i < n + then + let* i1 = array_index_usize u32 n a i in + let* s1 = u32_add s i1 in + let* i2 = usize_add i 1 in + sum_array_loop n a i2 s1 + else Return s + +(** [loops::sum_array]: forward function + Source: 'src/loops.rs', lines 50:0-50:52 *) +let sum_array (n : usize) (a : array u32 n) : result u32 = + sum_array_loop n a 0 0 + (** [loops::clear]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) - Source: 'src/loops.rs', lines 52:0-58:1 *) + Source: 'src/loops.rs', lines 62:0-68:1 *) let rec clear_loop (v : alloc_vec_Vec u32) (i : usize) : Tot (result (alloc_vec_Vec u32)) (decreases (clear_loop_decreases v i)) @@ -77,12 +96,12 @@ let rec clear_loop (** [loops::clear]: merged forward/backward function (there is a single backward function, and the forward function returns ()) - Source: 'src/loops.rs', lines 52:0-52:30 *) + Source: 'src/loops.rs', lines 62:0-62:30 *) let clear (v : alloc_vec_Vec u32) : result (alloc_vec_Vec u32) = clear_loop v 0 (** [loops::list_mem]: loop 0: forward function - Source: 'src/loops.rs', lines 66:0-75:1 *) + Source: 'src/loops.rs', lines 76:0-85:1 *) let rec list_mem_loop (x : u32) (ls : list_t u32) : Tot (result bool) (decreases (list_mem_loop_decreases x ls)) @@ -93,12 +112,12 @@ let rec list_mem_loop end (** [loops::list_mem]: forward function - Source: 'src/loops.rs', lines 66:0-66:52 *) + Source: 'src/loops.rs', lines 76:0-76:52 *) let list_mem (x : u32) (ls : list_t u32) : result bool = list_mem_loop x ls (** [loops::list_nth_mut_loop]: loop 0: forward function - Source: 'src/loops.rs', lines 78:0-88:1 *) + Source: 'src/loops.rs', lines 88:0-98:1 *) let rec list_nth_mut_loop_loop (t : Type0) (ls : list_t t) (i : u32) : Tot (result t) (decreases (list_nth_mut_loop_loop_decreases t ls i)) @@ -112,12 +131,12 @@ let rec list_nth_mut_loop_loop end (** [loops::list_nth_mut_loop]: forward function - Source: 'src/loops.rs', lines 78:0-78:71 *) + Source: 'src/loops.rs', lines 88:0-88:71 *) let list_nth_mut_loop (t : Type0) (ls : list_t t) (i : u32) : result t = list_nth_mut_loop_loop t ls i (** [loops::list_nth_mut_loop]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 78:0-88:1 *) + Source: 'src/loops.rs', lines 88:0-98:1 *) 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)) @@ -134,13 +153,13 @@ let rec list_nth_mut_loop_loop_back end (** [loops::list_nth_mut_loop]: backward function 0 - Source: 'src/loops.rs', lines 78:0-78:71 *) + Source: 'src/loops.rs', lines 88:0-88:71 *) 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]: loop 0: forward function - Source: 'src/loops.rs', lines 91:0-101:1 *) + Source: 'src/loops.rs', lines 101:0-111:1 *) let rec list_nth_shared_loop_loop (t : Type0) (ls : list_t t) (i : u32) : Tot (result t) (decreases (list_nth_shared_loop_loop_decreases t ls i)) @@ -154,12 +173,12 @@ let rec list_nth_shared_loop_loop end (** [loops::list_nth_shared_loop]: forward function - Source: 'src/loops.rs', lines 91:0-91:66 *) + Source: 'src/loops.rs', lines 101:0-101:66 *) let list_nth_shared_loop (t : Type0) (ls : list_t t) (i : u32) : result t = list_nth_shared_loop_loop t ls i (** [loops::get_elem_mut]: loop 0: forward function - Source: 'src/loops.rs', lines 103:0-117:1 *) + Source: 'src/loops.rs', lines 113:0-127:1 *) let rec get_elem_mut_loop (x : usize) (ls : list_t usize) : Tot (result usize) (decreases (get_elem_mut_loop_decreases x ls)) @@ -170,7 +189,7 @@ let rec get_elem_mut_loop end (** [loops::get_elem_mut]: forward function - Source: 'src/loops.rs', lines 103:0-103:73 *) + Source: 'src/loops.rs', lines 113:0-113:73 *) let get_elem_mut (slots : alloc_vec_Vec (list_t usize)) (x : usize) : result usize = let* l = @@ -179,7 +198,7 @@ let get_elem_mut get_elem_mut_loop x l (** [loops::get_elem_mut]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 103:0-117:1 *) + Source: 'src/loops.rs', lines 113:0-127:1 *) 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)) @@ -193,7 +212,7 @@ let rec get_elem_mut_loop_back end (** [loops::get_elem_mut]: backward function 0 - Source: 'src/loops.rs', lines 103:0-103:73 *) + Source: 'src/loops.rs', lines 113:0-113:73 *) let get_elem_mut_back (slots : alloc_vec_Vec (list_t usize)) (x : usize) (ret : usize) : result (alloc_vec_Vec (list_t usize)) @@ -206,7 +225,7 @@ let get_elem_mut_back (core_slice_index_SliceIndexUsizeSliceTInst (list_t usize)) slots 0 l1 (** [loops::get_elem_shared]: loop 0: forward function - Source: 'src/loops.rs', lines 119:0-133:1 *) + Source: 'src/loops.rs', lines 129:0-143:1 *) let rec get_elem_shared_loop (x : usize) (ls : list_t usize) : Tot (result usize) (decreases (get_elem_shared_loop_decreases x ls)) @@ -217,7 +236,7 @@ let rec get_elem_shared_loop end (** [loops::get_elem_shared]: forward function - Source: 'src/loops.rs', lines 119:0-119:68 *) + Source: 'src/loops.rs', lines 129:0-129:68 *) let get_elem_shared (slots : alloc_vec_Vec (list_t usize)) (x : usize) : result usize = let* l = @@ -226,23 +245,23 @@ let get_elem_shared get_elem_shared_loop x l (** [loops::id_mut]: forward function - Source: 'src/loops.rs', lines 135:0-135:50 *) + Source: 'src/loops.rs', lines 145:0-145:50 *) let id_mut (t : Type0) (ls : list_t t) : result (list_t t) = Return ls (** [loops::id_mut]: backward function 0 - Source: 'src/loops.rs', lines 135:0-135:50 *) + Source: 'src/loops.rs', lines 145:0-145:50 *) let id_mut_back (t : Type0) (ls : list_t t) (ret : list_t t) : result (list_t t) = Return ret (** [loops::id_shared]: forward function - Source: 'src/loops.rs', lines 139:0-139:45 *) + Source: 'src/loops.rs', lines 149:0-149:45 *) let id_shared (t : Type0) (ls : list_t t) : result (list_t t) = Return ls (** [loops::list_nth_mut_loop_with_id]: loop 0: forward function - Source: 'src/loops.rs', lines 144:0-155:1 *) + Source: 'src/loops.rs', lines 154:0-165:1 *) let rec list_nth_mut_loop_with_id_loop (t : Type0) (i : u32) (ls : list_t t) : Tot (result t) (decreases (list_nth_mut_loop_with_id_loop_decreases t i ls)) @@ -256,13 +275,13 @@ let rec list_nth_mut_loop_with_id_loop end (** [loops::list_nth_mut_loop_with_id]: forward function - Source: 'src/loops.rs', lines 144:0-144:75 *) + Source: 'src/loops.rs', lines 154:0-154:75 *) let list_nth_mut_loop_with_id (t : Type0) (ls : list_t t) (i : u32) : result t = let* ls1 = id_mut t ls in list_nth_mut_loop_with_id_loop t i ls1 (** [loops::list_nth_mut_loop_with_id]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 144:0-155:1 *) + Source: 'src/loops.rs', lines 154:0-165:1 *) 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)) @@ -280,7 +299,7 @@ let rec list_nth_mut_loop_with_id_loop_back end (** [loops::list_nth_mut_loop_with_id]: backward function 0 - Source: 'src/loops.rs', lines 144:0-144:75 *) + Source: 'src/loops.rs', lines 154:0-154:75 *) let list_nth_mut_loop_with_id_back (t : Type0) (ls : list_t t) (i : u32) (ret : t) : result (list_t t) = let* ls1 = id_mut t ls in @@ -288,7 +307,7 @@ let list_nth_mut_loop_with_id_back id_mut_back t ls l (** [loops::list_nth_shared_loop_with_id]: loop 0: forward function - Source: 'src/loops.rs', lines 158:0-169:1 *) + Source: 'src/loops.rs', lines 168:0-179:1 *) let rec list_nth_shared_loop_with_id_loop (t : Type0) (i : u32) (ls : list_t t) : Tot (result t) @@ -303,13 +322,13 @@ let rec list_nth_shared_loop_with_id_loop end (** [loops::list_nth_shared_loop_with_id]: forward function - Source: 'src/loops.rs', lines 158:0-158:70 *) + Source: 'src/loops.rs', lines 168:0-168:70 *) let list_nth_shared_loop_with_id (t : Type0) (ls : list_t t) (i : u32) : result t = let* ls1 = id_shared t ls in list_nth_shared_loop_with_id_loop t i ls1 (** [loops::list_nth_mut_loop_pair]: loop 0: forward function - Source: 'src/loops.rs', lines 174:0-195:1 *) + Source: 'src/loops.rs', lines 184:0-205:1 *) let rec list_nth_mut_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -328,13 +347,13 @@ let rec list_nth_mut_loop_pair_loop end (** [loops::list_nth_mut_loop_pair]: forward function - Source: 'src/loops.rs', lines 174:0-178:27 *) + Source: 'src/loops.rs', lines 184:0-188:27 *) let list_nth_mut_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_mut_loop_pair]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 174:0-195:1 *) + Source: 'src/loops.rs', lines 184:0-205:1 *) 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)) @@ -356,7 +375,7 @@ let rec list_nth_mut_loop_pair_loop_back'a end (** [loops::list_nth_mut_loop_pair]: backward function 0 - Source: 'src/loops.rs', lines 174:0-178:27 *) + Source: 'src/loops.rs', lines 184:0-188:27 *) 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) @@ -364,7 +383,7 @@ let list_nth_mut_loop_pair_back'a list_nth_mut_loop_pair_loop_back'a t ls0 ls1 i ret (** [loops::list_nth_mut_loop_pair]: loop 0: backward function 1 - Source: 'src/loops.rs', lines 174:0-195:1 *) + Source: 'src/loops.rs', lines 184:0-205: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)) @@ -386,7 +405,7 @@ let rec list_nth_mut_loop_pair_loop_back'b end (** [loops::list_nth_mut_loop_pair]: backward function 1 - Source: 'src/loops.rs', lines 174:0-178:27 *) + Source: 'src/loops.rs', lines 184:0-188:27 *) 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) @@ -394,7 +413,7 @@ let list_nth_mut_loop_pair_back'b list_nth_mut_loop_pair_loop_back'b t ls0 ls1 i ret (** [loops::list_nth_shared_loop_pair]: loop 0: forward function - Source: 'src/loops.rs', lines 198:0-219:1 *) + Source: 'src/loops.rs', lines 208:0-229:1 *) let rec list_nth_shared_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -413,13 +432,13 @@ let rec list_nth_shared_loop_pair_loop end (** [loops::list_nth_shared_loop_pair]: forward function - Source: 'src/loops.rs', lines 198:0-202:19 *) + Source: 'src/loops.rs', lines 208:0-212:19 *) let list_nth_shared_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_mut_loop_pair_merge]: loop 0: forward function - Source: 'src/loops.rs', lines 223:0-238:1 *) + Source: 'src/loops.rs', lines 233:0-248:1 *) let rec list_nth_mut_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -439,13 +458,13 @@ let rec list_nth_mut_loop_pair_merge_loop end (** [loops::list_nth_mut_loop_pair_merge]: forward function - Source: 'src/loops.rs', lines 223:0-227:27 *) + Source: 'src/loops.rs', lines 233:0-237:27 *) let list_nth_mut_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_mut_loop_pair_merge]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 223:0-238:1 *) + Source: 'src/loops.rs', lines 233:0-248:1 *) 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))) @@ -468,7 +487,7 @@ let rec list_nth_mut_loop_pair_merge_loop_back end (** [loops::list_nth_mut_loop_pair_merge]: backward function 0 - Source: 'src/loops.rs', lines 223:0-227:27 *) + Source: 'src/loops.rs', lines 233:0-237:27 *) 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)) @@ -476,7 +495,7 @@ let list_nth_mut_loop_pair_merge_back list_nth_mut_loop_pair_merge_loop_back t ls0 ls1 i ret (** [loops::list_nth_shared_loop_pair_merge]: loop 0: forward function - Source: 'src/loops.rs', lines 241:0-256:1 *) + Source: 'src/loops.rs', lines 251:0-266:1 *) let rec list_nth_shared_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -497,13 +516,13 @@ let rec list_nth_shared_loop_pair_merge_loop end (** [loops::list_nth_shared_loop_pair_merge]: forward function - Source: 'src/loops.rs', lines 241:0-245:19 *) + Source: 'src/loops.rs', lines 251:0-255:19 *) let list_nth_shared_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_mut_shared_loop_pair]: loop 0: forward function - Source: 'src/loops.rs', lines 259:0-274:1 *) + Source: 'src/loops.rs', lines 269:0-284:1 *) let rec list_nth_mut_shared_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -524,13 +543,13 @@ let rec list_nth_mut_shared_loop_pair_loop end (** [loops::list_nth_mut_shared_loop_pair]: forward function - Source: 'src/loops.rs', lines 259:0-263:23 *) + Source: 'src/loops.rs', lines 269:0-273:23 *) let list_nth_mut_shared_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_shared_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_mut_shared_loop_pair]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 259:0-274:1 *) + Source: 'src/loops.rs', lines 269:0-284:1 *) 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)) @@ -552,7 +571,7 @@ let rec list_nth_mut_shared_loop_pair_loop_back end (** [loops::list_nth_mut_shared_loop_pair]: backward function 0 - Source: 'src/loops.rs', lines 259:0-263:23 *) + Source: 'src/loops.rs', lines 269:0-273:23 *) 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) @@ -560,7 +579,7 @@ let list_nth_mut_shared_loop_pair_back list_nth_mut_shared_loop_pair_loop_back t ls0 ls1 i ret (** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0: forward function - Source: 'src/loops.rs', lines 278:0-293:1 *) + Source: 'src/loops.rs', lines 288:0-303:1 *) let rec list_nth_mut_shared_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -581,13 +600,13 @@ let rec list_nth_mut_shared_loop_pair_merge_loop end (** [loops::list_nth_mut_shared_loop_pair_merge]: forward function - Source: 'src/loops.rs', lines 278:0-282:23 *) + Source: 'src/loops.rs', lines 288:0-292:23 *) let list_nth_mut_shared_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_mut_shared_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 278:0-293:1 *) + Source: 'src/loops.rs', lines 288:0-303:1 *) 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)) @@ -610,7 +629,7 @@ let rec list_nth_mut_shared_loop_pair_merge_loop_back end (** [loops::list_nth_mut_shared_loop_pair_merge]: backward function 0 - Source: 'src/loops.rs', lines 278:0-282:23 *) + Source: 'src/loops.rs', lines 288:0-292:23 *) 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) @@ -618,7 +637,7 @@ let list_nth_mut_shared_loop_pair_merge_back list_nth_mut_shared_loop_pair_merge_loop_back t ls0 ls1 i ret (** [loops::list_nth_shared_mut_loop_pair]: loop 0: forward function - Source: 'src/loops.rs', lines 297:0-312:1 *) + Source: 'src/loops.rs', lines 307:0-322:1 *) let rec list_nth_shared_mut_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -639,13 +658,13 @@ let rec list_nth_shared_mut_loop_pair_loop end (** [loops::list_nth_shared_mut_loop_pair]: forward function - Source: 'src/loops.rs', lines 297:0-301:23 *) + Source: 'src/loops.rs', lines 307:0-311:23 *) let list_nth_shared_mut_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_mut_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_shared_mut_loop_pair]: loop 0: backward function 1 - Source: 'src/loops.rs', lines 297:0-312:1 *) + Source: 'src/loops.rs', lines 307:0-322: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)) @@ -667,7 +686,7 @@ let rec list_nth_shared_mut_loop_pair_loop_back end (** [loops::list_nth_shared_mut_loop_pair]: backward function 1 - Source: 'src/loops.rs', lines 297:0-301:23 *) + Source: 'src/loops.rs', lines 307:0-311:23 *) 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) @@ -675,7 +694,7 @@ let list_nth_shared_mut_loop_pair_back list_nth_shared_mut_loop_pair_loop_back t ls0 ls1 i ret (** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0: forward function - Source: 'src/loops.rs', lines 316:0-331:1 *) + Source: 'src/loops.rs', lines 326:0-341:1 *) let rec list_nth_shared_mut_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -696,13 +715,13 @@ let rec list_nth_shared_mut_loop_pair_merge_loop end (** [loops::list_nth_shared_mut_loop_pair_merge]: forward function - Source: 'src/loops.rs', lines 316:0-320:23 *) + Source: 'src/loops.rs', lines 326:0-330:23 *) let list_nth_shared_mut_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_mut_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0: backward function 0 - Source: 'src/loops.rs', lines 316:0-331:1 *) + Source: 'src/loops.rs', lines 326:0-341:1 *) 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)) @@ -725,7 +744,7 @@ let rec list_nth_shared_mut_loop_pair_merge_loop_back end (** [loops::list_nth_shared_mut_loop_pair_merge]: backward function 0 - Source: 'src/loops.rs', lines 316:0-320:23 *) + Source: 'src/loops.rs', lines 326:0-330:23 *) 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-split/misc/Loops.Types.fst b/tests/fstar-split/misc/Loops.Types.fst index 8aa38290..29f56e1b 100644 --- a/tests/fstar-split/misc/Loops.Types.fst +++ b/tests/fstar-split/misc/Loops.Types.fst @@ -6,7 +6,7 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [loops::List] - Source: 'src/loops.rs', lines 60:0-60:16 *) + Source: 'src/loops.rs', lines 70:0-70:16 *) type list_t (t : Type0) = | List_Cons : t -> list_t t -> list_t t | List_Nil : list_t t diff --git a/tests/fstar-split/traits/Traits.fst b/tests/fstar-split/traits/Traits.fst index d3847590..a815406f 100644 --- a/tests/fstar-split/traits/Traits.fst +++ b/tests/fstar-split/traits/Traits.fst @@ -326,22 +326,14 @@ noeq type childTrait_t (self : Type0) = { parentTrait1SelfInst : parentTrait1_t self; } -(** [traits::test_parent_trait0]: forward function - Source: 'src/traits.rs', lines 208:0-208:57 *) -let test_parent_trait0 - (t : Type0) (parentTrait0TInst : parentTrait0_t t) (x : t) : - result parentTrait0TInst.tW - = - parentTrait0TInst.get_w x - (** [traits::test_child_trait1]: forward function - Source: 'src/traits.rs', lines 213:0-213:56 *) + Source: 'src/traits.rs', lines 209:0-209:56 *) let test_child_trait1 (t : Type0) (childTraitTInst : childTrait_t t) (x : t) : result string = childTraitTInst.parentTrait0SelfInst.get_name x (** [traits::test_child_trait2]: forward function - Source: 'src/traits.rs', lines 217:0-217:54 *) + Source: 'src/traits.rs', lines 213:0-213:54 *) let test_child_trait2 (t : Type0) (childTraitTInst : childTrait_t t) (x : t) : result childTraitTInst.parentTrait0SelfInst.tW @@ -349,7 +341,7 @@ let test_child_trait2 childTraitTInst.parentTrait0SelfInst.get_w x (** [traits::order1]: forward function - Source: 'src/traits.rs', lines 223:0-223:59 *) + Source: 'src/traits.rs', lines 219:0-219:59 *) let order1 (t u : Type0) (parentTrait0TInst : parentTrait0_t t) (parentTrait0UInst : parentTrait0_t u) : @@ -358,27 +350,27 @@ let order1 Return () (** Trait declaration: [traits::ChildTrait1] - Source: 'src/traits.rs', lines 226:0-226:35 *) + Source: 'src/traits.rs', lines 222:0-222:35 *) noeq type childTrait1_t (self : Type0) = { parentTrait1SelfInst : parentTrait1_t self; } (** Trait implementation: [traits::{usize#9}] - Source: 'src/traits.rs', lines 228:0-228:27 *) + Source: 'src/traits.rs', lines 224:0-224:27 *) let traits_ParentTrait1UsizeInst : parentTrait1_t usize = () (** Trait implementation: [traits::{usize#10}] - Source: 'src/traits.rs', lines 229:0-229:26 *) + Source: 'src/traits.rs', lines 225:0-225:26 *) let traits_ChildTrait1UsizeInst : childTrait1_t usize = { parentTrait1SelfInst = traits_ParentTrait1UsizeInst; } (** Trait declaration: [traits::Iterator] - Source: 'src/traits.rs', lines 233:0-233:18 *) + Source: 'src/traits.rs', lines 229:0-229:18 *) noeq type iterator_t (self : Type0) = { tItem : Type0; } (** Trait declaration: [traits::IntoIterator] - Source: 'src/traits.rs', lines 237:0-237:22 *) + Source: 'src/traits.rs', lines 233:0-233:22 *) noeq type intoIterator_t (self : Type0) = { tItem : Type0; tIntoIter : Type0; @@ -387,29 +379,29 @@ noeq type intoIterator_t (self : Type0) = { } (** Trait declaration: [traits::FromResidual] - Source: 'src/traits.rs', lines 254:0-254:21 *) + Source: 'src/traits.rs', lines 250:0-250:21 *) type fromResidual_t (self t : Type0) = unit (** Trait declaration: [traits::Try] - Source: 'src/traits.rs', lines 250:0-250:48 *) + Source: 'src/traits.rs', lines 246:0-246:48 *) noeq type try_t (self : Type0) = { tResidual : Type0; fromResidualSelftraitsTrySelfResidualInst : fromResidual_t self tResidual; } (** Trait declaration: [traits::WithTarget] - Source: 'src/traits.rs', lines 256:0-256:20 *) + Source: 'src/traits.rs', lines 252:0-252:20 *) noeq type withTarget_t (self : Type0) = { tTarget : Type0; } (** Trait declaration: [traits::ParentTrait2] - Source: 'src/traits.rs', lines 260:0-260:22 *) + Source: 'src/traits.rs', lines 256:0-256:22 *) noeq type parentTrait2_t (self : Type0) = { tU : Type0; tU_clause_0 : withTarget_t tU; } (** Trait declaration: [traits::ChildTrait2] - Source: 'src/traits.rs', lines 264:0-264:35 *) + Source: 'src/traits.rs', lines 260:0-260:35 *) noeq type childTrait2_t (self : Type0) = { parentTrait2SelfInst : parentTrait2_t self; convert : parentTrait2SelfInst.tU -> result @@ -417,37 +409,37 @@ noeq type childTrait2_t (self : Type0) = { } (** Trait implementation: [traits::{u32#11}] - Source: 'src/traits.rs', lines 268:0-268:23 *) + Source: 'src/traits.rs', lines 264:0-264:23 *) let traits_WithTargetU32Inst : withTarget_t u32 = { tTarget = u32; } (** Trait implementation: [traits::{u32#12}] - Source: 'src/traits.rs', lines 272:0-272:25 *) + Source: 'src/traits.rs', lines 268:0-268:25 *) let traits_ParentTrait2U32Inst : parentTrait2_t u32 = { tU = u32; tU_clause_0 = traits_WithTargetU32Inst; } (** [traits::{u32#13}::convert]: forward function - Source: 'src/traits.rs', lines 277:4-277:29 *) + Source: 'src/traits.rs', lines 273:4-273:29 *) let u32_convert (x : u32) : result u32 = Return x (** Trait implementation: [traits::{u32#13}] - Source: 'src/traits.rs', lines 276:0-276:24 *) + Source: 'src/traits.rs', lines 272:0-272:24 *) let traits_ChildTrait2U32Inst : childTrait2_t u32 = { parentTrait2SelfInst = traits_ParentTrait2U32Inst; convert = u32_convert; } (** Trait declaration: [traits::CFnOnce] - Source: 'src/traits.rs', lines 290:0-290:23 *) + Source: 'src/traits.rs', lines 286:0-286:23 *) noeq type cFnOnce_t (self args : Type0) = { tOutput : Type0; call_once : self -> args -> result tOutput; } (** Trait declaration: [traits::CFnMut] - Source: 'src/traits.rs', lines 296:0-296:37 *) + Source: 'src/traits.rs', lines 292:0-292:37 *) noeq type cFnMut_t (self args : Type0) = { cFnOnceSelfArgsInst : cFnOnce_t self args; call_mut : self -> args -> result cFnOnceSelfArgsInst.tOutput; @@ -455,19 +447,19 @@ noeq type cFnMut_t (self args : Type0) = { } (** Trait declaration: [traits::CFn] - Source: 'src/traits.rs', lines 300:0-300:33 *) + Source: 'src/traits.rs', lines 296:0-296:33 *) noeq type cFn_t (self args : Type0) = { cFnMutSelfArgsInst : cFnMut_t self args; call : self -> args -> result cFnMutSelfArgsInst.cFnOnceSelfArgsInst.tOutput; } (** Trait declaration: [traits::GetTrait] - Source: 'src/traits.rs', lines 304:0-304:18 *) + Source: 'src/traits.rs', lines 300:0-300:18 *) noeq type getTrait_t (self : Type0) = { tW : Type0; get_w : self -> result tW; } (** [traits::test_get_trait]: forward function - Source: 'src/traits.rs', lines 309:0-309:49 *) + Source: 'src/traits.rs', lines 305:0-305:49 *) let test_get_trait (t : Type0) (getTraitTInst : getTrait_t t) (x : t) : result getTraitTInst.tW diff --git a/tests/fstar/misc/Loops.Clauses.Template.fst b/tests/fstar/misc/Loops.Clauses.Template.fst index 6be351c6..244761d3 100644 --- a/tests/fstar/misc/Loops.Clauses.Template.fst +++ b/tests/fstar/misc/Loops.Clauses.Template.fst @@ -24,106 +24,113 @@ let sum_with_shared_borrows_loop_decreases (max : u32) (i : u32) (s : u32) : nat = admit () +(** [loops::sum_array]: decreases clause + Source: 'src/loops.rs', lines 50:0-58:1 *) +unfold +let sum_array_loop_decreases (n : usize) (a : array u32 n) (i : usize) + (s : u32) : nat = + admit () + (** [loops::clear]: decreases clause - Source: 'src/loops.rs', lines 52:0-58:1 *) + Source: 'src/loops.rs', lines 62:0-68:1 *) unfold let clear_loop_decreases (v : alloc_vec_Vec u32) (i : usize) : nat = admit () (** [loops::list_mem]: decreases clause - Source: 'src/loops.rs', lines 66:0-75:1 *) + Source: 'src/loops.rs', lines 76:0-85:1 *) unfold let list_mem_loop_decreases (x : u32) (ls : list_t u32) : nat = admit () (** [loops::list_nth_mut_loop]: decreases clause - Source: 'src/loops.rs', lines 78:0-88:1 *) + Source: 'src/loops.rs', lines 88:0-98:1 *) unfold let list_nth_mut_loop_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop]: decreases clause - Source: 'src/loops.rs', lines 91:0-101:1 *) + Source: 'src/loops.rs', lines 101:0-111:1 *) unfold let list_nth_shared_loop_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = admit () (** [loops::get_elem_mut]: decreases clause - Source: 'src/loops.rs', lines 103:0-117:1 *) + Source: 'src/loops.rs', lines 113:0-127:1 *) unfold let get_elem_mut_loop_decreases (x : usize) (ls : list_t usize) : nat = admit () (** [loops::get_elem_shared]: decreases clause - Source: 'src/loops.rs', lines 119:0-133:1 *) + Source: 'src/loops.rs', lines 129:0-143:1 *) unfold let get_elem_shared_loop_decreases (x : usize) (ls : list_t usize) : nat = admit () (** [loops::list_nth_mut_loop_with_id]: decreases clause - Source: 'src/loops.rs', lines 144:0-155:1 *) + Source: 'src/loops.rs', lines 154:0-165:1 *) unfold let list_nth_mut_loop_with_id_loop_decreases (t : Type0) (i : u32) (ls : list_t t) : nat = admit () (** [loops::list_nth_shared_loop_with_id]: decreases clause - Source: 'src/loops.rs', lines 158:0-169:1 *) + Source: 'src/loops.rs', lines 168:0-179:1 *) unfold let list_nth_shared_loop_with_id_loop_decreases (t : Type0) (i : u32) (ls : list_t t) : nat = admit () (** [loops::list_nth_mut_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 174:0-195:1 *) + Source: 'src/loops.rs', lines 184:0-205:1 *) unfold let list_nth_mut_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 198:0-219:1 *) + Source: 'src/loops.rs', lines 208:0-229:1 *) unfold let list_nth_shared_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 223:0-238:1 *) + Source: 'src/loops.rs', lines 233:0-248:1 *) unfold let list_nth_mut_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 241:0-256:1 *) + Source: 'src/loops.rs', lines 251:0-266:1 *) unfold let list_nth_shared_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_shared_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 259:0-274:1 *) + Source: 'src/loops.rs', lines 269:0-284:1 *) unfold let list_nth_mut_shared_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_shared_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 278:0-293:1 *) + Source: 'src/loops.rs', lines 288:0-303:1 *) unfold let list_nth_mut_shared_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_mut_loop_pair]: decreases clause - Source: 'src/loops.rs', lines 297:0-312:1 *) + Source: 'src/loops.rs', lines 307:0-322:1 *) unfold let list_nth_shared_mut_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_mut_loop_pair_merge]: decreases clause - Source: 'src/loops.rs', lines 316:0-331:1 *) + Source: 'src/loops.rs', lines 326:0-341:1 *) unfold let list_nth_shared_mut_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = diff --git a/tests/fstar/misc/Loops.Clauses.fst b/tests/fstar/misc/Loops.Clauses.fst index 75194437..13f5513d 100644 --- a/tests/fstar/misc/Loops.Clauses.fst +++ b/tests/fstar/misc/Loops.Clauses.fst @@ -19,6 +19,11 @@ unfold let sum_with_shared_borrows_loop_decreases (max : u32) (i : u32) (s : u32) : nat = if max >= i then max - i else 0 +(** [loops::sum_array]: decreases clause *) +unfold +let sum_array_loop_decreases (n : usize) (_ : array u32 n) (i : usize) (_ : u32) : nat = + if n >= i then n - i else 0 + (** [loops::clear]: decreases clause *) unfold let clear_loop_decreases (v : alloc_vec_Vec u32) (i : usize) : nat = if i <= List.Tot.length v then List.Tot.length v - i else 0 diff --git a/tests/fstar/misc/Loops.Funs.fst b/tests/fstar/misc/Loops.Funs.fst index 88389300..209c48cd 100644 --- a/tests/fstar/misc/Loops.Funs.fst +++ b/tests/fstar/misc/Loops.Funs.fst @@ -58,8 +58,27 @@ let rec sum_with_shared_borrows_loop let sum_with_shared_borrows (max : u32) : result u32 = sum_with_shared_borrows_loop max 0 0 +(** [loops::sum_array]: loop 0: + Source: 'src/loops.rs', lines 50:0-58:1 *) +let rec sum_array_loop + (n : usize) (a : array u32 n) (i : usize) (s : u32) : + Tot (result u32) (decreases (sum_array_loop_decreases n a i s)) + = + if i < n + then + let* i1 = array_index_usize u32 n a i in + let* s1 = u32_add s i1 in + let* i2 = usize_add i 1 in + sum_array_loop n a i2 s1 + else Return s + +(** [loops::sum_array]: + Source: 'src/loops.rs', lines 50:0-50:52 *) +let sum_array (n : usize) (a : array u32 n) : result u32 = + sum_array_loop n a 0 0 + (** [loops::clear]: loop 0: - Source: 'src/loops.rs', lines 52:0-58:1 *) + Source: 'src/loops.rs', lines 62:0-68:1 *) let rec clear_loop (v : alloc_vec_Vec u32) (i : usize) : Tot (result (alloc_vec_Vec u32)) (decreases (clear_loop_decreases v i)) @@ -76,12 +95,12 @@ let rec clear_loop else Return v (** [loops::clear]: - Source: 'src/loops.rs', lines 52:0-52:30 *) + Source: 'src/loops.rs', lines 62:0-62:30 *) let clear (v : alloc_vec_Vec u32) : result (alloc_vec_Vec u32) = clear_loop v 0 (** [loops::list_mem]: loop 0: - Source: 'src/loops.rs', lines 66:0-75:1 *) + Source: 'src/loops.rs', lines 76:0-85:1 *) let rec list_mem_loop (x : u32) (ls : list_t u32) : Tot (result bool) (decreases (list_mem_loop_decreases x ls)) @@ -92,12 +111,12 @@ let rec list_mem_loop end (** [loops::list_mem]: - Source: 'src/loops.rs', lines 66:0-66:52 *) + Source: 'src/loops.rs', lines 76:0-76:52 *) let list_mem (x : u32) (ls : list_t u32) : result bool = list_mem_loop x ls (** [loops::list_nth_mut_loop]: loop 0: - Source: 'src/loops.rs', lines 78:0-88:1 *) + Source: 'src/loops.rs', lines 88:0-98:1 *) let rec list_nth_mut_loop_loop (t : Type0) (ls : list_t t) (i : u32) : Tot (result (t & (t -> result (list_t t)))) @@ -116,7 +135,7 @@ let rec list_nth_mut_loop_loop end (** [loops::list_nth_mut_loop]: - Source: 'src/loops.rs', lines 78:0-78:71 *) + Source: 'src/loops.rs', lines 88:0-88:71 *) let list_nth_mut_loop (t : Type0) (ls : list_t t) (i : u32) : result (t & (t -> result (list_t t))) @@ -124,7 +143,7 @@ let list_nth_mut_loop let* (x, back) = list_nth_mut_loop_loop t ls i in Return (x, back) (** [loops::list_nth_shared_loop]: loop 0: - Source: 'src/loops.rs', lines 91:0-101:1 *) + Source: 'src/loops.rs', lines 101:0-111:1 *) let rec list_nth_shared_loop_loop (t : Type0) (ls : list_t t) (i : u32) : Tot (result t) (decreases (list_nth_shared_loop_loop_decreases t ls i)) @@ -138,12 +157,12 @@ let rec list_nth_shared_loop_loop end (** [loops::list_nth_shared_loop]: - Source: 'src/loops.rs', lines 91:0-91:66 *) + Source: 'src/loops.rs', lines 101:0-101:66 *) let list_nth_shared_loop (t : Type0) (ls : list_t t) (i : u32) : result t = list_nth_shared_loop_loop t ls i (** [loops::get_elem_mut]: loop 0: - Source: 'src/loops.rs', lines 103:0-117:1 *) + Source: 'src/loops.rs', lines 113:0-127:1 *) let rec get_elem_mut_loop (x : usize) (ls : list_t usize) : Tot (result (usize & (usize -> result (list_t usize)))) @@ -161,7 +180,7 @@ let rec get_elem_mut_loop end (** [loops::get_elem_mut]: - Source: 'src/loops.rs', lines 103:0-103:73 *) + Source: 'src/loops.rs', lines 113:0-113:73 *) let get_elem_mut (slots : alloc_vec_Vec (list_t usize)) (x : usize) : result (usize & (usize -> result (alloc_vec_Vec (list_t usize)))) @@ -174,7 +193,7 @@ let get_elem_mut Return (i, back1) (** [loops::get_elem_shared]: loop 0: - Source: 'src/loops.rs', lines 119:0-133:1 *) + Source: 'src/loops.rs', lines 129:0-143:1 *) let rec get_elem_shared_loop (x : usize) (ls : list_t usize) : Tot (result usize) (decreases (get_elem_shared_loop_decreases x ls)) @@ -185,7 +204,7 @@ let rec get_elem_shared_loop end (** [loops::get_elem_shared]: - Source: 'src/loops.rs', lines 119:0-119:68 *) + Source: 'src/loops.rs', lines 129:0-129:68 *) let get_elem_shared (slots : alloc_vec_Vec (list_t usize)) (x : usize) : result usize = let* l = @@ -194,7 +213,7 @@ let get_elem_shared get_elem_shared_loop x l (** [loops::id_mut]: - Source: 'src/loops.rs', lines 135:0-135:50 *) + Source: 'src/loops.rs', lines 145:0-145:50 *) let id_mut (t : Type0) (ls : list_t t) : result ((list_t t) & (list_t t -> result (list_t t))) @@ -202,12 +221,12 @@ let id_mut Return (ls, Return) (** [loops::id_shared]: - Source: 'src/loops.rs', lines 139:0-139:45 *) + Source: 'src/loops.rs', lines 149:0-149:45 *) let id_shared (t : Type0) (ls : list_t t) : result (list_t t) = Return ls (** [loops::list_nth_mut_loop_with_id]: loop 0: - Source: 'src/loops.rs', lines 144:0-155:1 *) + Source: 'src/loops.rs', lines 154:0-165:1 *) let rec list_nth_mut_loop_with_id_loop (t : Type0) (i : u32) (ls : list_t t) : Tot (result (t & (t -> result (list_t t)))) @@ -226,7 +245,7 @@ let rec list_nth_mut_loop_with_id_loop end (** [loops::list_nth_mut_loop_with_id]: - Source: 'src/loops.rs', lines 144:0-144:75 *) + Source: 'src/loops.rs', lines 154:0-154:75 *) let list_nth_mut_loop_with_id (t : Type0) (ls : list_t t) (i : u32) : result (t & (t -> result (list_t t))) @@ -237,7 +256,7 @@ let list_nth_mut_loop_with_id Return (x, back1) (** [loops::list_nth_shared_loop_with_id]: loop 0: - Source: 'src/loops.rs', lines 158:0-169:1 *) + Source: 'src/loops.rs', lines 168:0-179:1 *) let rec list_nth_shared_loop_with_id_loop (t : Type0) (i : u32) (ls : list_t t) : Tot (result t) @@ -252,13 +271,13 @@ let rec list_nth_shared_loop_with_id_loop end (** [loops::list_nth_shared_loop_with_id]: - Source: 'src/loops.rs', lines 158:0-158:70 *) + Source: 'src/loops.rs', lines 168:0-168:70 *) let list_nth_shared_loop_with_id (t : Type0) (ls : list_t t) (i : u32) : result t = let* ls1 = id_shared t ls in list_nth_shared_loop_with_id_loop t i ls1 (** [loops::list_nth_mut_loop_pair]: loop 0: - Source: 'src/loops.rs', lines 174:0-195:1 *) + Source: 'src/loops.rs', lines 184:0-205:1 *) let rec list_nth_mut_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)) & (t -> result (list_t t)))) @@ -288,7 +307,7 @@ let rec list_nth_mut_loop_pair_loop end (** [loops::list_nth_mut_loop_pair]: - Source: 'src/loops.rs', lines 174:0-178:27 *) + Source: 'src/loops.rs', lines 184:0-188:27 *) let list_nth_mut_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t)) & (t -> result (list_t t))) @@ -297,7 +316,7 @@ let list_nth_mut_loop_pair Return (p, back_'a, back_'b) (** [loops::list_nth_shared_loop_pair]: loop 0: - Source: 'src/loops.rs', lines 198:0-219:1 *) + Source: 'src/loops.rs', lines 208:0-229:1 *) let rec list_nth_shared_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -316,13 +335,13 @@ let rec list_nth_shared_loop_pair_loop end (** [loops::list_nth_shared_loop_pair]: - Source: 'src/loops.rs', lines 198:0-202:19 *) + Source: 'src/loops.rs', lines 208:0-212:19 *) let list_nth_shared_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_mut_loop_pair_merge]: loop 0: - Source: 'src/loops.rs', lines 223:0-238:1 *) + Source: 'src/loops.rs', lines 233:0-248:1 *) let rec list_nth_mut_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & ((t & t) -> result ((list_t t) & (list_t t))))) @@ -352,7 +371,7 @@ let rec list_nth_mut_loop_pair_merge_loop end (** [loops::list_nth_mut_loop_pair_merge]: - Source: 'src/loops.rs', lines 223:0-227:27 *) + Source: 'src/loops.rs', lines 233:0-237:27 *) let list_nth_mut_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & ((t & t) -> result ((list_t t) & (list_t t)))) @@ -361,7 +380,7 @@ let list_nth_mut_loop_pair_merge Return (p, back_'a) (** [loops::list_nth_shared_loop_pair_merge]: loop 0: - Source: 'src/loops.rs', lines 241:0-256:1 *) + Source: 'src/loops.rs', lines 251:0-266:1 *) let rec list_nth_shared_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -382,13 +401,13 @@ let rec list_nth_shared_loop_pair_merge_loop end (** [loops::list_nth_shared_loop_pair_merge]: - Source: 'src/loops.rs', lines 241:0-245:19 *) + Source: 'src/loops.rs', lines 251:0-255:19 *) let list_nth_shared_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_mut_shared_loop_pair]: loop 0: - Source: 'src/loops.rs', lines 259:0-274:1 *) + Source: 'src/loops.rs', lines 269:0-284:1 *) let rec list_nth_mut_shared_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -414,7 +433,7 @@ let rec list_nth_mut_shared_loop_pair_loop end (** [loops::list_nth_mut_shared_loop_pair]: - Source: 'src/loops.rs', lines 259:0-263:23 *) + Source: 'src/loops.rs', lines 269:0-273:23 *) let list_nth_mut_shared_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -423,7 +442,7 @@ let list_nth_mut_shared_loop_pair Return (p, back_'a) (** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0: - Source: 'src/loops.rs', lines 278:0-293:1 *) + Source: 'src/loops.rs', lines 288:0-303:1 *) let rec list_nth_mut_shared_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -450,7 +469,7 @@ let rec list_nth_mut_shared_loop_pair_merge_loop end (** [loops::list_nth_mut_shared_loop_pair_merge]: - Source: 'src/loops.rs', lines 278:0-282:23 *) + Source: 'src/loops.rs', lines 288:0-292:23 *) let list_nth_mut_shared_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -459,7 +478,7 @@ let list_nth_mut_shared_loop_pair_merge Return (p, back_'a) (** [loops::list_nth_shared_mut_loop_pair]: loop 0: - Source: 'src/loops.rs', lines 297:0-312:1 *) + Source: 'src/loops.rs', lines 307:0-322:1 *) let rec list_nth_shared_mut_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -485,7 +504,7 @@ let rec list_nth_shared_mut_loop_pair_loop end (** [loops::list_nth_shared_mut_loop_pair]: - Source: 'src/loops.rs', lines 297:0-301:23 *) + Source: 'src/loops.rs', lines 307:0-311:23 *) let list_nth_shared_mut_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -494,7 +513,7 @@ let list_nth_shared_mut_loop_pair Return (p, back_'b) (** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0: - Source: 'src/loops.rs', lines 316:0-331:1 *) + Source: 'src/loops.rs', lines 326:0-341:1 *) let rec list_nth_shared_mut_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -521,7 +540,7 @@ let rec list_nth_shared_mut_loop_pair_merge_loop end (** [loops::list_nth_shared_mut_loop_pair_merge]: - Source: 'src/loops.rs', lines 316:0-320:23 *) + Source: 'src/loops.rs', lines 326:0-330:23 *) let list_nth_shared_mut_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) diff --git a/tests/fstar/misc/Loops.Types.fst b/tests/fstar/misc/Loops.Types.fst index 8aa38290..29f56e1b 100644 --- a/tests/fstar/misc/Loops.Types.fst +++ b/tests/fstar/misc/Loops.Types.fst @@ -6,7 +6,7 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [loops::List] - Source: 'src/loops.rs', lines 60:0-60:16 *) + Source: 'src/loops.rs', lines 70:0-70:16 *) type list_t (t : Type0) = | List_Cons : t -> list_t t -> list_t t | List_Nil : list_t t diff --git a/tests/fstar/traits/Traits.fst b/tests/fstar/traits/Traits.fst index cb9c1654..0760de2e 100644 --- a/tests/fstar/traits/Traits.fst +++ b/tests/fstar/traits/Traits.fst @@ -325,22 +325,14 @@ noeq type childTrait_t (self : Type0) = { parentTrait1SelfInst : parentTrait1_t self; } -(** [traits::test_parent_trait0]: - Source: 'src/traits.rs', lines 208:0-208:57 *) -let test_parent_trait0 - (t : Type0) (parentTrait0TInst : parentTrait0_t t) (x : t) : - result parentTrait0TInst.tW - = - parentTrait0TInst.get_w x - (** [traits::test_child_trait1]: - Source: 'src/traits.rs', lines 213:0-213:56 *) + Source: 'src/traits.rs', lines 209:0-209:56 *) let test_child_trait1 (t : Type0) (childTraitTInst : childTrait_t t) (x : t) : result string = childTraitTInst.parentTrait0SelfInst.get_name x (** [traits::test_child_trait2]: - Source: 'src/traits.rs', lines 217:0-217:54 *) + Source: 'src/traits.rs', lines 213:0-213:54 *) let test_child_trait2 (t : Type0) (childTraitTInst : childTrait_t t) (x : t) : result childTraitTInst.parentTrait0SelfInst.tW @@ -348,7 +340,7 @@ let test_child_trait2 childTraitTInst.parentTrait0SelfInst.get_w x (** [traits::order1]: - Source: 'src/traits.rs', lines 223:0-223:59 *) + Source: 'src/traits.rs', lines 219:0-219:59 *) let order1 (t u : Type0) (parentTrait0TInst : parentTrait0_t t) (parentTrait0UInst : parentTrait0_t u) : @@ -357,27 +349,27 @@ let order1 Return () (** Trait declaration: [traits::ChildTrait1] - Source: 'src/traits.rs', lines 226:0-226:35 *) + Source: 'src/traits.rs', lines 222:0-222:35 *) noeq type childTrait1_t (self : Type0) = { parentTrait1SelfInst : parentTrait1_t self; } (** Trait implementation: [traits::{usize#9}] - Source: 'src/traits.rs', lines 228:0-228:27 *) + Source: 'src/traits.rs', lines 224:0-224:27 *) let traits_ParentTrait1UsizeInst : parentTrait1_t usize = () (** Trait implementation: [traits::{usize#10}] - Source: 'src/traits.rs', lines 229:0-229:26 *) + Source: 'src/traits.rs', lines 225:0-225:26 *) let traits_ChildTrait1UsizeInst : childTrait1_t usize = { parentTrait1SelfInst = traits_ParentTrait1UsizeInst; } (** Trait declaration: [traits::Iterator] - Source: 'src/traits.rs', lines 233:0-233:18 *) + Source: 'src/traits.rs', lines 229:0-229:18 *) noeq type iterator_t (self : Type0) = { tItem : Type0; } (** Trait declaration: [traits::IntoIterator] - Source: 'src/traits.rs', lines 237:0-237:22 *) + Source: 'src/traits.rs', lines 233:0-233:22 *) noeq type intoIterator_t (self : Type0) = { tItem : Type0; tIntoIter : Type0; @@ -386,29 +378,29 @@ noeq type intoIterator_t (self : Type0) = { } (** Trait declaration: [traits::FromResidual] - Source: 'src/traits.rs', lines 254:0-254:21 *) + Source: 'src/traits.rs', lines 250:0-250:21 *) type fromResidual_t (self t : Type0) = unit (** Trait declaration: [traits::Try] - Source: 'src/traits.rs', lines 250:0-250:48 *) + Source: 'src/traits.rs', lines 246:0-246:48 *) noeq type try_t (self : Type0) = { tResidual : Type0; fromResidualSelftraitsTrySelfResidualInst : fromResidual_t self tResidual; } (** Trait declaration: [traits::WithTarget] - Source: 'src/traits.rs', lines 256:0-256:20 *) + Source: 'src/traits.rs', lines 252:0-252:20 *) noeq type withTarget_t (self : Type0) = { tTarget : Type0; } (** Trait declaration: [traits::ParentTrait2] - Source: 'src/traits.rs', lines 260:0-260:22 *) + Source: 'src/traits.rs', lines 256:0-256:22 *) noeq type parentTrait2_t (self : Type0) = { tU : Type0; tU_clause_0 : withTarget_t tU; } (** Trait declaration: [traits::ChildTrait2] - Source: 'src/traits.rs', lines 264:0-264:35 *) + Source: 'src/traits.rs', lines 260:0-260:35 *) noeq type childTrait2_t (self : Type0) = { parentTrait2SelfInst : parentTrait2_t self; convert : parentTrait2SelfInst.tU -> result @@ -416,56 +408,56 @@ noeq type childTrait2_t (self : Type0) = { } (** Trait implementation: [traits::{u32#11}] - Source: 'src/traits.rs', lines 268:0-268:23 *) + Source: 'src/traits.rs', lines 264:0-264:23 *) let traits_WithTargetU32Inst : withTarget_t u32 = { tTarget = u32; } (** Trait implementation: [traits::{u32#12}] - Source: 'src/traits.rs', lines 272:0-272:25 *) + Source: 'src/traits.rs', lines 268:0-268:25 *) let traits_ParentTrait2U32Inst : parentTrait2_t u32 = { tU = u32; tU_clause_0 = traits_WithTargetU32Inst; } (** [traits::{u32#13}::convert]: - Source: 'src/traits.rs', lines 277:4-277:29 *) + Source: 'src/traits.rs', lines 273:4-273:29 *) let u32_convert (x : u32) : result u32 = Return x (** Trait implementation: [traits::{u32#13}] - Source: 'src/traits.rs', lines 276:0-276:24 *) + Source: 'src/traits.rs', lines 272:0-272:24 *) let traits_ChildTrait2U32Inst : childTrait2_t u32 = { parentTrait2SelfInst = traits_ParentTrait2U32Inst; convert = u32_convert; } (** Trait declaration: [traits::CFnOnce] - Source: 'src/traits.rs', lines 290:0-290:23 *) + Source: 'src/traits.rs', lines 286:0-286:23 *) noeq type cFnOnce_t (self args : Type0) = { tOutput : Type0; call_once : self -> args -> result tOutput; } (** Trait declaration: [traits::CFnMut] - Source: 'src/traits.rs', lines 296:0-296:37 *) + Source: 'src/traits.rs', lines 292:0-292:37 *) noeq type cFnMut_t (self args : Type0) = { cFnOnceSelfArgsInst : cFnOnce_t self args; call_mut : self -> args -> result (cFnOnceSelfArgsInst.tOutput & self); } (** Trait declaration: [traits::CFn] - Source: 'src/traits.rs', lines 300:0-300:33 *) + Source: 'src/traits.rs', lines 296:0-296:33 *) noeq type cFn_t (self args : Type0) = { cFnMutSelfArgsInst : cFnMut_t self args; call : self -> args -> result cFnMutSelfArgsInst.cFnOnceSelfArgsInst.tOutput; } (** Trait declaration: [traits::GetTrait] - Source: 'src/traits.rs', lines 304:0-304:18 *) + Source: 'src/traits.rs', lines 300:0-300:18 *) noeq type getTrait_t (self : Type0) = { tW : Type0; get_w : self -> result tW; } (** [traits::test_get_trait]: - Source: 'src/traits.rs', lines 309:0-309:49 *) + Source: 'src/traits.rs', lines 305:0-305:49 *) let test_get_trait (t : Type0) (getTraitTInst : getTrait_t t) (x : t) : result getTraitTInst.tW |