Skip to content

Commit 03aa4ed

Browse files
committed
start removing our blessing from alt-ergo
1 parent 1393a49 commit 03aa4ed

File tree

26 files changed

+308
-109
lines changed

26 files changed

+308
-109
lines changed

easycrypt.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[general]
2-
32
43

examples/MEE-CBC/RCPA_CMA.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ theory EtM.
336336
type leaks <- leaks,
337337
op leak <- leak,
338338
op dC (l:leaks) <- (dC l) `*` (MUnit.dunit witness<:tag>)
339-
proof * by smt.
339+
proof * by smt(dprod_ll dC_ll dunit_ll).
340340

341341
(** The black-box construction is as follows **)
342342
module EtM(E:SKEa.Enc_Scheme, M:MACa.MAC_Scheme): Enc_Scheme = {

examples/PIR.ec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ proof. by exists [] s. qed.
2222
2323
lemma sxor2_cons (s s':int list) (i j:int):
2424
sxor2 s s' i => sxor2 (j::s) (j::s') i.
25-
proof. smt (). qed.
25+
proof.
26+
move=> [].
27+
move=> [] s1 s2 [] -> ->.
28+
by left; exists (j :: s1) s2.
29+
+ move=> [] s1 s2 [] -> ->.
30+
by right; exists (j :: s1) s2.
31+
qed.
2632
2733
(* The database *)
2834
op a : int -> word.
@@ -72,7 +78,7 @@ proof.
7278
while (j <= N /\ if j <= i then PIR.s = PIR.s' else sxor2 PIR.s PIR.s' i).
7379
+ wp;rnd;skip => /= &m [[_]] + HjN.
7480
have -> /= : j{m} + 1 <= N by smt ().
75-
case: (j{m} <= i{m}) => Hji;2: by smt ().
81+
case: (j{m} <= i{m})=> Hji; 2:smt(sxor2_cons).
7682
move=> -> b _;case: (j{m} = i{m}) => [->> | /#].
7783
by rewrite (_ : !(i{m}+1 <= i{m})) 1:/# /=; smt (sxor_cons).
7884
by auto => /#.

examples/ehoare/qselect/partition.eca

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ lemma index_count x l: sorted (<=) l => uniq l => x \in l => index x l = count (
100100
proof.
101101
elim: l => // y l hrec /> hp hnin hu.
102102
case: (x = y) => [<<- _ | hne /= hin] /=.
103-
+ by rewrite index_cons /= count_pred0_eq_in //=; smt (order_path_min allP le_trans lt_nle).
103+
+ rewrite index_cons /= count_pred0_eq_in //=; 2:smt(lt_nle).
104+
move=> x0 x0_in_l; move: (order_path_min (<=) le_trans x l hp).
105+
by rewrite allP=> /(_ _ x0_in_l); rewrite lt_nle.
104106
rewrite index_cons hne /= hrec //; 1: by apply: path_sorted hp.
105107
smt (order_path_min allP le_trans).
106108
qed.

examples/hashed_elgamal_std.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ section Security.
192192
- Pr[ES1(ESAdv(A)).main() @ &m : res]|.
193193
proof.
194194
rewrite (cpa_ddh0 &m) (ddh1_es1 &m) (es0_Gb &m) (Gb_half &m).
195-
smt(@Real).
195+
smt(StdOrder.RealOrder.ler_dist_add).
196196
qed.
197197
end section Security.
198198

theories/algebra/DynMatrix.eca

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ lemma offunvK pv: tofunv (offunv pv) = vclamp pv.
7373
proof. by rewrite /tofunv /offunv eqv_repr vclamp_idemp. qed.
7474

7575
lemma vectorW (P : vector -> bool):
76-
(forall pv, P (offunv pv)) => forall v, P v by smt(tofunvK).
76+
(forall pv, P (offunv pv)) => forall v, P v.
77+
proof. by move=> P_pv v; rewrite -tofunvK; apply: P_pv. qed.
7778

7879
(* Dimension of the vector *)
7980
op size v = (tofunv v).`2.
@@ -593,8 +594,10 @@ qed.
593594
lemma dvector1E (d : R distr) (v : vector) : mu1 (dvector d (size v)) v =
594595
BRM.bigi predT (fun i => mu1 d v.[i]) 0 (size v).
595596
proof.
596-
rewrite -{2}[v]tolistK dmapE /(\o) /pred1.
597-
rewrite (@mu_eq _ _ (pred1 (tolist v))); 1: smt(oflist_inj).
597+
rewrite -{2}[v]tolistK dmapE /(\o) /pred1.
598+
rewrite (@mu_eq _ _ (pred1 (tolist v))).
599+
+ move=> x; rewrite eq_iff /pred1 /=; split=> />.
600+
exact: oflist_inj.
598601
rewrite dlist1E 1:/# size_tolist max0size /=.
599602
by rewrite BRM.big_mapT /(\o) &BRM.eq_big.
600603
qed.
@@ -694,7 +697,8 @@ proof. by rewrite /tofunm /offunm eqv_repr. qed.
694697
hint simplify offunmK.
695698

696699
lemma matrixW (P : matrix -> bool) : (forall pm, P (offunm pm)) =>
697-
forall m, P m by smt(tofunmK).
700+
forall m, P m.
701+
proof. by move=> P_pm m; rewrite -tofunmK; exact: P_pm. qed.
698702

699703
(* Number of rows and columns of matrices *)
700704
op rows m = (tofunm m).`2.
@@ -1451,16 +1455,17 @@ qed.
14511455
lemma catmrA (m1 m2 m3: matrix): ((m1 || m2) || m3) = (m1 || (m2 || m3)).
14521456
proof.
14531457
rewrite eq_matrixP.
1454-
split => [| i j bound]; 1: smt(size_catmr).
1458+
split => [| i j bound]; 1:smt(size_catmr rows_catmr cols_catmr).
14551459
rewrite 4!get_catmr cols_catmr // addrA.
1456-
algebra.
1460+
by algebra.
14571461
qed.
14581462

14591463
lemma catmrDr (m1 m2 m3: matrix): m1 * (m2 || m3) = ((m1 * m2) || (m1 * m3)).
14601464
proof.
14611465
rewrite eq_matrixP.
14621466
rewrite rows_mulmx cols_mulmx cols_catmr.
1463-
split => [| i j bound]; 1: smt(size_mulmx size_catmr).
1467+
split => [| i j bound].
1468+
+ by rewrite !size_catmr !rows_mulmx !cols_mulmx /#.
14641469
rewrite get_catmr 3!get_mulmx.
14651470
case (j < cols m2) => bound2.
14661471
- rewrite [col m3 _]col0E 1:/# dotpv0 addr0 !dotpE 2!size_col rows_catmr.
@@ -1667,7 +1672,9 @@ case (j < n) => j_bound.
16671672
+ smt(size_catmr size_subm).
16681673
by rewrite addr0.
16691674
- rewrite getm0E; 1: smt(size_catmr size_subm).
1670-
rewrite add0r get_subm; smt(size_catmr size_subm).
1675+
rewrite add0r get_subm; [3:smt()].
1676+
+ smt(rows_catmr rows_subm).
1677+
+ smt(cols_catmr cols_subm).
16711678
qed.
16721679

16731680
lemma subm_colmx (m: matrix) l :
@@ -1908,7 +1915,8 @@ move => r_ge0 c_ge0; split => [m_supp|]; last first.
19081915
- case => -[r_m c_m] m_d; rewrite /support -r_m -c_m dmatrix1E.
19091916
apply prodr_gt0_seq => i i_row _ /=.
19101917
by apply prodr_gt0_seq => j j_col _ /=; apply m_d; smt(mem_iota).
1911-
have [r_m c_m] : size m = (r,c) by smt(size_dmatrix).
1918+
have [r_m c_m] : size m = (r,c).
1919+
+ exact: (size_dmatrix d).
19121920
split => [//|i j range_ij]; move: m_supp.
19131921
rewrite -r_m -c_m /support dmatrix1E => gt0_big.
19141922
pose G i0 := (fun (j0 : int) => mu1 d m.[i0, j0]).

theories/analysis/RealFLub.ec

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ by smt().
2525
lemma flub_upper_bound (F : 'a -> real) x :
2626
has_fub F => F x <= flub F.
2727
proof.
28-
move => H. apply lub_upper_bound; 2: by exists x.
29-
by split; [ by exists (F x) x | smt() ].
28+
move => H; apply lub_upper_bound; 2: by exists x.
29+
split.
30+
+ by exists (F x) x.
31+
by case: H=> r is_fub_F_r; exists r=> /#.
3032
qed.
3133

3234
lemma flub_le_ub (F : 'a -> real) r :
@@ -53,17 +55,21 @@ lemma flubZ (f: 'a -> real) c : has_fub f =>
5355
c >= 0%r => flub (fun x => c * f x) = c * flub f.
5456
proof.
5557
move => fub_f c_ge0 @/flub; pose E := fun r => exists a, f a = r.
56-
have -> : (fun r => exists a, c * f a = r) = scale_rset E c by smt().
58+
have -> : (fun r => exists a, c * f a = r) = scale_rset E c.
59+
+ apply: fun_ext=> x; rewrite eq_iff; split.
60+
+ by move=> [] a xP; exists (f a); rewrite xP=> //=; exists a.
61+
+ by move=> /> a; exists a.
5762
by rewrite lub_scale //; apply has_fub_lub.
5863
qed.
5964

6065
lemma flub_const c :
6166
flub (fun _ : 'a => c) = c.
6267
proof.
6368
apply eqr_le; split; first apply flub_le_ub => /#.
64-
move => _; apply (@flub_upper_bound (fun _ => c) witness) => /#.
69+
move=> _; apply (@flub_upper_bound (fun _=> c) witness).
70+
by exists c=> /#.
6571
qed.
6672
6773
lemma has_fubZ (f: 'a -> real) c: has_fub f =>
6874
c >= 0%r => has_fub (fun x => c * f x).
69-
proof. move => [ym ub_ym] ge0_c; exists (c * ym) => /#. qed.
75+
proof. by move => [ym ub_ym] ge0_c; exists (c * ym) => /#. qed.

theories/analysis/RealFun.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ proof. smt (). qed.
3535

3636
lemma convexD f1 f2 a b:
3737
convex f1 a b => convex f2 a b => convex (fun x => f1 x + f2 x) a b.
38-
proof. smt (). qed.
38+
proof. by move=> + + x x_in01; smt(). qed.
3939

4040
lemma convexZ c f a b: 0%r <= c =>
4141
convex f a b => convex (fun x => c * f x) a b.

theories/analysis/RealLub.ec

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ qed.
8181
(* -------------------------------------------------------------------- *)
8282
lemma lub1 x : lub (pred1 x) = x.
8383
proof.
84-
apply eqr_le; split; [apply lub_le_ub => /#|move => _].
85-
apply lub_upper_bound; smt().
84+
have haslub_1x: (has_lub (pred1 x)).
85+
+ by rewrite /has_lub; split; exists x=> /#.
86+
apply: eqr_le; split.
87+
+ by apply: lub_le_ub=> //#.
88+
by move=> _; apply: lub_upper_bound.
8689
qed.
8790

8891
(* -------------------------------------------------------------------- *)
@@ -102,7 +105,8 @@ qed.
102105
lemma has_lub_scale E c : 0%r <= c =>
103106
has_lub E => has_lub (scale_rset E c).
104107
proof.
105-
move => c_ge0 [[x Ex] ?]; split; 1: smt().
108+
move=> c_ge0 [[x Ex] ?]; split.
109+
+ by exists (c * x) x.
106110
exists (c * lub E) => cx; smt(lub_upper_bound).
107111
qed.
108112

@@ -115,7 +119,9 @@ apply eqr_le; split => [|_].
115119
- apply lub_le_ub; first by apply has_lub_scale.
116120
smt(lub_upper_bound).
117121
rewrite -ler_pdivl_mull //; apply lub_le_ub => // x Ex.
118-
by rewrite ler_pdivl_mull //; smt(lub_upper_bound has_lub_scale).
122+
rewrite ler_pdivl_mull //; apply: lub_upper_bound.
123+
+ exact: has_lub_scale.
124+
by exists x.
119125
qed.
120126

121127
(* -------------------------------------------------------------------- *)

theories/analysis/RealSeries.ec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,8 @@ lemma summable_inj (h : 'a -> 'b) (s : 'b -> real) :
965965
injective h => summable s => summable (s \o h).
966966
proof.
967967
move => inj_h [M] sum_s; exists M => J uniq_J.
968-
have R := sum_s (map h J) _; 1: rewrite map_inj_in_uniq /#.
968+
have R := sum_s (map h J) _.
969+
+ by rewrite map_inj_in_uniq=> // x y _ _ /inj_h.
969970
apply (ler_trans _ _ R) => {R}; rewrite big_map /(\o)/= big_mkcond.
970971
exact Bigreal.ler_sum.
971972
qed.

0 commit comments

Comments
 (0)