Skip to content

Commit

Permalink
bv2arith
Browse files Browse the repository at this point in the history
  • Loading branch information
bclement-ocp committed Jul 24, 2024
1 parent 0f46897 commit 5e64b04
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/lib/reasoners/bitv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,31 @@ module Shostak(X : ALIEN) = struct
f x, ctx
let (and+) = (and*)

let other ~neg t _sz ctx =
let other ~neg t sz ctx =
let r, ctx' =
match E.term_view t with
| { f = Op BVmul ; xs = [ x ; y ] ; _ } ->
let x, y = if E.compare y x < 0 then y, x else x, y in
let eqn =
E.Core.eq t
(E.BV.int2bv sz E.Ints.(E.BV.bv2nat x * E.BV.bv2nat y))
in
X.term_embed t, [eqn]
| { f = Op BVadd ; xs = [ x ; y ] ; _ } ->
let x, y = if E.compare y x < 0 then y, x else x, y in
let eqn =
E.Core.eq t
(E.BV.int2bv sz E.Ints.(E.BV.bv2nat x + E.BV.bv2nat y))
in
X.term_embed t, [eqn]
| { f = Op BVsub ; xs = [ x ; y ] ; _ } ->
let eqn =
E.Core.eq t
(E.BV.int2bv sz E.Ints.(E.BV.bv2nat x - E.BV.bv2nat y))
in
X.term_embed t, [eqn]
| { f = Op (
BVand | BVor | BVxor
| BVadd | BVsub | BVmul | BVudiv | BVurem
| BVshl | BVlshr
BVand | BVor | BVxor | BVudiv | BVurem | BVshl | BVlshr
); _ } ->
X.term_embed t, []
| _ -> X.make t
Expand Down

0 comments on commit 5e64b04

Please sign in to comment.