-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathcheck_with_tlc.sh
63 lines (46 loc) · 1.42 KB
/
check_with_tlc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Files to process
FILES=("ewd426.qnt" "ewd426_3.qnt" "ewd426_4.qnt")
# Apalache jar path
APALACHE_JAR="$HOME/.quint/apalache-dist-0.47.2/apalache/lib/apalache.jar"
# Memory options for Java
JAVA_OPTS="-Xmx8G -Xss515m"
for file in "${FILES[@]}"; do
base_name="${file%.qnt}"
tla_file="${base_name}.tla"
cfg_file="${base_name}.cfg"
echo "Processing $file..."
# Step 1: Compile the .qnt file to .tla
quint compile --target=tlaplus "$file" --temporal=convergence,closure,persistence --invariant=tokenInv > "$tla_file"
if [[ $? -ne 0 ]]; then
echo "Error: Compilation failed for $file"
exit 1
fi
if [[ $? -ne 0 ]]; then
echo "Error: Failed to edit $tla_file"
exit 1
fi
# Step 2: Create the .cfg file
cat <<EOF > "$cfg_file"
INIT
q_init
NEXT
q_step
PROPERTY
q_temporalProps
INVARIANT
q_inv
EOF
# Step 3: Run TLC with the required Apalache lib files and check output
output=$(java $JAVA_OPTS -cp "$APALACHE_JAR" tlc2.TLC -deadlock "$tla_file" 2>&1)
# Step 4: Delete the generated .tla and .cfg files
rm -f "$tla_file" "$cfg_file"
if echo "$output" | grep -q "Model checking completed. No error has been found."; then
echo "Model checking succeeded for $tla_file"
else
echo "Error: Model checking failed for $tla_file"
echo "$output"
exit 1
fi
done
echo "All files processed successfully."