Skip to content

Commit

Permalink
Change assumption related to st.balance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sota Sato committed Mar 15, 2024
1 parent 2e5b08e commit 3aa76eb
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/gen_mlw.ml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ module T = struct
(* Hack: && => /\ *)
Tbinnop (of_expr e1, Dterm.DTand, of_expr e2)
| Eapply (e1, e2) -> Tapply (of_expr e1, of_expr e2)
| Eif (e1, e2, e3) -> Tif (of_expr e1, of_expr e2, of_expr e3)
| _ ->
Format.eprintf "T.of_expr: unsupported: %a@."
(Mlw_printer.pp_expr ~attr:true).closed e;
Expand Down Expand Up @@ -474,14 +475,7 @@ module Generator (D : Desc) = struct
(fun _ c e ->
E.mk_if
(is_contract_of c @@ Step_constant.self st)
(wrap_assume
~assumption:
(T.mk_and
(T.of_expr @@ call_param_wf_of c gp)
(T.of_expr
(E.mk_bin (Step_constant.balance st) "="
(E.mk_bin (balance_of c ctx) "+"
(Step_constant.amount st)))))
(wrap_assume ~assumption:(T.of_expr @@ call_param_wf_of c gp)
@@ call_func_of c st gp ctx)
e)
contracts (call_unknown ctx)
Expand Down Expand Up @@ -672,6 +666,19 @@ module Generator (D : Desc) = struct
in
let+ p = E.mk_any gparam_pty in
wrap_assume ~assumption:(wf st)
@@ wrap_assume
~assumption:
(T.of_expr
@@ M.fold
(fun _ c e ->
E.mk_if
(is_contract_of c @@ Step_constant.self st)
(E.mk_bin (Step_constant.balance st) "="
(E.mk_bin
(balance_of c (E.var_of_binder ctx))
"+" (Step_constant.amount st)))
e)
contracts (expr Etrue))
@@ let+ ctx = dispatch_transfer (E.var_of_binder ctx) st p in
call_unknown ctx
in
Expand Down

0 comments on commit 3aa76eb

Please sign in to comment.