class Z3::RealExpr

Defined in:

z3/real_expr.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(expr : LibZ3::Ast) #

[View source]

Instance Method Detail

def !=(other) #
Description copied from class Object

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.


[View source]
def *(other) #

[View source]
def **(other) #

[View source]
def +(other) #

[View source]
def -(other) #

[View source]
def - #

[View source]
def /(other) #

[View source]
def <(other) #

[View source]
def <=(other) #

[View source]
def ==(other) #
Description copied from class Reference

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


[View source]
def >(other) #

[View source]
def >=(other) #

[View source]
def abs #

[View source]
def algebraic? #

Z3 answers an irrational root with an algebraic number rather than giving up, and those are apps rather than numerals, so #const? won't spot them


[View source]
def const? #

[View source]
def floor #

SMT-LIB's #to_int rounds towards negative infinity, so this is Crystal's Float#floor. Deliberately not #to_i, which truncates towards zero instead - (-2.5).to_i is -2 in Crystal, but this is -3.


[View source]
def inspect(io) #

[View source]
def integer? #

A Z3 Bool, like #zero? and the other predicates, not a Crystal one


[View source]
def lower_bound(precision = 20) : BigRational #

Rationals bracketing the value, as tightly as precision asks for. An exact value is its own bound.


[View source]
def negative? #

[View source]
def nonzero? #

[View source]
def positive? #

[View source]
def 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.


[View source]
def simplify #

[View source]
def sort #

[View source]
def to_f : Float64 #

Always available, because a Float is allowed to be approximate


[View source]
def to_int #

[View source]
def to_r : BigRational #

There's no #value here, unlike every other sort which can hand back a Crystal object. Z3's Reals include the algebraic numbers, and √2 has no exact Crystal equivalent at all - so instead there's #to_r, which is exact and refuses when it can't be, and #to_f, which is an approximation and says so by being a Float64.


[View source]
def to_s(io) #

[View source]
def to_unsafe : LibZ3::Ast #

[View source]
def upper_bound(precision = 20) : BigRational #

[View source]
def zero? #

[View source]