Class Sort
java.lang.Object
de.uni_freiburg.informatik.ultimate.logic.Sort
public final class Sort
extends java.lang.Object
Represents an SMTLIB sort. We distinguish real sorts (which
are declared with declare-sort or pre-defined in the logic) from
defined sort (which are defined with define-sort to some other sort.
For a real sort, getRealSort() == this holds.
A sort has a sort symbol and as many sort arguments as the sort symbol
specifies. There are also parametric sorts used for declaring polymorphic
function symbols. A parametric sort (or sort variable) has a position
(used for substitution) and a name, both stored in the SortSymbol.
Every term has a closed real sort, which can be obtained by term.getSort().
Defined sorts may occur only in function symbols and the declared sort of
a term variable. Sorts that are not closed may only occur in polymorphic
function symbols and in sort definitions in SortSymbol.
- Author:
- Jochen Hoenicke
-
Method Summary
Modifier and Type Method Description Sort[]getArguments()Get the sort arguments for a sort.java.lang.StringgetIndexedName()Get the indexed name of this sort in smtlib representation.java.lang.String[]getIndices()Get the indices, if this is an indexed sort like (_ bv 5).java.lang.StringgetName()Get the name of this sort.SortgetRealSort()Get the real sort.SortSymbolgetSortSymbol()Get the symbol for the sort constructor.de.uni_freiburg.informatik.ultimate.logic.TheorygetTheory()inthashCode()booleanisArraySort()Returns true if this is an array sort.booleanisBitVecSort()booleanisInternal()Returns true if this sort is internal, i.e., defined by an SMTLIB theory.booleanisNumericSort()Returns true if this is a numeric sort.booleanisSortVariable()This returns true if and only if the sort was created withScript.sortVariables(String...).SortmapSort(Sort[] substitution)Substitute this sort.java.lang.StringtoString()This returns the SMTLIB string represenation of this sort.
-
Method Details
-
getName
public java.lang.String getName()Get the name of this sort.- Returns:
- the name.
-
getIndexedName
public java.lang.String getIndexedName()Get the indexed name of this sort in smtlib representation.- Returns:
- the name.
-
getSortSymbol
Get the symbol for the sort constructor.- Returns:
- the sort symbol
-
getIndices
public java.lang.String[] getIndices()Get the indices, if this is an indexed sort like (_ bv 5).- Returns:
- the indices, null if this sort is not indexed.
-
getArguments
Get the sort arguments for a sort. This is used for a sort, whose sort symbol was declared withdeclare-sort(name, int)where the second parameter is not zero. In that case the sort is created with sort arguments and these arguments are returned by this method.- Returns:
- An array containing the sort arguments for this sort. You must never write to this array.
-
getRealSort
Get the real sort. This is used for sorts that are defined withdefine-sort. For other sorts this just returns this.- Returns:
- the sort representation where all sort definitions are expanded.
-
mapSort
Substitute this sort.- Parameters:
substitution- The substitution. Note that every sort variable has a unique position which is used as index in the substitution array.- Returns:
- The substituted sort.
-
isSortVariable
public boolean isSortVariable()This returns true if and only if the sort was created withScript.sortVariables(String...). These are only used for a laterdefine-sortcommand.- Returns:
- true iff this is a sort variable.
-
toString
public java.lang.String toString()This returns the SMTLIB string represenation of this sort.- Overrides:
toStringin classjava.lang.Object- Returns:
- the SMTLIB string representation.
-
getTheory
public de.uni_freiburg.informatik.ultimate.logic.Theory getTheory() -
isArraySort
public boolean isArraySort()Returns true if this is an array sort. This is any instantiation of the parametric sort Array defined by the SMTLIB array theory.- Returns:
- true if this is an array sort.
-
isBitVecSort
public boolean isBitVecSort()- Returns:
- true if this is a bit-vector sort.
-
isNumericSort
public boolean isNumericSort()Returns true if this is a numeric sort. Numeric sorts are only the sorts Int and Real defined by the corresponding SMTLIB theories.- Returns:
- true if this is a numeric sort.
-
isInternal
public boolean isInternal()Returns true if this sort is internal, i.e., defined by an SMTLIB theory.- Returns:
- true if the sort is internal, false if it is user defined.
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-