Skip to content

Commit

Permalink
renamed vars
Browse files Browse the repository at this point in the history
  • Loading branch information
alex28sh committed Dec 3, 2024
1 parent 5e23932 commit 8f684a8
Show file tree
Hide file tree
Showing 88 changed files with 2,173 additions and 2,173 deletions.
62 changes: 31 additions & 31 deletions Bench/001-separate-paren-groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,50 +64,50 @@ def IsValidParentheses1(s : List[int], i : int, depth : int) -> bool :
def separate__paren__groups(paren__string : List[int]) -> List[List[int]]:
# pre-conditions-start
Requires(Acc(list_pred(paren__string)))
Requires(Forall(int, lambda d_0_i_:
not (((d_0_i_) >= (0)) and ((d_0_i_) < (len(paren__string)))) or ((((paren__string)[d_0_i_]) == (0)) or (((paren__string)[d_0_i_]) == (1)))))
Requires(Forall(int, lambda d_1_i_:
not (((0) <= (d_1_i_)) and ((d_1_i_) <= (len(paren__string)))) or (IsValidParentheses(paren__string, d_1_i_, 0))))
Requires(Forall(int, lambda i:
not (((i) >= (0)) and ((i) < (len(paren__string)))) or ((((paren__string)[i]) == (0)) or (((paren__string)[i]) == (1)))))
Requires(Forall(int, lambda i:
not (((0) <= (i)) and ((i) <= (len(paren__string)))) or (IsValidParentheses(paren__string, i, 0))))
Requires(IsValidParentheses2(paren__string, 0, 0))
# pre-conditions-end
# post-conditions-start
Ensures(Acc(list_pred(ResultT(List[List[int]]))))
Ensures(Forall(ResultT(List[List[int]]), lambda x: Acc(list_pred(x), 1/2)))
Ensures((Forall(int, lambda d_2_i_:
not (((0) <= (d_2_i_)) and ((d_2_i_) < (len(Result())))) or (IsValidParentheses1((Result())[d_2_i_], 0, 0)))))
Ensures((Forall(int, lambda i:
not (((0) <= (i)) and ((i) < (len(Result())))) or (IsValidParentheses1((Result())[i], 0, 0)))))
# post-conditions-end

# impl-start
res : List[List[int]] = []
d_3_current__string_ : List[int] = []
d_4_current__depth_ : int = int(0)
d_5_i_ : int = int(0)
while (d_5_i_) < (len(paren__string)):
current__string : List[int] = []
current__depth : int = int(0)
i : int = int(0)
while (i) < (len(paren__string)):
# invariants-start
Invariant(Acc(list_pred(res)))
Invariant(Acc(list_pred(d_3_current__string_)))
Invariant(Acc(list_pred(current__string)))
Invariant(Acc(list_pred(paren__string)))
Invariant(Forall(res, lambda d_4_i_: Acc(list_pred(d_4_i_), 1/2)))
Invariant(((0) <= (d_5_i_)) and ((d_5_i_) <= (len(paren__string))))
Invariant(Forall(int, lambda d_0_i_:
not (((d_0_i_) >= (0)) and ((d_0_i_) < (len(paren__string)))) or ((((paren__string)[d_0_i_]) == (0)) or (((paren__string)[d_0_i_]) == (1)))))
Invariant(Forall(int, lambda d_1_i_:
not (((0) <= (d_1_i_)) and ((d_1_i_) <= (len(paren__string)))) or (IsValidParentheses(paren__string, d_1_i_, 0))))
Invariant((Forall(int, lambda d_6_i1_:
not (((0) <= (d_6_i1_)) and ((d_6_i1_) < (len(res)))) or (IsValidParentheses1((res)[d_6_i1_], 0, 0)))))
Invariant(IsValidParentheses(paren__string, d_5_i_, 0))
Invariant(Forall(res, lambda i: Acc(list_pred(i), 1/2)))
Invariant(((0) <= (i)) and ((i) <= (len(paren__string))))
Invariant(Forall(int, lambda i:
not (((i) >= (0)) and ((i) < (len(paren__string)))) or ((((paren__string)[i]) == (0)) or (((paren__string)[i]) == (1)))))
Invariant(Forall(int, lambda i:
not (((0) <= (i)) and ((i) <= (len(paren__string)))) or (IsValidParentheses(paren__string, i, 0))))
Invariant((Forall(int, lambda i1:
not (((0) <= (i1)) and ((i1) < (len(res)))) or (IsValidParentheses1((res)[i1], 0, 0)))))
Invariant(IsValidParentheses(paren__string, i, 0))
# invariants-end
d_7_c_ = (paren__string)[d_5_i_]
if (d_7_c_) == (0):
d_4_current__depth_ = (d_4_current__depth_) + (1)
d_3_current__string_ = (d_3_current__string_) + [d_7_c_]
elif (d_7_c_) == (1):
d_4_current__depth_ = (d_4_current__depth_) - (1)
d_3_current__string_ = (d_3_current__string_) + [d_7_c_]
if (d_4_current__depth_) == (0):
res = (res) + [d_3_current__string_]
d_3_current__string_ = []
d_5_i_ = (d_5_i_) + (1)
c = (paren__string)[i]
if (c) == (0):
current__depth = (current__depth) + (1)
current__string = (current__string) + [c]
elif (c) == (1):
current__depth = (current__depth) - (1)
current__string = (current__string) + [c]
if (current__depth) == (0):
res = (res) + [current__string]
current__string = []
i = (i) + (1)
return res
# impl-end

