Skip to content

inconsistent behaviour #647

Description

@amenahh

we don't have the same result when we wrote a smt file with a negative argument for rotate_left and the equivalent in ocaml

here's the smtlib file

(declare-const y (_ BitVec 32))
(declare-const z (_ BitVec 32))


(assert (= ((_ rotate_left -1) y)  z) )

(check-sat)

(get-model)

and the Z3 error when try to run it

(error "line 5 column 32: rotate left expects one integer parameter")
sat
(
  (define-fun z () (_ BitVec 32)
    #x00000000)
  (define-fun y () (_ BitVec 32)
    #x00000000)
)

here's the ocaml code

let y = Smtml.Typed.Bitv32.symbol (Smtml.Symbol.make (Smtml.Ty.Ty_bitv 32) "y")
let z = Smtml.Typed.Bitv32.symbol (Smtml.Symbol.make (Smtml.Ty.Ty_bitv 32) "z")

let expr = Smtml.Typed.Bitv32.rotate_left (-1) y

let expr = Smtml.Typed.Bitv32.eq expr z 

Z3 and CVC5 return SAT
Colibri2 throws an exception

Fatal error: exception Invalid_argument("Z.extract: nonpositive bit length")
Raised at Stdlib.invalid_arg in file "stdlib.ml", line 30, characters 20-45
Called from Z.extract in file "z.ml", line 389, characters 16-63
Called from Colibri2_theories_LRA__RealValue.Check.compute_ground in file "colibri2/theories/LRA/realValue.ml", line 496, characters 46-69
Called from Colibri2_theories_LRA__RealValue.Check.attach.f in file "colibri2/theories/LRA/realValue.ml", line 670, characters 12-30
Called from Colibri2_core__Egraph.Delayed.do_pending in file "colibri2/core/egraph.ml", line 1158, characters 16-39
Called from Colibri2_core__Egraph.Backtrackable.flush in file "colibri2/core/egraph.ml", line 1386, characters 4-24
Called from Colibri2_solver__Scheduler.protect_against_contradiction in file "colibri2/solver/scheduler.ml" (inlined), line 821, characters 8-12
Called from Colibri2_solver__Scheduler.run_one_step_fix_model in file "colibri2/solver/scheduler.ml", lines 895-901, characters 6-24
Re-raised at Colibri2_solver__Scheduler.run_one_step_fix_model in file "colibri2/solver/scheduler.ml", lines 895-901, characters 6-24
Called from Colibri2_solver__Scheduler.run_inf_step in file "colibri2/solver/scheduler.ml", line 1009, characters 8-41
Called from Colibri2_solver__Scheduler.run_inf_step in file "colibri2/solver/scheduler.ml", line 1019, characters 4-49
Called from Colibri2_solver__Scheduler.check_sat.(fun) in file "colibri2/solver/scheduler.ml", line 1064, characters 4-37
Called from Smtml__Colibri2_mappings.M.Make.Solver.check in file "src/smtml/colibri2_mappings.default.ml", line 199, characters 15-46
Called from Smtml__Utils.run_and_time_call in file "src/smtml/utils.ml", line 7, characters 15-19
Called from Dune__exe__Bug5 in file "bug/bug5.ml", line 36, characters 8-64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions