From 651f4f2e86167f1071033f892b5cba3e388265b6 Mon Sep 17 00:00:00 2001 From: alex28sh <alex.shefer.31@gmail.com> Date: Wed, 21 Aug 2024 15:31:18 +0200 Subject: [PATCH 1/4] checks --- Bench/000-has-close-elements.py | 1 - WIP/096-count_up_to.py | 2 ++ public/scripts/test-new.sh | 22 +++++++++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Bench/000-has-close-elements.py b/Bench/000-has-close-elements.py index 7970ab7..1da5b1a 100644 --- a/Bench/000-has-close-elements.py +++ b/Bench/000-has-close-elements.py @@ -34,7 +34,6 @@ def has_close_elements(numbers: List[int], threshold: int) -> bool: Ensures(Implies(Result() != True, Forall(range(len(numbers)), lambda x : fn(x, numbers, threshold) ))) - flag = False i = 0 diff --git a/WIP/096-count_up_to.py b/WIP/096-count_up_to.py index 25fe389..f79705d 100644 --- a/WIP/096-count_up_to.py +++ b/WIP/096-count_up_to.py @@ -9,6 +9,8 @@ def IsPrime(n : int) -> bool : def CountUpTo(n : int) -> List[int]: Requires((n) >= (0)) Ensures(Acc(list_pred(Result()))) + + Ensures(Forall(int, lambda d_2_i_: not (((0) <= (d_2_i_)) and ((d_2_i_) < (len(Result())))) or (((Result())[d_2_i_]) < (n)))) # Ensures(Forall(int, lambda d_1_i_: diff --git a/public/scripts/test-new.sh b/public/scripts/test-new.sh index a06e59e..7efffed 100644 --- a/public/scripts/test-new.sh +++ b/public/scripts/test-new.sh @@ -1,25 +1,33 @@ #!/bin/bash set -eou pipefail +DIRECTORY="./Bench" # You can change this to your specific directory + # Timeout duration in seconds TIMEOUT_DURATION=600 file_count=0 echo "New files found:" for f in $1; do - if [[ $f == *.dfy ]]; then - echo $f - file_count=$((file_count+1)) + # Check if the file is in the known directory + if [[ $f == $directory/* ]]; then + if [[ $f == *.py and $f == $directory/*]]; then + echo $f + file_count=$((file_count+1)) + fi fi done echo "Staring the check" for f in $1 do - if [[ $f == *.dfy ]]; then - file_no=$((file_no+1)) - echo "Running dafny on $(basename "$f") ($file_no/$file_count)" - timeout "$TIMEOUT_DURATION" nagini "$file" + # Check if the file is in the known directory + if [[ $f == $directory/* ]]; then + if [[ $f == *.py ]]; then + file_no=$((file_no+1)) + echo "Running dafny on $(basename "$f") ($file_no/$file_count)" + timeout "$TIMEOUT_DURATION" nagini "$file" + fi fi done From e8cad8000c878b060acc7d2a630ffc0051077ea8 Mon Sep 17 00:00:00 2001 From: alex28sh <alex.shefer.31@gmail.com> Date: Wed, 21 Aug 2024 15:34:46 +0200 Subject: [PATCH 2/4] fix --- public/scripts/test-new.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/test-new.sh b/public/scripts/test-new.sh index 7efffed..2f6541a 100644 --- a/public/scripts/test-new.sh +++ b/public/scripts/test-new.sh @@ -11,7 +11,7 @@ echo "New files found:" for f in $1; do # Check if the file is in the known directory if [[ $f == $directory/* ]]; then - if [[ $f == *.py and $f == $directory/*]]; then + if [[ $f == *.py ]]; then echo $f file_count=$((file_count+1)) fi From d33dd6963ca01b5735264bf7189d391f06202c9f Mon Sep 17 00:00:00 2001 From: alex28sh <alex.shefer.31@gmail.com> Date: Wed, 21 Aug 2024 15:38:04 +0200 Subject: [PATCH 3/4] checks --- public/scripts/test-new.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 public/scripts/test-new.sh diff --git a/public/scripts/test-new.sh b/public/scripts/test-new.sh old mode 100644 new mode 100755 index 2f6541a..0040b29 --- a/public/scripts/test-new.sh +++ b/public/scripts/test-new.sh @@ -10,7 +10,7 @@ file_count=0 echo "New files found:" for f in $1; do # Check if the file is in the known directory - if [[ $f == $directory/* ]]; then + if [[ $f == $DIRECTORY/* ]]; then if [[ $f == *.py ]]; then echo $f file_count=$((file_count+1)) @@ -22,7 +22,7 @@ echo "Staring the check" for f in $1 do # Check if the file is in the known directory - if [[ $f == $directory/* ]]; then + if [[ $f == $DIRECTORY/* ]]; then if [[ $f == *.py ]]; then file_no=$((file_no+1)) echo "Running dafny on $(basename "$f") ($file_no/$file_count)" From e7fc147a8ad197c8216693b3d3513bd5b5fe2c1d Mon Sep 17 00:00:00 2001 From: alex28sh <alex.shefer.31@gmail.com> Date: Wed, 21 Aug 2024 15:41:07 +0200 Subject: [PATCH 4/4] checks --- Bench/000-has-close-elements.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Bench/000-has-close-elements.py b/Bench/000-has-close-elements.py index 1da5b1a..3c626c7 100644 --- a/Bench/000-has-close-elements.py +++ b/Bench/000-has-close-elements.py @@ -57,7 +57,6 @@ def has_close_elements(numbers: List[int], threshold: int) -> bool: ) ) - if i != j: distance = abs_value(numbers[i] - numbers[j]) if distance < threshold: