Created
April 7, 2024 07:48
-
-
Save pschanely/1b2b03acd505422a4e90aff214c93a63 to your computer and use it in GitHub Desktop.
Shared via CrossHair Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def func_source(x: list[int]) -> list[int]: | |
return [x[0], -1] | |
def func_sink(x: list[int]) -> bool: | |
return x[1] > 0 | |
def func_safe(x: list[int]) -> list[int]: | |
return [x[0], 1] | |
def func_1(x: list[int]) -> list[int]: | |
if x[0] > 0: | |
return func_source(x) | |
else: | |
return func_safe(x) | |
def func_2(x: list[int]) -> bool: | |
''' | |
pre: len(x) == 2 | |
post: __return__ == True | |
''' | |
while x[0] > 0: | |
x[0] = func_1(x)[0] - 1 | |
x[1] = func_1(x)[1] | |
x = func_1(x) | |
return func_sink(x) | |
def func_3(x: list[int]) -> bool: | |
''' | |
pre: len(x) == 2 | |
post: __return__ == False | |
''' | |
while x[0] <= 0: | |
x[0] = func_1(x)[0] + 1 | |
x[1] = func_1(x)[1] | |
x = func_1(x) | |
return func_sink(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment