Skip to content

Commit 41d8e7b

Browse files
committed
make easycrypt independent from alt-ergo
This makes stdlib and examples go through without alt-ergo, and removes that prover from the expected set of provers for EC CI. This makes EasyCrypt more cleanly usable in commercial and non-free contexts. Our docker images still contain alt-ergo versions, which are available for proofs in external CI and individual proofs, upon a user's (hopefully informed) choice. Anyone wanting to transition their proofs away from alt-ergo should expect proofs that use SMT to solve goals that require either instantiation of existentials or case analysis on inductively-typed values to fail after removing alt-ergo.
1 parent c54cbb5 commit 41d8e7b

File tree

27 files changed

+366
-152
lines changed

27 files changed

+366
-152
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-
provers = Alt-Ergo@2.4
32
provers = CVC5@1.0
43
provers = Z3@4.12

examples/ChaChaPoly/chacha_poly.ec

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,13 @@ proof.
807807
rewrite (hrec (size (drop block_size p))) 2://; 1: smt(size_drop gt0_block_size).
808808
rewrite -{4}(cat_take_drop block_size p); congr.
809809
rewrite -!take_xor_map2_xor; apply (eq_from_nth Byte.zero).
810-
+ smt (size_map2 Block.bytes_of_blockP size_cat size_take gt0_block_size size_ge0).
810+
+ rewrite size_take 1:#smt:(gt0_block_size).
811+
rewrite size_map2 size_cat size_map2 bytes_of_blockP.
812+
by rewrite /min; smt(size_ge0).
811813
move=> j hj.
812814
have [hj1 hj2] : j < block_size /\ j < size p.
813-
+ smt (size_map2 Block.bytes_of_blockP size_cat size_take gt0_block_size size_ge0).
815+
+ move: hj; rewrite size_map2 size_cat size_map2 bytes_of_blockP /min.
816+
smt(size_ge0).
814817
rewrite
815818
(nth_map2 Byte.zero Byte.zero)
816819
?(size_cat, size_map2, Block.bytes_of_blockP) 1:#smt:(size_ge0).
@@ -878,7 +881,9 @@ proof.
878881
move=> _; rewrite /dblock; apply eq_distr => b.
879882
rewrite !dmap1E.
880883
apply (eq_trans _ (mu1 (dpoly `*` dextra_block) ((topair b).`1, (topair b).`2))); last first.
881-
+ congr; apply fun_ext; smt (topairK).
884+
+ congr; apply: fun_ext=> x @/(\o) @/pred1.
885+
rewrite -{3}topairK; case: (topair b)=> />.
886+
by move: (can_inj _ _ ofpairK)=> /#.
882887
rewrite dprod1E (_:block_size = poly_size + extra_block_size) //.
883888
rewrite dlist_add 1:ge0_poly_size 1:ge0_extra_block_size dmapE.
884889
rewrite !dmap1E /(\o) -dprodE &(mu_eq_support) => -[l1 l2] /supp_dprod /= [h1 h2].
@@ -946,7 +951,9 @@ proof.
946951
move=> _; rewrite /dpoly; apply eq_distr => b.
947952
rewrite !dmap1E.
948953
apply (eq_trans _ (mu1 (dpoly_in `*` dpoly_out) ((topair b).`1, (topair b).`2))); last first.
949-
+ congr; apply fun_ext; smt (topairK).
954+
+ congr; apply: fun_ext=> x @/(\o) @/pred1.
955+
rewrite -{3}(topairK b); case: (topair b)=> />.
956+
by move: (can_inj _ _ ofpairK)=> /#.
950957
rewrite dprod1E (_:poly_size = poly_in_size + poly_out_size) //.
951958
rewrite dlist_add 1:ge0_poly_in_size 1:ge0_poly_out_size dmapE.
952959
rewrite !dmap1E /(\o) -dprodE &(mu_eq_support) => -[l1 l2] /supp_dprod /= [h1 h2].
@@ -1752,31 +1759,18 @@ section PROOFS.
17521759
let r = oget ROin.m{1}.[(n, C.ofintd 0)] in
17531760
let s = oget ROout.m{1}.[(n, C.ofintd 0)] in
17541761
s = t - poly1305_eval r (topol a c))); last first.
1755-
+ auto => /> ; smt (undup_uniq size_undup size_map).
1756-
1757-
(* + auto => /> *; have [#] * :=H H0. *)
1758-
(* rewrite H3/=. *)
1759-
(* move:H4=> [][]->>[#] 3->> [#]*. *)
1760-
(* move:H6=> [#] ->> * /=. *)
1761-
(* rewrite undup_uniq //=; do ! split=> //=. *)
1762-
(* - smt (undup_uniq size_undup size_map). *)
1763-
(* - smt (undup_uniq size_undup size_map). *)
1764-
(* - smt (undup_uniq size_undup size_map). *)
1765-
(* - move=> *. *)
1766-
(* pose n1:= nth witness _ _. *)
1767-
(* have* :=H5 _ _ H19. *)
1768-
(* have:=H16 _ H21; rewrite H20 /= => -> //=. *)
1769-
(* rewrite/n1/=. *)
1770-
(* pose l1:= List.map _ _. *)
1771-
(* pose l := undup _. *)
1772-
(* have:=mem_nth witness l j; rewrite H17 H18 /= =>*. *)
1773-
(* move:H22; rewrite mem_undup mapP => [][] /= [] n2 y1 y2 y3 /= [] *. *)
1774-
(* have:=H15 n1 x1 x2 x3. *)
1775-
(* have:=H11 n1 x1 x2 x3. *)
1776-
(* have := H19; rewrite -H8 => *. *)
1777-
(* have :=H13 n1 x1 x2 x3; rewrite H20 /= -H18/= get_some //= => -> //=. *)
1778-
(* smt (undup_uniq size_undup size_map). *)
1779-
1762+
+ auto=> /> &1 &2 + not_bad; rewrite not_bad=> />.
1763+
move=> inv_count inv_domRO inv_domSRO1 eq_domSRO2 inv_domSRO2.
1764+
move=> size_lenc inv_ndec inv_log inv_sc inv0 inv1 inv2 inv3 inv4.
1765+
do !split; [1..5:smt(undup_uniq size_undup size_map)].
1766+
move=> j ge0_j gtj_size lc_j x1 x2 x3.
1767+
pose n0 := nth _ _ _; case _: (UFCMA.log.[n0]{2})=> [/#|/> log_nth].
1768+
split=> [/#|]; case _: (SplitC2.I2.RO.m{1}.[n0, C.ofintd 0])=> [/#|].
1769+
case _: (RO.m{2}.[n0, C.ofintd 0])=> [/#|/>].
1770+
move: (inv2 n0 _); 1:by rewrite domE log_nth.
1771+
rewrite log_nth=> /> _ _ x0 m2_n0 x4 i2_n0.
1772+
move: (inv4 n0 _); 1:exact: (inv_domSRO1 _ (C.ofintd 0)).
1773+
by rewrite log_nth i2_n0 m2_n0.
17801774
inline{1} 2; rcondt{1} 3.
17811775
+ by move=> *;auto => />;rewrite /test /= C.ofintdK; smt (C.gt0_max_counter).
17821776
inline{1} 3; inline{1} 4; sp 0 1; wp.
@@ -2086,12 +2080,13 @@ section PROOFS.
20862080
- have:=allP (fun (n0 : nonce) => (n0, C.ofintd 0) \notin ROout.m{2}) l2.
20872081
have-> /= -> //=:=filter_all (fun (n0 : nonce) => (n0, C.ofintd 0) \notin SplitC2.I2.RO.m{2}) l.
20882082
by rewrite mem_nth //=.
2089-
rewrite (drop_nth witness i{2} l2) //= drop0 //=; do ! split=> /> *.
2083+
rewrite (drop_nth witness i{2} l2) //= drop0 //=; do ! split=> />.
20902084
+ smt().
20912085
+ smt(mem_set).
2092-
+ rewrite get_set_neqE /=; smt(mem_nth).
2093-
+ smt(mem_set).
2086+
+ move=> *; rewrite get_set_neqE /=; smt(mem_nth).
20942087
+ smt(mem_set).
2088+
+ move=> n0; rewrite mem_set; case=> [/#|/>].
2089+
by right; exists i{2}=> /#.
20952090
+ smt(mem_set size_drop size_ge0 size_eq0).
20962091
+ smt(mem_set size_drop size_ge0 size_eq0).
20972092
qed.
@@ -2479,8 +2474,8 @@ section PROOFS.
24792474
call(: ={glob BNR, UFCMA.cbad1, UFCMA.cbad1, glob RO, Mem.log, Mem.lc} /\
24802475
inv_lbad1 UFCMA_l.lbad1{2} BNR.lenc{2} UFCMA.log{2} Mem.log{2} Mem.lc{2} UFCMA.cbad1{2} BNR.ndec{2} /\
24812476
(UFCMA.bad1{1} => exists (tt : tag * tag), (tt \in UFCMA_l.lbad1{2}) /\ tt.`1 = tt.`2)); first last.
2482-
+ by proc; inline*; sp 1 1; if; auto; smt(in_cons make_lbad1_size_cons2 leq_make_lbad1).
2483-
+ by skip; smt( mem_empty ge0_qenc ge0_qdec).
2477+
+ proc; inline*; sp 1 1; if; auto => &1 &2 /> ?????????????; smt(in_cons make_lbad1_size_cons2 leq_make_lbad1).
2478+
+ skip => &1 &2 />; rewrite ge0_qenc size_flatten /sumz /= ge0_qdec /=; smt(mem_empty).
24842479
proc; sp; if; 1, 3: auto=> />.
24852480
sp; wp=> /=.
24862481
case: (UFCMA.cbad1{1} < qenc); last first.
@@ -2492,8 +2487,19 @@ section PROOFS.
24922487
wp -7 -7=> />.
24932488
move => />; smt (get_setE).
24942489
conseq (: ={c1, t, RO.m, Mem.log}); [2:sim=> /> /#].
2495-
move => />.
2496-
smt(get_setE leq_make_lbad1 make_lbad1_size_cons3 size_ge0).
2490+
move => &1 &2 /> 9? X ?????? c1_R t_R.
2491+
do! split.
2492+
- smt().
2493+
- rewrite (make_lbad1_size_cons3) //; smt(leq_make_lbad1 size_ge0).
2494+
- smt(leq_make_lbad1).
2495+
- move => n D ad msg tag; rewrite get_setE.
2496+
case: D => />.
2497+
+ by rewrite /dom get_setE.
2498+
smt(get_setE).
2499+
- move => n; rewrite /dom get_setE /#.
2500+
move => t t' tt'; case: (X _ _ tt') => /> n hn ht ad msg ht'.
2501+
case: (n = n{!2}); first smt().
2502+
move => _; exists n; rewrite get_setE /#.
24972503
inline*; sp.
24982504
rcondt{1} 5; 1: auto=> />.
24992505
- conseq(:_==> true)=> />; 1: smt(size_map size_filter count_size).
@@ -2509,8 +2515,10 @@ section PROOFS.
25092515
- smt().
25102516
- rewrite size_cat !size_map make_lbad1_size_cons3 //= /#.
25112517
- smt(leq_make_lbad1).
2512-
- smt(get_setE).
2513-
- smt(get_setE).
2518+
- move => n D ad msg tag; rewrite get_setE; case: D => />; first by rewrite /dom get_setE.
2519+
smt(get_setE).
2520+
- move => n; case: (n = n{!2}) => />; first by rewrite /dom get_setE.
2521+
smt(get_setE).
25142522
- move=> ? ? H15; have:=H15; rewrite mem_cat=> [#][] H16 *.
25152523
+ smt(get_setE).
25162524
have:= H16; rewrite mapP /= => [#][] t2 [#] h <<- <<-; have:=h.
@@ -2643,7 +2651,12 @@ section PROOFS.
26432651
inv_lbad1_i UFCMA_l.lbad1{1} BNR.lenc{1} UFCMA.log{1} Mem.log{1} Mem.lc{1} UFCMA.cbad1{1} BNR.ndec{1} /\
26442652
(((nth (w1,w2) UFCMA_l.lbad1{1} nth0).`1 =
26452653
(nth (w1,w2) UFCMA_l.lbad1{1} nth0).`2) => UFCMA_li.badi{2})); first last.
2646-
+ proc; sp; if; auto; inline*; auto; smt(make_lbad1_size_cons2 size_ge0 leq_make_lbad1).
2654+
+ proc; sp; if; auto; inline*; auto => &1 &2 /> *; do !split.
2655+
- case: (c{2} \in Mem.log{2}); first smt().
2656+
rewrite make_lbad1_size_cons2 // /#.
2657+
- smt(leq_make_lbad1).
2658+
- smt().
2659+
- smt().
26472660
+ by auto; smt(neq_w1_w2 size_ge0 ge0_qdec size_flatten ge0_qenc).
26482661
+ proc; inline*; sp; if; 1, 3: auto; sp.
26492662
swap [5..6] 7.
@@ -2732,8 +2745,8 @@ section PROOFS.
27322745
proof.
27332746
apply (RealOrder.ler_trans _ _ _ (step4_bad1_lbad1 &m)).
27342747
apply (RealOrder.ler_trans _ _ _ (step4_lbad1_sum &m)).
2735-
apply (RealOrder.ler_trans _ _ _ (StdBigop.Bigreal.ler_sum_seq _ _ (fun _ => pr1_poly_out) _ _));
2736-
last by rewrite sumr_const count_predT size_iota; smt(ge0_qdec).
2748+
apply (RealOrder.ler_trans _ _ _ (StdBigop.Bigreal.ler_sum_seq _ _ (fun _ => pr1_poly_out) _ _));
2749+
last by rewrite sumr_const count_predT size_iota ler_maxr // ge0_qdec.
27372750
move=> nth0; rewrite mem_iota /predT /= => [#] *.
27382751
apply (RealOrder.ler_trans _ _ _ (step4_badi &m nth0 _))=> //.
27392752
exact (pr_step4_badi &m).

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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ 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.
105-
smt (order_path_min allP le_trans).
107+
suff -> : y < x by smt().
108+
have /allP := order_path_min _ le_trans _ _ hp.
109+
move => /(_ _ hin) /#.
106110
qed.
107111

108112
lemma sindex_countP (t: elem array) (lo hi p : int) :

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
(* -------------------------------------------------------------------- *)

0 commit comments

Comments
 (0)