Skip to content

Commit

Permalink
fix summation to add bitwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
David Chemouil committed May 1, 2024
1 parent 8d61662 commit 914c9bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Elo_to_ltl1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ module Make (Ltl : Solver.LTL) = struct
empty r_sup_seq

(* Produces the integer term corresponding to [SUM_(t \in on) f(t)] *)
let summation ~(on : TS.t) (f : Tuple.t -> term) : term =
on |> TS.to_iter |> Iter.fold (fun t1 t2 -> plus t1 (f t2)) (num 2 0)
let summation ~bw ~(on : TS.t) (f : Tuple.t -> term) : term =
on |> TS.to_iter |> Iter.fold (fun t1 t2 -> plus t1 (f t2)) (num bw 0)

module TupleHashtbl = CCHashtbl.Make (Tuple)

Expand Down Expand Up @@ -616,9 +616,9 @@ module Make (Ltl : Solver.LTL) = struct
method build_Sum (subst : stack) (r : G.exp) ie _range' _dummy_to_ignore =
let { must; may; _ } = env#must_may_sup subst r in
let ie' t = self#visit_iexp (t :: subst) ie in
let must_part = summation ~on:must ie' in
let must_part = summation ~bw:env#bitwidth ~on:must ie' in
let may_part =
summation ~on:may (fun t ->
summation ~bw:env#bitwidth ~on:may (fun t ->
ifthenelse_arith (self#visit_exp subst r t) (ie' t)
(num env#bitwidth 0))
in
Expand All @@ -629,7 +629,7 @@ module Make (Ltl : Solver.LTL) = struct
let { must; may; _ } = env#must_may_sup subst r in
let must_card = num env#bitwidth @@ TS.size must in
let may_part =
summation ~on:may (fun t ->
summation ~bw:env#bitwidth ~on:may (fun t ->
ifthenelse_arith (r' t) (num env#bitwidth 1) (num env#bitwidth 0))
in
plus must_card may_part
Expand Down

0 comments on commit 914c9bf

Please sign in to comment.