32 changes: 16 additions & 16 deletions Bench/003-below-zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@ def below__zero(ops : List[int]) -> bool:
# pre-conditions-end
# post-conditions-start
Ensures(Acc(list_pred(ops)))
Ensures(not (Result()) or (Forall(int, lambda d_1_i_:
not (((0) <= (d_1_i_)) and ((d_1_i_) <= (len(ops)))) or ((psum(0, d_1_i_, ops)) >= (0)))))
Ensures(not (not(Result())) or (Exists(int, lambda d_2_i_:
(((0) <= (d_2_i_)) and ((d_2_i_) <= (len(ops)))) and ((psum(0, d_2_i_, ops)) < (0)))))
Ensures(not (Result()) or (Forall(int, lambda i:
not (((0) <= (i)) and ((i) <= (len(ops)))) or ((psum(0, i, ops)) >= (0)))))
Ensures(not (not(Result())) or (Exists(int, lambda i:
(((0) <= (i)) and ((i) <= (len(ops)))) and ((psum(0, i, ops)) < (0)))))
# post-conditions-end

# impl-start
d_3_balance_ : int = 0
d_4_i_ : int = 0
balance : int = 0
i : int = 0

while (d_4_i_) < (len(ops)):
while (i) < (len(ops)):
# invariants-start
Invariant(Acc(list_pred(ops)))
Invariant(((0) <= (d_4_i_)) and ((d_4_i_) <= (len(ops))))
Invariant((d_3_balance_) == (psum(0, d_4_i_, ops)))
Invariant(Forall(int, lambda d_2_i_: (not (((0) <= (d_2_i_)) and ((d_2_i_) < (len(ops)))) or ((psum(0, d_2_i_ + 1, ops)) == (psum(0, d_2_i_, ops) + ops[d_2_i_])), [[psum(0, d_2_i_ + 1, ops)]])))
Invariant(Forall(int, lambda d_5_j_:
(not (((0) <= (d_5_j_)) and ((d_5_j_) <= (d_4_i_))) or ((psum(0, d_5_j_, ops)) >= (0)), [[psum(0, d_5_j_, ops)]])))
Invariant(((0) <= (i)) and ((i) <= (len(ops))))
Invariant((balance) == (psum(0, i, ops)))
Invariant(Forall(int, lambda i: (not (((0) <= (i)) and ((i) < (len(ops)))) or ((psum(0, i + 1, ops)) == (psum(0, i, ops) + ops[i])), [[psum(0, i + 1, ops)]])))
Invariant(Forall(int, lambda j:
(not (((0) <= (j)) and ((j) <= (i))) or ((psum(0, j, ops)) >= (0)), [[psum(0, j, ops)]])))
# invariants-end

# assert-start
Assert((psum(0, (d_4_i_) + (1), ops)) == ((psum(0, d_4_i_, ops)) + ((ops)[d_4_i_])))
Assert((psum(0, (i) + (1), ops)) == ((psum(0, i, ops)) + ((ops)[i])))
# assert-end

d_3_balance_ = (d_3_balance_) + ((ops)[d_4_i_])
if (d_3_balance_) < (0):
balance = (balance) + ((ops)[i])
if (balance) < (0):
return False
d_4_i_ = (d_4_i_) + (1)
i = (i) + (1)

return True
# impl-end
126 changes: 63 additions & 63 deletions Bench/006-parse_nested_parens.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ def parseparengroup(s : List[int]) -> int:
# post-conditions-end

# impl-start
d_1_depth_ : int = 0
depth : int = 0
max__depth : int = 0
d_2_i_ : int = 0
while (d_2_i_) < (len(s)):
i : int = 0
while (i) < (len(s)):
# invariants-start
Invariant(Acc(list_pred(s), 1/2))
Invariant(((d_2_i_) >= (0)) and ((d_2_i_) <= (len(s))))
Invariant(((i) >= (0)) and ((i) <= (len(s))))
Invariant(max__depth >= 0)
Invariant(contains12(s))
Invariant(get_len(s))
# invariants-end
d_3_c_ : int = (s)[d_2_i_]
if (d_3_c_) == (1):
d_1_depth_ = (d_1_depth_) + (1)
if (d_1_depth_) > (max__depth):
max__depth = d_1_depth_
c : int = (s)[i]
if (c) == (1):
depth = (depth) + (1)
if (depth) > (max__depth):
max__depth = depth
else:
d_1_depth_ = (d_1_depth_) - (1)
d_2_i_ = (d_2_i_) + (1)
depth = (depth) - (1)
i = (i) + (1)
return max__depth
# impl-end

Expand All @@ -54,97 +54,97 @@ def contains12(s : List[int]) -> bool:
# pre-conditions-end

# pure-start
return Forall(int, lambda d_0_i_:
Implies(d_0_i_ >= 0 and d_0_i_ < len(s), s[d_0_i_] == 1 or s[d_0_i_] == 2))
return Forall(int, lambda i:
Implies(i >= 0 and i < len(s), s[i] == 1 or s[i] == 2))
# pure-end

def split(s : List[int]) -> List[List[int]]:
# pre-conditions-start
Requires(Acc(list_pred(s)))
Requires(Forall(int, lambda d_4_i_:
not (((d_4_i_) >= (0)) and ((d_4_i_) < (len(s)))) or (((((s)[d_4_i_]) == (1)) or (((s)[d_4_i_]) == (2))) or (((s)[d_4_i_]) == (3)))))
Requires(Forall(int, lambda i:
not (((i) >= (0)) and ((i) < (len(s)))) or (((((s)[i]) == (1)) or (((s)[i]) == (2))) or (((s)[i]) == (3)))))
# pre-conditions-end
# post-conditions-start
Ensures(Acc(list_pred(ResultT(List[List[int]]))))
Ensures(Forall(ResultT(List[List[int]]), lambda x: Acc(list_pred(x), 1/2)))
Ensures(Forall(int, lambda d_10_j_:
Implies(d_10_j_ >= 0 and d_10_j_ < len(ResultT(List[List[int]])), (get_len(ResultT(List[List[int]])[d_10_j_])))))
Ensures(Forall(int, lambda d_10_j_:
(Implies(d_10_j_ >= 0 and d_10_j_ < len(Result()),
contains12(Result()[d_10_j_])), [[contains12(Result()[d_10_j_])]])))
Ensures(Forall(int, lambda j:
Implies(j >= 0 and j < len(ResultT(List[List[int]])), (get_len(ResultT(List[List[int]])[j])))))
Ensures(Forall(int, lambda j:
(Implies(j >= 0 and j < len(Result()),
contains12(Result()[j])), [[contains12(Result()[j])]])))
# post-conditions-end

# impl-start
res : List[List[int]] = []
d_7_current__string_ : List[int] = []
d_8_i_ : int = 0
while (d_8_i_) < (len(s)):
current__string : List[int] = []
i : int = 0
while (i) < (len(s)):
# invariants-start
Invariant(Acc(list_pred(res)))
Invariant(Forall(res, lambda x: Acc(list_pred(x), 1/2)))
Invariant(Acc(list_pred(d_7_current__string_)))
Invariant(Acc(list_pred(current__string)))
Invariant(Acc(list_pred(s)))
Invariant(((d_8_i_) >= (0)) and ((d_8_i_) <= (len(s))))
Invariant(Forall(int, lambda d_4_i_:
(not (((d_4_i_) >= (0)) and ((d_4_i_) < (len(s)))) or (((((s)[d_4_i_]) == (1)) or
(((s)[d_4_i_]) == (2))) or (((s)[d_4_i_]) == (3))), [[]])))
Invariant(Forall(int, lambda d_4_i_:
(not (((d_4_i_) >= (0)) and ((d_4_i_) < (len(d_7_current__string_)))) or
(((((d_7_current__string_)[d_4_i_]) == (1)) or (((d_7_current__string_)[d_4_i_]) == (2)))), [[]])))
Invariant(Forall(int, lambda d_10_j_:
(Implies(d_10_j_ >= 0 and d_10_j_ < len(res), ((get_len(res[d_10_j_])))), [[]])))
Invariant(Forall(int, lambda d_10_j_:
(Implies(d_10_j_ >= 0 and d_10_j_ < len(res),
contains12(res[d_10_j_])), [[contains12(res[d_10_j_])]])))
Invariant(((i) >= (0)) and ((i) <= (len(s))))
Invariant(Forall(int, lambda i:
(not (((i) >= (0)) and ((i) < (len(s)))) or (((((s)[i]) == (1)) or
(((s)[i]) == (2))) or (((s)[i]) == (3))), [[]])))
Invariant(Forall(int, lambda i:
(not (((i) >= (0)) and ((i) < (len(current__string)))) or
(((((current__string)[i]) == (1)) or (((current__string)[i]) == (2)))), [[]])))
Invariant(Forall(int, lambda j:
(Implies(j >= 0 and j < len(res), ((get_len(res[j])))), [[]])))
Invariant(Forall(int, lambda j:
(Implies(j >= 0 and j < len(res),
contains12(res[j])), [[contains12(res[j])]])))
# invariants-end
if ((s)[d_8_i_]) == (3):
if len(d_7_current__string_) > 0:
d_7_copy = list(d_7_current__string_)
if ((s)[i]) == (3):
if len(current__string) > 0:
d_7_copy = list(current__string)
res = (res) + [d_7_copy]
d_7_current__string_ = []
current__string = []
else:
d_7_current__string_ = (d_7_current__string_) + [(s)[d_8_i_]]
d_8_i_ = (d_8_i_) + (1)
if len(d_7_current__string_) > 0:
d_7_copy = list(d_7_current__string_)
current__string = (current__string) + [(s)[i]]
i = (i) + (1)
if len(current__string) > 0:
d_7_copy = list(current__string)
# assert-start
Assert(get_len(d_7_copy))
# assert-end
res = (res) + [d_7_copy]
d_7_current__string_ = []
current__string = []
return res
# impl-end

