Skip to content

Commit

Permalink
Merge pull request #20 from JetBrains-Research/123,126
Browse files Browse the repository at this point in the history
123, 126 fix
  • Loading branch information
alex28sh authored Nov 3, 2024
2 parents 2e87838 + 1f2a266 commit e86eb18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Bench/123-get_odd_collatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def get__odd__collatz__unsorted(n : int) -> List[int]:
Ensures(Forall(int, lambda d_2_i_:
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
Expand Down Expand Up @@ -109,6 +110,8 @@ def get__odd__collatz__unsorted(n : int) -> List[int]:
(not (((1) <= (d_5_i_)) and ((d_5_i_) < (len(odd__collatz)))) or (((odd__collatz)[d_5_i_]) == (next__odd__collatz((odd__collatz)[(d_5_i_) - (1)]))), [[next__odd__collatz((odd__collatz)[(d_5_i_) - (1)])]])))
# assert-end
return odd__collatz
# impl-end



def get__odd__collatz(n : int) -> List[int]:
Expand Down
4 changes: 4 additions & 0 deletions Bench/126-is_sorted.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def is__sorted(a : List[int]) -> bool:
and (Forall(int, lambda d_2_i_:
not (((0) <= (d_2_i_)) and ((d_2_i_) < (len(a)))) or ((count_set(a, (a)[d_2_i_], 0)) <= (2))))))
# post-conditions-end
# impl-start
f = False # type : bool
if (len(a)) == (0):
f = True
Expand Down Expand Up @@ -66,13 +67,16 @@ def is__sorted(a : List[int]) -> bool:
d_4_i_ = (d_4_i_) + (1)
f = d_7_has__no__more__that__2_
return f
# impl-end

@Pure
def count_set(a : List[int], x : int, i : int) -> int:
# pre-conditions-start
Requires(Acc(list_pred(a), 1/2))
Requires(((0) <= (i)) and ((i) <= (len(a))))
# pre-conditions-end
# post-conditions-start
# post-conditions-end

# impl-start
if (i) == 0:
Expand Down

0 comments on commit e86eb18

Please sign in to comment.