Skip to content

Commit ddaaf3e

Browse files
oskgoCopilot
authored andcommitted
fix #211 where defining a lossless distribution without requiring Distr makes rnd panic
Co-authored-by: Copilot <copilot@github.com>
1 parent dda4571 commit ddaaf3e

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

src/ecScope.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,8 @@ module Op = struct
14311431
let add_distr_tag
14321432
(pred : path) (bases : string list) (tag : string) (suffix : string) scope
14331433
=
1434-
if not (EcAlgTactic.is_module_loaded (env scope)) then
1435-
hierror "for tag %s, load Distr first" tag;
1434+
if EcEnv.Op.by_path_opt pred (env scope) = None then
1435+
hierror "for tag %s, load Distr first" tag;
14361436

14371437
let oppath = EcPath.pqname (path scope) (unloc op.po_name) in
14381438
let nparams = List.map EcIdent.fresh tyop.op_tparams in

tests/rnd_ll.ec

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require import AllCore.
2+
3+
fail op[lossless] dC : bool distr.
4+
5+
require import Distr.
6+
7+
op[lossless] dC : bool distr.
8+
9+
module M = {
10+
proc p1() = {
11+
var e1;
12+
e1 <$ dC;
13+
}
14+
}.
15+
16+
equiv foo : M.p1 ~ M.p1 : true ==> true.
17+
proc.
18+
rnd.
19+
abort.

theories/crypto/DigitalSignatures.eca

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
(* --- Require/Import Theories --- *)
1414
(* -- Built-in (i.e, standard library) -- *)
15-
require import AllCore List.
15+
require import AllCore List Distr.
1616

1717

1818

0 commit comments

Comments
 (0)