aboutsummaryrefslogtreecommitdiffstats
path: root/src/lfsc/tests/cvc4tov
blob: 183629ea787a3d8a4bf2676d6f53b7d8dd16637f (plain)
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
64
65
66
#!/bin/bash
set -e

name=${1%.*}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

echo "Running CVC4..."
cvc4 --proof --dump-proof --no-simplification --fewer-preprocessing-holes --no-bv-eq --no-bv-ineq --no-bv-algebraic $1 > $name.lfsc

# sed -i -e '1d' $name.lfsc

# echo "Convert LFSC proof to SMTCoq..."
$DIR/../lfsctosmtcoq.native $name.lfsc | grep "^1:" -A 9999999 > $name.log

echo "Creating Coq file..."
cat > $name.v <<EOF
Require Import SMTCoq Bool List.
Import ListNotations BVList.BITVECTOR_LIST FArray.
Local Open Scope list_scope.
Local Open Scope farray_scope.
Local Open Scope bv_scope.

Section File.
  Verit_Checker "$name.smt2" "$name.log".
End File.
EOF

cat > ${name}_debug.v <<EOF
Require Import SMTCoq Bool List.
Import ListNotations BVList.BITVECTOR_LIST FArray.
Local Open Scope list_scope.
Local Open Scope farray_scope.
Local Open Scope bv_scope.

Section File.
  Verit_Checker_Debug "$name.smt2" "$name.log".
End File.

(*
Section File2.
  Parse_certif_verit t_i t_func t_atom t_form root used_roots trace "$name.smt2" "$name.log".
  Compute (
      let (nclauses, t, confl) := trace in
      let s := add_roots (S.make nclauses) root used_roots in
      let s' := Structures.trace_fold
        (fun s a =>
          (@Euf_Checker.step_checker t_i t_func t_atom t_form) s a
        ) s t in
      let s'' := PArray.mapi (fun i c => (to_Z i, List.map to_Z c)) s' in
      (PArray.to_list s'', to_Z confl)).
End File2.
*)
EOF

cat > ${name}_debug.sh <<EOF
#!/bin/sh
coqc -q -R $DIR/../.. SMTCoq ${name}_debug.v | grep --color -E "\[0(;\s+0)*\]| 0|"
EOF

chmod +x ${name}_debug.sh


echo "Checking with Coq..."
coqc -q -R $DIR/../.. SMTCoq $name.v

exit 0