diff --git a/Bench/055-fib.py b/Bench/055-fib.py index 9da57ec..c2f1d6c 100644 --- a/Bench/055-fib.py +++ b/Bench/055-fib.py @@ -29,29 +29,23 @@ def ComputeFib(n : int) -> int: # post-conditions-end # impl-start - result = int(0) # type : int + result : int = int(0) if (n) == (0): result = 0 return result if (n) == (1): result = 1 return result - d_0_a_ = int(0) # type : int - d_1_b_ = int(0) # type : int - rhs0_ = 0 # type : int - rhs1_ = 1 # type : int - d_0_a_ = rhs0_ - d_1_b_ = rhs1_ - d_2_i_ = int(0) # type : int - d_2_i_ = 2 + d_0_a_ : int = 0 + d_1_b_ : int = 1 + d_2_i_ : int = 2 while (d_2_i_) <= (n): # invariants-start Invariant(((2) <= (d_2_i_)) and ((d_2_i_) <= ((n) + (1)))) Invariant((d_0_a_) == (fib((d_2_i_) - (2)))) Invariant((d_1_b_) == (fib((d_2_i_) - (1)))) # invariants-end - d_3_temp_ = int(0) # type : int - d_3_temp_ = (d_0_a_) + (d_1_b_) + d_3_temp_ : int = (d_0_a_) + (d_1_b_) d_0_a_ = d_1_b_ d_1_b_ = d_3_temp_ d_2_i_ = (d_2_i_) + (1) diff --git a/Bench/057-monotonic.py b/Bench/057-monotonic.py index dd5ca34..aa8fd4c 100644 --- a/Bench/057-monotonic.py +++ b/Bench/057-monotonic.py @@ -16,16 +16,11 @@ def monotonic(xs : List[int]) -> bool: # post-conditions-end # impl-start - result = False # type : bool if (len(xs)) == (1): - result = True - return result - d_4_increasing_ = False # type : bool - d_4_increasing_ = True - d_5_decreasing_ = False # type : bool - d_5_decreasing_ = True - d_6_i_ = int(0) # type : int - d_6_i_ = 1 + return True + d_4_increasing_ : bool = True + d_5_decreasing_ : bool = True + d_6_i_ : int = 1 while (d_6_i_) < (len(xs)): # invariants-start Invariant(Acc(list_pred(xs))) @@ -42,6 +37,6 @@ def monotonic(xs : List[int]) -> bool: if ((xs)[(d_6_i_) - (1)]) <= ((xs)[d_6_i_]): d_5_decreasing_ = False d_6_i_ = (d_6_i_) + (1) - result = (d_4_increasing_) or (d_5_decreasing_) + result : bool = (d_4_increasing_) or (d_5_decreasing_) return result # impl-end \ No newline at end of file diff --git a/Bench/058-common.py b/Bench/058-common.py index 402978a..7f05122 100644 --- a/Bench/058-common.py +++ b/Bench/058-common.py @@ -53,8 +53,7 @@ def common(l1 : List[int], l2 : List[int]) -> List[int]: Invariant(Forall(int, lambda d_0_i_: (Implies((d_0_i_) >= 0 and d_0_i_ < len(c), ExistsBoth(l1, l2, c[d_0_i_])), [[ExistsBoth(l1, l2, c[d_0_i_])]]))) # invariants-end - d_5_j_ = int(0) # type : int - d_5_j_ = 0 + d_5_j_ : int = 0 while (d_5_j_) < (len(l2)): # invariants-start Invariant(Acc(list_pred(c))) diff --git a/Bench/064-vowel_count.py b/Bench/064-vowel_count.py index 81d1399..e7a1d5d 100644 --- a/Bench/064-vowel_count.py +++ b/Bench/064-vowel_count.py @@ -12,10 +12,8 @@ def vowel__count(s : List[int]) -> int: # post-conditions-end # impl-start - count = int(0) # type : int - count = 0 - d_1_i_ = int(0) # type : int - d_1_i_ = 0 + count : int = 0 + d_1_i_ : int = 0 while (d_1_i_) < (len(s)): # invariants-start Invariant(Acc(list_pred(s))) diff --git a/Bench/066-digitSum.py b/Bench/066-digitSum.py index 25f3e78..a5d7026 100644 --- a/Bench/066-digitSum.py +++ b/Bench/066-digitSum.py @@ -34,6 +34,7 @@ def upper__sum(s : List[int]) -> int: Invariant(Forall(int, lambda d_0_i_: (Implies(((0) <= (d_0_i_)) and ((d_0_i_) < (len(s))), upper__sum__rec(0, d_0_i_ + 1, s) == upper__sum__rec(0, d_0_i_, s) + s[d_0_i_]), [[upper__sum__rec(0, d_1_i_ + 1, s)]]))) Invariant((res) == (upper__sum__rec(0, d_1_i_, s))) # invariants-end + Assert(upper__sum__rec(0, d_1_i_ + 1, s) == upper__sum__rec(0, d_1_i_, s) + s[d_1_i_]) res = (res) + (((s)[d_1_i_])) d_1_i_ = (d_1_i_) + (1) return res diff --git a/Bench/083-starts_one_ends.py b/Bench/083-starts_one_ends.py index 2df5685..c9527ce 100644 --- a/Bench/083-starts_one_ends.py +++ b/Bench/083-starts_one_ends.py @@ -11,7 +11,7 @@ def CountNumbersStartingOrEndingWithOne(n : int) -> int: # post-conditions-end # impl-start - count = int(0) # type : int + count : int = int(0) if (n) == (1): count = 1 elif True: diff --git a/Bench/092-any_int.py b/Bench/092-any_int.py index 2f04970..eeb2016 100644 --- a/Bench/092-any_int.py +++ b/Bench/092-any_int.py @@ -6,7 +6,5 @@ def any__int(a : int, b : int, c : int) -> bool: # post-conditions-end # impl-start - r = False # type : bool - r = (((a) == ((b) + (c))) or ((b) == ((a) + (c)))) or ((c) == ((a) + (b))) - return r + return (((a) == ((b) + (c))) or ((b) == ((a) + (c)))) or ((c) == ((a) + (b))) # impl-end \ No newline at end of file diff --git a/Bench/108-count_nums.py b/Bench/108-count_nums.py index 1b78676..f4717ad 100644 --- a/Bench/108-count_nums.py +++ b/Bench/108-count_nums.py @@ -11,10 +11,8 @@ def count__nums(s : List[int]) -> int: # post-conditions-end # impl-start - cnt = int(0) # type : int - cnt = 0 - d_1_i_ = int(0) # type : int - d_1_i_ = 0 + cnt : int = 0 + d_1_i_ : int = 0 while (d_1_i_) < (len(s)): # invariants-start Invariant(Acc(list_pred(s))) diff --git a/Bench/122-add_elements.py b/Bench/122-add_elements.py index acded76..23cacb7 100644 --- a/Bench/122-add_elements.py +++ b/Bench/122-add_elements.py @@ -27,10 +27,8 @@ def SumElementsWithAtMostTwoDigits(lst : List[int], k : int) -> int: # post-conditions-end # impl-start - sum = int(0) # type : int - sum = 0 - d_3_i_ = int(0) # type : int - d_3_i_ = 0 + sum : int = 0 + d_3_i_ : int = 0 while d_3_i_ < k: # invariants-start Invariant(Acc(list_pred(lst))) diff --git a/Bench/123-get_odd_collatz.py b/Bench/123-get_odd_collatz.py index 4ff7280..4107008 100644 --- a/Bench/123-get_odd_collatz.py +++ b/Bench/123-get_odd_collatz.py @@ -48,11 +48,10 @@ def next__odd__collatz__iter(n : int) -> int: # post-conditions-end # impl-start - next = int(0) # type : int - next = n + next : int = n if ((next % 2)) == (1): next = ((3) * (next)) + (1) - d_0_start_ = next # type : int + d_0_start_ : int = next while ((next % 2)) == (0): # invariants-start Invariant((next) > (0)) @@ -79,9 +78,8 @@ def get__odd__collatz__unsorted(n : int) -> List[int]: not (((1) <= (d_2_i_)) and ((d_2_i_) < (len(Result())))) or (((Result())[d_2_i_]) == (next__odd__collatz((Result())[(d_2_i_) - (1)]))))) # post-conditions-end # impl-start - odd__collatz = list([int(0)] * 0) # type : List[int] - d_3_cur_ = int(0) # type : int - d_3_cur_ = n + odd__collatz : List[int] = [] + d_3_cur_ : int = n if ((d_3_cur_ % 2)) == (0): d_3_cur_ = next__odd__collatz__iter(d_3_cur_) odd__collatz = [d_3_cur_] @@ -128,11 +126,10 @@ def get__odd__collatz(n : int) -> List[int]: # post-conditions-end # impl-start - sorted = list([int(0)] * 0) # type : List[int] + sorted : List[int] = [] sorted = get__odd__collatz__unsorted(n) - d_12_unsorted_ = list(sorted) # type : List[int] - d_9_i_ = int(0) # type : int - d_9_i_ = 0 + d_12_unsorted_ : List[int] = list(sorted) + d_9_i_ : int = 0 while (d_9_i_) < (len(sorted)): # invariants-start Invariant(Acc(list_pred(sorted))) @@ -152,10 +149,8 @@ def get__odd__collatz(n : int) -> List[int]: (not ((((d_9_i_) <= (d_13_k_)) and ((d_13_k_) < (len(sorted))))) or (((sorted)[d_12_j_]) <= ((sorted)[d_13_k_])), [[sorted[d_13_k_]]]))), [[(sorted)[d_12_j_]]]))) # invariants-end - d_15_minIndex_ = int(0) # type : int - d_15_minIndex_ = d_9_i_ - d_16_j_ = int(0) # type : int - d_16_j_ = (d_9_i_) + (1) + d_15_minIndex_ : int = d_9_i_ + d_16_j_ : int = (d_9_i_) + (1) while (d_16_j_) < (len(sorted)): # invariants-start Invariant(Acc(list_pred(sorted))) @@ -182,7 +177,7 @@ def get__odd__collatz(n : int) -> List[int]: d_15_minIndex_ = d_16_j_ d_16_j_ = (d_16_j_) + (1) if (d_15_minIndex_) != (d_9_i_): - rhs0_ = (sorted)[d_9_i_] # type : int + rhs0_ : int = (sorted)[d_9_i_] (sorted)[d_9_i_] = (sorted)[d_15_minIndex_] (sorted)[d_15_minIndex_] = rhs0_ d_9_i_ = (d_9_i_) + (1) diff --git a/Bench/142-sum_squares.py b/Bench/142-sum_squares.py index a4f6878..848636f 100644 --- a/Bench/142-sum_squares.py +++ b/Bench/142-sum_squares.py @@ -36,10 +36,8 @@ def sum__squares(lst : List[int]) -> int: # post-conditions-end # impl-start - r = int(0) # type : int - r = 0 - d_2_k_ = int(0) # type : int - d_2_k_ = 0 + r : int = 0 + d_2_k_ : int = 0 while (d_2_k_) < (len(lst)): # invariants-start Invariant(Acc(list_pred(lst)))