Skip to content

Commit 88096fb

Browse files
oskgofdupress
authored andcommitted
use auto unfold for some Logic operators
and fix bug with bindings for multiple variables and one type
1 parent 7e192dd commit 88096fb

22 files changed

Lines changed: 107 additions & 107 deletions

File tree

examples/ChaChaPoly/chacha_poly.ec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,6 @@ section PROOFS.
23832383
move=> n lenc Hrec [#] log lc c [] H1 H2.
23842384
have/=:=Hrec log lc c H2.
23852385
rewrite !size_flatten /= !sumzE /= !BIA.big_cons /=.
2386-
pose p1 := predT _; have->/={p1}:p1=true by done.
23872386
case: (c.`1 \in lenc) => ? H0 * /=.
23882387
+ rewrite H0 //=.
23892388
have-> /= :c.`1 <> n by smt().
@@ -2431,7 +2430,6 @@ section PROOFS.
24312430
proof.
24322431
move=> huniq hnin.
24332432
rewrite !size_flatten /= !sumzE /= !BIA.big_cons /=.
2434-
pose p1 := predT _; have->/={p1}:p1=true by done.
24352433
rewrite !size_map; congr.
24362434
rewrite !BIA.big_map /= !predTofV/(\o) /=.
24372435
apply BIA.congr_big_seq => />; rewrite {1}/predT /= => *.

examples/PRG.ec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ section.
270270
by move=> _ _; islossless.
271271
(* Psample.prg preserves bad *)
272272
move=> *; proc; auto=> />; rewrite dseed_ll dout_ll /=.
273-
move=> &hr + v1 _ _ v2 _ _; case=> [h|r r_in_log r_in_m].
273+
move=> &hr + v1 _ v2 _; case=> [h|r r_in_log r_in_m].
274274
+ by apply/Cycle; rewrite /= h.
275275
by apply/(@Collision _ _ r)=> /=; [rewrite r_in_log|rewrite r_in_m].
276276
(* [F.f ~ F.f: I] when Bad does not hold *)
@@ -290,7 +290,7 @@ section.
290290
case (x \in F.m).
291291
+ by rcondf 3; auto=> />; rewrite dseed_ll dout_ll.
292292
rcondt 3; first by do !rnd; wp.
293-
auto=> />; rewrite dseed_ll dout_ll //= => &hr bad_init x_notin_m v _ _ v0 _ _.
293+
auto=> />; rewrite dseed_ll dout_ll //= => &hr bad_init x_notin_m v _ v0 _.
294294
case: bad_init=> [/(Cycle<:seed,seed * output>) -> //|r r_in_log r_in_m].
295295
by apply/(@Collision _ _ r)=> //=; rewrite mem_set r_in_m.
296296
(* Returning to main *)

examples/Pedersen.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ section PedersenSecurity.
108108
proc; wp.
109109
swap 4 3.
110110
rnd (pred1 b'); call ug_ll; wp; rnd; call uc_ll; auto => />.
111-
by rewrite dt_ll /= => v _ _ result; rewrite DBool.dbool1E.
111+
by rewrite dt_ll /= => v _ result; rewrite DBool.dbool1E.
112112
qed.
113113

114114
local lemma phi_hi (U<:Unhider) &m:

examples/UC/RndO.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ module LRO : RO = {
318318
lemma RRO_resample_ll : islossless RRO.resample.
319319
proof.
320320
proc; call (iter_ll RRO.I _)=> //; proc; auto=> /= ?;
321-
by split; first apply sampleto_ll.
321+
by apply sampleto_ll.
322322
qed.
323323
324324
(* now we use the eager tactics to show a series of lemmas

examples/br93.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ auto; call (_: true).
363363
+ exact A_a1_ll. (* adversary *)
364364
+ by proc; call (LRO_o_ll _); auto=> /=; apply: dptxt_ll. (* oracle *)
365365
auto=> />; rewrite dkeys_ll drand_ll dptxt_ll /predT /=.
366-
by move=> _ _ _ _ _ _ r; rewrite dbool1E pred1E.
366+
by move=> _ _ _ _ _ _ r; rewrite dbool1E.
367367
qed.
368368
369369
(* Step 3: The reduction step -- if A queries the RO with the randomness *)

examples/ehoare/qselect/qselect.ec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ proof.
251251
have -> : 4 * sumid (pos + 1)(hi + 1) = 2 * (2 * sumid (pos + 1)(hi + 1)) by ring.
252252
rewrite sumidE_rm 1:/#.
253253
apply RealOrder.ler_pdivr_mulr; 1: smt().
254-
rewrite !to_pos_pos 1,3,4:/#.
254+
rewrite !to_pos_pos 3,4:/#.
255+
+ rewrite le_fromint.
256+
pose h1 := hi + 1; pose p1 := pos + 1. pose lo1 := 1+ lo.
257+
by apply IntOrder.mulr_ge0 => /#.
255258
+ rewrite le_fromint.
256259
pose h1 := hi + 1; pose p1 := pos + 1. pose lo1 := 1+ lo.
257260
have -> : 2 * ((h1 - p1) * (h1 + p1 - 1)) + 4 * ((- lo1) * (h1 - p1)) =

examples/hashed_elgamal_std.ec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ section Security.
179179
proof.
180180
byphoare=> //; proc.
181181
rnd (pred1 b')=> /=; conseq (_:_ ==> true).
182-
+ by move=> /> b; rewrite dbool1E pred1E.
182+
+ by move=> /> b; rewrite dbool1E.
183183
call Ag_ll; auto.
184184
by call Ac_ll; auto=> />; rewrite dhkey_ll dt_ll dbits_ll.
185185
qed.

src/ecScope.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ module Op = struct
13491349
} in
13501350
let unfold =
13511351
match op.po_args with
1352-
| (a, Some _) -> Some (List.length a)
1352+
| (a, Some _) -> Some (List.fold (fun acc (b, _) -> acc + List.length b) 0 a)
13531353
| (_, None) -> None in
13541354

13551355
let tyop = EcDecl.mk_op ~opaque ?unfold tparams ty body lc in

theories/algebra/Bigalg.ec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ lemma sum_pair_dep ['a 'b] u v J : uniq J =>
122122
(filter (fun ij : _ * _ => ij.`1 = i) J))
123123
(undup (unzip1 J)).
124124
proof.
125-
move=> uqJ; rewrite big_pair // &(eq_bigr) => /= a _.
125+
move=> uqJ; rewrite big_pair // &(eq_bigr) => /= a.
126126
by rewrite mulr_sumr !big_filter &(eq_bigr) => -[a' b] /= ->>.
127127
qed.
128128

@@ -133,7 +133,7 @@ lemma sum_pair ['a 'b] u v J : uniq J =>
133133
(undup (unzip1 J)).
134134
proof.
135135
move=> uqJ; rewrite (@sum_pair_dep u (fun _ => v)) // &(eq_bigr) /=.
136-
by move=> a _ /=; congr; rewrite big_map predT_comp /(\o).
136+
by move=> a /=; congr; rewrite big_map predT_comp /(\o).
137137
qed.
138138
end BAdd.
139139

@@ -357,7 +357,7 @@ case: (x = zeror) => [->>|nz_x].
357357
rewrite -subr_ge0 subrXX 1:ltzW // pmulr_lge0 ?subr_ge0 //=.
358358
rewrite {2}(_ : n = n - 1 + 1) 1:#ring BAdd.big_int_recr /= 1:/#.
359359
rewrite expr0 /= ltr_spaddr ?mul1r; 1: by rewrite expr_gt0 ltr_neqAle /#.
360-
by rewrite sumr_ge0 => /= i _; rewrite mulr_ge0 ?expr_ge0.
360+
by rewrite sumr_ge0 => /= i; rewrite mulr_ge0 ?expr_ge0.
361361
qed.
362362

363363
lemma big_normr ['a] P F s :

theories/algebra/Bigop.eca

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ lemma big_undup ['a] (P : 'a -> bool) F s :
439439
proof.
440440
have <- := eq_big_perm P F _ _ (perm_undup_count s).
441441
rewrite big_flatten big_map (@big_mkcond P); apply/eq_big => //=.
442-
by move=> @/(\o) /= x _; apply/big_nseq_cond.
442+
by move=> @/(\o) /= x; apply/big_nseq_cond.
443443
qed.
444444

445445
(* -------------------------------------------------------------------- *)

0 commit comments

Comments
 (0)