diff --git a/Bench/003-below-zero.py b/Bench/003-below-zero.py index 86c3c40..14f432d 100644 --- a/Bench/003-below-zero.py +++ b/Bench/003-below-zero.py @@ -28,11 +28,8 @@ def below__zero(ops : List[int]) -> bool: # post-conditions-end # impl-start - res = False # type : bool - d_3_balance_ = int(0) # type : int - d_3_balance_ = 0 - d_4_i_ = int(0) # type : int - d_4_i_ = 0 + d_3_balance_ : int = 0 + d_4_i_ : int = 0 while (d_4_i_) < (len(ops)): # invariants-start @@ -50,10 +47,8 @@ def below__zero(ops : List[int]) -> bool: d_3_balance_ = (d_3_balance_) + ((ops)[d_4_i_]) if (d_3_balance_) < (0): - res = False - return res + return False d_4_i_ = (d_4_i_) + (1) - - res = True - return res + + return True # impl-end \ No newline at end of file diff --git a/Bench/016-count_distinct_characters.py b/Bench/016-count_distinct_characters.py index 144badb..11a6f3f 100644 --- a/Bench/016-count_distinct_characters.py +++ b/Bench/016-count_distinct_characters.py @@ -48,8 +48,8 @@ def count_distinct_characters(s : List[int]) -> int: # post-conditions-end # impl-start - c = int(0) # type : int - d_2_i_ = int(97) # type : int + c : int = int(0) + d_2_i_ : int = int(97) while (d_2_i_) <= (122): # invariants-start Invariant(Acc(list_pred(s))) diff --git a/Bench/033-sort_third.py b/Bench/033-sort_third.py index 1afc3ca..b45b8c5 100644 --- a/Bench/033-sort_third.py +++ b/Bench/033-sort_third.py @@ -18,11 +18,9 @@ def sort__third(a : List[int]) -> List[int]: # post-conditions-end # impl-start - sorted__even = list([int(0)] * 0) # type : List[int] - d_3_p_ = list([False] * 0) # type : List[bool] - d_3_p_ = list([]) - d_4_i_ = int(0) # type : int - d_4_i_ = 0 + sorted__even : List[int] = [] + d_3_p_ : List[bool] = list([]) + d_4_i_ : int = 0 while (d_4_i_) < (len(a)): # invariants-start Invariant(Acc(list_pred(d_3_p_))) @@ -59,10 +57,8 @@ def SortSeqPred(s : List[int], p : List[bool]) -> List[int]: # post-conditions-end # impl-start - sorted = list([int(0)] * 0) # type : List[int] - sorted = list(s) - d_9_i_ = int(0) # type : int - d_9_i_ = 0 + sorted : List[int] = list(s) + d_9_i_ : int = 0 while (d_9_i_) < (len(sorted)): # invariants-start Invariant(Acc(list_pred(sorted))) @@ -84,10 +80,8 @@ def SortSeqPred(s : List[int], p : List[bool]) -> List[int]: (((sorted)[d_12_j_]) <= ((sorted)[d_13_k_])), [[sorted[d_13_k_]]]))), [[(sorted)[d_12_j_]]]))) # invariants-end if (p)[d_9_i_]: - 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))) @@ -121,7 +115,7 @@ def SortSeqPred(s : List[int], p : List[bool]) -> List[int]: Assert((p)[d_15_minIndex_]) Assert(p[d_9_i_]) # assert-end - 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/042-incr-list.py b/Bench/042-incr-list.py index cc55e68..dd6d6bf 100644 --- a/Bench/042-incr-list.py +++ b/Bench/042-incr-list.py @@ -14,10 +14,8 @@ def incr__list(l : List[int]) -> List[int]: # post-conditions-end # impl-start - result = list([int(0)] * 0) # type : List[int] - result = list([]) - d_1_i_ = int(0) # type : int - d_1_i_ = 0 + result : List[int] = list([]) + d_1_i_ : int = 0 while (d_1_i_) < (len(l)): # invariants-start Invariant(Acc(list_pred(result))) diff --git a/Bench/048-is-palindrome.py b/Bench/048-is-palindrome.py index f8bd4f8..7c74717 100644 --- a/Bench/048-is-palindrome.py +++ b/Bench/048-is-palindrome.py @@ -12,10 +12,8 @@ def is__palindrome(text : List[int]) -> bool: # post-conditions-end # impl-start - result = False # type : bool - result = True - d_1_i_ = int(0) # type : int - d_1_i_ = 0 + result : bool = True + d_1_i_ : int = 0 while (d_1_i_) < ((len(text) // 2)): # invariants-start Invariant(Acc(list_pred(text))) diff --git a/Bench/049-modp.py b/Bench/049-modp.py index db1dd29..e588828 100644 --- a/Bench/049-modp.py +++ b/Bench/049-modp.py @@ -25,10 +25,8 @@ def modp(n : int, p : int) -> int: # post-conditions-end # impl-start - r = int(0) # type : int - r = (1 % p) - d_0_i_ = int(0) # type : int - d_0_i_ = 0 + r : int = (1 % p) + d_0_i_ : int = 0 while (d_0_i_) < (n): # invariants-start Invariant(((0) <= (d_0_i_)) and ((d_0_i_) <= (n))) diff --git a/Bench/068-pluck.py b/Bench/068-pluck.py index 61018af..7bd0c9c 100644 --- a/Bench/068-pluck.py +++ b/Bench/068-pluck.py @@ -23,12 +23,10 @@ def PluckSmallestEven(nodes : List[int]) -> List[int]: # post-conditions-end # impl-start - result = list([int(0)] * 0) # type : List[int] - d_4_smallestEven_ = int(0) # type : int - d_4_smallestEven_ = -1 - d_5_smallestIndex_ = int(0) # type : int - d_5_smallestIndex_ = -1 - d_6_i_ = int(0) # type : int + result : List[int] = [] + d_4_smallestEven_ : int = -1 + d_5_smallestIndex_ : int = -1 + d_6_i_ : int = int(0) while d_6_i_ < len(nodes): # invariants-start Invariant(Acc(list_pred(result))) diff --git a/Bench/073-smallest_change.py b/Bench/073-smallest_change.py index 6927c5f..56041ef 100644 --- a/Bench/073-smallest_change.py +++ b/Bench/073-smallest_change.py @@ -31,10 +31,8 @@ def smallest__change(s : List[int]) -> int: # post-conditions-end # impl-start - c = int(0) # type : int - c = 0 - d_1_i_ = int(0) # type : int - d_1_i_ = 0 + c : int = 0 + d_1_i_ : int = 0 while (d_1_i_) < ((len(s) // 2)): # invariants-start Invariant(Acc(list_pred(s))) diff --git a/Bench/078-hex_key.py b/Bench/078-hex_key.py index 12cd19c..31fc617 100644 --- a/Bench/078-hex_key.py +++ b/Bench/078-hex_key.py @@ -33,10 +33,8 @@ def count__prime__hex__digits(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/080-is_happy.py b/Bench/080-is_happy.py index ad6b458..8228b58 100644 --- a/Bench/080-is_happy.py +++ b/Bench/080-is_happy.py @@ -33,12 +33,9 @@ def IsHappy(s : List[int]) -> bool: # post-conditions-end # impl-start - happy = False # type : bool if (len(s)) < (3): - happy = False - return happy - d_1_i_ = int(0) # type : int - d_1_i_ = 1 + return False + d_1_i_ : int = 1 while (d_1_i_) < ((len(s)) - (1)): # invariants-start Invariant(Acc(list_pred(s))) @@ -48,9 +45,7 @@ def IsHappy(s : List[int]) -> bool: Implies(((0) < (d_2_j_)) and ((d_2_j_) < (d_1_i_)), ThreeDistinct(s, d_2_j_)))) # invariants-end if not(ThreeDistinct(s, d_1_i_)): - happy = False - return happy + return False d_1_i_ = (d_1_i_) + (1) - happy = True - return happy + return True # impl-end diff --git a/Bench/088-sort_array.py b/Bench/088-sort_array.py index 3da865f..39dfc99 100644 --- a/Bench/088-sort_array.py +++ b/Bench/088-sort_array.py @@ -18,7 +18,7 @@ def sort__array(s : List[int]) -> List[int]: # post-conditions-end # impl-start - sorted = list([int(0)] * 0) # type : List[int] + sorted : List[int] = [] if (len(s)) == (0): sorted = list([]) return sorted @@ -26,8 +26,7 @@ def sort__array(s : List[int]) -> List[int]: # assert-start Assert(len(s) > 0) # assert-end - d_4_t_ = list([int(0)] * 0) # type : List[int] - d_4_t_ = BubbleSort(s) + d_4_t_ : List[int] = BubbleSort(s) # assert-start Assert(Forall(int, lambda d_0_i_: Forall(int, lambda d_1_j_: @@ -71,10 +70,8 @@ def reverse(str : List[int]) -> List[int]: # post-conditions-end # impl-start - rev = list([int(0)] * 0) # type : List[int] - rev = [] - d_12_i_ = int(0) # type : int - d_12_i_ = 0 + rev : List[int] = [] + d_12_i_ : int = 0 while (d_12_i_) < (len(str)): # invariants-start Invariant(Acc(list_pred(str), 1/2)) @@ -106,9 +103,8 @@ def BubbleSort(a1 : List[int]) -> List[int]: # post-conditions-end # impl-start - a = list(a1) # type : List[int] - d_2_i_ = int(0) # type : int - d_2_i_ = (len((a))) - (1) + a : List[int] = list(a1) + d_2_i_ : int = (len((a))) - (1) while (d_2_i_) > (0): # invariants-start Invariant(Acc(list_pred(a))) @@ -127,8 +123,7 @@ def BubbleSort(a1 : List[int]) -> List[int]: [[(a)[d_6_k_k_]]])), [[(a)[d_5_k_]]]))) # invariants-end - d_7_j_ = int(0) # type : int - d_7_j_ = 0 + d_7_j_ : int = 0 while (d_7_j_) < (d_2_i_): # invariants-start Invariant(Acc(list_pred(a))) @@ -150,7 +145,7 @@ def BubbleSort(a1 : List[int]) -> List[int]: [[(a)[d_12_k_]]]))) # invariants-end if ((a)[d_7_j_]) > ((a)[(d_7_j_) + (1)]): - rhs0_ = (a)[(d_7_j_) + (1)] # type : int + rhs0_ : int = (a)[(d_7_j_) + (1)] (a)[(d_7_j_) + (1)] = (a)[d_7_j_] (a)[d_7_j_] = rhs0_ d_7_j_ = (d_7_j_) + (1) diff --git a/Bench/104-unique_digits.py b/Bench/104-unique_digits.py index 016b73f..909dfb0 100644 --- a/Bench/104-unique_digits.py +++ b/Bench/104-unique_digits.py @@ -48,8 +48,7 @@ def UniqueDigits(x : List[int]) -> List[int]: # post-conditions-end # impl-start - result = list([int(0)] * 0) # type : List[int] - result = list([]) + result : List[int] = [] d_5_i_ = 0 while d_5_i_ < len(x): @@ -75,8 +74,7 @@ def UniqueDigits(x : List[int]) -> List[int]: if HasNoEvenDigit((x)[d_5_i_]): result = (result) + [(x)[d_5_i_]] d_5_i_ = (d_5_i_) + (1) - d_9_i_ = int(0) # type : int - d_9_i_ = 0 + d_9_i_ : int = 0 while (d_9_i_) < (len(result)): # invariants-start Invariant(Acc(list_pred(result))) @@ -111,10 +109,8 @@ def UniqueDigits(x : List[int]) -> List[int]: [[result[d_13_k_]]]))), [[(result)[d_12_j_]]]))) # invariants-end - d_17_minIndex_ = int(0) # type : int - d_17_minIndex_ = d_9_i_ - d_18_j_ = int(0) # type : int - d_18_j_ = (d_9_i_) + (1) + d_17_minIndex_ : int = d_9_i_ + d_18_j_ : int = (d_9_i_) + (1) while (d_18_j_) < (len(result)): # invariants-start Invariant(Acc(list_pred(result))) @@ -157,8 +153,7 @@ def UniqueDigits(x : List[int]) -> List[int]: d_17_minIndex_ = d_18_j_ d_18_j_ = (d_18_j_) + (1) if (d_17_minIndex_) != (d_9_i_): - d_20_temp_ = int(0) # type : int - d_20_temp_ = (result)[d_9_i_] + d_20_temp_ : int = (result)[d_9_i_] # assert-start Assert(HasNoEvenDigit((result)[d_17_minIndex_])) # assert-end diff --git a/Bench/121-solution.py b/Bench/121-solution.py index a8dbebc..312d6e9 100644 --- a/Bench/121-solution.py +++ b/Bench/121-solution.py @@ -25,10 +25,8 @@ def add(v : 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(v)): # invariants-start Invariant(Acc(list_pred(v))) diff --git a/Bench/151-double_the_difference.py b/Bench/151-double_the_difference.py index 22b9698..b0adb19 100644 --- a/Bench/151-double_the_difference.py +++ b/Bench/151-double_the_difference.py @@ -35,10 +35,8 @@ def double__the__difference(lst : List[int]) -> int: # post-conditions-end # impl-start - r = int(0) # type : int - r = 0 - d_3_k_ = int(0) # type : int - d_3_k_ = 0 + r : int = 0 + d_3_k_ : int = 0 while (d_3_k_) < (len(lst)): # invariants-start Invariant(Acc(list_pred(lst))) diff --git a/Bench/152-compare.py b/Bench/152-compare.py index 8f675f2..71810e1 100644 --- a/Bench/152-compare.py +++ b/Bench/152-compare.py @@ -18,11 +18,8 @@ def Compare(scores : List[int], guesses : List[int]) -> List[int]: # post-conditions-end # impl-start - result = [int(0)] * 0 # type : List[int] - nw0_ = [int(0)] * len((scores)) # type : List[int] - result = nw0_ - d_1_i_ = int(0) # type : int - d_1_i_ = 0 + result : List[int] = [int(0)] * len((scores)) + d_1_i_ : int = 0 while (d_1_i_) < (len((scores))): # invariants-start Invariant(Acc(list_pred(result))) diff --git a/Bench/154-cycpattern_check.py b/Bench/154-cycpattern_check.py index e5b9cdf..9f4046b 100644 --- a/Bench/154-cycpattern_check.py +++ b/Bench/154-cycpattern_check.py @@ -29,9 +29,7 @@ def CycpatternCheck(word : List[int], pattern : List[int]) -> bool: # post-conditions-end # impl-start - result = False # type : bool - d_3_i_ = int(0) # type : int - d_3_i_ = 0 + d_3_i_ : int = 0 while (d_3_i_) <= (len(pattern)): # invariants-start Invariant(Acc(list_pred(word))) @@ -41,9 +39,7 @@ def CycpatternCheck(word : List[int], pattern : List[int]) -> bool: (Implies(((0) <= (d_4_j_)) and ((d_4_j_) < (d_3_i_)), not(IsSubstring(word, pattern, d_4_j_))), [[IsSubstring(word, pattern, d_4_j_)]]))) # invariants-end if IsSubstring(word, pattern, d_3_i_): - result = True - return result + return True d_3_i_ = (d_3_i_) + (1) - result = False - return result + return False # impl-end \ No newline at end of file diff --git a/Bench/159-eat.py b/Bench/159-eat.py index c12b8a6..5280fce 100644 --- a/Bench/159-eat.py +++ b/Bench/159-eat.py @@ -13,7 +13,7 @@ def eat(number : int, need : int, remaining : int) -> List[int]: # post-conditions-end # impl-start - result = list([int(0)] * 2) # type : List[int] + result : List[int] = list([int(0)] * 2) if (remaining) < (need): result[0] = (number) + (remaining) else: