Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

123, 126 fix #20

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading