I want to mutate the internal representation of constraints from the sygus file generated by CVC4.
For e.g. (constraint (and (<= x (f x y)) (<= y (f x y)))) is a constraint from small.sl which I give to cvc4 qas input to synthesize a program.
I know that cvc4 creates an internal representation using class Expr;
cvc4 defines a command cmd which seems to point to each statement in the sygus file which is as below:
(set-logic LIA)
(synth-fun f ((x Int) (y Int)) Int)
(declare-var x Int)
(declare-var y Int)
(constraint (= (f x y) (f y x)))
(constraint (and (<= x (f x y)) (<= y (f x y))))
(check-synth)
I am concerned with the two constraints. I want to modify the constraints by commutating it around the operators as below:
(constraint (and (<= x (f x y)) (<= y (f x y)))) commutated to
(constraint (and (<= y (f x y)) (<= x (f x y))))
For this, I am searching the object that points to the expression tree formed from constraint after parsing it.
This is how they declare their parser builder.
ParserBuilder parserBuilder(pExecutor->getSolver(), filename, opts);
here pointer to parser is defined.
std::unique_ptr<Parser> parser(parserBuilder.build());
this is the command that points to the parsed statements from the input file.
std::unique_ptr<Command> cmd;
this is the class declarations for the internal representations.
// The internal expression representation
template <bool ref_count>
class NodeTemplate;
class NodeManager;
class Expr;
class ExprManager;
class SmtEngine;
class Type;
class TypeCheckingException;
class TypeCheckingExceptionPrivate;
does anyone know how to get the object for the expression tree?
Thanks in advance