class

Z3::BitvecExpr

Inherits Reference < Object

Constructors

new(expr : LibZ3::Ast, sort : BitvecSort)
Source

Instance methods

!=(other)

Returns true if this object is not equal to other.

By default this method is implemented as !(self == other) so there's no need to override this unless there's a more efficient way to do it.

Source
%(other)
Source
&(other)
Source
*(other)
Source
+(other)
Source
-(other)
Source
/(other)
Source
<(other)
Source
<<(other)
Source
<=(other)
Source
==(other)

Returns false (other can only be a Value here).

Source
>(other)
Source
>=(other)
Source
>>(other)
Source
^(other)
Source
|(other)
Source
abs

Inherently signed

Source
add_no_overflow?(other)
Source
add_no_underflow?(other)
Source
all_bits_set?
Source
any_bits_set?
Source
bit(index : Int)

A single bit, as a Bool. Deliberately not #[] - that would read like #extract with a one-bit range, which gives a Bitvec(1) instead

Source
concat(other : BitvecExpr)
Source
const?
Source
div_no_overflow?(other)
Source
extract(hi : Int, lo : Int)
Source
inspect(io)
Source
lshift(other)
Source
mul_no_overflow?(other)
Source
mul_no_underflow?(other)
Source
nand(other)
Source
neg_no_overflow?
Source
negative?

Inherently signed

Source
nonzero?
Source
nor(other)
Source
positive?

Inherently signed

Source
redand

Z3 answers these with a one-bit Bitvec rather than a Bool, which is what #all_bits_set? and #any_bits_set? are for

Source
redor
Source
repeat(n : Int)
Source
rotate_left(n : Int)

An Int rotates by a fixed amount, a Bitvec of the same size by whatever it turns out to be - Z3 has a separate operation for each, and the fixed one gives the solver much more to work with, so a literal never goes through the other

Source
rotate_left(n : BitvecExpr)
Source
rotate_right(n : Int)
Source
rotate_right(n : BitvecExpr)
Source
rshift(other)
Source
same_term?(other : AnyExpr)

Whether this is the same term as other. Z3 hash-conses its expressions, so this is structural equality - Z3.int("a") + 1 built twice is one term. It is a named method rather than == because == builds a Z3 expression instead of answering a Crystal Bool - see the Limitations section of the README.

Source
sign_ext(n : Int)
Source
signed_add_no_overflow?(other)
Source
signed_add_no_underflow?(other)
Source
signed_div(other)
Source
signed_div_no_overflow?(other)
Source
signed_ge(other)
Source
signed_gt(other)
Source
signed_le(other)
Source
signed_lshift(other)
Source
signed_lt(other)
Source
signed_mod(other)
Source
signed_mul_no_overflow?(other)
Source
signed_mul_no_underflow?(other)
Source
signed_neg_no_overflow?
Source
signed_rem(other)
Source
signed_rshift(other)
Source
signed_sub_no_overflow?(other)
Source
signed_sub_no_underflow?(other)
Source
signed_to_i
Source
signed_value
Source
simplify
Source
size
Source
sort
Source
sub_no_overflow?(other)

Subtraction is addition's mirror image: only signed can overflow, and both signs can underflow - so which of these takes a sign is the other way round

Source
sub_no_underflow?(other)
Source
to_i

#to_i and friends build a Z3 Int expression out of this one. #value and friends leave Z3 and give back a Crystal Integer, which only works on a literal. Both come in pairs because a Bitvec carries no sign of its own - the same eight bits are 200 read one way and -56 read the other.

Source
to_s(io)
Source
to_unsafe
Source
unsigned_add_no_overflow?(other)
Source
unsigned_add_no_underflow?(other)
Source
unsigned_div(other)
Source
unsigned_div_no_overflow?(other)
Source
unsigned_ge(other)
Source
unsigned_gt(other)
Source
unsigned_le(other)
Source
unsigned_lshift(other)
Source
unsigned_lt(other)
Source
unsigned_mul_no_overflow?(other)
Source
unsigned_mul_no_underflow?(other)
Source
unsigned_neg_no_overflow?
Source
unsigned_rem(other)
Source
unsigned_rshift(other)
Source
unsigned_sub_no_overflow?(other)
Source
unsigned_sub_no_underflow?(other)
Source
unsigned_to_i
Source
unsigned_value

Z3 prints a Bitvec numeral as its unsigned value, so this is the one it gives us

Source
value
Source
xnor(other)
Source
zero?
Source
zero_ext(n : Int)
Source