/**
* Match expressions.
* For example, the smt2 syntax match term
- * `(match l (((cons h t) h) (nil 0)))`
+ * \rst
+ * .. code:: smtlib
+ *
+ * (match l (((cons h t) h) (nil 0)))
+ * \endrst
* is represented by the AST
*
+ * \rst
+ * .. code:: lisp
+ *
* (MATCH l
- * (MATCH_BIND_CASE (VARIABLE_LIST h t) (cons h t) h)
- * (MATCH_CASE nil 0))
+ * (MATCH_BIND_CASE (VARIABLE_LIST h t) (cons h t) h)
+ * (MATCH_CASE nil 0))
+ * \endrst
*
* The type of the last argument of each case term could be equal.
*
* - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2) const`
* - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2, const Term& child3) const`
* - `Solver::mkTerm(Kind kind, const std::vector<Term>& children) const`
- *
*/
MATCH,
/**
* - 2: a set of type (Set T1)
*
* Create with:
- * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2)
- * const`
+ * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2) const`
* - `Solver::mkTerm(Kind kind, const std::vector<Term>& children) const`
*/
SET_MAP,
BAG_EMPTY,
/**
* Bag max union.
+ *
* Parameters:
* - 1..2: Terms of bag sort
*
BAG_CHOOSE,
/**
* Bag is_singleton predicate (single element with multiplicity exactly one).
+ *
* Parameters:
* - 1: Term of bag sort, is [1] a singleton bag?
*
* - 2: a bag of type (Bag T1)
*
* Create with:
- * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2)
- * const`
+ * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2) const`
* - `Solver::mkTerm(Kind kind, const std::vector<Term>& children) const`
*/
BAG_MAP,
* - 2: a bag of type (Bag T)
*
* Create with:
- * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2)
- * const`
+ * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2) const`
* - `Solver::mkTerm(Kind kind, const std::vector<Term>& children) const`
*/
BAG_FILTER,
* - 2: a bag of type (Bag T1)
*
* Create with:
- * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2,
- * const Term& child3) const`
+ * - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2, const Term& child3) const`
* - `Solver::mkTerm(Kind kind, const std::vector<Term>& children) const`
*/
BAG_FOLD,
*/
REGEXP_DIFF,
/**
- * Regexp *.
+ * Regexp \*.
*
* Parameters:
* - 1: Term of sort Regexp
/*
* An instantiation pool.
* Specifies an annotation for pool based instantiation.
+ *
* Parameters: n > 1
- * - 1..n: Terms that comprise the pools, which are one-to-one with
- * the variables of the quantified formula to be instantiated.
+ * - 1..n: Terms that comprise the pools, which are one-to-one with the variables of the quantified formula to be instantiated.
+ *
* Create with:
- * - `mkTerm(Kind kind, Term child1, Term child2)
- * - `mkTerm(Kind kind, Term child1, Term child2, Term child3)
- * - `mkTerm(Kind kind, const std::vector<Term>& children)
+ * - `mkTerm(Kind kind, Term child1, Term child2)`
+ * - `mkTerm(Kind kind, Term child1, Term child2, Term child3)`
+ * - `mkTerm(Kind kind, const std::vector<Term>& children)`
*/
INST_POOL,
/*
* A instantantiation-add-to-pool annotation.
+ *
* Parameters: n = 1
* - 1: The pool to add to.
+ *
* Create with:
- * - `mkTerm(Kind kind, Term child)
+ * - `mkTerm(Kind kind, Term child)`
*/
INST_ADD_TO_POOL,
/*
* A skolemization-add-to-pool annotation.
+ *
* Parameters: n = 1
* - 1: The pool to add to.
+ *
* Create with:
- * - `mkTerm(Kind kind, Term child)
+ * - `mkTerm(Kind kind, Term child)`
*/
SKOLEM_ADD_TO_POOL,
/**
* - 2...n: The values of the attribute.
*
* Create with:
- * - `mkTerm(Kind kind, Term child1, Term child2)
- * - `mkTerm(Kind kind, Term child1, Term child2, Term child3)
- * - `mkTerm(Kind kind, const std::vector<Term>& children)
+ * - `mkTerm(Kind kind, Term child1, Term child2)`
+ * - `mkTerm(Kind kind, Term child1, Term child2, Term child3)`
+ * - `mkTerm(Kind kind, const std::vector<Term>& children)`
*/
INST_ATTRIBUTE,
/**
* A list of instantiation patterns and/or attributes.
*
* Parameters: n > 1
- * - 1..n: Terms with kind INST_PATTERN, INST_NO_PATTERN, or
- * INST_ATTRIBUTE.
+ * - 1..n: Terms with kind INST_PATTERN, INST_NO_PATTERN, or INST_ATTRIBUTE.
*
* Create with:
* - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2) const`
def getParameters(self):
"""
- :return: the parameters of this datatype, if it is parametric. An
- exception is thrown if this datatype is not parametric.
+ :return: the parameters of this datatype, if it is parametric. An exception is thrown if this datatype is not parametric.
"""
param_sorts = []
for s in self.cd.getParameters():
( check-synth )
:return: the result of the check, which is unsat if the check succeeded,
- in which case solutions are available via getSynthSolutions.
+ in which case solutions are available via getSynthSolutions.
"""
cdef Result r = Result()
r.cr = self.csolver.checkSynthNext()
def substitute(self, sort_or_list_1, sort_or_list_2):
"""
- Substitution of Sorts.
+ Substitution of Sorts.
- :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.
+ :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
takes priority.
For example,
- (Array A B) .substitute([A, C], [(Array C D), (Array A B)]) will
- return (Array (Array C D) B).
+ ``(Array A B) .substitute([A, C], [(Array C D), (Array A B)])`` will
+ return ``(Array (Array C D) B)``.
"""
# The resulting sort after substitution
"""
: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).
- """
+ 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
+
+ .. code:: python
+
+ 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)
# lists for substitutions
or otherwise an exception is thrown.
:return: 0 if this term is zero, -1 if this term is a negative real or
- integer value, 1 if this term is a positive real or integer value.
+ integer value, 1 if this term is a positive real or integer
+ value.
"""
return self.cterm.getRealOrIntegerValueSign()
import argparse
import os
+import re
import sys
# get access to cvc5/src/api/parsekinds.py
doc = parser.kinds_doc.get(name, '')
f.write(KINDS_ATTR_TEMPLATE.format(name=name, kind=kind, doc=doc))
+comment_repls = {
+ '`Solver::([a-zA-Z]+)\(([^)]*)\)[^`]*`': ':py:meth:`pycvc5.Solver.\\1`',
+}
+def reformat_comment(comment):
+ for pat,repl in comment_repls.items():
+ comment = re.sub(pat, repl, comment)
+ return comment
+
if __name__ == "__main__":
parser = argparse.ArgumentParser('Read a kinds header file and generate a '
'corresponding pxd file, with simplified kind names.')
kp = KindsParser()
kp.parse(kinds_header)
+ for name in kp.kinds_doc:
+ kp.kinds_doc[name] = reformat_comment(kp.kinds_doc[name])
+
gen_pxd(kp, kinds_file_prefix + ".pxd")
gen_pxi(kp, kinds_file_prefix + ".pxi")