Skip to content

Commit 907be52

Browse files
oskgostrub
authored andcommitted
check for memory independence of list in rewrite Pr[mu_has_le]
only check memory once during selection
1 parent 491d76b commit 907be52

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/phl/ecPhlPrRw.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ let destr_pr_has pr =
113113
let m = pr.pr_event.m in
114114
match pr.pr_event.inv.f_node with
115115
| Fapp ({ f_node = Fop(op, [ty_elem]) }, [f_f; f_l]) ->
116-
if EcPath.p_equal p_list_has op then
117-
Some(ty_elem, {m;inv=f_f}, {m;inv=f_l})
116+
if EcPath.p_equal p_list_has op && not (Mid.mem m f_l.f_fv) then
117+
Some(ty_elem, {m;inv=f_f}, f_l)
118118
else None
119119
| _ -> None
120120
(*
121121
lemma mu_has_le ['a 'b] (P : 'a -> 'b -> bool) (d : 'a distr) (s : 'b list) :
122122
mu d (fun a => has (P a) s) <= BRA.big predT (fun b => mu d (fun a => P a b)) s.
123-
Pr [f(args)@ &m : has P s] <= BRA.big predT (fun b => Pr [f(args) &m : P b])
123+
Pr [f(args)@ &m : has Pa s] <= BRA.big predT (fun b => Pr [f(args) &m : Pa b]) s
124124
*)
125125
let pr_has_le f_pr =
126126
let pr = destr_pr f_pr in
@@ -131,8 +131,7 @@ let pr_has_le f_pr =
131131
let f_pr1 = f_pr_r {pr with pr_event} in
132132
let f_fsum = f_lambda [idx, GTty ty_elem] f_pr1 in
133133
let f_sum =
134-
(* FIXME: Ensure that `f_l` does not use its memory *)
135-
f_app (f_op p_BRA_big [ty_elem] EcTypes.treal) [f_predT ty_elem; f_fsum; f_l.inv] EcTypes.treal in
134+
f_app (f_op p_BRA_big [ty_elem] EcTypes.treal) [f_predT ty_elem; f_fsum; f_l] EcTypes.treal in
136135
f_real_le f_pr f_sum
137136

138137
(* -------------------------------------------------------------------- *)
@@ -185,7 +184,7 @@ let select_pr_muhasle sid f =
185184
if EcPath.p_equal EcCoreLib.CI_Real.p_real_le op then
186185
match destr_pr_has pr with
187186
| Some (_, _, f_l) when
188-
Mid.set_disjoint f_l.inv.f_fv (Mid.add f_l.m () sid) ->
187+
Mid.set_disjoint f_l.f_fv sid ->
189188
raise (FoundPr f_pr)
190189
| _ -> false
191190
else false

0 commit comments

Comments
 (0)