Proof of concept sequential reverser

This commit is contained in:
Claudio Maggioni 2023-05-08 14:15:13 +02:00
parent 63f27e6a93
commit d207d42f77
3 changed files with 63 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
Examples
**/pan.*
**/pan
*.tmp

View file

@ -0,0 +1,36 @@
#define N 10
#define LENGTH 3
#define R 2
init {
int to_reverse[LENGTH];
// array initialization
{
int i;
for (i in to_reverse) {
int value;
select(value: 0 .. R);
to_reverse[i] = value;
}
}
int reversed[LENGTH];
// sequential reverser
{
int from = 0;
int to = LENGTH ;
int k;
for (k: from..to) {
reversed[LENGTH - k - 1] = to_reverse[k];
}
}
}
ltl test {
eventually (false) implies true
// eventually (a > b) implies len(q) == 0
}

23
ReversalModel/verify.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "LTL property name required" > /dev/stderr
exit 1
else
userid="$1"
fi
set -e
spin -a reversal.pml
gcc-13 -Wno-format-overflow -o pan pan.c
./pan -a "$1"
exitcode="$?"
if [ "$exitcode" -ne 0 ]; then
echo "Terminated with status: $exitcode" > /dev/stderr
exit "$exitcode"
else
echo "Terminated successfully"
fi