def parse__nested__parens(paren__string : List[int]) -> List[int]:
# pre-conditions-start
Requires(Acc(list_pred(paren__string)))
Requires(Forall(int, lambda d_12_i_:
not (((d_12_i_) >= (0)) and ((d_12_i_) < (len(paren__string)))) or (((((paren__string)[d_12_i_]) == (3)) or (((paren__string)[d_12_i_]) == (1))) or (((paren__string)[d_12_i_]) == (2)))))
Requires(Forall(int, lambda i:
not (((i) >= (0)) and ((i) < (len(paren__string)))) or (((((paren__string)[i]) == (3)) or (((paren__string)[i]) == (1))) or (((paren__string)[i]) == (2)))))
# pre-conditions-end
# post-conditions-start
Ensures(Acc(list_pred(Result())))
Ensures(Forall(ResultT(List[int]), lambda d_13_x_: ((d_13_x_) >= (0))))
Ensures(Forall(ResultT(List[int]), lambda x: ((x) >= (0))))
# post-conditions-end

# impl-start
res : List[int] = []
d_14_strings_ : List[List[int]] = split(paren__string)
d_15_i_ : int = int(0)
while (d_15_i_) < (len(d_14_strings_)):
strings : List[List[int]] = split(paren__string)
i : int = int(0)
while (i) < (len(strings)):
# invariants-start
Invariant(Acc(list_pred(d_14_strings_)))
Invariant(Acc(list_pred(strings)))
Invariant(Acc(list_pred(res)))
Invariant(Forall(d_14_strings_, lambda x: Acc(list_pred(x), 1/2)))
Invariant(0 <= d_15_i_ and d_15_i_ <= len(d_14_strings_))
Invariant(Forall(res, lambda d_16_x_: ((d_16_x_) >= (0))))
Invariant(Forall(int, lambda d_10_j_:
Implies(d_10_j_ >= 0 and d_10_j_ < len(d_14_strings_), (get_len(d_14_strings_[d_10_j_])))))
Invariant(Forall(int, lambda d_10_j_:
(Implies(d_10_j_ >= 0 and d_10_j_ < len(d_14_strings_),
contains12(d_14_strings_[d_10_j_])), [[contains12(d_14_strings_[d_10_j_])]])))
Invariant(Forall(strings, lambda x: Acc(list_pred(x), 1/2)))
Invariant(0 <= i and i <= len(strings))
Invariant(Forall(res, lambda x: ((x) >= (0))))
Invariant(Forall(int, lambda j:
Implies(j >= 0 and j < len(strings), (get_len(strings[j])))))
Invariant(Forall(int, lambda j:
(Implies(j >= 0 and j < len(strings),
contains12(strings[j])), [[contains12(strings[j])]])))
# invariants-end
d_17_cur_ : int = parseparengroup((d_14_strings_)[d_15_i_])
res = (res) + [d_17_cur_]
d_15_i_ = (d_15_i_) + (1)
cur : int = parseparengroup((strings)[i])
res = (res) + [cur]
i = (i) + (1)
return res
# impl-end
Loading

0 comments on commit 8f684a8

Please sign in to comment.