Skip to main content

BV

Struct BV 

Source
pub struct BV { /* private fields */ }
Expand description

A bitvector term of a known width.

Mirrors the z3::ast::BV call surface used by the semantics encoders.

Implementations§

Source§

impl BV

Source

pub fn new_const(name: impl Into<String>, width: u32) -> Self

A fresh free (symbolic) bitvector variable.

Source

pub fn from_i64(value: i64, width: u32) -> Self

A concrete constant from a signed value (two’s-complement, masked).

Source

pub fn from_u64(value: u64, width: u32) -> Self

A concrete constant from an unsigned value (masked to width).

Source

pub fn get_size(&self) -> u32

Bit width of this term.

Source

pub fn bvadd(&self, other: impl Borrow<BV>) -> BV

Modular addition.

Source

pub fn bvsub(&self, other: impl Borrow<BV>) -> BV

Modular subtraction.

Source

pub fn bvmul(&self, other: impl Borrow<BV>) -> BV

Modular multiplication.

Source

pub fn bvudiv(&self, other: impl Borrow<BV>) -> BV

Unsigned division (SMT-LIB: division by zero yields all-ones).

Source

pub fn bvsdiv(&self, other: impl Borrow<BV>) -> BV

Signed division (SMT-LIB semantics, via ordeal::lowering).

Source

pub fn bvurem(&self, other: impl Borrow<BV>) -> BV

Unsigned remainder (via ordeal::lowering).

Source

pub fn bvsrem(&self, other: impl Borrow<BV>) -> BV

Signed remainder (via ordeal::lowering).

Source

pub fn bvneg(&self) -> BV

Two’s-complement negation (via ordeal::lowering).

Source

pub fn bvand(&self, other: impl Borrow<BV>) -> BV

Bitwise AND.

Source

pub fn bvor(&self, other: impl Borrow<BV>) -> BV

Bitwise OR.

Source

pub fn bvxor(&self, other: impl Borrow<BV>) -> BV

Bitwise XOR.

Source

pub fn bvnot(&self) -> BV

Bitwise NOT (via ordeal::lowering).

Source

pub fn bvshl(&self, other: impl Borrow<BV>) -> BV

Logical shift left (SMT-LIB oversize semantics: amount >= width → 0).

Source

pub fn bvlshr(&self, other: impl Borrow<BV>) -> BV

Logical shift right.

Source

pub fn bvashr(&self, other: impl Borrow<BV>) -> BV

Arithmetic shift right.

Source

pub fn bvrotl(&self, other: impl Borrow<BV>) -> BV

Rotate left by a term amount (via ordeal::lowering).

Source

pub fn bvrotr(&self, other: impl Borrow<BV>) -> BV

Rotate right by a term amount.

Source

pub fn extract(&self, hi: u32, lo: u32) -> BV

Bit extraction [hi:lo] (inclusive).

Source

pub fn concat(&self, other: impl Borrow<BV>) -> BV

Concatenation: self becomes the high bits.

Source

pub fn zero_ext(&self, by: u32) -> BV

Zero-extension by by bits.

Source

pub fn sign_ext(&self, by: u32) -> BV

Sign-extension by by bits.

Source

pub fn eq(&self, other: impl Borrow<BV>) -> Bool

Equality predicate (canonicalized — = is commutative).

Source

pub fn ne(&self, other: impl Borrow<BV>) -> Bool

Disequality predicate (canonicalized — distinct is commutative).

Source

pub fn bvult(&self, other: impl Borrow<BV>) -> Bool

Unsigned less-than.

Source

pub fn bvule(&self, other: impl Borrow<BV>) -> Bool

Unsigned less-or-equal.

Source

pub fn bvugt(&self, other: impl Borrow<BV>) -> Bool

Unsigned greater-than.

Source

pub fn bvuge(&self, other: impl Borrow<BV>) -> Bool

Unsigned greater-or-equal.

Source

pub fn bvslt(&self, other: impl Borrow<BV>) -> Bool

Signed less-than.

Source

pub fn bvsle(&self, other: impl Borrow<BV>) -> Bool

Signed less-or-equal.

Source

pub fn bvsgt(&self, other: impl Borrow<BV>) -> Bool

Signed greater-than.

Source

pub fn bvsge(&self, other: impl Borrow<BV>) -> Bool

Signed greater-or-equal.

Source

pub fn simplify(&self) -> BV

Return self unchanged; pair with BV::as_i64 / BV::as_u64, which concretely evaluate closed terms (the z3 idiom x.simplify().as_i64() keeps working).

Source

pub fn as_i64(&self) -> Option<i64>

Concrete value of a closed (variable-free) term, as z3’s as_i64 reports it: the unsigned value when it fits in i64.

Source

pub fn as_u64(&self) -> Option<u64>

Concrete value of a closed (variable-free) term as u64.

Trait Implementations§

Source§

impl Clone for BV

Source§

fn clone(&self) -> BV

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BV

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BV

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for BV

§

impl RefUnwindSafe for BV

§

impl Send for BV

§

impl Sync for BV

§

impl Unpin for BV

§

impl UnsafeUnpin for BV

§

impl UnwindSafe for BV

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V