Documentation ¶
Overview ¶
Package st provides symbolic equivalents of basic Go types.
Every value from this package can be either concrete or symbolic. Operations on concrete values always produce concrete values and are implemented as the underlying Go operations, so they're efficient. If one of the operands is symbolic, the result is generally symbolic.
Every type provided by this package has two fields: C and S. If the value is concrete, C is its concrete value. Otherwise, S is its symbolic value. This makes it convenient to write concrete literals. E.g., st.Int{C: 2} is a concrete "2".
Every type also has an "Any" constructor that returns an unconstrained symbolic value of that type. This value can be thought of as taking on every possible value of that type.
Every Go operation on a type has a corresponding method. Where possible, these follow the names from math/big.
x + y x.Add(y) x - y x.Sub(y) x * y x.Mul(y) x / y x.Div(y) (does not panic on symbolic divide by 0) x % y x.Rem(y) x & y x.And(y) x | y x.Or(y) x ^ y x.Xor(y) x << y x.Lsh(y) x >> y x.Rsh(y) x &^ y x.AndNot(y) x && y x.And(y) (Bool only; *not* short-circuiting) x || y x.Or(y) (Bool only; *not* short-circuiting) x == y x.Eq(y) x != y x.NE(y) x < y x.LT(y) x <= y x.LE(y) x > y x.GT(y) x >= y x.GE(y) -x x.Neg() ^x x.Not() !x x.Not() (Bool only)
For any pair of types T and U that support conversion in Go, T has a method ToU() that returns a U value.
TODO: Float, complex, and string types.
Index ¶
- Variables
- type Bool
- type Int
- func (x Int) Add(y Int) Int
- func (x Int) And(y Int) Int
- func (x Int) AndNot(y Int) Int
- func (x Int) Eq(y Int) Bool
- func (x Int) Eval(m *z3.Model) int
- func (x Int) GE(y Int) Bool
- func (x Int) GT(y Int) Bool
- func (x Int) IsConcrete() bool
- func (x Int) LE(y Int) Bool
- func (x Int) LT(y Int) Bool
- func (x Int) Lsh(y Uint64) Int
- func (x Int) Mul(y Int) Int
- func (x Int) NE(y Int) Bool
- func (x Int) Neg() Int
- func (x Int) Not() Int
- func (x Int) Or(y Int) Int
- func (x Int) Quo(y Int) Int
- func (x Int) Rem(y Int) Int
- func (x Int) Rsh(y Uint64) Int
- func (x Int) String() string
- func (x Int) Sub(y Int) Int
- func (x Int) ToInt() Int
- func (x Int) ToInt16() Int16
- func (x Int) ToInt32() Int32
- func (x Int) ToInt64() Int64
- func (x Int) ToInt8() Int8
- func (x Int) ToUint() Uint
- func (x Int) ToUint16() Uint16
- func (x Int) ToUint32() Uint32
- func (x Int) ToUint64() Uint64
- func (x Int) ToUint8() Uint8
- func (x Int) ToUintptr() Uintptr
- func (x Int) Xor(y Int) Int
- type Int16
- func (x Int16) Add(y Int16) Int16
- func (x Int16) And(y Int16) Int16
- func (x Int16) AndNot(y Int16) Int16
- func (x Int16) Eq(y Int16) Bool
- func (x Int16) Eval(m *z3.Model) int16
- func (x Int16) GE(y Int16) Bool
- func (x Int16) GT(y Int16) Bool
- func (x Int16) IsConcrete() bool
- func (x Int16) LE(y Int16) Bool
- func (x Int16) LT(y Int16) Bool
- func (x Int16) Lsh(y Uint64) Int16
- func (x Int16) Mul(y Int16) Int16
- func (x Int16) NE(y Int16) Bool
- func (x Int16) Neg() Int16
- func (x Int16) Not() Int16
- func (x Int16) Or(y Int16) Int16
- func (x Int16) Quo(y Int16) Int16
- func (x Int16) Rem(y Int16) Int16
- func (x Int16) Rsh(y Uint64) Int16
- func (x Int16) String() string
- func (x Int16) Sub(y Int16) Int16
- func (x Int16) ToInt() Int
- func (x Int16) ToInt16() Int16
- func (x Int16) ToInt32() Int32
- func (x Int16) ToInt64() Int64
- func (x Int16) ToInt8() Int8
- func (x Int16) ToUint() Uint
- func (x Int16) ToUint16() Uint16
- func (x Int16) ToUint32() Uint32
- func (x Int16) ToUint64() Uint64
- func (x Int16) ToUint8() Uint8
- func (x Int16) ToUintptr() Uintptr
- func (x Int16) Xor(y Int16) Int16
- type Int32
- func (x Int32) Add(y Int32) Int32
- func (x Int32) And(y Int32) Int32
- func (x Int32) AndNot(y Int32) Int32
- func (x Int32) Eq(y Int32) Bool
- func (x Int32) Eval(m *z3.Model) int32
- func (x Int32) GE(y Int32) Bool
- func (x Int32) GT(y Int32) Bool
- func (x Int32) IsConcrete() bool
- func (x Int32) LE(y Int32) Bool
- func (x Int32) LT(y Int32) Bool
- func (x Int32) Lsh(y Uint64) Int32
- func (x Int32) Mul(y Int32) Int32
- func (x Int32) NE(y Int32) Bool
- func (x Int32) Neg() Int32
- func (x Int32) Not() Int32
- func (x Int32) Or(y Int32) Int32
- func (x Int32) Quo(y Int32) Int32
- func (x Int32) Rem(y Int32) Int32
- func (x Int32) Rsh(y Uint64) Int32
- func (x Int32) String() string
- func (x Int32) Sub(y Int32) Int32
- func (x Int32) ToInt() Int
- func (x Int32) ToInt16() Int16
- func (x Int32) ToInt32() Int32
- func (x Int32) ToInt64() Int64
- func (x Int32) ToInt8() Int8
- func (x Int32) ToUint() Uint
- func (x Int32) ToUint16() Uint16
- func (x Int32) ToUint32() Uint32
- func (x Int32) ToUint64() Uint64
- func (x Int32) ToUint8() Uint8
- func (x Int32) ToUintptr() Uintptr
- func (x Int32) Xor(y Int32) Int32
- type Int64
- func (x Int64) Add(y Int64) Int64
- func (x Int64) And(y Int64) Int64
- func (x Int64) AndNot(y Int64) Int64
- func (x Int64) Eq(y Int64) Bool
- func (x Int64) Eval(m *z3.Model) int64
- func (x Int64) GE(y Int64) Bool
- func (x Int64) GT(y Int64) Bool
- func (x Int64) IsConcrete() bool
- func (x Int64) LE(y Int64) Bool
- func (x Int64) LT(y Int64) Bool
- func (x Int64) Lsh(y Uint64) Int64
- func (x Int64) Mul(y Int64) Int64
- func (x Int64) NE(y Int64) Bool
- func (x Int64) Neg() Int64
- func (x Int64) Not() Int64
- func (x Int64) Or(y Int64) Int64
- func (x Int64) Quo(y Int64) Int64
- func (x Int64) Rem(y Int64) Int64
- func (x Int64) Rsh(y Uint64) Int64
- func (x Int64) String() string
- func (x Int64) Sub(y Int64) Int64
- func (x Int64) ToInt() Int
- func (x Int64) ToInt16() Int16
- func (x Int64) ToInt32() Int32
- func (x Int64) ToInt64() Int64
- func (x Int64) ToInt8() Int8
- func (x Int64) ToUint() Uint
- func (x Int64) ToUint16() Uint16
- func (x Int64) ToUint32() Uint32
- func (x Int64) ToUint64() Uint64
- func (x Int64) ToUint8() Uint8
- func (x Int64) ToUintptr() Uintptr
- func (x Int64) Xor(y Int64) Int64
- type Int8
- func (x Int8) Add(y Int8) Int8
- func (x Int8) And(y Int8) Int8
- func (x Int8) AndNot(y Int8) Int8
- func (x Int8) Eq(y Int8) Bool
- func (x Int8) Eval(m *z3.Model) int8
- func (x Int8) GE(y Int8) Bool
- func (x Int8) GT(y Int8) Bool
- func (x Int8) IsConcrete() bool
- func (x Int8) LE(y Int8) Bool
- func (x Int8) LT(y Int8) Bool
- func (x Int8) Lsh(y Uint64) Int8
- func (x Int8) Mul(y Int8) Int8
- func (x Int8) NE(y Int8) Bool
- func (x Int8) Neg() Int8
- func (x Int8) Not() Int8
- func (x Int8) Or(y Int8) Int8
- func (x Int8) Quo(y Int8) Int8
- func (x Int8) Rem(y Int8) Int8
- func (x Int8) Rsh(y Uint64) Int8
- func (x Int8) String() string
- func (x Int8) Sub(y Int8) Int8
- func (x Int8) ToInt() Int
- func (x Int8) ToInt16() Int16
- func (x Int8) ToInt32() Int32
- func (x Int8) ToInt64() Int64
- func (x Int8) ToInt8() Int8
- func (x Int8) ToUint() Uint
- func (x Int8) ToUint16() Uint16
- func (x Int8) ToUint32() Uint32
- func (x Int8) ToUint64() Uint64
- func (x Int8) ToUint8() Uint8
- func (x Int8) ToUintptr() Uintptr
- func (x Int8) Xor(y Int8) Int8
- type Integer
- func (x Integer) Add(y Integer) Integer
- func (x Integer) Eq(y Integer) Bool
- func (x Integer) Eval(m *z3.Model) *big.Int
- func (x Integer) GE(y Integer) Bool
- func (x Integer) GT(y Integer) Bool
- func (x Integer) IsConcrete() bool
- func (x Integer) LE(y Integer) Bool
- func (x Integer) LT(y Integer) Bool
- func (x Integer) Mul(y Integer) Integer
- func (x Integer) NE(y Integer) Bool
- func (x Integer) Neg() Integer
- func (x Integer) Quo(y Integer) Integer
- func (x Integer) Rem(y Integer) Integer
- func (x Integer) String() string
- func (x Integer) Sub(y Integer) Integer
- type Real
- func (x Real) Add(y Real) Real
- func (x Real) Eq(y Real) Bool
- func (x Real) Eval(m *z3.Model) *big.Rat
- func (x Real) GE(y Real) Bool
- func (x Real) GT(y Real) Bool
- func (x Real) IsConcrete() bool
- func (x Real) LE(y Real) Bool
- func (x Real) LT(y Real) Bool
- func (x Real) Mul(y Real) Real
- func (x Real) NE(y Real) Bool
- func (x Real) Neg() Real
- func (x Real) Quo(y Real) Real
- func (x Real) String() string
- func (x Real) Sub(y Real) Real
- type Uint
- func (x Uint) Add(y Uint) Uint
- func (x Uint) And(y Uint) Uint
- func (x Uint) AndNot(y Uint) Uint
- func (x Uint) Eq(y Uint) Bool
- func (x Uint) Eval(m *z3.Model) uint
- func (x Uint) GE(y Uint) Bool
- func (x Uint) GT(y Uint) Bool
- func (x Uint) IsConcrete() bool
- func (x Uint) LE(y Uint) Bool
- func (x Uint) LT(y Uint) Bool
- func (x Uint) Lsh(y Uint64) Uint
- func (x Uint) Mul(y Uint) Uint
- func (x Uint) NE(y Uint) Bool
- func (x Uint) Neg() Uint
- func (x Uint) Not() Uint
- func (x Uint) Or(y Uint) Uint
- func (x Uint) Quo(y Uint) Uint
- func (x Uint) Rem(y Uint) Uint
- func (x Uint) Rsh(y Uint64) Uint
- func (x Uint) String() string
- func (x Uint) Sub(y Uint) Uint
- func (x Uint) ToInt() Int
- func (x Uint) ToInt16() Int16
- func (x Uint) ToInt32() Int32
- func (x Uint) ToInt64() Int64
- func (x Uint) ToInt8() Int8
- func (x Uint) ToUint() Uint
- func (x Uint) ToUint16() Uint16
- func (x Uint) ToUint32() Uint32
- func (x Uint) ToUint64() Uint64
- func (x Uint) ToUint8() Uint8
- func (x Uint) ToUintptr() Uintptr
- func (x Uint) Xor(y Uint) Uint
- type Uint16
- func (x Uint16) Add(y Uint16) Uint16
- func (x Uint16) And(y Uint16) Uint16
- func (x Uint16) AndNot(y Uint16) Uint16
- func (x Uint16) Eq(y Uint16) Bool
- func (x Uint16) Eval(m *z3.Model) uint16
- func (x Uint16) GE(y Uint16) Bool
- func (x Uint16) GT(y Uint16) Bool
- func (x Uint16) IsConcrete() bool
- func (x Uint16) LE(y Uint16) Bool
- func (x Uint16) LT(y Uint16) Bool
- func (x Uint16) Lsh(y Uint64) Uint16
- func (x Uint16) Mul(y Uint16) Uint16
- func (x Uint16) NE(y Uint16) Bool
- func (x Uint16) Neg() Uint16
- func (x Uint16) Not() Uint16
- func (x Uint16) Or(y Uint16) Uint16
- func (x Uint16) Quo(y Uint16) Uint16
- func (x Uint16) Rem(y Uint16) Uint16
- func (x Uint16) Rsh(y Uint64) Uint16
- func (x Uint16) String() string
- func (x Uint16) Sub(y Uint16) Uint16
- func (x Uint16) ToInt() Int
- func (x Uint16) ToInt16() Int16
- func (x Uint16) ToInt32() Int32
- func (x Uint16) ToInt64() Int64
- func (x Uint16) ToInt8() Int8
- func (x Uint16) ToUint() Uint
- func (x Uint16) ToUint16() Uint16
- func (x Uint16) ToUint32() Uint32
- func (x Uint16) ToUint64() Uint64
- func (x Uint16) ToUint8() Uint8
- func (x Uint16) ToUintptr() Uintptr
- func (x Uint16) Xor(y Uint16) Uint16
- type Uint32
- func (x Uint32) Add(y Uint32) Uint32
- func (x Uint32) And(y Uint32) Uint32
- func (x Uint32) AndNot(y Uint32) Uint32
- func (x Uint32) Eq(y Uint32) Bool
- func (x Uint32) Eval(m *z3.Model) uint32
- func (x Uint32) GE(y Uint32) Bool
- func (x Uint32) GT(y Uint32) Bool
- func (x Uint32) IsConcrete() bool
- func (x Uint32) LE(y Uint32) Bool
- func (x Uint32) LT(y Uint32) Bool
- func (x Uint32) Lsh(y Uint64) Uint32
- func (x Uint32) Mul(y Uint32) Uint32
- func (x Uint32) NE(y Uint32) Bool
- func (x Uint32) Neg() Uint32
- func (x Uint32) Not() Uint32
- func (x Uint32) Or(y Uint32) Uint32
- func (x Uint32) Quo(y Uint32) Uint32
- func (x Uint32) Rem(y Uint32) Uint32
- func (x Uint32) Rsh(y Uint64) Uint32
- func (x Uint32) String() string
- func (x Uint32) Sub(y Uint32) Uint32
- func (x Uint32) ToInt() Int
- func (x Uint32) ToInt16() Int16
- func (x Uint32) ToInt32() Int32
- func (x Uint32) ToInt64() Int64
- func (x Uint32) ToInt8() Int8
- func (x Uint32) ToUint() Uint
- func (x Uint32) ToUint16() Uint16
- func (x Uint32) ToUint32() Uint32
- func (x Uint32) ToUint64() Uint64
- func (x Uint32) ToUint8() Uint8
- func (x Uint32) ToUintptr() Uintptr
- func (x Uint32) Xor(y Uint32) Uint32
- type Uint64
- func (x Uint64) Add(y Uint64) Uint64
- func (x Uint64) And(y Uint64) Uint64
- func (x Uint64) AndNot(y Uint64) Uint64
- func (x Uint64) Eq(y Uint64) Bool
- func (x Uint64) Eval(m *z3.Model) uint64
- func (x Uint64) GE(y Uint64) Bool
- func (x Uint64) GT(y Uint64) Bool
- func (x Uint64) IsConcrete() bool
- func (x Uint64) LE(y Uint64) Bool
- func (x Uint64) LT(y Uint64) Bool
- func (x Uint64) Lsh(y Uint64) Uint64
- func (x Uint64) Mul(y Uint64) Uint64
- func (x Uint64) NE(y Uint64) Bool
- func (x Uint64) Neg() Uint64
- func (x Uint64) Not() Uint64
- func (x Uint64) Or(y Uint64) Uint64
- func (x Uint64) Quo(y Uint64) Uint64
- func (x Uint64) Rem(y Uint64) Uint64
- func (x Uint64) Rsh(y Uint64) Uint64
- func (x Uint64) String() string
- func (x Uint64) Sub(y Uint64) Uint64
- func (x Uint64) ToInt() Int
- func (x Uint64) ToInt16() Int16
- func (x Uint64) ToInt32() Int32
- func (x Uint64) ToInt64() Int64
- func (x Uint64) ToInt8() Int8
- func (x Uint64) ToUint() Uint
- func (x Uint64) ToUint16() Uint16
- func (x Uint64) ToUint32() Uint32
- func (x Uint64) ToUint64() Uint64
- func (x Uint64) ToUint8() Uint8
- func (x Uint64) ToUintptr() Uintptr
- func (x Uint64) Xor(y Uint64) Uint64
- type Uint8
- func (x Uint8) Add(y Uint8) Uint8
- func (x Uint8) And(y Uint8) Uint8
- func (x Uint8) AndNot(y Uint8) Uint8
- func (x Uint8) Eq(y Uint8) Bool
- func (x Uint8) Eval(m *z3.Model) uint8
- func (x Uint8) GE(y Uint8) Bool
- func (x Uint8) GT(y Uint8) Bool
- func (x Uint8) IsConcrete() bool
- func (x Uint8) LE(y Uint8) Bool
- func (x Uint8) LT(y Uint8) Bool
- func (x Uint8) Lsh(y Uint64) Uint8
- func (x Uint8) Mul(y Uint8) Uint8
- func (x Uint8) NE(y Uint8) Bool
- func (x Uint8) Neg() Uint8
- func (x Uint8) Not() Uint8
- func (x Uint8) Or(y Uint8) Uint8
- func (x Uint8) Quo(y Uint8) Uint8
- func (x Uint8) Rem(y Uint8) Uint8
- func (x Uint8) Rsh(y Uint64) Uint8
- func (x Uint8) String() string
- func (x Uint8) Sub(y Uint8) Uint8
- func (x Uint8) ToInt() Int
- func (x Uint8) ToInt16() Int16
- func (x Uint8) ToInt32() Int32
- func (x Uint8) ToInt64() Int64
- func (x Uint8) ToInt8() Int8
- func (x Uint8) ToUint() Uint
- func (x Uint8) ToUint16() Uint16
- func (x Uint8) ToUint32() Uint32
- func (x Uint8) ToUint64() Uint64
- func (x Uint8) ToUint8() Uint8
- func (x Uint8) ToUintptr() Uintptr
- func (x Uint8) Xor(y Uint8) Uint8
- type Uintptr
- func (x Uintptr) Add(y Uintptr) Uintptr
- func (x Uintptr) And(y Uintptr) Uintptr
- func (x Uintptr) AndNot(y Uintptr) Uintptr
- func (x Uintptr) Eq(y Uintptr) Bool
- func (x Uintptr) Eval(m *z3.Model) uintptr
- func (x Uintptr) GE(y Uintptr) Bool
- func (x Uintptr) GT(y Uintptr) Bool
- func (x Uintptr) IsConcrete() bool
- func (x Uintptr) LE(y Uintptr) Bool
- func (x Uintptr) LT(y Uintptr) Bool
- func (x Uintptr) Lsh(y Uint64) Uintptr
- func (x Uintptr) Mul(y Uintptr) Uintptr
- func (x Uintptr) NE(y Uintptr) Bool
- func (x Uintptr) Neg() Uintptr
- func (x Uintptr) Not() Uintptr
- func (x Uintptr) Or(y Uintptr) Uintptr
- func (x Uintptr) Quo(y Uintptr) Uintptr
- func (x Uintptr) Rem(y Uintptr) Uintptr
- func (x Uintptr) Rsh(y Uint64) Uintptr
- func (x Uintptr) String() string
- func (x Uintptr) Sub(y Uintptr) Uintptr
- func (x Uintptr) ToInt() Int
- func (x Uintptr) ToInt16() Int16
- func (x Uintptr) ToInt32() Int32
- func (x Uintptr) ToInt64() Int64
- func (x Uintptr) ToInt8() Int8
- func (x Uintptr) ToUint() Uint
- func (x Uintptr) ToUint16() Uint16
- func (x Uintptr) ToUint32() Uint32
- func (x Uintptr) ToUint64() Uint64
- func (x Uintptr) ToUint8() Uint8
- func (x Uintptr) ToUintptr() Uintptr
- func (x Uintptr) Xor(y Uintptr) Uintptr
Constants ¶
This section is empty.
Variables ¶
var RealApproxDigits = 100
RealApproxDigits is the number of decimal digits an irrational real will be approximated to when evaluating it as a *big.Rat.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool implements symbolic bool values.
type Int ¶
Int implements symbolic int values.
type Int16 ¶
Int16 implements symbolic int16 values.
func (Int16) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Int16) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Int32 ¶
Int32 implements symbolic int32 values.
func (Int32) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Int32) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Int64 ¶
Int64 implements symbolic int64 values.
func (Int64) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Int64) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Int8 ¶
Int8 implements symbolic int8 values.
type Integer ¶
Integer implements symbolic *big.Int values.
func AnyInteger ¶
AnyInteger returns an unconstrained symbolic Integer.
func (Integer) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Integer) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Real ¶
Real implements symbolic *big.Rat values.
type Uint ¶
Uint implements symbolic uint values.
type Uint16 ¶
Uint16 implements symbolic uint16 values.
func (Uint16) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Uint16) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Uint32 ¶
Uint32 implements symbolic uint32 values.
func (Uint32) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Uint32) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Uint64 ¶
Uint64 implements symbolic uint64 values.
func (Uint64) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Uint64) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Uint8 ¶
Uint8 implements symbolic uint8 values.
func (Uint8) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Uint8) IsConcrete ¶
IsConcrete returns true if x is concrete.
type Uintptr ¶
Uintptr implements symbolic uintptr values.
func AnyUintptr ¶
AnyUintptr returns an unconstrained symbolic Uintptr.
func (Uintptr) Eval ¶
Eval returns x's concrete value in model m. This also evaluates x with model completion.
func (Uintptr) IsConcrete ¶
IsConcrete returns true if x is concrete.