diff options
author | Son Ho | 2023-01-04 21:17:30 +0100 |
---|---|---|
committer | Son HO | 2023-02-03 11:21:46 +0100 |
commit | f3eb7aed4082e8f014d03c3c6045852687989a5b (patch) | |
tree | 51b0dcbef16cdfbb41427e4731ca497ae2bb3407 /tests/fstar/misc/Loops.Clauses.fst | |
parent | 0f0cfff07333a4e7762443e261ae9141ce373e54 (diff) |
Implement support for nested borrows in loops, and add loop tests
Diffstat (limited to '')
-rw-r--r-- | tests/fstar/misc/Loops.Clauses.fst | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/tests/fstar/misc/Loops.Clauses.fst b/tests/fstar/misc/Loops.Clauses.fst index d315a4f0..9cf5db1f 100644 --- a/tests/fstar/misc/Loops.Clauses.fst +++ b/tests/fstar/misc/Loops.Clauses.fst @@ -9,25 +9,70 @@ open Loops.Types unfold let sum_decreases (max : u32) (i : u32) (s : u32) : nat = if i <= max then max - i else 0 +(** [loops::sum_with_mut_borrows]: decreases clause *) +unfold +let sum_with_mut_borrows_decreases (max : u32) (mi : u32) (ms : u32) : nat = + if max >= mi then max - mi else 0 -(** [loops::sum_with_borrows]: decreases clause *) +(** [loops::sum_with_shared_borrows]: decreases clause *) unfold -let sum_with_borrows_decreases (max : u32) (mi : u32) (ms : u32) : nat = - if mi <= max then max - mi else 0 +let sum_with_shared_borrows_decreases (max : u32) (i : u32) (s : u32) : nat = + if max >= i then max - i else 0 (** [loops::list_nth_mut_loop]: decreases clause *) unfold let list_nth_mut_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = i +(** [loops::list_nth_shared_loop]: decreases clause *) +unfold +let list_nth_shared_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : list_t t = + ls + (** [loops::list_nth_mut_loop_pair]: decreases clause *) unfold let list_nth_mut_loop_pair_decreases (t : Type0) (l : list_t t) (l0 : list_t t) (i : u32) : nat = i +(** [loops::list_nth_shared_loop_pair]: decreases clause *) +unfold +let list_nth_shared_loop_pair_decreases (t : Type0) (l : list_t t) + (l0 : list_t t) (i : u32) : list_t t = + l + (** [loops::list_nth_mut_loop_pair_merge]: decreases clause *) unfold let list_nth_mut_loop_pair_merge_decreases (t : Type0) (l : list_t t) (l0 : list_t t) (i : u32) : nat = i + +(** [loops::list_nth_shared_loop_pair_merge]: decreases clause *) +unfold +let list_nth_shared_loop_pair_merge_decreases (t : Type0) (l : list_t t) + (l0 : list_t t) (i : u32) : list_t t = + l + +(** [loops::list_nth_mut_shared_loop_pair]: decreases clause *) +unfold +let list_nth_mut_shared_loop_pair_decreases (t : Type0) (l : list_t t) + (l0 : list_t t) (i : u32) : list_t t = + l + +(** [loops::list_nth_mut_shared_loop_pair_merge]: decreases clause *) +unfold +let list_nth_mut_shared_loop_pair_merge_decreases (t : Type0) (l : list_t t) + (l0 : list_t t) (i : u32) : list_t t = + l + +(** [loops::list_nth_shared_mut_loop_pair]: decreases clause *) +unfold +let list_nth_shared_mut_loop_pair_decreases (t : Type0) (l : list_t t) + (l0 : list_t t) (i : u32) : list_t t = + l + +(** [loops::list_nth_shared_mut_loop_pair_merge]: decreases clause *) +unfold +let list_nth_shared_mut_loop_pair_merge_decreases (t : Type0) (l : list_t t) + (l0 : list_t t) (i : u32) : list_t t = + l |