File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,8 +250,18 @@ let t_pr_rewrite_low (s, (dof: (_ -> _ -> _ -> ss_inv) option)) tc =
250250 let (resv, k) = map_ss_inv_destr2 destr_eq pr.pr_event in
251251 let k_id = EcEnv.LDecl. fresh_id hyps " k" in
252252 let d = (oget dof) tc torw (EcTypes. tdistr k.inv.f_ty) in
253- (* FIXME: Ensure that d.inv does not use d.m *)
254- (* FIXME: Ensure that k.inv does not use k.m *)
253+ (* Check that k and d do not reference the post-execution memory.
254+ Otherwise the rewrite is unsound: the event `res = k` would use
255+ k from the post-state, but `mu1 d k` treats k as a constant. *)
256+ let post_mem = Mid. singleton k.m () in
257+ if not (Mid. set_disjoint k.inv.f_fv post_mem) then
258+ tc_error !! tc
259+ " Pr-rewrite: the value compared to res must not depend on \
260+ the post-execution memory" ;
261+ if not (Mid. set_disjoint d.inv.f_fv post_mem) then
262+ tc_error !! tc
263+ " Pr-rewrite: the distribution must not depend on \
264+ the post-execution memory" ;
255265 (pr_mu1_le_eq_mu1 pr_mem pr_fun pr_args resv k.inv k_id d.inv, 2 )
256266
257267 | (`MuEq | `MuSub as kind ) -> begin
You can’t perform that action at this time.
0 commit comments