Skip to content

Commit

Permalink
7,10,36,52,72,118 fixes in markup
Browse files Browse the repository at this point in the history
  • Loading branch information
alex28sh committed Nov 4, 2024
1 parent 1f2a266 commit bb30d05
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 45 deletions.
12 changes: 4 additions & 8 deletions Bench/007-filter_by_substring.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ def checkSubstring(s : List[int], sub : List[int]) -> bool:
# post-conditions-end

# impl-start
result = False # type : bool
result = False
result : bool = False
if (len(sub)) == (0):
result = True
elif (len(s)) >= (len(sub)):
d_0_i_ = int(0) # type : int
d_0_i_ = 0
d_0_i_ : int = 0
while (d_0_i_) <= ((len(s)) - (len(sub))):
# invariants-start
Invariant(Acc(list_pred(s), 1/2))
Expand Down Expand Up @@ -90,8 +88,7 @@ def filter__by__substring(strings : List[List[int]], substring : List[int]) -> L

# impl-start
res : List[List[int]] = []
d_2_i_ = int(0) # type : int
d_2_i_ = 0
d_2_i_ : int = 0
while (d_2_i_) < (len(strings)):
# invariants-start
Invariant(Acc(list_pred(res)))
Expand All @@ -104,8 +101,7 @@ def filter__by__substring(strings : List[List[int]], substring : List[int]) -> L
Invariant(Forall(int, lambda d_3_i_:
(Implies(0 <= d_3_i_ and d_3_i_ < len(res), InArray(strings, res[d_3_i_])), [[InArray(strings, res[d_3_i_])]])))
# invariants-end
d_4_check_ = False # type : bool
d_4_check_ = checkSubstring((strings)[d_2_i_], substring)
d_4_check_ : bool = checkSubstring((strings)[d_2_i_], substring)
if d_4_check_:
cpy = list((strings)[d_2_i_])
res = (res) + [cpy]
Expand Down
20 changes: 8 additions & 12 deletions Bench/010-is_palindrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ def is__palindrome(start : int, s : List[int]) -> bool:
# post-conditions-end

# impl-start
d_1_i_ = int(0) # type : int
d_1_i_ = start
d_2_j_ = int(0) # type : int
d_2_j_ = (len(s)) - (1)
d_1_i_ : int = start
d_2_j_ : int = (len(s)) - (1)
while (d_1_i_) < (d_2_j_):
# invariants-start
Invariant(Acc(list_pred(s), 1/2))
Expand Down Expand Up @@ -76,12 +74,12 @@ def make__palindrome(s : List[int]) -> List[int]:
# post-conditions-end

# impl-start
result = list([int(0)] * 0) # type : List[int]
result : List[int] = list([int(0)] * 0)
if (len(s)) == (0):
result = []
return result
d_6_beginning__of__suffix_ = int(0) # type : int
d_8_flag_ = is__palindrome(d_6_beginning__of__suffix_, s) # type : bool
d_6_beginning__of__suffix_ : int = int(0)
d_8_flag_ : bool = is__palindrome(d_6_beginning__of__suffix_, s)
while not(d_8_flag_):
# invariants-start
Invariant(Acc(list_pred(s)))
Expand All @@ -91,7 +89,7 @@ def make__palindrome(s : List[int]) -> List[int]:
# invariants-end
d_6_beginning__of__suffix_ = (d_6_beginning__of__suffix_) + (1)
d_8_flag_ = is__palindrome(d_6_beginning__of__suffix_, s)
d_10_reversed_ = reverse(d_6_beginning__of__suffix_, s) # type : List[int]
d_10_reversed_ : List[int] = reverse(d_6_beginning__of__suffix_, s)
result = (s) + (d_10_reversed_)
return result
# impl-end
Expand All @@ -112,10 +110,8 @@ def reverse(end : int, 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_) < (end):
# invariants-start
Invariant(Acc(list_pred(str), 1/2))
Expand Down
15 changes: 5 additions & 10 deletions Bench/036-fizz_buzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ def fizz__buzz(n : int) -> int:
# post-conditions-end

# impl-start
result = int(0) # type : int
result = 0
d_1_i_ = int(0) # type : int
d_1_i_ = 0
result : int = 0
d_1_i_ : int = 0
while (d_1_i_) < (n):
# invariants-start
Invariant(((0) <= (d_1_i_)) and ((d_1_i_) <= (n)))
Expand All @@ -23,8 +21,7 @@ def fizz__buzz(n : int) -> int:
Invariant(result == fizz_buzz_fun(d_1_i_))
# invariants-end
if (((d_1_i_ % 11)) == (0)) or (((d_1_i_ % 13)) == (0)):
d_4_cnt_ = int(0) # type : int
d_4_cnt_ = count7(d_1_i_)
d_4_cnt_ : int = count7(d_1_i_)
result = (result) + (d_4_cnt_)
d_1_i_ = (d_1_i_) + (1)
return result
Expand Down Expand Up @@ -57,10 +54,8 @@ def count7(x : int) -> int:
# post-conditions-end

# impl-start
count = int(0) # type : int
count = 0
d_6_y_ = int(0) # type : int
d_6_y_ = x
count : int = 0
d_6_y_ : int = x
while (d_6_y_) > (0):
# invariants-start
Invariant(((0) <= (d_6_y_)) and ((d_6_y_) <= (x)))
Expand Down
6 changes: 2 additions & 4 deletions Bench/052-below-threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ def below__threshold(l : List[int], t : int) -> bool:
# post-conditions-end

# impl-start
b = False # type : bool
b = True
d_1_i_ = int(0) # type : int
d_1_i_ = 0
b : bool = True
d_1_i_ : int = 0
while (d_1_i_) < (len(l)):
# invariants-start
Invariant(Acc(list_pred(l)))
Expand Down
12 changes: 4 additions & 8 deletions Bench/072-will_it_fly.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ def will__it__fly(s : List[int], w : int) -> bool:
# post-conditions-end

# impl-start
result = False # type : bool
result = True
d_0_i_ = int(0) # type : int
d_0_i_ = 0
d_1_j_ = int(0) # type : int
d_1_j_ = (len(s)) - (1)
result : bool = True
d_0_i_ : int = 0
d_1_j_ : int = (len(s)) - (1)
while (d_0_i_) < (d_1_j_):
# invariants-start
Invariant(Acc(list_pred(s)))
Expand All @@ -32,8 +29,7 @@ def will__it__fly(s : List[int], w : int) -> bool:
return result
d_0_i_ = (d_0_i_) + (1)
d_1_j_ = (d_1_j_) - (1)
d_3_total_ = int(0) # type : int
d_3_total_ = 0
d_3_total_ : int = 0
d_0_i_ = 0
while (d_0_i_) < (len(s)):
# invariants-start
Expand Down
5 changes: 2 additions & 3 deletions Bench/118-get_closest_vowel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ def get__closest__vowel(word : List[int]) -> List[int]:
# post-conditions-end

# impl-start
result = list([int(0)] * 0) # type : List[int]
result : List[int] = list([int(0)] * 0)
if (len(word)) < (3):
result = []
return result
d_5_i_ = int(0) # type : int
d_5_i_ = (len(word)) - (2)
d_5_i_ : int = (len(word)) - (2)
while (d_5_i_) > (0):
# invariants-start
Invariant(Acc(list_pred(word)))
Expand Down

0 comments on commit bb30d05

Please sign in to comment.