-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreproduce
executable file
·191 lines (165 loc) · 3.83 KB
/
reproduce
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/bin/sh
set -e # to exit as soon as there is an error
hollight_version=3.0.0 # for dependencies
hollight_commit=28e4aed
hol2dk_commit=7eb6a02
lambdapi_commit=21ee7f3d
opam_version=2.2.1
dune_version=3.17.1
ocaml_version=5.2.1
camlp5_version=8.03.01
coq_version=8.20.1
hollight_file=Multivariate/make_complex.ml
base=`basename $hollight_file .ml`
root_path=HOLLight
jobs='-j32'
line() { echo '------------------------------------------------------------'; }
mkdir -p tmp
cd tmp
#usage: checkout_commit url commit
checkout_commit() {
line
d=`basename $1 .git`
echo install $d ...
git clone $1
cd $d
git checkout $2
cd ..
}
create_opam_switch() {
line
echo create opam switch ...
opam switch create . $ocaml_version
}
install_hol_light_deps() {
line
echo install HOL-Light dependencies ...
opam install -y --deps-only hol_light.$hollight_version
}
install_lambdapi() {
checkout_commit https://github.com/Deducteam/lambdapi.git $lambdapi_commit
cd lambdapi
git checkout -b reproduce
opam install -y .
cd ..
}
install_coq() {
line
echo install coq ...
opam repo add coq-released https://coq.inria.fr/opam/released
opam install -y coq.$coq_version
}
install_coq_deps() {
line
echo install coq dependencies ...
opam install -y --deps-only .
}
install_hol2dk() {
checkout_commit https://github.com/Deducteam/hol2dk.git $hol2dk_commit
cd hol2dk
dune build && dune install
cd ..
}
install_hol_light() {
checkout_commit https://github.com/jrh13/hol-light.git $hollight_commit
cd hol-light
make
cd ..
}
patch_hol_light() {
line
echo patch hol-light ...
hol2dk patch
}
dump_proofs() {
line
echo dump hol-light proofs ...
cd hol-light
hol2dk dump-simp $hollight_file
cd ..
}
config_output_dir() {
line
echo configure output directory ...
mkdir -p output
cd output
if test -f Makefile; then make $jobs clean-all; fi
hol2dk config $hollight_file $root_path HOLLight_Real_With_N.mappings ../../With_N.v Coq.NArith.BinNat Coq.Reals.Rbase Coq.Reals.Rdefinitions Coq.Reals.Rbasic_fun ../../With_N.lp ../../With_N.mk
cd ..
}
translate_proofs() {
line
echo translate HOL-Light proofs to lambdapi and coq ...
cd output
make split
make $jobs lp
make $jobs v
cd ..
}
check_proofs() {
line
echo check proofs ...
cd output
make $jobs -k vo
cd ..
}
create_and_check_opam_library() {
line
echo create opam library ...
cd output
make opam
cd ..
mkdir -p opam
cd opam
cp ../../Makefile ../../With_N.v ../output/theory_hol.v .
sed -e "s/${base}_//g" -e "/^Require Import ${root_path}.types.$/d" ../output/${base}_terms.v > terms.v
sed -e "s/${base}_//g" -e "/^Require Import ${root_path}.types.$/d" -e '/^Require Import ${root_path}.axioms.$/d' -e "/^Axiom thm_HAS_INTEGRAL_TWIZZLE_INTERVAL /d" ../output/${base}_opam.v > theorems.v
make
cd ..
}
compare_opam_file() {
line
echo compare $1 ...
diff ../$1 opam/$1
}
compare_opam_files() {
for f in theory_hol.v terms.v theorems.v
do
compare_opam_file $f
done
}
export HOLLIGHT_DIR=`pwd`/hol-light
export HOL2DK_DIR=`pwd`/hol2dk
stage() {
if test -f STAGE
then
i=`head -n1 STAGE`
i=`expr $i + 1`
else
i=1
fi
if test $i -eq $1
then
$2
echo $1 > STAGE
fi
}
if test -n "$1"
then
expr $1 - 1 > STAGE
fi
stage 1 create_opam_switch
eval `opam env`
stage 2 install_hol_light_deps
stage 3 install_lambdapi
stage 4 install_coq
stage 5 install_hol2dk
stage 6 install_hol_light
stage 7 patch_hol_light
stage 8 dump_proofs
stage 9 config_output_dir
stage 10 translate_proofs
stage 11 install_coq_deps
stage 12 check_proofs
stage 13 create_and_check_opam_library
stage 14 compare_opam_files