Skip to content

Commit 28a10c0

Browse files
committed
updating proofs so that they check without CVC4
1 parent cc67d0d commit 28a10c0

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

case_studies/HamiltonBlum/Blum_SpecialSoundness.ec

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ have : K <= size (prj_path x.`1 p1.`2).
213213
elim p4. move => _. elim.
214214
progress.
215215
have ->: size (prj_path x.`1 p1.`2) = K.
216-
smt (prj_path_size).
216+
rewrite prj_path_size. smt(). smt(). auto.
217217
auto.
218218
have : K <= size x.`2. smt().
219219
move => q g.

checkall

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
timeout=20
44

55
ECO=
6-
#ECO=-no-eco
6+
ECO=-no-eco
77

88
check() {
99
echo checking $1;
10-
if easycrypt $ECO -p "CVC4" -p "Z3" -p "Alt-Ergo" -I . -I ./rewinding -I ./misc -I ./misc/while_props -I ./generic -timeout $timeout $1;
10+
if easycrypt $ECO -p "CVC4" -p "Z3" -p "Alt-Ergo" -I . -I ./rewinding -I ./misc -I ./misc/while_props -I ./generic -timeout $timeout $1;
1111
then echo passed: $1;
1212
echo "";
1313
else echo failed: $1;

misc/MemoryProps.ec

+23-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ declare module A <: RewEx1Ex2.
1717
declare axiom A_run_ll : islossless A.ex1.
1818

1919

20+
21+
local lemma unit_rule x : x = tt.
22+
elim x. auto. qed.
23+
2024
local lemma prob_refl_app &m p :
2125
exists (D1 : at1 -> (glob A) -> (unit * (glob A)) distr)
2226
(D2 : at2 -> unit * (glob A) -> (glob A) distr),
@@ -55,7 +59,8 @@ have : Pr[RCR(A).main(i1, i2) @ &m : true ] = 0%r.
5559
rewrite - (H1 &m predT).
5660
rewrite dlet_mu_main.
5761
apply sum0_eq. progress.
58-
have -> : x = (tt, x.`2). smt().
62+
have -> : x = (tt, x.`2).
63+
rewrite - (unit_rule x.`1). smt().
5964
rewrite - q22. smt(). smt(@Distr).
6065
elim q2. move => g gp.
6166
have : mu (dlet (D1 i1 (glob A){m}) (D2 i2)) M <= p.
@@ -76,7 +81,9 @@ have -> : sum
7681
apply fun_ext. move => x.
7782
case (pred1 (tt, g) x). simplify. progress.
7883
rewrite H4.
79-
have -> : mu1 (duniform [(tt, g)]) (tt, g) = 1%r. smt(@Distr). smt().
84+
have -> : mu1 (duniform [(tt, g)]) (tt, g) = 1%r. rewrite - H4.
85+
smt(duniform1E_uniq).
86+
smt().
8087
smt().
8188
rewrite sumZ.
8289
rewrite - muE. progress.
@@ -90,11 +97,12 @@ have zzz : sum
9097
else 0%r).
9198
apply ler_sum. progress.
9299
case (pred1 (tt, g) x). simplify. auto. simplify. progress.
93-
have ->: x = (tt,x.`2). smt().
100+
have ->: x = (tt,x.`2).
101+
rewrite - (unit_rule x.`1). smt().
94102
case (mu1 (D1 i1 (glob A){m}) (tt, x.`2) = 0%r).
95103
smt().
96104
progress.
97-
have jk : forall (a b c : real), a >= 0%r => b <= c => a * b <= a * c. smt(@Real).
105+
have jk : forall (a b c : real), a >= 0%r => b <= c => a * b <= a * c. smt().
98106
apply jk. smt(@Distr). apply q. smt(@Distr).
99107
have ->: (fun (x : unit * (glob A)) =>
100108
if ! pred1 (tt, g) x then mu1 (D1 i1 (glob A){m}) x * mu (D2 i2 x) M
@@ -153,9 +161,10 @@ have ->: (fun (x : unit * (glob A)) => mu1 (D1 i1 (glob A){m}) x)
153161
= (fun (x : unit * (glob A)) => if predT x then mu1 (D1 i1 (glob A){m}) x else 0%r).
154162
smt().
155163
rewrite - muE.
156-
smt(@Distr).
157-
smt().
158-
rewrite H1. smt().
164+
have : 0%r <= weight (D1 i1 (glob A){m}) <= 1%r. smt(@Distr).
165+
pose w := weight (D1 i1 (glob A){m}) .
166+
progress. clear zzz gp g q G g0 H1 H0 H. smt().
167+
smt(). rewrite H1. smt().
159168
qed.
160169

161170

@@ -168,7 +177,10 @@ elim (H2 M i1 i2 _ _);auto. progress.
168177
have f1 : Pr[A.ex1(i1) @ &m : glob A = g] > 0%r.
169178
have f2 : mu (D1 i1 (glob A){m}) (fun x => snd x = g) = Pr[A.ex1(i1) @ &m : (glob A) = g].
170179
rewrite (H &m). auto. rewrite - f2.
171-
have ->: (fun (x : unit * (glob A)) => x.`2 = g) = pred1 (tt,g). apply fun_ext. smt(). apply H5.
180+
have ->: (fun (x : unit * (glob A)) => x.`2 = g) = pred1 (tt,g). apply fun_ext.
181+
move => x. simplify.
182+
rewrite - (unit_rule x.`1).
183+
smt(). apply H5.
172184
have f3: exists &n, g = (glob A){n}.
173185
have f31: Pr[A.ex1(i1) @ &m : (glob A) = g /\ (exists &n, (glob A) = (glob A){n}) ] = Pr[A.ex1(i1) @ &m : (glob A) = g].
174186
have <- : Pr[A.ex1(i1) @ &m : (glob A) = g] = Pr[A.ex1(i1) @ &m : (glob A) = g /\ exists &n, (glob A) = (glob A){n}].
@@ -185,6 +197,9 @@ smt(). auto.
185197
<= Pr[A.ex1(i1) @ &m : (glob A) = g]. rewrite Pr[mu_sub]. auto. auto.
186198
case (exists &n, g = (glob A){n}).
187199
rewrite - (H &m predT i1). smt(@Distr).
200+
move => ne. rewrite Pr[mu_false]. simplify.
201+
have c1 : Pr[A.ex1(i1) @ &m : (glob A) = g] = 0%r. rewrite - f32.
202+
rewrite ne. simplify. rewrite Pr[mu_false]. simplify. auto.
188203
smt().
189204
clear f32 f31 f1 H2 H1 H0 H.
190205
case (exists &n, g = (glob A){n}). auto.

misc/PrIntervalToSum.ec

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ lemma pr_interval_to_sum_lemma &m : forall (a : iat)
6565
proof. progress.
6666
case (s <= e). move => sep.
6767
have : exists e', 0 <= e' /\ e = s + e'.
68-
smt(). elim. progress.
68+
exists (e - s). progress.
69+
smt(). smt(). elim. progress.
6970
apply (pr_interval_to_sum_lemma' &m a). auto.
7071
progress.
7172
rewrite range_geq. smt().

rewinding/checkall

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/bin/bash
22

3-
timeout=35
3+
timeout=20
4+
5+
ECO=
6+
ECO=-no-eco
47

58
check() {
69
echo checking $1;
7-
if easycrypt -I . -timeout $timeout $1
10+
if easycrypt $ECO -p "CVC4" -p "Z3" -p "Alt-Ergo" -I . -timeout $timeout $1;
811
then echo passed: $1;
912
echo "";
1013
else echo failed: $1;
@@ -14,6 +17,7 @@ check() {
1417
fi;
1518
}
1619

20+
1721
# list of files to check
1822
check RandomFacts.ec
1923
check FiniteApproximation.ec

0 commit comments

Comments
 (0)