* Substitution of Sorts.
* @param sort the subsort to be substituted within this sort.
* @param replacement the sort replacing the substituted subsort.
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the sort. It is not run until fix point.
+ *
+ * For example,
+ * (Array A B).substitute({A, C}, {(Array C D), (Array A B)}) will
+ * return (Array (Array C D) B).
*/
Sort substitute(const Sort& sort, const Sort& replacement) const;
* Simultaneous substitution of Sorts.
* @param sorts the subsorts to be substituted within this sort.
* @param replacements the sort replacing the substituted subsorts.
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the sort. It is not run until fix point. In the case that
+ * sorts contains duplicates, the replacement earliest in the vector takes
+ * priority.
*/
Sort substitute(const std::vector<Sort>& sorts,
const std::vector<Sort>& replacements) const;
Sort getSort() const;
/**
- * @return the result of replacing 'term' by 'replacement' in this term
+ * @return the result of replacing 'term' by 'replacement' in this term.
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the term. It is not run until fix point.
*/
Term substitute(const Term& term, const Term& replacement) const;
/**
* @return the result of simultaneously replacing 'terms' by 'replacements'
* in this term
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the term. It is not run until fix point. In the case that
+ * terms contains duplicates, the replacement earliest in the vector takes
+ * priority. For example, calling substitute on f(x,y) with
+ * terms = { x, z }, replacements = { g(z), w }
+ * results in the term f(g(z),y).
*/
Term substitute(const std::vector<Term>& terms,
const std::vector<Term>& replacements) const;
* Substitution of Sorts.
* @param sort the subsort to be substituted within this sort.
* @param replacement the sort replacing the substituted subsort.
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the sort. It is not run until fix point.
*/
public Sort substitute(Sort sort, Sort replacement)
{
* Simultaneous substitution of Sorts.
* @param sorts the subsorts to be substituted within this sort.
* @param replacements the sort replacing the substituted subsorts.
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the sort. It is not run until fix point. In the case that
+ * sorts contains duplicates, the replacement earliest in the list takes
+ * priority.
+ *
+ * For example,
+ * (Array A B).substitute({A, C}, {(Array C D), (Array A B)}) will
+ * return (Array (Array C D) B).
*/
public Sort substitute(Sort[] sorts, Sort[] replacements)
{
/**
* @return the result of replacing 'term' by 'replacement' in this term
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the term. It is not run until fix point.
*/
public Term substitute(Term term, Term replacement)
{
/**
* @return the result of simultaneously replacing 'terms' by 'replacements'
* in this term
+ *
+ * Note that this replacement is applied during a pre-order traversal and
+ * only once to the term. It is not run until fix point. In the case that
+ * terms contains duplicates, the replacement earliest in the vector takes
+ * priority. For example, calling substitute on f(x,y) with
+ * terms = { x, z }, replacements = { g(z), w }
+ * results in the term f(g(z),y).
*/
public Term substitute(List<Term> terms, List<Term> replacements)
{
:param sort_or_list_1: the subsort or subsorts to be substituted within this sort.
:param sort_or_list_2: the sort or list of sorts replacing the substituted subsort.
+
+ Note that this replacement is applied during a pre-order traversal and
+ only once to the sort. It is not run until fix point. In the case that
+ sort_or_list_1 contains duplicates, the replacement earliest in the list
+ takes priority.
+
+ For example,
+ (Array A B) .substitute([A, C], [(Array C D), (Array A B)]) will
+ return (Array (Array C D) B).
"""
# The resulting sort after substitution
def substitute(self, term_or_list_1, term_or_list_2):
"""
:return: the result of simultaneously replacing the term(s) stored in ``term_or_list_1`` by the term(s) stored in ``term_or_list_2`` in this term.
+
+ Note that this replacement is applied during a pre-order traversal and
+ only once to the term. It is not run until fix point. In the case that
+ terms contains duplicates, the replacement earliest in the list takes
+ priority. For example, calling substitute on f(x,y) with
+ term_or_list_1 = [ x, z ], term_or_list_2 = [ g(z), w ]
+ results in the term f(g(z),y).
"""
# The resulting term after substitution
cdef Term term = Term(self.solver)