Smt
smt
¶
NonFuncSMTType: TypeAlias = BoolType | BitVectorType
module-attribute
¶
NonFuncSMTTypeConstr = irdl_to_attr_constraint(NonFuncSMTType)
module-attribute
¶
SMTType: TypeAlias = NonFuncSMTType | FuncType
module-attribute
¶
SMTTypeConstr = irdl_to_attr_constraint(SMTType)
module-attribute
¶
SMT = Dialect('smt', [DeclareFunOp, ApplyFuncOp, ConstantBoolOp, NotOp, AndOp, OrOp, XOrOp, ImpliesOp, DistinctOp, EqOp, IteOp, ExistsOp, ForallOp, YieldOp, AssertOp, BvConstantOp, BVNegOp, BVNotOp, BVAndOp, BVOrOp, BVXOrOp, BVAddOp, BVMulOp, BVUDivOp, BVSDivOp, BVURemOp, BVSRemOp, BVSModOp, BVShlOp, BVLShrOp, BVAShrOp], [BoolType, BitVectorType, FuncType, BitVectorAttr])
module-attribute
¶
BoolType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
A boolean.
Source code in xdsl/dialects/smt.py
name = 'smt.bool'
class-attribute
instance-attribute
¶
BitVectorType
¶
Bases: ParametrizedAttribute, TypeAttribute
This type represents the (_ BitVec width) sort as described in the SMT bitvector theory. The bit-width must be strictly greater than zero.
Source code in xdsl/dialects/smt.py
name = 'smt.bv'
class-attribute
instance-attribute
¶
width: IntAttr
instance-attribute
¶
__init__(width: int | IntAttr)
¶
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
¶
print_parameters(printer: Printer) -> None
¶
verify() -> None
¶
value_range() -> tuple[int, int]
¶
The range of values that this bitvector can represent. The maximum value is exclusive.
FuncType
¶
Bases: ParametrizedAttribute, TypeAttribute
A function type.
Source code in xdsl/dialects/smt.py
name = 'smt.func'
class-attribute
instance-attribute
¶
domain_types: ArrayAttr[NonFuncSMTType]
instance-attribute
¶
The types of the function arguments.
range_type: NonFuncSMTType
instance-attribute
¶
The type of the function result.
__init__(domain_types: Sequence[NonFuncSMTType], range_type: NonFuncSMTType)
¶
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
¶
Source code in xdsl/dialects/smt.py
print_parameters(printer: Printer) -> None
¶
constr(domain: RangeConstraint[NonFuncSMTType], range: AttrConstraint[NonFuncSMTType]) -> AttrConstraint[FuncType]
staticmethod
¶
BitVectorAttr
¶
Bases: TypedAttribute
Source code in xdsl/dialects/smt.py
name = 'smt.bv'
class-attribute
instance-attribute
¶
value: IntAttr
instance-attribute
¶
type: BitVectorType
instance-attribute
¶
__init__(value: int | IntAttr, type: BitVectorType | int)
¶
verify() -> None
¶
Source code in xdsl/dialects/smt.py
constr(type: AttrConstraint[BitVectorType]) -> AttrConstraint[BitVectorAttr]
staticmethod
¶
get_type_index() -> int
classmethod
¶
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
¶
Source code in xdsl/dialects/smt.py
print_parameters(printer: Printer) -> None
¶
parse_with_type(parser: AttrParser, type: Attribute) -> TypedAttribute
staticmethod
¶
Source code in xdsl/dialects/smt.py
DeclareFunOp
¶
Bases: IRDLOperation
This operation declares a symbolic value just as the declare-const and declare-fun statements in SMT-LIB 2.7. The result type determines the SMT sort of the symbolic value. The returned value can then be used to refer to the symbolic value instead of using the identifier like in SMT-LIB.
The optionally provided string will be used as a prefix for the newly generated identifier (useful for easier readability when exporting to SMT-LIB). Each declare will always provide a unique new symbolic value even if the identifier strings are the same.
Source code in xdsl/dialects/smt.py
name = 'smt.declare_fun'
class-attribute
instance-attribute
¶
name_prefix = opt_prop_def(StringAttr, prop_name='namePrefix')
class-attribute
instance-attribute
¶
result = result_def(SMTType)
class-attribute
instance-attribute
¶
assembly_format = '($namePrefix^)? attr-dict `:` type($result)'
class-attribute
instance-attribute
¶
__init__(result_type: SMTType, name_prefix: StringAttr | str | None = None)
¶
Source code in xdsl/dialects/smt.py
ApplyFuncOp
¶
Bases: IRDLOperation
This operation performs a function application as described in the SMT-LIB 2.7 standard. It is part of the SMT-LIB core theory.
Source code in xdsl/dialects/smt.py
name = 'smt.apply_func'
class-attribute
instance-attribute
¶
DOMAIN: ClassVar = RangeVarConstraint('DOMAIN', RangeOf(NonFuncSMTTypeConstr))
class-attribute
instance-attribute
¶
RANGE: ClassVar = VarConstraint('RANGE', NonFuncSMTTypeConstr)
class-attribute
instance-attribute
¶
func = operand_def(FuncType.constr(DOMAIN, RANGE))
class-attribute
instance-attribute
¶
args = var_operand_def(DOMAIN)
class-attribute
instance-attribute
¶
result = result_def(RANGE)
class-attribute
instance-attribute
¶
assembly_format = '$func `(` $args `)` attr-dict `:` qualified(type($func))'
class-attribute
instance-attribute
¶
ConstantBoolOp
¶
Bases: IRDLOperation, HasFolderInterface
This operation represents a constant boolean value. The semantics are
equivalent to the true and false keywords in the Core theory of the
SMT-LIB Standard 2.7.
Source code in xdsl/dialects/smt.py
name = 'smt.constant'
class-attribute
instance-attribute
¶
value_attr = prop_def(BoolAttr, prop_name='value')
class-attribute
instance-attribute
¶
result = result_def(BoolType())
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), ConstantLike())
class-attribute
instance-attribute
¶
assembly_format = 'qualified($value) attr-dict'
class-attribute
instance-attribute
¶
value: bool
property
¶
__init__(value: bool)
¶
NotOp
¶
Bases: IRDLOperation
This operation performs a boolean negation. The semantics are equivalent
to the not operator in the Core theory of the SMT-LIB Standard 2.7.
Source code in xdsl/dialects/smt.py
name = 'smt.not'
class-attribute
instance-attribute
¶
input = operand_def(BoolType)
class-attribute
instance-attribute
¶
result = result_def(BoolType)
class-attribute
instance-attribute
¶
assembly_format = '$input attr-dict'
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
VariadicBoolOp
¶
Bases: IRDLOperation
A variadic operation on boolean. It has a variadic number of operands, but requires at least two.
Source code in xdsl/dialects/smt.py
inputs = var_operand_def(RangeOf.get(BoolType).of_length(AtLeast(2)))
class-attribute
instance-attribute
¶
result = result_def(BoolType())
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = '$inputs attr-dict'
class-attribute
instance-attribute
¶
AndOp
dataclass
¶
Bases: VariadicBoolOp
This operation performs a boolean conjunction. The semantics are equivalent
to the and operator in the Core theory of the SMT-LIB Standard 2.7.
It supports a variadic number of operands, but requires at least two.
Source code in xdsl/dialects/smt.py
name = 'smt.and'
class-attribute
instance-attribute
¶
OrOp
dataclass
¶
Bases: VariadicBoolOp
This operation performs a boolean disjunction. The semantics are equivalent
to the or operator in the Core theory of the SMT-LIB Standard 2.7.
It supports a variadic number of operands, but requires at least two.
Source code in xdsl/dialects/smt.py
name = 'smt.or'
class-attribute
instance-attribute
¶
XOrOp
dataclass
¶
Bases: VariadicBoolOp
This operation performs a boolean exclusive or. The semantics are equivalent
to the xor operator in the Core theory of the SMT-LIB Standard 2.7.
It supports a variadic number of operands, but requires at least two.
Source code in xdsl/dialects/smt.py
name = 'smt.xor'
class-attribute
instance-attribute
¶
ImpliesOp
¶
Bases: IRDLOperation
This operation performs a boolean implication. The semantics are equivalent
to the => operator in the Core theory of the SMT-LIB Standard 2.7.
Source code in xdsl/dialects/smt.py
name = 'smt.implies'
class-attribute
instance-attribute
¶
lhs = operand_def(BoolType)
class-attribute
instance-attribute
¶
rhs = operand_def(BoolType)
class-attribute
instance-attribute
¶
result = result_def(BoolType)
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = '$lhs `,` $rhs attr-dict'
class-attribute
instance-attribute
¶
VariadicPredicateOp
¶
Bases: IRDLOperation, ABC
A predicate with a variadic number (but at least 2) operands.
Source code in xdsl/dialects/smt.py
T: ClassVar = VarConstraint('T', NonFuncSMTTypeConstr)
class-attribute
instance-attribute
¶
inputs = var_operand_def(RangeOf(T).of_length(AtLeast(2)))
class-attribute
instance-attribute
¶
result = result_def(BoolType())
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
parse(parser: Parser) -> Self
classmethod
¶
print(printer: Printer)
¶
DistinctOp
dataclass
¶
Bases: VariadicPredicateOp
This operation compares the operands and returns true iff all operands are not
identical to any of the other operands. The semantics are equivalent to the
distinct operator defined in the SMT-LIB Standard 2.7 in the Core theory.
Any SMT sort/type is allowed for the operands and it supports a variadic
number of operands, but requires at least two. This is because the distinct
operator is annotated with :pairwise which means that distinct a b c d is
equivalent to
Source code in xdsl/dialects/smt.py
name = 'smt.distinct'
class-attribute
instance-attribute
¶
EqOp
dataclass
¶
Bases: VariadicPredicateOp
This operation compares the operands and returns true iff all operands are
identical. The semantics are equivalent to the = operator defined in the
SMT-LIB Standard 2.7 in the Core theory.
Any SMT sort/type is allowed for the operands and it supports a variadic number of
operands, but requires at least two. This is because the = operator is annotated
with :chainable which means that = a b c d is equivalent to
and (= a b) (= b c) (= c d) where and is annotated :left-assoc, i.e., it can
be further rewritten to and (and (= a b) (= b c)) (= c d).
Source code in xdsl/dialects/smt.py
name = 'smt.eq'
class-attribute
instance-attribute
¶
IteOp
¶
Bases: IRDLOperation
This operation returns its second operand or its third operand depending on whether its first operand is true or not. The semantics are equivalent to the ite operator defined in the Core theory of the SMT-LIB 2.7 standard.
Source code in xdsl/dialects/smt.py
name = 'smt.ite'
class-attribute
instance-attribute
¶
T: ClassVar = VarConstraint('T', NonFuncSMTTypeConstr)
class-attribute
instance-attribute
¶
cond = operand_def(BoolType)
class-attribute
instance-attribute
¶
then_value = operand_def(T)
class-attribute
instance-attribute
¶
else_value = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = '$cond `,` $then_value `,` $else_value attr-dict `:` type($result)'
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
QuantifierOp
¶
Bases: IRDLOperation, ABC
Source code in xdsl/dialects/smt.py
result = result_def(BoolType)
class-attribute
instance-attribute
¶
body = region_def('single_block')
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
assembly_format = 'attr-dict-with-keyword $body'
class-attribute
instance-attribute
¶
returned_value: SSAValue[BoolType]
property
¶
The value returned by the quantifier. This is the value that is passed
to the smt.yield terminator of the operation region.
This function will asserts if the region is not correctly terminated by
an smt.yield operation with a single boolean operand.
__init__(body: Region) -> None
¶
verify_() -> None
¶
Source code in xdsl/dialects/smt.py
ExistsOp
dataclass
¶
Bases: QuantifierOp
This operation represents the exists quantifier as described in the SMT-LIB 2.7
standard. It is part of the language itself rather than a theory or logic.
Source code in xdsl/dialects/smt.py
name = 'smt.exists'
class-attribute
instance-attribute
¶
ForallOp
dataclass
¶
Bases: QuantifierOp
This operation represents the forall quantifier as described in the SMT-LIB 2.7
standard. It is part of the language itself rather than a theory or logic.
Source code in xdsl/dialects/smt.py
name = 'smt.forall'
class-attribute
instance-attribute
¶
YieldOp
¶
Bases: IRDLOperation
Source code in xdsl/dialects/smt.py
name = 'smt.yield'
class-attribute
instance-attribute
¶
values = var_operand_def(NonFuncSMTType)
class-attribute
instance-attribute
¶
assembly_format = '($values^ `:` type($values))? attr-dict'
class-attribute
instance-attribute
¶
traits = traits_def(IsTerminator(), HasParent(ExistsOp, ForallOp))
class-attribute
instance-attribute
¶
AssertOp
¶
Bases: IRDLOperation
Assert that a boolean expression holds.
Source code in xdsl/dialects/smt.py
BvConstantOp
¶
Bases: IRDLOperation, HasFolderInterface
This operation produces an SSA value equal to the bitvector constant specified
by the value attribute.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.constant'
class-attribute
instance-attribute
¶
T: ClassVar = VarConstraint.get('T', BitVectorType)
class-attribute
instance-attribute
¶
value = prop_def(BitVectorAttr.constr(T))
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = 'qualified($value) attr-dict'
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), ConstantLike())
class-attribute
instance-attribute
¶
__init__(value: BitVectorAttr | int, type: int | BitVectorType | None = None)
¶
Create a new BvConstantOp from a value and a bitvector width.
Source code in xdsl/dialects/smt.py
UnaryBVOp
¶
Bases: IRDLOperation, ABC
A unary bitvector operation. It has one operand and one result of the same bitvector type.
Source code in xdsl/dialects/smt.py
T: ClassVar = VarConstraint.get('T', BitVectorType)
class-attribute
instance-attribute
¶
input = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = '$input attr-dict `:` qualified(type($result))'
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
BVNotOp
dataclass
¶
BVNegOp
dataclass
¶
BinaryBVOp
¶
Bases: IRDLOperation, ABC
A binary bitvector operation. It has two operands and one result of the same bitvector type.
Source code in xdsl/dialects/smt.py
T: ClassVar = VarConstraint.get('T', BitVectorType)
class-attribute
instance-attribute
¶
lhs = operand_def(T)
class-attribute
instance-attribute
¶
rhs = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(T)
class-attribute
instance-attribute
¶
assembly_format = '$lhs `,` $rhs attr-dict `:` qualified(type($result))'
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
BVAndOp
dataclass
¶
Bases: BinaryBVOp
A bitwise AND operation for bitvectors. It corresponds to the 'bvand' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.and'
class-attribute
instance-attribute
¶
BVOrOp
dataclass
¶
Bases: BinaryBVOp
A bitwise OR operation for bitvectors. It corresponds to the 'bvor' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.or'
class-attribute
instance-attribute
¶
BVXOrOp
dataclass
¶
Bases: BinaryBVOp
A bitwise XOR operation for bitvectors. It corresponds to the 'bvxor' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.xor'
class-attribute
instance-attribute
¶
BVAddOp
dataclass
¶
Bases: BinaryBVOp
An addition operation for bitvectors. It corresponds to the 'bvadd' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.add'
class-attribute
instance-attribute
¶
BVMulOp
dataclass
¶
Bases: BinaryBVOp
A multiplication operation for bitvectors. It corresponds to the 'bvmul' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.mul'
class-attribute
instance-attribute
¶
BVUDivOp
dataclass
¶
Bases: BinaryBVOp
An unsigned division operation (rounded towards zero) for bitvectors. It corresponds to the 'bvudiv' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.udiv'
class-attribute
instance-attribute
¶
BVSDivOp
dataclass
¶
Bases: BinaryBVOp
A two's complement signed division operation (rounded towards zero) for bitvectors. It corresponds to the 'bvsdiv' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.sdiv'
class-attribute
instance-attribute
¶
BVURemOp
dataclass
¶
Bases: BinaryBVOp
An unsigned remainder for bitvectors. It corresponds to the 'bvurem' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.urem'
class-attribute
instance-attribute
¶
BVSRemOp
dataclass
¶
Bases: BinaryBVOp
A two's complement signed remainder (sign follows dividend) for bitvectors. It corresponds to the 'bvsrem' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.srem'
class-attribute
instance-attribute
¶
BVSModOp
dataclass
¶
Bases: BinaryBVOp
A two's complement signed remainder (sign follows divisor) for bitvectors. It corresponds to the 'bvsmod' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.smod'
class-attribute
instance-attribute
¶
BVShlOp
dataclass
¶
Bases: BinaryBVOp
A shift left for bitvectors. It corresponds to the 'bvshl' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.shl'
class-attribute
instance-attribute
¶
BVLShrOp
dataclass
¶
Bases: BinaryBVOp
A logical shift right for bitvectors. It corresponds to the 'bvlshr' operation in SMT-LIB.
Source code in xdsl/dialects/smt.py
name = 'smt.bv.lshr'
class-attribute
instance-attribute
¶
BVAShrOp
dataclass
¶
Bases: BinaryBVOp
An arithmetic shift right for bitvectors. It corresponds to the 'bvashr' operation in SMT-LIB.